Adding a new system call to the Linux kernel

Note: Please use the class discussion board (you can find it on your blackboard) as a communication and Q&A tool.  Should you still need to send an e-mail inquiry, address it to the TA (Xiaowan Dong: xdong at cs...) and cc the instructor. 

Introduction

Though adding system calls to the kernel should never be your first choice to expand the kernel's functionality in the real world (applications and developers expect a certain set of calls), for the purpose of this class it will be a rather common habit. Below we describe how to add a new system call to the Linux kernel v2.6.26.5 from the kernel repository. For information on the underlying mechanisms, refer here, as well as in the suggested class resources and of course, any internet search engine.

We will be adding a system call named cs2456_test which takes an integer as an argument and prints it out along with a greeting.

Adding a new system call - the Linux-kernel side


Adding a new system call - the user-level side

Since all the libraries we have are unaware of our new system call, in order to test it we need to provide the user with a library call to trigger the syscall. Boot your GNU/Linux distribution (Debian in QDGL's case), login as a simple user and follow the procedure below.
Testing your new system call