开发者

inotify C headers

So I'm trying to write a C program that uses inotify. I've used pyinotify before so I understand how it works. However, I'm following some guide and it tells me to include <linux/inotify.h>. The problem is that this header only has macro definitions, not the funciton prototypes. It looks like the functions are prototyped in <sys/inotify.h>开发者_开发技巧.

My question is what's the difference between linux/inotify.h and sys/inotify.h? Why are there both?


sys/inotify.h is part of the GNU C library. It exposes the structures and functions that your program will use in order to receive filesystem change notifications. It can be considered as the public API of the notification system.

linux/inotify.h is part of the Linux kernel. It defines the kernel structures and constants used to implement the notification system itself. You shouldn't include that file unless you're writing something like a kernel module, because it's Linux-specific and thus not portable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜