i/o ウォッチャーinotifyとepollの違いは何ですか?
通知する
- inotify_init(void)は inotify インスタンスを作成してイベントを読み取ります
- inotify_add_watch(int fd, const char * path, int mask)は、パスの後ろにあるファイル ノードの周りに監視 fd を返します。
- inotify_rm_watch(int fd, int wd)は fd のイベントの監視を停止します
エポール
- epoll_create(void)は epollオブジェクトを作成します
- epoll_ctl(int epfd, int op, int fd, struct epoll_event * event)監視するイベントを設定します
- epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout); イベントが発生するまでブロック
そのため、ファイルの監視には別のアプローチがあるようです。inotify は、何かが起こるまで epoll がブロックしている間、イベントをいつ収集するかをユーザーに決定させようとします。
これは正しいです?他の違いは何ですか?