Linux inotify使用安装创建设备
作者:IT科技 来源:数据库 浏览: 【大中小】 发布时间:2025-11-05 02:30:23 评论数:

复制/* This program will take as argument a directory name and monitor it,使用设备 printing event notifications to the console. */ int main (int argc, char **argv) { /* This is the file descriptor for the Linux inotify device */ int Linux inotify_fd; /* First we open the Linux inotify dev entry */ Linux inotify_fd = open_Linux inotify_dev(); if (Linux inotify_fd <0) { return 0; } /* We will need a place to enqueue Linux inotify events, this is needed because if you do not read events fast enough, you will miss them. */ queue_t q; q = queue_create (128); /* Watch the directory passed in as argument Read on for why you might want to alter this for more efficient Linux inotify use in your app. */ watch_dir (Linux inotify_fd, argv[1], ALL_MASK); process_Linux inotify_events (q, Linux inotify_fd); /* Finish up by destroying the queue, closing the fd, and returning a proper code */ queue_destroy (q); close_Linux inotify_dev (Linux inotify_fd); return 0; } 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.
