diff --git a/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-descriptor-and-io-control/README.md b/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-descriptor-and-io-control/README.md index b11befd55..e1feb6409 100644 --- a/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-descriptor-and-io-control/README.md +++ b/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-descriptor-and-io-control/README.md @@ -3,7 +3,7 @@ diff --git a/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/README.md b/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/README.md index 6afbf885d..c8109fab6 100644 --- a/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/README.md +++ b/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/README.md @@ -4,7 +4,8 @@ Put system calls such as mount, umount2, pivot_root, statfs, fstatfs, truncate, ftruncate, fsync, fdatasync, sync, syncfs, sync_file_range, open_tree, move_mount, fsopen, -fsconfig, fsmount, and fspick +fsconfig, fsmount, fspick, inotify_init, inotify_init1, inotify_add_watch, +inotify_rm_watch under this category. --> @@ -57,4 +58,50 @@ Silently-ignored flags: * `MNT_EXPIRE` For more information, -see [the man page](https://man7.org/linux/man-pages/man2/umount.2.html). \ No newline at end of file +see [the man page](https://man7.org/linux/man-pages/man2/umount.2.html). + +## Event Notifications + +### `inotify_init` and `inotify_init1` + +Supported functionality in SCML: + +```c +{{#include inotify_init_and_init1.scml}} +``` + +For more information, +see [the man page](https://man7.org/linux/man-pages/man2/inotify_init.2.html). + +### `inotify_add_watch` + +Supported functionality in SCML: + +```c +{{#include inotify_add_watch.scml}} +``` + +Unsupported event flags: +* `IN_MOVED_FROM` and `IN_MOVED_TO` - Move events are not generated +* `IN_MOVE_SELF` - Self move events are not generated +* `IN_UNMOUNT` - Unmount events are not generated +* `IN_Q_OVERFLOW` - Queue overflow events are not generated (events are silently dropped when queue is full) +* `IN_ALL_EVENTS` - Only includes actually supported events + +Unsupported control flags: +* `IN_EXCL_UNLINK` - Events on unlinked files are not excluded +* `IN_ONESHOT` - Watches are not automatically removed after the first event + +For more information, +see [the man page](https://man7.org/linux/man-pages/man7/inotify.7.html). + +### `inotify_rm_watch` + +Supported functionality in SCML: + +```c +{{#include inotify_rm_watch.scml}} +``` + +For more information, +see [the man page](https://man7.org/linux/man-pages/man2/inotify_rm_watch.2.html). \ No newline at end of file diff --git a/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/inotify_add_watch.scml b/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/inotify_add_watch.scml new file mode 100644 index 000000000..75e6f5e68 --- /dev/null +++ b/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/inotify_add_watch.scml @@ -0,0 +1,10 @@ +inotify_events = IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | + IN_CLOSE_NOWRITE | IN_OPEN | IN_CREATE | IN_DELETE | + IN_DELETE_SELF | IN_CLOSE; + +inotify_controls = IN_ONLYDIR | IN_DONT_FOLLOW | IN_MASK_CREATE | + IN_MASK_ADD | IN_ISDIR; + +// Add a watch to an initialized inotify instance +inotify_add_watch(fd, pathname = , mask = | ); + diff --git a/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/inotify_init_and_init1.scml b/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/inotify_init_and_init1.scml new file mode 100644 index 000000000..4d5648d7a --- /dev/null +++ b/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/inotify_init_and_init1.scml @@ -0,0 +1,6 @@ +// Create an inotify instance +inotify_init(); + +// Create an inotify instance with enhanced behavior control +inotify_init1(flags = IN_CLOEXEC | IN_NONBLOCK); + diff --git a/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/inotify_rm_watch.scml b/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/inotify_rm_watch.scml new file mode 100644 index 000000000..d597cdb98 --- /dev/null +++ b/book/src/kernel/linux-compatibility/syscall-feature-coverage/file-systems-and-mount-control/inotify_rm_watch.scml @@ -0,0 +1,3 @@ +// Remove a watch from an inotify instance +inotify_rm_watch(fd, wd); +