Handling of asynchronous events---reference
|
There are many problems with this interface. It can only watch directories. If one wants to watch many directories,it takes many file descriptors. Moreover,the open file pins the filesystem so that it cannot be unmounted. When something happens it is unknown what,and a? 12.7?inotify(Since 2.6.13.) Inotify is implemented using three new system calls and the usual? int inotify_init(void); int inotify_add_watch (int fd,const char *pathname,int mask); int inotify_rm_watch (int fd,int wd); The first returns a file descriptor:? An inotify_event is defined by struct inotify_event {
int wd; /* Watch descriptor */
uint32_t mask; /* Mask of events */
uint32_t cookie; /* Unique cookie associating related
events (for rename(2)) */
uint32_t len; /* Size of 'name' field */
char name[]; /* Optional null-terminated name */
};
The? There is a? % ls /proc/sys/fs/inotify/ max_queued_events max_user_instances max_user_watches % cat $_/* 16384 128 8192 Applications are?,??and?. /* inotify demo,mimicking the above dnotify one */ #include (编辑:清远站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |

