Skip to contentSkip to conversation

Question about syscall

Xenomai ニャン星人 2 participants 2 messages Dec 23, 2015

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
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_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.

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 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, ...)

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