简体   繁体   English

创建一个新的 Linux 系统调用还需要在 libc 中进行更改吗?

[英]Creating a new Linux systemcall need changes in libc as well?

If I am creating a new Linux system call, does that need changes in libc as well?如果我正在创建一个新的 Linux 系统调用,是否也需要在libc中进行更改?

If you want a libc wrapper, then you probably need to update libc (which can be a pain).如果您想要一个 libc 包装器,那么您可能需要更新 libc(这可能会很痛苦)。 Thankfully, libc includes syscall(2) which can be used for any arbitrary system call.值得庆幸的是,libc 包含syscall(2) ,可用于任意系统调用。

The only catch is that the programmer is now responsible for making sure invocations of this system call use the correct arguments since the compiler will only check the type of the first argument.唯一需要注意的是,程序员现在负责确保调用此系统调用使用正确的 arguments,因为编译器只会检查第一个参数的类型。 For this reason, you should implement your own system call wrapper that includes types.因此,您应该实现自己的包含类型的系统调用包装器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM