1

I'm trying to add a new syscall in Red Hat 8.0 and I'm confused about some aspect of the mechanism. I've been following this guide: http://www.linuxjournal.com/article/3326 which details the steps of updating the syscall table in entry.S and unistd.h.

However, I can't seem to figure out how the compiler actually finds where the syscall is implemented from this information. Obviously there's something that involves #includes, but I can't find any indications of includes being made, nor locate many of the syscalls in the code. What do I need to do for my syscall to be found?

4

1 回答 1

5

C 库提供的函数恰好看起来像系统调用。实际发生的是调用 C 库函数,然后它进行系统调用。

如果您添加一个新的系统调用,那么为了使其易于使用,您需要将其添加到 C 库并重新编译它。

或者您可以使用 C 库提供的 syscall 函数和宏:syscall 和 _syscall。

尝试man syscallman _syscall查看详细信息。

于 2009-11-03T03:02:43.670 回答