Skip to content
Xiangyan Sun edited this page Mar 13, 2015 · 1 revision

When you see something like FATAL: Unimplemented syscall: 123 in flog it means a system call the application calling is missing. To fix this problem, you have to first identify the system call, then implement it, at last add an entry to the system call dispatch table.

Identify the system call

From the log you can get the system call ID. You need to look up that ID in the table. Use the table in the official Linux source code is recommended, as it is most accurate and up-to-date. The system call table can be found at arch/x86/syscalls/syscall_{32,64}.tbl.

After identifying the system call, if you are not familiar with the function, you can view man pages online at man7.org.

Implement the system call

Firstly find the correct file to place the function.

exec: execve() and friends.
fork: fork() and friends.
mm: Memory management functions, such as mmap().
process: Process management, such getpid(), getuid(), getsid(). Currently I placed many misc functions here, should be move to another when appropriate.
sig: Signal handling, such as sigaction().
timer: Timers, such as gettimeofday().
tls: Thread-local storage, such as set_thread_area().
vfs: Virtual file system, such as open().

A special case is socket system calls, which is placed in fs/socket.c.

When implementing the system call, try to group similar functions together so that it will be a bit easier to navigate.

Add entry to system call dispatch table

When finished implementing the system call, you should add an entry to the system call dispatch table so the runtime knows the newly introduced function. The tables are located at src/syscall_table_{x86,x64}.h. The line number in each file corresponds to the system call ID. Please add both x86 and x64 entries so it will be a bit easier when we start to implement x64.