System Calls in Linux
Linux System Calls and their Numbers
System Calls
System calls are a special set of procedures that regular programs (user space processes) can submit to the Linux kernel
for working with files, interacting with hardware, accessing internal OS functionality, implement all sorts of communication and process management and basically do anything else that’s sensitive or performance critical enough that OS kernel must enforce strict controls around it.
Regular processes interface with the OS kernel by supplying a system call
name and parameters, the kernel then verifies validity of a system call and executes it within kernel space, returning data and execution status back.
Each system call has a unique number and name for identification. There are separate syscall numbers for 32bit and 64bit architectures.
System Calls in Linux
To review the full list of system calls in your Linux distribution, you’ll need to inspect the unistd-32.h
or unistd-64.h
file.
In CentOS
and RedHat
, this file is installed by the kernel-headers
package.
When browsing the file, you’ll see a list like this:
For instance, __NR_mount
indicates the syscall
name - the actual name is the word without __NR_
bit, so in this case it’s mount
. 21 is the syscall number in your Linux.
Syscall Man Pages
To get more information about using a system call, just use man command. Because syscalls are a pretty core part of man
pages, they have their own section - it’s section number 2. So add .2 to the name of a syscall when looking for it:
SysCall Numbers
Don’t forget: although oldest syscalls match across multiple distributions, there’s always a chance that a particular syscall will have a different number in your OS.
This is only relevant if you’re trying to use syscalls directly - which you probably shouldn’t. Use glibc
instead - I’ll be sure to write a small article on it sometime in the future.
See Also
- Linux Kernel
- Unix Tutorial Digests
- Linux Kernel 5.8
- Confirm current Kernel boot command
- Linux Commands
- Unix Commands
- Where to Find Syscall Numbers
Linux System Calls and their Numbers
System Calls
System calls are a special set of procedures that regular programs (user space processes) can submit to the Linux kernel
for working with files, interacting with hardware, accessing internal OS functionality, implement all sorts of communication and process management and basically do anything else that’s sensitive or performance critical enough that OS kernel must enforce strict controls around it.
Regular processes interface with the OS kernel by supplying a system call
name and parameters, the kernel then verifies validity of a system call and executes it within kernel space, returning data and execution status back.
Each system call has a unique number and name for identification. There are separate syscall numbers for 32bit and 64bit architectures.
System Calls in Linux
To review the full list of system calls in your Linux distribution, you’ll need to inspect the unistd-32.h
or unistd-64.h
file.
In CentOS
and RedHat
, this file is installed by the kernel-headers
package.
When browsing the file, you’ll see a list like this:
For instance, __NR_mount
indicates the syscall
name - the actual name is the word without __NR_
bit, so in this case it’s mount
. 21 is the syscall number in your Linux.
Syscall Man Pages
To get more information about using a system call, just use man command. Because syscalls are a pretty core part of man
pages, they have their own section - it’s section number 2. So add .2 to the name of a syscall when looking for it:
SysCall Numbers
Don’t forget: although oldest syscalls match across multiple distributions, there’s always a chance that a particular syscall will have a different number in your OS.
This is only relevant if you’re trying to use syscalls directly - which you probably shouldn’t. Use glibc
instead - I’ll be sure to write a small article on it sometime in the future.
See Also
- Linux Kernel
- Unix Tutorial Digests
- Linux Kernel 5.8
- Confirm current Kernel boot command
- Linux Commands
- Unix Commands
- Where to Find Syscall Numbers