Conflict between system call number and system call handler pointer

When I read "Operating System Concepts" (7th, Silberšac, Galvin, Gagnier), I came across a training project on adding a system call to the linux kernel. The book says that

System call numbers for the latest versions of the Linux kernel are listed in / usr / src / linux -2.x / include / asm-i386 / unistd.h. (for example, __NR_close, which corresponds to the close () system call, which is called to close the descriptor file, is defined as 6.) / usr / src / linux -2.x / arc / i386 / kernel / entry.S under the heading RECORD ( sys_call_table). Please note that sys_close is stored when writing number 6 to the table corresponding to the system call number defined in the unistd.h file. (p. 75)

I downloaded the latest Linux source package from the ubuntu repository and found the mentioned source files with minor changes to the directory and file name. But there is an interesting thing that confuses me in the file / usr / src / linux -source-2.6.31 / arch / x86 / kernel / less syscall_table_32.S, sys_close is stored when writing with the number 6, as the book says, nevertheless , in the unistd.h file __NR_close is defined as 57, not 6. What is the reason for this difference?

Thanks in advance

+3
source share
1 answer

, ? . , x86 6, x86-64 - 3 ( unistd.h ).

+2

Source: https://habr.com/ru/post/1735838/


All Articles