From http://www.ibm.com/developerworks/linux/library/l-ubuntu-inotify/