MACOSX (BSD) equivalent for F_NOTIFY flag for fcntl() function
Does anybody know equivalent for F_NOTIFY flag for fcntl function in a BSD based system? This flag allows you to receive notifications about file events (for example file opened, file closed, bytes written to file, bytes read from file). This flag exists in Linux, but does not exist in MACOSX (BSD based system).
Quote from linux man:
File and directory change notification (dnotify)
int fcntl(int fd, int cmd, ... /* arg */ );
F_NOTIFY (long) (Linux 2.4 onwards) Provide notific开发者_JAVA技巧ation when the directory referred to by fd or any of the files that it contains is changed.
Actually any API which allows me to receive file events will be enough for me.
Does anybody know if any substitute exists for F_NOTIFY? At this time I have only one idea: using the kqueue(), kevent() functions.
There is no exact equivalent; kqueue()
/kevent()
with an EVFILT_VNODE
event filter is the substitute on OS X.
Note that even in Linux, F_NOTIFY has been superceded by inotify.
精彩评论