https://android.googlesource.com/platform/bionic/+/android-8.1.0_r18
Adding system calls
Adding a system call usually involves:
- Add entries to SYSCALLS.TXT. See SYSCALLS.TXT itself for documentation on the format.
- Run the gensyscalls.py script.
- Add constants (and perhaps types) to the appropriate header file. Note that you should check to see whether the constants are already in kernel uapi header files, in which case you just need to make sure that the appropriate POSIX header file in libc/include/ includes the relevant file or files.
- Add function declarations to the appropriate header file.
- Add the function name to the correct section in libc/libc.map.txt and run
./libc/tools/genversion-scripts.py
.
- Add at least basic tests. Even a test that deliberately supplies an invalid argument helps check that we're generating the right symbol and have the right declaration in the header file, and that you correctly updated the maps in step 5. (You can use strace(1) to confirm that the correct system call is being made.)