Search Suggest

Advanced Topics: fcntl and mmap

1. fcntl
 #include <unistd.h>   
#include <fcntl.h>

int fcntl(int fd, int cmd);
int fcntl(int fd, int cmd, long arg);
int fcntl(int fd, int cmd, struct flock *lock);

fcntc system call cung cấp một phương tiện để tác động đến low-level file descriptor. Một số thao tác như duplicating file descriptor, getting and setting file descriptor flags, getting and setting file descriptor status flags, file locking.

Chi tiết fcntl.

2. mmap
 #include <sys/mman.h>   

void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
int munmap(void *start, size_t length);

mmap cung cấp một share memory để cho nhiều chương trình có thể cùng truy cập.

Chi tiết mmap.


Đăng nhận xét