Adding a new system call to the Linux kernel

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

Introduction

Though adding system calls to the kernel should not 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 v3.18.77 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