Reputation: 1507
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 #include
s, 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?
Upvotes: 1
Views: 423
Reputation: 54325
The C library provides functions which happen to look like system calls. What actually happens is that the C library function is called and then it makes the system call.
If you add a new system call, then to make it easily usable you would need to add it to the C library and recompile that too.
Or you can use the syscall function and macros provided by the C library: syscall and _syscall.
Try man syscall
and man _syscall
to see details.
Upvotes: 5