Welcome! Log In Create A New Profile


Conflict between system call number and system call handler pointer

Posted by Pushdown 
When I was reading Operating System Concepts (7e, Silberschatz, Galvin, Gagne), I encountered a study project about adding a system call to the linux kernel. The book says that


The system call numbers for recent versions of the Linux kernel are listed in
/usr/src/linux-2.x/include/asm-i386/unistd.h. (for instance, __NR_close, which
corresponds to the system call close() that is invoked for closing a file
descriptor, is defined as value 6.) The
/usr/src/linux-2.x/arc/i386/kernel/entry.S under the heading
ENTRY(sys_call_table). Notice that sys_close is stored at entry numbered 6 in
the table to be consistent with the system call number defined in unistd.h
file. (pg. 75)

I've downloaded latest linux source package from the ubuntu repository, and found the mentioned source files with minor directory and file name changes. But there is an interesting thing confuses me in the file /usr/src/linux-source-2.6.31/arch/x86/kernel/less syscall_table_32.S, sys_close is stored at entry numbered 6 as said in the book, nevertheless, in unistd.h file __NR_close defined as 57, instead of 6. What is the reason of this difference?

Thanks in advance

Your Email:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 4 plus 2?