The table you linked to provides the list of arguments you're asking for.
I think what may be confusing you is that syscall
doesn't perform a single operation. Rather, it's a general-purpose API for anything you might want to ask the kernel to do -- open a file, map memory, fork a new process, and so on.
The specific operation you want the kernel to do is selected using the syscall number. Just picking the first one from the table, syscall 0 (known as sys_read
) reads from a file.
Obviously, the operations performed by the different syscalls require different arguments. Staying with the sys_read
example, we see in the table that it takes three arguments: The file descriptor (fd
), a pointer to a buffer (buf
) and a number of bytes to read (count
). So if you wanted to call this syscall, you would do it as follows:
#include <sys/syscall.h>
// Assuming these have been initialized appropriately.
unsigned int fd = ...;
char * buf = ...;
size_t count = ...;
syscall(SYS_read, fd, buf, count);
This answer has more information on when you might want to choose to use syscall
. The short version is that the reasons to use syscall
are few and far between.
Edit: As @PeterCordes points out, syscall numbers differ between ABIs, so you should use the constants defined in sys/syscall.h
instead of hardcoding syscall numbers yourself.