[Xenomai] Question about syscall

Gilles Chanteperdrix gilles.chanteperdrix at xenomai.org
Wed Dec 23 13:39:02 CET 2015

On Wed, Dec 23, 2015 at 12:01:03PM +0800, ニャン星人 wrote:
> 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.


Strictly speaking, cobalt_open is not a pointer, so it does not
point to anything. cobalt_syscall[75] is indeed a pointer to

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



More information about the Xenomai mailing list