Add inotify SCML document

Signed-off-by: Zhenchen Wang <m202372036@hust.edu.cn>
This commit is contained in:
Zhenchen Wang 2025-11-17 23:12:37 +08:00 committed by Tate, Hongliang Tian
parent 156eeb1835
commit cf4f6e306c
5 changed files with 69 additions and 3 deletions

View File

@ -3,7 +3,7 @@
<!--
Put system calls such as
dup, dup2, dup3, fcntl, ioctl, pipe, pipe2, splice, tee, vmsplice, sendfile,
eventfd, eventfd2, inotify_init, inotify_init1, inotify_add_watch, and inotify_rm_watch
eventfd, and eventfd2
under this category.
-->

View File

@ -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).
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).

View File

@ -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 = <PATH>, mask = <inotify_events> | <inotify_controls>);

View File

@ -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);

View File

@ -0,0 +1,3 @@
// Remove a watch from an inotify instance
inotify_rm_watch(fd, wd);