umask on x64
set file mode creation mask
sys_umask(int mask)
| number | 95 (0x5f) |
|---|---|
| abi | common |
| entry point | sys_umask |
| since | Linux 3.3 or earlier (3.3 is the first release scanned for x64) |
| man page | umask(2) |
| source | elixir.bootlin.com |
Registers
| register | value |
|---|---|
rax | 95, the syscall number |
rdi | int 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 60
- arm64 166
- arm 60
- riscv64 166
- ia32 60
- x32 1073741919
- loongarch64 166
- ppc64 60
- ppc 60
- s390x 60
- mips64 5093
- mipsn32 6093
- mipso32 4060
- alpha 60
- arc 166
- blackfin 60, removed in 4.17
- cris 60, removed in 4.17
- csky 166
- frv 60, removed in 4.17
- hexagon 166
- ia64 1067, removed in 6.7
- m32r 60, removed in 4.17
- m68k 60
- metag 166, removed in 4.17
- microblaze 60
- mn10300 60, removed in 4.17
- nds32 166, removed in 5.18
- nios2 166
- openrisc 166
- parisc 60
- score 166, removed in 4.17
- sh 60
- sparc 60
- sparc64 60
- tilegx 166, removed in 4.17
- tilepro 166, removed in 4.17
- xtensa 58
Get this as JSON: https://api.syscall.sh/v2/syscalls/x64/umask