Initialize the inode notify system


#include <sys/inotify.h>

int inotify_init( void );


BlackBerry 10.0.0



Use the -l c option to qcc to link against this library. This library is usually included automatically.


The inotify_init() function initializes the inode notify system that you can use to watch for filesystem events.

This function opens the file /dev/fsnotify. If your process doesn't have read permission for this path, the function fails.

The basic steps for using the inotify system are as follows:

  • Initialize the inotify system by calling inotify_init(), saving the file descriptor that it returns.
  • Use inotify_add_watch() to add or modify a watch for a given file or directory.
  • Read the filesystem events (of type struct inotify_event ) from the file descriptor returned by inotify_init().
  • To remove a watch, call inotify_rm_watch().
  • To remove all watches and shut down inotify, close the file descriptor returned by inotify_init().

While the BlackBerry 10 OS inotify implementation follows the same semantics as the Linux implementation, the behavior differs from Linux due to the kernel and filesystem models employed. For instance, you may see IN_OPEN, IN_STAT, and IN_CLOSE events for a single invocation of stat(). For an overview of inotify, see,0 in the Linux Journal.


A file descriptor for the inotify mailbox, or -1 if an error occurred ( errno is set).



Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

Last modified: 2014-06-24

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus