inotify_add_watch on x64
add a watch to an initialized inotify instance
sys_inotify_add_watch(int fd, const char *path, u32 mask)
| number | 254 (0xfe) |
|---|---|
| abi | common |
| kconfig | CONFIG_INOTIFY_USER |
| family | inotify see the whole family on x64 |
| entry point | sys_inotify_add_watch |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | inotify_add_watch(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 254, the syscall number |
rdi | int fd |
rsi | const char *path |
rdx | u32 mask |
rax | the return value |
Then run syscall to enter the kernel.
The syscall instruction clobbers rcx (the return address lands in rcx) and r11 (the flags land in r11).
Since Linux 5.14 the kernel reads the syscall number from eax and ignores the upper 32 bits of rax. Older kernels fail with ENOSYS when those bits are not zero, and mov eax, N clears them, so it works on both.
Same syscall on other architectures
- x86 292
- arm64 27
- arm 317
- riscv64 27
- ia32 292
- x32 1073742078
- loongarch64 27
- ppc64 276
- ppc 276
- s390x 285
- mips64 5244
- mipsn32 6248
- mipso32 4285
- alpha 445
- arc 27
- blackfin 292, removed in 4.17
- cris 292, removed in 4.17
- csky 27
- frv 292, removed in 4.17
- hexagon 27
- ia64 1278, removed in 6.7
- m32r 292, removed in 4.17
- m68k 285
- metag 27, removed in 4.17
- microblaze 292
- mn10300 293, removed in 4.17
- nds32 27, removed in 5.18
- nios2 27
- openrisc 27
- parisc 270
- score 27, removed in 4.17
- sh 291
- sparc 152
- sparc64 152
- tilegx 27, removed in 4.17
- tilepro 27, removed in 4.17
- xtensa 277
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/inotify_add_watch