[英]Redundant Linux Kernel System Calls
I'm currently working on a project that hooks into various system calls and writes things to a log, depending on which one was called. 我正在开发一个项目,它挂钩到各种系统调用并将内容写入日志,具体取决于调用的是哪一个。 So, for example, when I change the permissions of a file, I write a little entry to a log file that tracks the old permission and new permission. 因此,例如,当我更改文件的权限时,我会在跟踪旧权限和新权限的日志文件中写一个小条目。 However, I'm having some trouble pinning down exactly where I should be watching. 但是,我在确定我应该注意的位置时遇到了一些麻烦。 For the above example, strace tells me that the "chmod" command uses the system call sys_fchmodat(). 对于上面的例子,strace告诉我“chmod”命令使用系统调用sys_fchmodat()。 However, there's also a sys_chmod() and a sys_fchmod(). 但是,还有一个sys_chmod()和一个sys_fchmod()。
I'm sure the kernel developers know what they're doing, but I wonder: what is the point of all these (seemingly) redundant system calls, and is there any rule on which ones are used for what? 我确信内核开发人员知道他们正在做什么,但我想知道:所有这些(看似)冗余系统调用的重点是什么,是否有关于哪些用于什么的规则? (ie are the "at" syscalls or ones prefixed with "f" meant to do something specific?) (即“at”系统调用或以“f”为前缀的那些意味着做某些特定的事情?)
History :-) 历史:-)
Once a system call has been created it can't ever be changed, therefore when new functionality is required a new system call is created. 一旦创建了系统调用,就无法对其进行更改,因此当需要新功能时,将创建新的系统调用。 (Of course this means there's a very high bar before a new system call is created). (当然这意味着在创建新的系统调用之前有一个很高的标准)。
Yes, there are some naming rules. 是的,有一些命名规则。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.