Sure, here is a list of common syscalls available for use in assembly code with the GNU Assembler (GAS) on Linux systems. These syscalls are typically accessed via the syscall instruction in x86_64 architecture. Note that syscall numbers can vary by architecture and kernel version.

Common Syscalls and Their Numbers (x86_64)

  1. exit: Terminate a process

    • Syscall Number: 60
  2. fork: Create a new process

    • Syscall Number: 57
  3. read: Read from a file descriptor

    • Syscall Number: 0
  4. write: Write to a file descriptor

    • Syscall Number: 1
  5. open: Open a file

    • Syscall Number: 2
  6. close: Close a file descriptor

    • Syscall Number: 3
  7. stat: Get file status

    • Syscall Number: 4
  8. fstat: Get file status (using file descriptor)

    • Syscall Number: 5
  9. lstat: Get file status (like stat, but follows symlinks)

    • Syscall Number: 6
  10. mmap: Map files or devices into memory

    • Syscall Number: 9
  11. mprotect: Set protection on a region of memory

    • Syscall Number: 10
  12. munmap: Unmap files or devices from memory

    • Syscall Number: 11
  13. brk: Change data segment size

    • Syscall Number: 12
  14. socket: Create a socket

    • Syscall Number: 41
  15. connect: Connect a socket to an address

    • Syscall Number: 42
  16. accept: Accept a connection on a socket

    • Syscall Number: 43
  17. sendto: Send a message on a socket

    • Syscall Number: 44
  18. recvfrom: Receive a message from a socket

    • Syscall Number: 45
  19. sendmsg: Send a message on a socket

    • Syscall Number: 46
  20. recvmsg: Receive a message from a socket

    • Syscall Number: 47
  21. shutdown: Shut down part of a full-duplex connection

    • Syscall Number: 48
  22. bind: Bind a name to a socket

    • Syscall Number: 49
  23. listen: Listen for connections on a socket

    • Syscall Number: 50
  24. getsockname: Get socket name

    • Syscall Number: 51
  25. getpeername: Get peer name

    • Syscall Number: 52
  26. socketpair: Create a pair of connected sockets

    • Syscall Number: 53
  27. fork: Create a child process

    • Syscall Number: 57
  28. execve: Execute a program

    • Syscall Number: 59
  29. wait4: Wait for a process to change state

    • Syscall Number: 61
  30. sigreturn: Return from a signal handler

    • Syscall Number: 63
  31. setrlimit: Set resource limits

    • Syscall Number: 75
  32. getrlimit: Get resource limits

    • Syscall Number: 76
  33. poll: Poll file descriptors

    • Syscall Number: 7
  34. eventfd2: Create an eventfd object

    • Syscall Number: 284

This list covers a range of common syscalls, but there are many more available depending on the specific needs and kernel version. For a complete and up-to-date list of syscalls and their numbers, refer to the official Linux man pages (man 2 syscall) or the Linux kernel source.


documentation provided by: chatgpt, 2024