Where to Find System Calls Numbers

Linux System Calls Linux System Calls and their Numbers

If you ever want to refresh numeric IDs of specific system calls in your Linux system it’s easy to do by inspecting some of the standard Linux header (include) files.

System Calls

In operating systems, Linux/Unix included, system calls are a special set of procedures that regular programs (usespace processes) for working with hardware, internal OS functionality, all sorts of cummunication and process management, and everything security enhanced. Such procedures interface with OS kernel that verifies validity of a system call and them executes it within kernel space, then returning something back.

Examples of a system call

  • creating a process
  • killing a process (technically: sending it a signal which may be different from SIGKILL)
  • opening a file or closing a file
  • reading or writing from file or socket
  • establishing or terminating connections (like network)
  • verifying or modifying device parameters
  • verifying or modifying permissions or attributes

System Calls Definitions in Linux Headers

In Linux (I’m using CentOS server for this post) you’ll most likely find two files with system call definitions: 32-bit version and 64-bit version:

  • /usr/include/asm/unistd_32.h
  • /usr/include/asm/unistd_64.h

Both have system calls lists like this (that’s the unistd_32.h file):

#ifndef _ASM_X86_UNISTD_32_H
#define _ASM_X86_UNISTD_32_H 1

#define __NR_restart_syscall 0
#define __NR_exit 1
#define __NR_fork 2
#define __NR_read 3
#define __NR_write 4
#define __NR_open 5
#define __NR_close 6
#define __NR_waitpid 7
#define __NR_creat 8

See Also




Keep Learning

Follow me on Facebook, Twitter or Telegram:
Recommended
I learn with Educative: Educative
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!

Recent Tweets