Making a system call on Linux

We just got an intermediate project for my course on "operating systems", we are invited to implement a system call (and I assume that we will have to write a piece of code to call it).

I understand that I will need to update the system call table (I don’t remember the name, but not biggie), and also create a kernel module that the table will refer to, but does that mean I will have to recompile the whole kernel, so the kernel knows about my module?

I saw that it is possible to capture the current system call, but I suspect that I will not get credit for my job if I do.

I just wanted to feel the size of the efforts that I will make.

UPDATE: Well, in the end, it became a problem, they change some things starting from version 2.6.32, so when I returned to the previous version of the kernel specific for students on the Internet, I found it was really easy to follow. If someone catches this on the Internet and follows the tutorial, initially I would recommend downloading the same kernel in the tutorial first and then moving from there when you have an understanding of what you are doing. If you are really familiar with compiling kernels, etc., you might not have a problem, but this was the first time I built the kernel, so it was painful to compile for 2 hours, and then find out something wasn’t working, and have to do it again, especially when I wasn’t sure that I / didn’t do it wrong.

+4
source share
3 answers

but does this mean that I will have to recompile the whole kernel, so does the kernel know about my module?

Yes, you will need to recompile the kernel.

+3
source

Do you want to read:

  • Linux kernel programming, third edition (paperback) by Michael Beck (author), Harald Bohm (author), Mirko Dzyadzka (author), Ulrich Kunitz (author), Robert Magnus (author), Dirk Verwoner (author), Klaus Schroter ( author), published by Addison-Wesley (Pearson Education), ISBN-10: 0201719754 , ISBN-13: 978-0201719758

and possibly also for more details:

  • Understanding the Linux Kernel, Third Edition by Daniel P. Beauvet, Marco Cesati, published by OReilly, ISBN 10: 0-596-00565-2 , ISBN 13: 9780596005658
  • Linux device drivers, third edition Jonathan Corbet, Alessandro Rubini, Greg Croa-Hartman, published by OReilly, ISBN 10: 0-596-00590-3 , ISBN 13: 9780596005900
+4
source

I understand that I will need to update the system call table

This is /usr/src/linux/arch/i386/kernel/syscall_table.S

Does this mean that I will have to recompile the whole kernel, so does the kernel know about my module?

Yes indeed.

 Just wanted to get a feel for the size of the effort I'll be making. 

If you know what code you are going to write as part of a system call, you are already done. You just have to wait for the time to recompile the kernel. Here is a set of instructions:

Implementing a system call on Linux

+2
source

All Articles