“名称"是什么? syscall_32.tbl linux文件中的参数均值? [英] What does the "name" parameter mean in the syscall_32.tbl linux file?

查看:228
本文介绍了“名称"是什么? syscall_32.tbl linux文件中的参数均值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在向Linux Fedora添加一些自定义系统调用,并且当前正在尝试更新"syscall_32.tbl".唯一的麻烦是我不太清楚呼叫表的name字段是什么意思.

I am adding some custom system calls to linux Fedora and I am currently trying to update "syscall_32.tbl". The only hiccup is that I am not too sure what the name field for the call table means.

这是我们刚刚组成的东西吗?就像我们决定调用此特定系统调用的名称一样?

Is this something we just make up? As in a name that we decide to call this particular system call?

例如,表的结构为:

<number> <abi> <name> <entry point> <compat entry point>

对于<name>部分,这是我们确定并仅在其中输入的参数吗?还是更具体一些,例如系统调用所在的文件名?

For the <name> section is this a parameter that we decide on and just enter there? Or is it something more specific like the filename that the system call is located in?

推荐答案

内核中有一个系统调用表,其中列出了所有系统调用及其实现功能.用户域通过指定syscall的索引号来请求系统调用.因此,该索引号必须在内核编译和用户域代码编译之间匹配.由于此列表很容易维护,因此引入了您找到的系统调用表,并自动从中生成代码.该表与系统调用相关:它们的索引号,在用户域中使用的名称以及实现系统调用的内核函数名称. Makefile从该表中生成头文件.

There is a system call table in the kernel, listing all the system calls and their implementing functions. The user-land requests a system call by specifying the index number of the syscall. Therefore this index number must match between kernel compilations and user-land code compilations. Since this list is an error-prone thing to maintain, the system call table that you have found was introduced, and code is generated from it automatically. That table correlates the system calls: their index number, the name to be used in the user-land, and the kernel function name implementing the system call. From this table, the Makefile generates the header files.

有一个头文件syscalls_xx.h,它定义了内核中的表(它通过索引列出了实现syscall的所有内核函数).

There is a header file syscalls_xx.h, it defines the table within the kernel (it lists all the kernel functions implementing the syscalls by their index).

还有另一个头文件unistd_xx.h,它为用户区域提供#define,并按名称列出了系统调用索引号.您要求的 name 字段将进入此列表,用户界面可通过该列表引用此系统调用:__NR_<xxx>.复制该头文件,并在用户空间代码中使用该头文件,以便可以按名称引用syscall索引号(请参阅glibc源代码,以及如何使用它们).

There is another header file unistd_xx.h, it provides #define's for the user-land, listing the syscall index numbers by name. The name field you are asking will get into this list, by which the user-land can refer to this system call: __NR_<xxx>. This header file is copied and used in user-space code so that the syscall index numbers can be referenced by name (see the glibc sources, how these are used).

syscall_32.tbl:

syscall_32.tbl:

350     i386    finit_module            sys_finit_module

unistd_32.h:

unistd_32.h:

#define __NR_finit_module 350

syscalls_32.h:

syscalls_32.h:

__SYSCALL_I386(350, sys_finit_module, sys_finit_module)

这篇关于“名称"是什么? syscall_32.tbl linux文件中的参数均值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆