Question about syscall
Hi, I am reading the source code about xenomai syscall. And I have some question about xenomai syscall. For example, when I call function open which is defined in file rtdm.c,it would call xenomai syscall by using "fd = XENOMAI_SYSCALL2( sc_cobalt_open, path, oflag);". sc_cobalt_open is a macro like "#define sc_cobalt_open 75" defined in file syscall.h. After interrupt requested, system would handle the irq. By using 75 and array cobalt_syscalls which is defined in \kernel\cobalt\posix\syscall.c, the irq handle function could be found in cobalt_syscalls[75]. After reading source code, I found cobalt_syscalls[75] is a function pointer. cobalt_syscalls[75] and cobalt_open point to the same function.
At this point, it is clear that function pointer cobalt_##name initialize the array cobalt_syscalls. But I can't find where cobalt_##name like cobalt_open defined in.
All in all, I just want to figure out the map about syscall from user-function to kernel-function, like open->fd = XENOMAI_SYSCALL2( sc_cobalt_open, path, oflag);->static inline int rtdm_open(const char *path, int oflag, ...)
Thanks for your help.
Quoted 4 lines · ニャン星人
Hi, I am reading the source code about xenomai syscall. And I have some question about xenomai syscall. For example, when I call function open which is defined in file rtdm.c,it would call xenomai syscall by using "fd = XENOMAI_SYSCALL2(
sc_cobalt_open,
Quoted 8 lines
path, oflag);".
sc_cobalt_openis a macro like "#definesc_cobalt_open75" defined in filesyscall.h. After interrupt requested, system would handle the irq. By using 75 and arraycobalt_syscallswhich is defined in \kernel\cobalt\posix\syscall.c, the irq handle function could be found in cobalt_syscalls[75]. After reading source code, I found cobalt_syscalls[75] is a function pointer. cobalt_syscalls[75] andcobalt_openpoint to the same function.
Hi,
Strictly speaking, cobalt_open is not a pointer, so it does not point to anything. cobalt_syscall[75] is indeed a pointer to cobalt_open.
Quoted 9 lines
At this point, it is clear that function pointer cobalt_##name initialize the array
cobalt_syscalls. But I can't find where cobalt_##name likecobalt_opendefined in.All in all, I just want to figure out the map about syscall from user-function to kernel-function, like
open->fd=XENOMAI_SYSCALL2( sc_cobalt_open, path, oflag);->static inline intrtdm_open(const char *path, int oflag, ...)
cobalt_open is implemented in kernel/cobalt/posix/io.c
The macro COBALT_SYSCALL generates the "cobalt_open" name from the declaration COBALT_SYSCALL(open, ...)
Regards.
Signature · 2 lines
Gilles. https://click-hack.org