Module: xenomai-forge
Branch: next
Commit: 0b9234dfedf59679351ceb04232f2c6d5e1da3d8
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=0b9234dfedf59679351ceb04232f2c6d5e1da3d8

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Sep  2 12:14:57 2014 +0200

cobalt/syscall, lib/cobalt: generate handler names automatically

---

 include/cobalt/uapi/syscall.h  |    4 +-
 kernel/cobalt/posix/clock.c    |   17 +-
 kernel/cobalt/posix/clock.h    |   23 ++-
 kernel/cobalt/posix/cond.c     |   24 ++-
 kernel/cobalt/posix/cond.h     |   27 ++-
 kernel/cobalt/posix/event.c    |   41 ++--
 kernel/cobalt/posix/event.h    |   34 +--
 kernel/cobalt/posix/internal.h |    1 +
 kernel/cobalt/posix/io.c       |   50 +++--
 kernel/cobalt/posix/io.h       |   42 ++--
 kernel/cobalt/posix/monitor.c  |   48 +++--
 kernel/cobalt/posix/monitor.h  |   27 ++-
 kernel/cobalt/posix/mqueue.c   |   67 +++---
 kernel/cobalt/posix/mqueue.h   |   38 ++--
 kernel/cobalt/posix/mutex.c    |   25 ++-
 kernel/cobalt/posix/mutex.h    |   26 ++-
 kernel/cobalt/posix/nsem.c     |   13 +-
 kernel/cobalt/posix/sched.c    |   25 ++-
 kernel/cobalt/posix/sched.h    |   29 +--
 kernel/cobalt/posix/sem.c      |   38 ++--
 kernel/cobalt/posix/sem.h      |   52 +++--
 kernel/cobalt/posix/signal.c   |   22 +-
 kernel/cobalt/posix/signal.h   |   31 +--
 kernel/cobalt/posix/syscall.c  |  447 +++++++++++++++++++++-------------------
 kernel/cobalt/posix/syscall.h  |   27 +++
 kernel/cobalt/posix/thread.c   |   45 ++--
 kernel/cobalt/posix/thread.h   |   66 +++---
 kernel/cobalt/posix/timer.c    |   20 +-
 kernel/cobalt/posix/timer.h    |   35 ++--
 kernel/cobalt/posix/timerfd.c  |   13 +-
 kernel/cobalt/posix/timerfd.h  |   14 +-
 lib/cobalt/arch/arm/features.c |    2 +-
 lib/cobalt/current.c           |    4 +-
 33 files changed, 785 insertions(+), 592 deletions(-)

diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 3074af5..75e0d3e 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -109,11 +109,11 @@
 #define sc_cobalt_mmap                         86
 #define sc_cobalt_select                       87
 #define sc_cobalt_migrate                      88
-#define sc_cobalt_arch                         89
+#define sc_cobalt_archcall                     89
 #define sc_cobalt_info                         90
 #define sc_cobalt_trace                                91
 #define sc_cobalt_heap_getstat                 92
-#define sc_cobalt_current                      93
+#define sc_cobalt_get_current                  93
 #define sc_cobalt_mayday                       94
 #define sc_cobalt_backtrace                    95
 #define sc_cobalt_serialdbg                    96
diff --git a/kernel/cobalt/posix/clock.c b/kernel/cobalt/posix/clock.c
index 5074dc2..09e4d8b 100644
--- a/kernel/cobalt/posix/clock.c
+++ b/kernel/cobalt/posix/clock.c
@@ -104,7 +104,8 @@ static int do_clock_host_realtime(struct timespec *tp)
        __val;                                                  \
 })
 
-int cobalt_clock_getres(clockid_t clock_id, struct timespec __user *u_ts)
+COBALT_SYSCALL(clock_getres, current,
+              int, (clockid_t clock_id, struct timespec __user *u_ts))
 {
        struct timespec ts;
        xnticks_t ns;
@@ -131,7 +132,8 @@ int cobalt_clock_getres(clockid_t clock_id, struct timespec 
__user *u_ts)
        return 0;
 }
 
-int cobalt_clock_gettime(clockid_t clock_id, struct timespec __user *u_ts)
+COBALT_SYSCALL(clock_gettime, current,
+              int, (clockid_t clock_id, struct timespec __user *u_ts))
 {
        struct timespec ts;
        xnticks_t ns;
@@ -164,7 +166,9 @@ int cobalt_clock_gettime(clockid_t clock_id, struct 
timespec __user *u_ts)
        return 0;
 }
 
-int cobalt_clock_settime(clockid_t clock_id, const struct timespec __user 
*u_ts)
+COBALT_SYSCALL(clock_settime, current,
+              int, (clockid_t clock_id,
+                    const struct timespec __user *u_ts))
 {
        struct timespec ts;
        int _ret, ret = 0;
@@ -195,9 +199,10 @@ int cobalt_clock_settime(clockid_t clock_id, const struct 
timespec __user *u_ts)
        return 0;
 }
 
-int cobalt_clock_nanosleep(clockid_t clock_id, int flags,
-                          const struct timespec __user *u_rqt,
-                          struct timespec __user *u_rmt)
+COBALT_SYSCALL(clock_nanosleep, nonrestartable,
+              int, (clockid_t clock_id, int flags,
+                    const struct timespec __user *u_rqt,
+                    struct timespec __user *u_rmt))
 {
        struct timespec rqt, rmt, *rmtp = NULL;
        struct xnthread *cur;
diff --git a/kernel/cobalt/posix/clock.h b/kernel/cobalt/posix/clock.h
index fae85a7..8a601f9 100644
--- a/kernel/cobalt/posix/clock.h
+++ b/kernel/cobalt/posix/clock.h
@@ -21,6 +21,7 @@
 #include <linux/types.h>
 #include <linux/time.h>
 #include <cobalt/uapi/time.h>
+#include <xenomai/posix/syscall.h>
 
 #define ONE_BILLION             1000000000
 
@@ -83,18 +84,22 @@ static inline int clock_flag(int flag, clockid_t clock_id)
        return -EINVAL;
 }
 
-int cobalt_clock_getres(clockid_t clock_id,
-                       struct timespec __user *u_ts);
+COBALT_SYSCALL_DECL(clock_getres,
+                   int, (clockid_t clock_id,
+                         struct timespec __user *u_ts));
 
-int cobalt_clock_gettime(clockid_t clock_id,
-                        struct timespec __user *u_ts);
+COBALT_SYSCALL_DECL(clock_gettime,
+                   int, (clockid_t clock_id,
+                         struct timespec __user *u_ts));
 
-int cobalt_clock_settime(clockid_t clock_id,
-                        const struct timespec __user *u_ts);
+COBALT_SYSCALL_DECL(clock_settime,
+                   int, (clockid_t clock_id,
+                         const struct timespec __user *u_ts));
 
-int cobalt_clock_nanosleep(clockid_t clock_id, int flags,
-                          const struct timespec __user *u_rqt,
-                          struct timespec __user *u_rmt);
+COBALT_SYSCALL_DECL(clock_nanosleep,
+                   int, (clockid_t clock_id, int flags,
+                         const struct timespec __user *u_rqt,
+                         struct timespec __user *u_rmt));
 
 int cobalt_clock_register(struct xnclock *clock,
                          clockid_t *clk_id);
diff --git a/kernel/cobalt/posix/cond.c b/kernel/cobalt/posix/cond.c
index 1777a6f..948bd71 100644
--- a/kernel/cobalt/posix/cond.c
+++ b/kernel/cobalt/posix/cond.c
@@ -272,8 +272,9 @@ unlock_and_return:
        return err;
 }
 
-int cobalt_cond_init(struct cobalt_cond_shadow __user *u_cnd,
-                    const struct cobalt_condattr __user *u_attr)
+COBALT_SYSCALL(cond_init, current,
+              int, (struct cobalt_cond_shadow __user *u_cnd,
+                    const struct cobalt_condattr __user *u_attr))
 {
        struct cobalt_cond_shadow cnd;
        struct cobalt_condattr attr;
@@ -294,7 +295,8 @@ int cobalt_cond_init(struct cobalt_cond_shadow __user 
*u_cnd,
        return __xn_safe_copy_to_user(u_cnd, &cnd, sizeof(*u_cnd));
 }
 
-int cobalt_cond_destroy(struct cobalt_cond_shadow __user *u_cnd)
+COBALT_SYSCALL(cond_destroy, current,
+              int, (struct cobalt_cond_shadow __user *u_cnd))
 {
        struct cobalt_cond_shadow cnd;
        int err;
@@ -316,11 +318,12 @@ struct us_cond_data {
 };
 
 /* pthread_cond_wait_prologue(cond, mutex, count_ptr, timed, timeout) */
-int cobalt_cond_wait_prologue(struct cobalt_cond_shadow __user *u_cnd,
-                             struct cobalt_mutex_shadow __user *u_mx,
-                             int *u_err,
-                             unsigned int timed,
-                             struct timespec __user *u_ts)
+COBALT_SYSCALL(cond_wait_prologue, nonrestartable,
+              int, (struct cobalt_cond_shadow __user *u_cnd,
+                    struct cobalt_mutex_shadow __user *u_mx,
+                    int *u_err,
+                    unsigned int timed,
+                    struct timespec __user *u_ts))
 {
        struct xnthread *cur = xnthread_current();
        struct cobalt_cond *cnd;
@@ -386,8 +389,9 @@ int cobalt_cond_wait_prologue(struct cobalt_cond_shadow 
__user *u_cnd,
        return err == 0 ? perr : err;
 }
 
-int cobalt_cond_wait_epilogue(struct cobalt_cond_shadow __user *u_cnd,
-                             struct cobalt_mutex_shadow __user *u_mx)
+COBALT_SYSCALL(cond_wait_epilogue, primary,
+              int, (struct cobalt_cond_shadow __user *u_cnd,
+                    struct cobalt_mutex_shadow __user *u_mx))
 {
        struct xnthread *cur = xnthread_current();
        struct cobalt_cond *cnd;
diff --git a/kernel/cobalt/posix/cond.h b/kernel/cobalt/posix/cond.h
index dc1165b..8db0b78 100644
--- a/kernel/cobalt/posix/cond.h
+++ b/kernel/cobalt/posix/cond.h
@@ -23,6 +23,7 @@
 #include <cobalt/kernel/synch.h>
 #include <cobalt/uapi/thread.h>
 #include <cobalt/uapi/cond.h>
+#include <xenomai/posix/syscall.h>
 
 struct cobalt_kqueues;
 struct cobalt_mutex;
@@ -40,21 +41,25 @@ struct cobalt_cond {
        xnhandle_t handle;
 };
 
-int cobalt_cond_deferred_signals(struct cobalt_cond *cond);
+COBALT_SYSCALL_DECL(cond_init,
+                   int, (struct cobalt_cond_shadow __user *u_cnd,
+                         const struct cobalt_condattr __user *u_attr));
 
-int cobalt_cond_init(struct cobalt_cond_shadow __user *u_cnd,
-                    const struct cobalt_condattr __user *u_attr);
+COBALT_SYSCALL_DECL(cond_destroy,
+                   int, (struct cobalt_cond_shadow __user *u_cnd));
 
-int cobalt_cond_destroy(struct cobalt_cond_shadow __user *u_cnd);
+COBALT_SYSCALL_DECL(cond_wait_prologue,
+                   int, (struct cobalt_cond_shadow __user *u_cnd,
+                         struct cobalt_mutex_shadow __user *u_mx,
+                         int *u_err,
+                         unsigned int timed,
+                         struct timespec __user *u_ts));
 
-int cobalt_cond_wait_prologue(struct cobalt_cond_shadow __user *u_cnd,
-                             struct cobalt_mutex_shadow __user *u_mx,
-                             int *u_err,
-                             unsigned int timed,
-                             struct timespec __user *u_ts);
+COBALT_SYSCALL_DECL(cond_wait_epilogue,
+                   int, (struct cobalt_cond_shadow __user *u_cnd,
+                         struct cobalt_mutex_shadow __user *u_mx));
 
-int cobalt_cond_wait_epilogue(struct cobalt_cond_shadow __user *u_cnd,
-                             struct cobalt_mutex_shadow __user *u_mx);
+int cobalt_cond_deferred_signals(struct cobalt_cond *cond);
 
 void cobalt_condq_cleanup(struct cobalt_kqueues *q);
 
diff --git a/kernel/cobalt/posix/event.c b/kernel/cobalt/posix/event.c
index f9f9338..a7cc523 100644
--- a/kernel/cobalt/posix/event.c
+++ b/kernel/cobalt/posix/event.c
@@ -46,9 +46,9 @@ struct event_wait_context {
        int mode;
 };
 
-int cobalt_event_init(struct cobalt_event_shadow __user *u_event,
-                     unsigned long value,
-                     int flags)
+COBALT_SYSCALL(event_init, current,
+              int, (struct cobalt_event_shadow __user *u_event,
+                    unsigned long value, int flags))
 {
        struct cobalt_event_shadow shadow;
        struct cobalt_event_data *datp;
@@ -104,11 +104,11 @@ int cobalt_event_init(struct cobalt_event_shadow __user 
*u_event,
        return __xn_safe_copy_to_user(u_event, &shadow, sizeof(*u_event));
 }
 
-int cobalt_event_wait(struct cobalt_event_shadow __user *u_event,
-                     unsigned long bits,
-                     unsigned long __user *u_bits_r,
-                     int mode,
-                     struct timespec __user *u_ts)
+COBALT_SYSCALL(event_wait, primary,
+              int, (struct cobalt_event_shadow __user *u_event,
+                    unsigned long bits,
+                    unsigned long __user *u_bits_r,
+                    int mode, struct timespec __user *u_ts))
 {
        unsigned long rbits = 0, testval;
        xnticks_t timeout = XN_INFINITE;
@@ -193,7 +193,8 @@ out:
        return ret;
 }
 
-int cobalt_event_sync(struct cobalt_event_shadow __user *u_event)
+COBALT_SYSCALL(event_sync, current,
+              int, (struct cobalt_event_shadow __user *u_event))
 {
        unsigned long bits, waitval, testval;
        struct xnthread_wait_context *wc;
@@ -242,9 +243,9 @@ out:
        return ret;
 }
 
-static void cobalt_event_destroy_inner(struct cobalt_event *event,
-                                      struct cobalt_kqueues *q,
-                                      spl_t s)
+static void event_destroy(struct cobalt_event *event,
+                         struct cobalt_kqueues *q,
+                         spl_t s)
 {
        struct xnheap *heap;
        int pshared;
@@ -262,7 +263,8 @@ static void cobalt_event_destroy_inner(struct cobalt_event 
*event,
        xnlock_get_irqsave(&nklock, s);
 }
 
-int cobalt_event_destroy(struct cobalt_event_shadow __user *u_event)
+COBALT_SYSCALL(event_destroy, current,
+              int, (struct cobalt_event_shadow __user *u_event))
 {
        struct cobalt_event *event;
        xnhandle_t handle;
@@ -281,7 +283,7 @@ int cobalt_event_destroy(struct cobalt_event_shadow __user 
*u_event)
                goto out;
        }
 
-       cobalt_event_destroy_inner(event, event->owningq, s);
+       event_destroy(event, event->owningq, s);
 
        xnsched_run();
 out:
@@ -290,10 +292,11 @@ out:
        return ret;
 }
 
-int cobalt_event_inquire(struct cobalt_event_shadow __user *u_event,
-                        struct cobalt_event_info __user *u_info,
-                        pid_t __user *u_waitlist,
-                        size_t waitsz)
+COBALT_SYSCALL(event_inquire, current,
+              int, (struct cobalt_event_shadow __user *u_event,
+                    struct cobalt_event_info __user *u_info,
+                    pid_t __user *u_waitlist,
+                    size_t waitsz))
 {
        int nrpend = 0, nrwait = 0, nrpids, ret = 0;
        unsigned long pstamp, nstamp = 0;
@@ -384,7 +387,7 @@ void cobalt_eventq_cleanup(struct cobalt_kqueues *q)
 
        if (!list_empty(&q->eventq)) {
                list_for_each_entry_safe(event, tmp, &q->eventq, link)
-                       cobalt_event_destroy_inner(event, q, s);
+                       event_destroy(event, q, s);
        }
 
        xnlock_put_irqrestore(&nklock, s);
diff --git a/kernel/cobalt/posix/event.h b/kernel/cobalt/posix/event.h
index e4db082..4ff217f 100644
--- a/kernel/cobalt/posix/event.h
+++ b/kernel/cobalt/posix/event.h
@@ -21,6 +21,7 @@
 
 #include <cobalt/kernel/synch.h>
 #include <cobalt/uapi/event.h>
+#include <xenomai/posix/syscall.h>
 
 struct cobalt_kqueues;
 
@@ -35,24 +36,29 @@ struct cobalt_event {
        xnhandle_t handle;
 };
 
-int cobalt_event_init(struct cobalt_event_shadow __user *u_evtsh,
-                     unsigned long value,
-                     int flags);
+COBALT_SYSCALL_DECL(event_init,
+                   int, (struct cobalt_event_shadow __user *u_evtsh,
+                         unsigned long value,
+                         int flags));
 
-int cobalt_event_wait(struct cobalt_event_shadow __user *u_evtsh,
-                     unsigned long bits,
-                     unsigned long __user *u_bits_r,
-                     int mode,
-                     struct timespec __user *u_ts);
+COBALT_SYSCALL_DECL(event_wait,
+                   int, (struct cobalt_event_shadow __user *u_evtsh,
+                         unsigned long bits,
+                         unsigned long __user *u_bits_r,
+                         int mode,
+                         struct timespec __user *u_ts));
 
-int cobalt_event_sync(struct cobalt_event_shadow __user *u_evtsh);
+COBALT_SYSCALL_DECL(event_sync,
+                   int, (struct cobalt_event_shadow __user *u_evtsh));
 
-int cobalt_event_destroy(struct cobalt_event_shadow __user *u_evtsh);
+COBALT_SYSCALL_DECL(event_destroy,
+                   int, (struct cobalt_event_shadow __user *u_evtsh));
 
-int cobalt_event_inquire(struct cobalt_event_shadow __user *u_event,
-                        struct cobalt_event_info __user *u_info,
-                        pid_t __user *u_waitlist,
-                        size_t waitsz);
+COBALT_SYSCALL_DECL(event_inquire,
+                   int, (struct cobalt_event_shadow __user *u_event,
+                         struct cobalt_event_info __user *u_info,
+                         pid_t __user *u_waitlist,
+                         size_t waitsz));
 
 void cobalt_eventq_cleanup(struct cobalt_kqueues *q);
 
diff --git a/kernel/cobalt/posix/internal.h b/kernel/cobalt/posix/internal.h
index fff6bd4..0182aae 100644
--- a/kernel/cobalt/posix/internal.h
+++ b/kernel/cobalt/posix/internal.h
@@ -27,6 +27,7 @@
 #include <asm/xenomai/syscall.h>
 #include "process.h"
 #include "extension.h"
+#include "syscall.h"
 
 #define COBALT_MAXNAME         64
 #define COBALT_PERMS_MASK      (O_RDONLY | O_WRONLY | O_RDWR)
diff --git a/kernel/cobalt/posix/io.c b/kernel/cobalt/posix/io.c
index 9d1ed0e..891d28d 100644
--- a/kernel/cobalt/posix/io.c
+++ b/kernel/cobalt/posix/io.c
@@ -21,10 +21,12 @@
 #include <cobalt/kernel/ppd.h>
 #include <xenomai/rtdm/internal.h>
 #include "process.h"
+#include "internal.h"
 #include "clock.h"
 #include "io.h"
 
-int cobalt_open(int fd, const char __user *u_path, int oflag)
+COBALT_SYSCALL(open, lostage,
+              int, (int fd, const char __user *u_path, int oflag))
 {
        char krnl_path[RTDM_MAX_DEVNAME_LEN + 1];
 
@@ -37,29 +39,39 @@ int cobalt_open(int fd, const char __user *u_path, int 
oflag)
        return __rt_dev_open(cobalt_ppd_get(0), fd, krnl_path, oflag);
 }
 
-int cobalt_socket(int fd, int protocol_family,
-                 int socket_type, int protocol)
+COBALT_SYSCALL(socket, lostage,
+              int, (int fd, int protocol_family,
+                    int socket_type, int protocol))
 {
        return __rt_dev_socket(cobalt_ppd_get(0), fd,
                        protocol_family, socket_type, protocol);
 }
 
-int cobalt_ioctl(int fd, unsigned int request, void __user *arg)
+COBALT_SYSCALL(close, lostage, int, (int fd))
+{
+       return rtdm_fd_close(cobalt_ppd_get(0), fd, XNFD_MAGIC_ANY);
+}
+
+COBALT_SYSCALL(ioctl, probing,
+              int, (int fd, unsigned int request, void __user *arg))
 {
        return rtdm_fd_ioctl(cobalt_ppd_get(0), fd, request, arg);
 }
 
-ssize_t cobalt_read(int fd, void __user *buf, size_t size)
+COBALT_SYSCALL(read, probing,
+              ssize_t, (int fd, void __user *buf, size_t size))
 {
        return rtdm_fd_read(cobalt_ppd_get(0), fd, buf, size);
 }
 
-ssize_t cobalt_write(int fd, const void __user *buf, size_t size)
+COBALT_SYSCALL(write, probing,
+              ssize_t, (int fd, const void __user *buf, size_t size))
 {
        return rtdm_fd_write(cobalt_ppd_get(0), fd, buf, size);
 }
 
-ssize_t cobalt_recvmsg(int fd, struct msghdr __user *umsg, int flags)
+COBALT_SYSCALL(recvmsg, probing,
+              ssize_t, (int fd, struct msghdr __user *umsg, int flags))
 {
        struct msghdr m;
        int ret;
@@ -77,7 +89,8 @@ ssize_t cobalt_recvmsg(int fd, struct msghdr __user *umsg, 
int flags)
        return ret;
 }
 
-ssize_t cobalt_sendmsg(int fd, struct msghdr __user *umsg, int flags)
+COBALT_SYSCALL(sendmsg, probing,
+              ssize_t, (int fd, struct msghdr __user *umsg, int flags))
 {
        struct msghdr m;
 
@@ -87,13 +100,9 @@ ssize_t cobalt_sendmsg(int fd, struct msghdr __user *umsg, 
int flags)
        return rtdm_fd_sendmsg(cobalt_ppd_get(0), fd, &m, flags);
 }
 
-int cobalt_close(int fd)
-{
-       return rtdm_fd_close(cobalt_ppd_get(0), fd, XNFD_MAGIC_ANY);
-}
-
-int cobalt_mmap(int fd, struct _rtdm_mmap_request __user *u_rma,
-                  void __user **u_addrp)
+COBALT_SYSCALL(mmap, lostage,
+              int, (int fd, struct _rtdm_mmap_request __user *u_rma,
+                    void __user **u_addrp))
 {
        struct _rtdm_mmap_request rma;
        void *u_addr;
@@ -159,11 +168,12 @@ static int select_bind_all(struct xnselector *selector,
 }
 
 /* int select(int, fd_set *, fd_set *, fd_set *, struct timeval *) */
-int cobalt_select(int nfds,
-                 fd_set __user *u_rfds,
-                 fd_set __user *u_wfds,
-                 fd_set __user *u_xfds,
-                 struct timeval __user *u_tv)
+COBALT_SYSCALL(select, nonrestartable,
+              int, (int nfds,
+                    fd_set __user *u_rfds,
+                    fd_set __user *u_wfds,
+                    fd_set __user *u_xfds,
+                    struct timeval __user *u_tv))
 {
        fd_set __user *ufd_sets[XNSELECT_MAX_TYPES] = {
                [XNSELECT_READ] = u_rfds,
diff --git a/kernel/cobalt/posix/io.h b/kernel/cobalt/posix/io.h
index 3e1e0c8..f8fdc82 100644
--- a/kernel/cobalt/posix/io.h
+++ b/kernel/cobalt/posix/io.h
@@ -20,31 +20,41 @@
 #define _COBALT_POSIX_IO_H
 
 #include <rtdm/rtdm.h>
+#include <xenomai/posix/syscall.h>
 
-int cobalt_open(int fd, const char __user *u_path, int oflag);
+COBALT_SYSCALL_DECL(open, int,
+                   (int fd, const char __user *u_path, int oflag));
 
-int cobalt_socket(int fd, int protocol_family,
-                 int socket_type, int protocol);
+COBALT_SYSCALL_DECL(socket, int,
+                   (int fd, int protocol_family,
+                    int socket_type, int protocol));
 
-int cobalt_ioctl(int fd, unsigned int request, void __user *arg);
+COBALT_SYSCALL_DECL(close, int, (int fd));
 
-ssize_t cobalt_read(int fd, void __user *buf, size_t size);
+COBALT_SYSCALL_DECL(ioctl, int,
+                   (int fd, unsigned int request, void __user *arg));
 
-ssize_t cobalt_write(int fd, const void __user *buf, size_t size);
+COBALT_SYSCALL_DECL(read, ssize_t,
+                   (int fd, void __user *buf, size_t size));
 
-ssize_t cobalt_recvmsg(int fd, struct msghdr __user *umsg, int flags);
+COBALT_SYSCALL_DECL(write, ssize_t,
+                   (int fd, const void __user *buf, size_t size));
 
-ssize_t cobalt_sendmsg(int fd, struct msghdr __user *umsg, int flags);
+COBALT_SYSCALL_DECL(recvmsg, ssize_t,
+                   (int fd, struct msghdr __user *umsg, int flags));
 
-int cobalt_close(int fd);
+COBALT_SYSCALL_DECL(sendmsg, ssize_t,
+                   (int fd, struct msghdr __user *umsg, int flags));
 
-int cobalt_mmap(int fd, struct _rtdm_mmap_request __user *u_rma,
-               void __user **u_addrp);
+COBALT_SYSCALL_DECL(mmap, int,
+                   (int fd, struct _rtdm_mmap_request __user *u_rma,
+                    void __user **u_addrp));
 
-int cobalt_select(int nfds,
-                 fd_set __user *u_rfds,
-                 fd_set __user *u_wfds,
-                 fd_set __user *u_xfds,
-                 struct timeval __user *u_tv);
+COBALT_SYSCALL_DECL(select,
+                   int, (int nfds,
+                         fd_set __user *u_rfds,
+                         fd_set __user *u_wfds,
+                         fd_set __user *u_xfds,
+                         struct timeval __user *u_tv));
 
 #endif /* !_COBALT_POSIX_IO_H */
diff --git a/kernel/cobalt/posix/monitor.c b/kernel/cobalt/posix/monitor.c
index 416519b..63ab7a7 100644
--- a/kernel/cobalt/posix/monitor.c
+++ b/kernel/cobalt/posix/monitor.c
@@ -48,8 +48,9 @@
  * Implementation-wise, the monitor logic is shared with the Cobalt
  * thread object.
  */
-int cobalt_monitor_init(struct cobalt_monitor_shadow __user *u_mon,
-                       clockid_t clk_id, int flags)
+COBALT_SYSCALL(monitor_init, current,
+              int, (struct cobalt_monitor_shadow __user *u_mon,
+                    clockid_t clk_id, int flags))
 {
        struct cobalt_monitor_shadow shadow;
        struct cobalt_monitor_data *datp;
@@ -108,7 +109,7 @@ int cobalt_monitor_init(struct cobalt_monitor_shadow __user 
*u_mon,
 }
 
 /* nklock held, irqs off */
-static int cobalt_monitor_enter_inner(xnhandle_t handle, struct xnthread *curr)
+static int monitor_enter(xnhandle_t handle, struct xnthread *curr)
 {
        struct cobalt_monitor *mon;
        int ret = 0, info;
@@ -145,7 +146,8 @@ static int cobalt_monitor_enter_inner(xnhandle_t handle, 
struct xnthread *curr)
        return 0;
 }
 
-int cobalt_monitor_enter(struct cobalt_monitor_shadow __user *u_mon)
+COBALT_SYSCALL(monitor_enter, primary,
+              int, (struct cobalt_monitor_shadow __user *u_mon))
 {
        struct xnthread *curr = xnthread_current();
        xnhandle_t handle;
@@ -155,14 +157,14 @@ int cobalt_monitor_enter(struct cobalt_monitor_shadow 
__user *u_mon)
        handle = cobalt_get_handle_from_user(&u_mon->handle);
 
        xnlock_get_irqsave(&nklock, s);
-       ret = cobalt_monitor_enter_inner(handle, curr);
+       ret = monitor_enter(handle, curr);
        xnlock_put_irqrestore(&nklock, s);
 
        return ret;
 }
 
 /* nklock held, irqs off */
-static void cobalt_monitor_wakeup(struct cobalt_monitor *mon)
+static void monitor_wakeup(struct cobalt_monitor *mon)
 {
        struct cobalt_monitor_data *datp = mon->data;
        struct cobalt_thread *thread, *tmp;
@@ -221,9 +223,10 @@ drain:
                datp->flags &= ~COBALT_MONITOR_PENDED;
 }
 
-int cobalt_monitor_wait(struct cobalt_monitor_shadow __user *u_mon,
-                       int event, const struct timespec __user *u_ts,
-                       int __user *u_ret)
+COBALT_SYSCALL(monitor_wait, nonrestartable,
+              int, (struct cobalt_monitor_shadow __user *u_mon,
+                    int event, const struct timespec __user *u_ts,
+                    int __user *u_ret))
 {
        struct cobalt_thread *curr = cobalt_current_thread();
        struct cobalt_monitor_data *datp;
@@ -259,7 +262,7 @@ int cobalt_monitor_wait(struct cobalt_monitor_shadow __user 
*u_mon,
         */
        datp = mon->data;
        if (datp->flags & COBALT_MONITOR_SIGNALED)
-               cobalt_monitor_wakeup(mon);
+               monitor_wakeup(mon);
 
        /* Release the gate prior to waiting, all atomically. */
        xnsynch_release(&mon->gate, &curr->threadbase);
@@ -291,7 +294,7 @@ int cobalt_monitor_wait(struct cobalt_monitor_shadow __user 
*u_mon,
                        opret = -ETIMEDOUT;
        }
 
-       ret = cobalt_monitor_enter_inner(handle, &curr->threadbase);
+       ret = monitor_enter(handle, &curr->threadbase);
 out:
        xnlock_put_irqrestore(&nklock, s);
 
@@ -300,7 +303,8 @@ out:
        return ret;
 }
 
-int cobalt_monitor_sync(struct cobalt_monitor_shadow __user *u_mon)
+COBALT_SYSCALL(monitor_sync, nonrestartable,
+              int, (struct cobalt_monitor_shadow __user *u_mon))
 {
        struct cobalt_monitor *mon;
        struct xnthread *curr;
@@ -317,10 +321,10 @@ int cobalt_monitor_sync(struct cobalt_monitor_shadow 
__user *u_mon)
        if (mon == NULL || mon->magic != COBALT_MONITOR_MAGIC)
                ret = -EINVAL;
        else if (mon->data->flags & COBALT_MONITOR_SIGNALED) {
-               cobalt_monitor_wakeup(mon);
+               monitor_wakeup(mon);
                xnsynch_release(&mon->gate, curr);
                xnsched_run();
-               ret = cobalt_monitor_enter_inner(handle, curr);
+               ret = monitor_enter(handle, curr);
        }
 
        xnlock_put_irqrestore(&nklock, s);
@@ -328,7 +332,8 @@ int cobalt_monitor_sync(struct cobalt_monitor_shadow __user 
*u_mon)
        return ret;
 }
 
-int cobalt_monitor_exit(struct cobalt_monitor_shadow __user *u_mon)
+COBALT_SYSCALL(monitor_exit, primary,
+              int, (struct cobalt_monitor_shadow __user *u_mon))
 {
        struct cobalt_monitor *mon;
        struct xnthread *curr;
@@ -346,7 +351,7 @@ int cobalt_monitor_exit(struct cobalt_monitor_shadow __user 
*u_mon)
                ret = -EINVAL;
        else {
                if (mon->data->flags & COBALT_MONITOR_SIGNALED)
-                       cobalt_monitor_wakeup(mon);
+                       monitor_wakeup(mon);
 
                xnsynch_release(&mon->gate, curr);
                xnsched_run();
@@ -357,8 +362,8 @@ int cobalt_monitor_exit(struct cobalt_monitor_shadow __user 
*u_mon)
        return ret;
 }
 
-static void cobalt_monitor_destroy_inner(struct cobalt_monitor *mon,
-                                        struct cobalt_kqueues *q)
+static void monitor_destroy(struct cobalt_monitor *mon,
+                           struct cobalt_kqueues *q)
 {
        struct xnheap *heap;
        int pshared;
@@ -377,7 +382,8 @@ static void cobalt_monitor_destroy_inner(struct 
cobalt_monitor *mon,
        xnfree(mon);
 }
 
-int cobalt_monitor_destroy(struct cobalt_monitor_shadow __user *u_mon)
+COBALT_SYSCALL(monitor_destroy, primary,
+              int, (struct cobalt_monitor_shadow __user *u_mon))
 {
        struct cobalt_monitor_data *datp;
        struct cobalt_monitor *mon;
@@ -417,7 +423,7 @@ int cobalt_monitor_destroy(struct cobalt_monitor_shadow 
__user *u_mon)
 
        xnlock_put_irqrestore(&nklock, s);
 
-       cobalt_monitor_destroy_inner(mon, mon->owningq);
+       monitor_destroy(mon, mon->owningq);
 
        xnsched_run();
 
@@ -441,7 +447,7 @@ void cobalt_monitorq_cleanup(struct cobalt_kqueues *q)
        list_for_each_entry_safe(mon, tmp, &q->monitorq, link) {
                mon->magic = 0;
                xnlock_put_irqrestore(&nklock, s);
-               cobalt_monitor_destroy_inner(mon, q);
+               monitor_destroy(mon, q);
                xnlock_get_irqsave(&nklock, s);
        }
 out:
diff --git a/kernel/cobalt/posix/monitor.h b/kernel/cobalt/posix/monitor.h
index 4d240f9..1519abf 100644
--- a/kernel/cobalt/posix/monitor.h
+++ b/kernel/cobalt/posix/monitor.h
@@ -21,6 +21,7 @@
 
 #include <cobalt/kernel/synch.h>
 #include <cobalt/uapi/monitor.h>
+#include <xenomai/posix/syscall.h>
 
 struct cobalt_kqueues;
 
@@ -37,21 +38,27 @@ struct cobalt_monitor {
        xnhandle_t handle;
 };
 
-int cobalt_monitor_init(struct cobalt_monitor_shadow __user *u_monsh,
-                       clockid_t clk_id,
-                       int flags);
+COBALT_SYSCALL_DECL(monitor_init,
+                   int, (struct cobalt_monitor_shadow __user *u_monsh,
+                         clockid_t clk_id,
+                         int flags));
 
-int cobalt_monitor_enter(struct cobalt_monitor_shadow __user *u_monsh);
+COBALT_SYSCALL_DECL(monitor_enter,
+                   int, (struct cobalt_monitor_shadow __user *u_monsh));
 
-int cobalt_monitor_sync(struct cobalt_monitor_shadow __user *u_monsh);
+COBALT_SYSCALL_DECL(monitor_sync,
+                   int, (struct cobalt_monitor_shadow __user *u_monsh));
 
-int cobalt_monitor_exit(struct cobalt_monitor_shadow __user *u_monsh);
+COBALT_SYSCALL_DECL(monitor_exit,
+                   int, (struct cobalt_monitor_shadow __user *u_monsh));
 
-int cobalt_monitor_wait(struct cobalt_monitor_shadow __user *u_monsh,
-                       int event, const struct timespec __user *u_ts,
-                       int __user *u_ret);
+COBALT_SYSCALL_DECL(monitor_wait,
+                   int, (struct cobalt_monitor_shadow __user *u_monsh,
+                         int event, const struct timespec __user *u_ts,
+                         int __user *u_ret));
 
-int cobalt_monitor_destroy(struct cobalt_monitor_shadow __user *u_monsh);
+COBALT_SYSCALL_DECL(monitor_destroy,
+                   int, (struct cobalt_monitor_shadow __user *u_monsh));
 
 void cobalt_monitorq_cleanup(struct cobalt_kqueues *q);
 
diff --git a/kernel/cobalt/posix/mqueue.c b/kernel/cobalt/posix/mqueue.c
index d401fdb..689c755 100644
--- a/kernel/cobalt/posix/mqueue.c
+++ b/kernel/cobalt/posix/mqueue.c
@@ -419,7 +419,7 @@ static inline int mq_unlink(const char *name)
 }
 
 static inline struct cobalt_msg *
-cobalt_mq_trysend(struct cobalt_mqd *mqd, size_t len)
+mq_trysend(struct cobalt_mqd *mqd, size_t len)
 {
        struct cobalt_msg *msg;
        struct cobalt_mq *mq;
@@ -445,7 +445,7 @@ cobalt_mq_trysend(struct cobalt_mqd *mqd, size_t len)
 }
 
 static inline struct cobalt_msg *
-cobalt_mq_tryrcv(struct cobalt_mqd *mqd, size_t len)
+mq_tryrcv(struct cobalt_mqd *mqd, size_t len)
 {
        struct cobalt_msg *msg;
        unsigned int flags;
@@ -473,8 +473,8 @@ cobalt_mq_tryrcv(struct cobalt_mqd *mqd, size_t len)
 }
 
 static struct cobalt_msg *
-cobalt_mq_timedsend_inner(struct cobalt_mqd *mqd,
-                         size_t len, const struct timespec *abs_timeoutp)
+mq_timedsend_inner(struct cobalt_mqd *mqd,
+                  size_t len, const struct timespec *abs_timeoutp)
 {
        struct cobalt_mqwait_context mwc;
        struct cobalt_msg *msg;
@@ -485,7 +485,7 @@ cobalt_mq_timedsend_inner(struct cobalt_mqd *mqd,
        int ret;
 
        xnlock_get_irqsave(&nklock, s);
-       msg = cobalt_mq_trysend(mqd, len);
+       msg = mq_trysend(mqd, len);
        if (msg != ERR_PTR(-EAGAIN))
                goto out;
 
@@ -545,7 +545,7 @@ static void mq_release_msg(struct cobalt_mq *mq, struct 
cobalt_msg *msg)
 }
 
 static int
-cobalt_mq_finish_send(struct cobalt_mqd *mqd, struct cobalt_msg *msg)
+mq_finish_send(struct cobalt_mqd *mqd, struct cobalt_msg *msg)
 {
        struct cobalt_mqwait_context *mwc;
        struct xnthread_wait_context *wc;
@@ -593,8 +593,8 @@ cobalt_mq_finish_send(struct cobalt_mqd *mqd, struct 
cobalt_msg *msg)
 }
 
 static struct cobalt_msg *
-cobalt_mq_timedrcv_inner(struct cobalt_mqd *mqd,
-                        size_t len, const struct timespec *abs_timeoutp)
+mq_timedrcv_inner(struct cobalt_mqd *mqd,
+                 size_t len, const struct timespec *abs_timeoutp)
 {
        struct cobalt_mqwait_context mwc;
        struct cobalt_msg *msg;
@@ -605,7 +605,7 @@ cobalt_mq_timedrcv_inner(struct cobalt_mqd *mqd,
        int ret;
 
        xnlock_get_irqsave(&nklock, s);
-       msg = cobalt_mq_tryrcv(mqd, len);
+       msg = mq_tryrcv(mqd, len);
        if (msg != ERR_PTR(-EAGAIN))
                goto out;
 
@@ -641,7 +641,7 @@ out:
 }
 
 static int
-cobalt_mq_finish_rcv(struct cobalt_mqd *mqd, struct cobalt_msg *msg)
+mq_finish_rcv(struct cobalt_mqd *mqd, struct cobalt_msg *msg)
 {
        spl_t s;
 
@@ -762,7 +762,8 @@ static inline void cobalt_mqd_put(struct cobalt_mqd *mqd)
        rtdm_fd_put(&mqd->fd);
 }
 
-int cobalt_mq_notify(mqd_t fd, const struct sigevent *__user evp)
+COBALT_SYSCALL(mq_notify, primary,
+              int, (mqd_t fd, const struct sigevent *__user evp))
 {
        struct cobalt_mqd *mqd;
        struct sigevent sev;
@@ -789,8 +790,9 @@ int cobalt_mq_notify(mqd_t fd, const struct sigevent 
*__user evp)
        return err;
 }
 
-int cobalt_mq_open(const char __user *u_name, int oflags,
-                  mode_t mode, struct mq_attr __user *u_attr, mqd_t uqd)
+COBALT_SYSCALL(mq_open, lostage,
+              int, (const char __user *u_name, int oflags,
+                    mode_t mode, struct mq_attr __user *u_attr, mqd_t uqd))
 {
        struct mq_attr locattr, *attr;
        char name[COBALT_MAXNAME];
@@ -819,14 +821,15 @@ int cobalt_mq_open(const char __user *u_name, int oflags,
        return mq_open(uqd, name, oflags, mode, attr);
 }
 
-int cobalt_mq_close(mqd_t uqd)
+COBALT_SYSCALL(mq_close, lostage, int, (mqd_t uqd))
 {
        trace_cobalt_mq_close(uqd);
 
        return mq_close(uqd);
 }
 
-int cobalt_mq_unlink(const char __user *u_name)
+COBALT_SYSCALL(mq_unlink, lostage,
+              int, (const char __user *u_name))
 {
        char name[COBALT_MAXNAME];
        unsigned len;
@@ -842,7 +845,8 @@ int cobalt_mq_unlink(const char __user *u_name)
        return mq_unlink(name);
 }
 
-int cobalt_mq_getattr(mqd_t uqd, struct mq_attr __user *u_attr)
+COBALT_SYSCALL(mq_getattr, current,
+              int, (mqd_t uqd, struct mq_attr __user *u_attr))
 {
        struct cobalt_mqd *mqd;
        struct mq_attr attr;
@@ -863,8 +867,9 @@ int cobalt_mq_getattr(mqd_t uqd, struct mq_attr __user 
*u_attr)
        return __xn_safe_copy_to_user(u_attr, &attr, sizeof(attr));
 }
 
-int cobalt_mq_setattr(mqd_t uqd, const struct mq_attr __user *u_attr,
-                     struct mq_attr __user *u_oattr)
+COBALT_SYSCALL(mq_setattr, current,
+              int, (mqd_t uqd, const struct mq_attr __user *u_attr,
+                    struct mq_attr __user *u_oattr))
 {
        struct mq_attr attr, oattr;
        struct cobalt_mqd *mqd;
@@ -893,8 +898,9 @@ int cobalt_mq_setattr(mqd_t uqd, const struct mq_attr 
__user *u_attr,
        return 0;
 }
 
-int cobalt_mq_timedsend(mqd_t uqd, const void __user *u_buf, size_t len,
-                       unsigned int prio, const struct timespec __user *u_ts)
+COBALT_SYSCALL(mq_timedsend, primary,
+              int, (mqd_t uqd, const void __user *u_buf, size_t len,
+                    unsigned int prio, const struct timespec __user *u_ts))
 {
        struct timespec timeout, *timeoutp;
        struct cobalt_msg *msg;
@@ -927,31 +933,32 @@ int cobalt_mq_timedsend(mqd_t uqd, const void __user 
*u_buf, size_t len,
                trace_cobalt_mq_send(uqd, u_buf, len, prio);
        }
 
-       msg = cobalt_mq_timedsend_inner(mqd, len, timeoutp);
+       msg = mq_timedsend_inner(mqd, len, timeoutp);
        if (IS_ERR(msg)) {
                err = PTR_ERR(msg);
                goto out;
        }
 
        if(__xn_copy_from_user(msg->data, u_buf, len)) {
-               cobalt_mq_finish_rcv(mqd, msg);
+               mq_finish_rcv(mqd, msg);
                err = -EFAULT;
                goto out;
        }
        msg->len = len;
        msg->prio = prio;
 
-       err = cobalt_mq_finish_send(mqd, msg);
+       err = mq_finish_send(mqd, msg);
   out:
        cobalt_mqd_put(mqd);
 
        return err;
 }
 
-int cobalt_mq_timedreceive(mqd_t uqd, void __user *u_buf,
-                          ssize_t __user *u_len,
-                          unsigned int __user *u_prio,
-                          const struct timespec __user *u_ts)
+COBALT_SYSCALL(mq_timedreceive, primary,
+              int, (mqd_t uqd, void __user *u_buf,
+                    ssize_t __user *u_len,
+                    unsigned int __user *u_prio,
+                    const struct timespec __user *u_ts))
 {
        struct timespec timeout, *timeoutp;
        struct cobalt_mqd *mqd;
@@ -987,21 +994,21 @@ int cobalt_mq_timedreceive(mqd_t uqd, void __user *u_buf,
                trace_cobalt_mq_receive(uqd, u_buf, len);
        }
 
-       msg = cobalt_mq_timedrcv_inner(mqd, len, timeoutp);
+       msg = mq_timedrcv_inner(mqd, len, timeoutp);
        if (IS_ERR(msg)) {
                err = PTR_ERR(msg);
                goto fail;
        }
 
        if (__xn_copy_to_user(u_buf, msg->data, msg->len)) {
-               cobalt_mq_finish_rcv(mqd, msg);
+               mq_finish_rcv(mqd, msg);
                err = -EFAULT;
                goto fail;
        }
 
        len = msg->len;
        prio = msg->prio;
-       err = cobalt_mq_finish_rcv(mqd, msg);
+       err = mq_finish_rcv(mqd, msg);
        if (err)
                goto fail;
 
diff --git a/kernel/cobalt/posix/mqueue.h b/kernel/cobalt/posix/mqueue.h
index 8370634..5097b78 100644
--- a/kernel/cobalt/posix/mqueue.h
+++ b/kernel/cobalt/posix/mqueue.h
@@ -21,6 +21,7 @@
 
 #include <linux/types.h>
 #include <linux/fcntl.h>
+#include <xenomai/posix/syscall.h>
 
 struct mq_attr {
        long mq_flags;
@@ -29,27 +30,36 @@ struct mq_attr {
        long mq_curmsgs;
 };
 
-int cobalt_mq_open(const char __user *u_name, int oflags,
-                  mode_t mode, struct mq_attr __user *u_attr, mqd_t uqd);
+COBALT_SYSCALL_DECL(mq_open,
+                   int, (const char __user *u_name, int oflags,
+                         mode_t mode, struct mq_attr __user *u_attr,
+                         mqd_t uqd));
 
-int cobalt_mq_close(mqd_t uqd);
+COBALT_SYSCALL_DECL(mq_close, int, (mqd_t uqd));
 
-int cobalt_mq_unlink(const char __user *u_name);
+COBALT_SYSCALL_DECL(mq_unlink,
+                   int, (const char __user *u_name));
 
-int cobalt_mq_getattr(mqd_t uqd, struct mq_attr __user *u_attr);
+COBALT_SYSCALL_DECL(mq_getattr, 
+                   int, (mqd_t uqd, struct mq_attr __user *u_attr));
 
-int cobalt_mq_setattr(mqd_t uqd, const struct mq_attr __user *u_attr,
-                     struct mq_attr __user *u_oattr);
+COBALT_SYSCALL_DECL(mq_setattr,
+                   int, (mqd_t uqd, const struct mq_attr __user *u_attr,
+                         struct mq_attr __user *u_oattr));
 
-int cobalt_mq_timedsend(mqd_t uqd, const void __user *u_buf, size_t len,
-                       unsigned int prio, const struct timespec __user *u_ts);
+COBALT_SYSCALL_DECL(mq_timedsend,
+                   int, (mqd_t uqd, const void __user *u_buf, size_t len,
+                         unsigned int prio,
+                         const struct timespec __user *u_ts));
 
-int cobalt_mq_timedreceive(mqd_t uqd, void __user *u_buf,
-                          ssize_t __user *u_len,
-                          unsigned int __user *u_prio,
-                          const struct timespec __user *u_ts);
+COBALT_SYSCALL_DECL(mq_timedreceive,
+                   int, (mqd_t uqd, void __user *u_buf,
+                        ssize_t __user *u_len,
+                        unsigned int __user *u_prio,
+                        const struct timespec __user *u_ts));
 
-int cobalt_mq_notify(mqd_t fd, const struct sigevent *__user evp);
+COBALT_SYSCALL_DECL(mq_notify,
+                   int, (mqd_t fd, const struct sigevent *__user evp));
 
 int cobalt_mq_pkg_init(void);
 
diff --git a/kernel/cobalt/posix/mutex.c b/kernel/cobalt/posix/mutex.c
index e000202..9205bf0 100644
--- a/kernel/cobalt/posix/mutex.c
+++ b/kernel/cobalt/posix/mutex.c
@@ -214,7 +214,8 @@ int cobalt_mutex_timedlock_break(struct cobalt_mutex *mutex,
        return ret;
 }
 
-int cobalt_mutex_check_init(struct cobalt_mutex_shadow __user *u_mx)
+COBALT_SYSCALL(mutex_check_init, current,
+              int, (struct cobalt_mutex_shadow __user *u_mx))
 {
        struct cobalt_mutex *mutex;
        xnhandle_t handle;
@@ -235,8 +236,9 @@ int cobalt_mutex_check_init(struct cobalt_mutex_shadow 
__user *u_mx)
        return err;
 }
 
-int cobalt_mutex_init(struct cobalt_mutex_shadow __user *u_mx,
-                     const struct cobalt_mutexattr __user *u_attr)
+COBALT_SYSCALL(mutex_init, current,
+              int, (struct cobalt_mutex_shadow __user *u_mx,
+                    const struct cobalt_mutexattr __user *u_attr))
 {
        struct cobalt_mutexattr attr;
        struct cobalt_mutex *mutex;
@@ -271,7 +273,8 @@ int cobalt_mutex_init(struct cobalt_mutex_shadow __user 
*u_mx,
        return __xn_safe_copy_to_user(u_mx, &mx, sizeof(*u_mx));
 }
 
-int cobalt_mutex_destroy(struct cobalt_mutex_shadow __user *u_mx)
+COBALT_SYSCALL(mutex_destroy, current,
+              int, (struct cobalt_mutex_shadow __user *u_mx))
 {
        struct cobalt_mutex *mutex;
        struct cobalt_mutex_shadow mx;
@@ -312,7 +315,8 @@ int cobalt_mutex_destroy(struct cobalt_mutex_shadow __user 
*u_mx)
        return __xn_safe_copy_to_user(u_mx, &mx, sizeof(*u_mx));
 }
 
-int cobalt_mutex_trylock(struct cobalt_mutex_shadow __user *u_mx)
+COBALT_SYSCALL(mutex_trylock, primary,
+              int, (struct cobalt_mutex_shadow __user *u_mx))
 {
        struct xnthread *curr = xnthread_current();
        struct cobalt_mutex *mutex;
@@ -353,7 +357,8 @@ int cobalt_mutex_trylock(struct cobalt_mutex_shadow __user 
*u_mx)
        return err;
 }
 
-int cobalt_mutex_lock(struct cobalt_mutex_shadow __user *u_mx)
+COBALT_SYSCALL(mutex_lock, primary,
+              int, (struct cobalt_mutex_shadow __user *u_mx))
 {
        xnhandle_t handle;
        spl_t s;
@@ -369,8 +374,9 @@ int cobalt_mutex_lock(struct cobalt_mutex_shadow __user 
*u_mx)
        return err;
 }
 
-int cobalt_mutex_timedlock(struct cobalt_mutex_shadow __user *u_mx,
-                          const struct timespec __user *u_ts)
+COBALT_SYSCALL(mutex_timedlock, primary,
+              int, (struct cobalt_mutex_shadow __user *u_mx,
+                    const struct timespec __user *u_ts))
 {
        xnhandle_t handle;
        spl_t s;
@@ -386,7 +392,8 @@ int cobalt_mutex_timedlock(struct cobalt_mutex_shadow 
__user *u_mx,
        return err;
 }
 
-int cobalt_mutex_unlock(struct cobalt_mutex_shadow __user *u_mx)
+COBALT_SYSCALL(mutex_unlock, nonrestartable,
+              int, (struct cobalt_mutex_shadow __user *u_mx))
 {
        struct cobalt_mutex *mutex;
        struct xnthread *curr;
diff --git a/kernel/cobalt/posix/mutex.h b/kernel/cobalt/posix/mutex.h
index cfe591e..7b84fb5 100644
--- a/kernel/cobalt/posix/mutex.h
+++ b/kernel/cobalt/posix/mutex.h
@@ -21,6 +21,7 @@
 
 #include "thread.h"
 #include <cobalt/uapi/mutex.h>
+#include <xenomai/posix/syscall.h>
 
 struct cobalt_mutex {
        unsigned int magic;
@@ -33,21 +34,28 @@ struct cobalt_mutex {
        xnhandle_t handle;
 };
 
-int cobalt_mutex_check_init(struct cobalt_mutex_shadow __user *u_mx);
+COBALT_SYSCALL_DECL(mutex_check_init,
+                   int, (struct cobalt_mutex_shadow __user *u_mx));
 
-int cobalt_mutex_init(struct cobalt_mutex_shadow __user *u_mx,
-                     const struct cobalt_mutexattr __user *u_attr);
+COBALT_SYSCALL_DECL(mutex_init,
+                   int, (struct cobalt_mutex_shadow __user *u_mx,
+                         const struct cobalt_mutexattr __user *u_attr));
 
-int cobalt_mutex_destroy(struct cobalt_mutex_shadow __user *u_mx);
+COBALT_SYSCALL_DECL(mutex_destroy,
+                   int, (struct cobalt_mutex_shadow __user *u_mx));
 
-int cobalt_mutex_trylock(struct cobalt_mutex_shadow __user *u_mx);
+COBALT_SYSCALL_DECL(mutex_trylock,
+                   int, (struct cobalt_mutex_shadow __user *u_mx));
 
-int cobalt_mutex_lock(struct cobalt_mutex_shadow __user *u_mx);
+COBALT_SYSCALL_DECL(mutex_lock,
+                   int, (struct cobalt_mutex_shadow __user *u_mx));
 
-int cobalt_mutex_timedlock(struct cobalt_mutex_shadow __user *u_mx,
-                          const struct timespec __user *u_ts);
+COBALT_SYSCALL_DECL(mutex_timedlock,
+                   int, (struct cobalt_mutex_shadow __user *u_mx,
+                         const struct timespec __user *u_ts));
 
-int cobalt_mutex_unlock(struct cobalt_mutex_shadow __user *u_mx);
+COBALT_SYSCALL_DECL(mutex_unlock,
+                   int, (struct cobalt_mutex_shadow __user *u_mx));
 
 int cobalt_mutex_acquire_unchecked(struct xnthread *cur,
                                   struct cobalt_mutex *mutex,
diff --git a/kernel/cobalt/posix/nsem.c b/kernel/cobalt/posix/nsem.c
index 8294b3d..6d613fb 100644
--- a/kernel/cobalt/posix/nsem.c
+++ b/kernel/cobalt/posix/nsem.c
@@ -185,9 +185,10 @@ void __cobalt_sem_unlink(xnhandle_t handle)
                xnregistry_unlink(xnregistry_key(handle));
 }
 
-int cobalt_sem_open(struct cobalt_sem_shadow __user *__user *u_addr,
-                   const char __user *u_name,
-                   int oflags, mode_t mode, unsigned value)
+COBALT_SYSCALL(sem_open, current,
+              int, (struct cobalt_sem_shadow __user *__user *u_addr,
+                    const char __user *u_name,
+                    int oflags, mode_t mode, unsigned value))
 {
        struct cobalt_sem_shadow __user *usm;
        char name[COBALT_MAXNAME + 1];
@@ -220,7 +221,8 @@ int cobalt_sem_open(struct cobalt_sem_shadow __user *__user 
*u_addr,
        return 0;
 }
 
-int cobalt_sem_close(struct cobalt_sem_shadow __user *usm)
+COBALT_SYSCALL(sem_close, current,
+              int, (struct cobalt_sem_shadow __user *usm))
 {
        struct cobalt_process *cc;
        xnhandle_t handle;
@@ -252,7 +254,8 @@ static inline int sem_unlink(const char *name)
        return 0;
 }
 
-int cobalt_sem_unlink(const char __user *u_name)
+COBALT_SYSCALL(sem_unlink, current,
+              int, (const char __user *u_name))
 {
        char name[COBALT_MAXNAME + 1];
        long len;
diff --git a/kernel/cobalt/posix/sched.c b/kernel/cobalt/posix/sched.c
index db4a47a..bfdd2e0 100644
--- a/kernel/cobalt/posix/sched.c
+++ b/kernel/cobalt/posix/sched.c
@@ -121,7 +121,7 @@ cobalt_sched_policy_param(union xnsched_policy_param *param,
        return sched_class;
 }
 
-int cobalt_sched_min_prio(int policy)
+COBALT_SYSCALL(sched_minprio, current, int, (int policy))
 {
        int ret;
 
@@ -149,7 +149,7 @@ int cobalt_sched_min_prio(int policy)
        return ret;
 }
 
-int cobalt_sched_max_prio(int policy)
+COBALT_SYSCALL(sched_maxprio, current, int, (int policy))
 {
        int ret;
 
@@ -183,7 +183,7 @@ int cobalt_sched_max_prio(int policy)
        return ret;
 }
 
-int cobalt_sched_yield(void)
+COBALT_SYSCALL(sched_yield, primary, int, (void))
 {
        struct cobalt_thread *curr = cobalt_current_thread();
        int ret = 0;
@@ -518,9 +518,10 @@ ssize_t get_quota_config(int cpu, union sched_config 
__user *u_config,
 
 #endif /* !CONFIG_XENO_OPT_SCHED_QUOTA */
 
-int cobalt_sched_setconfig_np(int cpu, int policy,
-                             const union sched_config __user *u_config,
-                             size_t len)
+COBALT_SYSCALL(sched_setconfig_np, current,
+              int, (int cpu, int policy,
+                    const union sched_config __user *u_config,
+                    size_t len))
 {
        union sched_config *buf;
        int ret;
@@ -558,9 +559,10 @@ out:
        return ret;
 }
 
-ssize_t cobalt_sched_getconfig_np(int cpu, int policy,
-                                 union sched_config __user *u_config,
-                                 size_t len)
+COBALT_SYSCALL(sched_getconfig_np, current,
+              ssize_t, (int cpu, int policy,
+                        union sched_config __user *u_config,
+                        size_t len))
 {
        ssize_t ret;
 
@@ -580,8 +582,9 @@ ssize_t cobalt_sched_getconfig_np(int cpu, int policy,
        return ret;
 }
 
-int cobalt_sched_weighted_prio(int policy,
-                              const struct sched_param_ex __user *u_param)
+COBALT_SYSCALL(sched_weightprio, current,
+              int, (int policy,
+                    const struct sched_param_ex __user *u_param))
 {
        struct xnsched_class *sched_class;
        union xnsched_policy_param param;
diff --git a/kernel/cobalt/posix/sched.h b/kernel/cobalt/posix/sched.h
index 59ca971..db5e152 100644
--- a/kernel/cobalt/posix/sched.h
+++ b/kernel/cobalt/posix/sched.h
@@ -20,6 +20,7 @@
 
 #include <linux/list.h>
 #include <cobalt/kernel/sched.h>
+#include <xenomai/posix/syscall.h>
 
 struct cobalt_kqueues;
 
@@ -37,24 +38,26 @@ cobalt_sched_policy_param(union xnsched_policy_param *param,
                          int u_policy, const struct sched_param_ex *param_ex,
                          xnticks_t *tslice_r);
 
-int cobalt_sched_yield(void);
+COBALT_SYSCALL_DECL(sched_yield, int, (void));
 
-int cobalt_sched_weighted_prio(int policy,
-                              const struct sched_param_ex __user *u_param);
+COBALT_SYSCALL_DECL(sched_weightprio,
+                   int, (int policy,
+                         const struct sched_param_ex __user *u_param));
 
-int cobalt_sched_min_prio(int policy);
+COBALT_SYSCALL_DECL(sched_minprio, int, (int policy));
 
-int cobalt_sched_max_prio(int policy);
+COBALT_SYSCALL_DECL(sched_maxprio, int, (int policy));
 
-int cobalt_sched_setconfig_np(int cpu,
-                             int policy,
-                             const union sched_config __user *u_config,
-                             size_t len);
+COBALT_SYSCALL_DECL(sched_setconfig_np,
+                   int, (int cpu,
+                         int policy,
+                         const union sched_config __user *u_config,
+                         size_t len));
 
-ssize_t cobalt_sched_getconfig_np(int cpu,
-                                 int policy,
-                                 union sched_config __user *u_config,
-                                 size_t len);
+COBALT_SYSCALL_DECL(sched_getconfig_np,
+                   ssize_t, (int cpu, int policy,
+                             union sched_config __user *u_config,
+                             size_t len));
 
 void cobalt_sched_cleanup(struct cobalt_kqueues *q);
 
diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c
index f01f843..0ca21cd 100644
--- a/kernel/cobalt/posix/sem.c
+++ b/kernel/cobalt/posix/sem.c
@@ -395,8 +395,9 @@ static int sem_getvalue(xnhandle_t handle, int *value)
        return 0;
 }
 
-int cobalt_sem_init(struct cobalt_sem_shadow __user *u_sem,
-                   int flags, unsigned int value)
+COBALT_SYSCALL(sem_init, current,
+              int, (struct cobalt_sem_shadow __user *u_sem,
+                    int flags, unsigned int value))
 {
        struct cobalt_sem_shadow sm;
        struct cobalt_sem *sem;
@@ -415,7 +416,8 @@ int cobalt_sem_init(struct cobalt_sem_shadow __user *u_sem,
        return __xn_safe_copy_to_user(u_sem, &sm, sizeof(*u_sem));
 }
 
-int cobalt_sem_post(struct cobalt_sem_shadow __user *u_sem)
+COBALT_SYSCALL(sem_post, current,
+              int, (struct cobalt_sem_shadow __user *u_sem))
 {
        xnhandle_t handle;
 
@@ -425,7 +427,8 @@ int cobalt_sem_post(struct cobalt_sem_shadow __user *u_sem)
        return sem_post(handle);
 }
 
-int cobalt_sem_wait(struct cobalt_sem_shadow __user *u_sem)
+COBALT_SYSCALL(sem_wait, primary,
+              int, (struct cobalt_sem_shadow __user *u_sem))
 {
        xnhandle_t handle;
 
@@ -435,8 +438,9 @@ int cobalt_sem_wait(struct cobalt_sem_shadow __user *u_sem)
        return sem_wait(handle);
 }
 
-int cobalt_sem_timedwait(struct cobalt_sem_shadow __user *u_sem,
-                        struct timespec __user *u_ts)
+COBALT_SYSCALL(sem_timedwait, primary,
+              int, (struct cobalt_sem_shadow __user *u_sem,
+                    struct timespec __user *u_ts))
 {
        xnhandle_t handle;
 
@@ -446,7 +450,8 @@ int cobalt_sem_timedwait(struct cobalt_sem_shadow __user 
*u_sem,
        return sem_timedwait(handle, u_ts);
 }
 
-int cobalt_sem_trywait(struct cobalt_sem_shadow __user *u_sem)
+COBALT_SYSCALL(sem_trywait, primary,
+              int, (struct cobalt_sem_shadow __user *u_sem))
 {
        xnhandle_t handle;
 
@@ -456,7 +461,9 @@ int cobalt_sem_trywait(struct cobalt_sem_shadow __user 
*u_sem)
        return sem_trywait(handle);
 }
 
-int cobalt_sem_getvalue(struct cobalt_sem_shadow __user *u_sem, int __user 
*u_sval)
+COBALT_SYSCALL(sem_getvalue, current,
+              int, (struct cobalt_sem_shadow __user *u_sem,
+                    int __user *u_sval))
 {
        int ret, sval = -1;
        xnhandle_t handle;
@@ -471,7 +478,8 @@ int cobalt_sem_getvalue(struct cobalt_sem_shadow __user 
*u_sem, int __user *u_sv
        return __xn_safe_copy_to_user(u_sval, &sval, sizeof(sval));
 }
 
-int cobalt_sem_destroy(struct cobalt_sem_shadow __user *u_sem)
+COBALT_SYSCALL(sem_destroy, current,
+              int, (struct cobalt_sem_shadow __user *u_sem))
 {
        struct cobalt_sem_shadow sm;
        int err;
@@ -488,7 +496,8 @@ int cobalt_sem_destroy(struct cobalt_sem_shadow __user 
*u_sem)
        return __xn_safe_copy_to_user(u_sem, &sm, sizeof(*u_sem)) ?: err;
 }
 
-int cobalt_sem_broadcast_np(struct cobalt_sem_shadow __user *u_sem)
+COBALT_SYSCALL(sem_broadcast_np, current,
+              int, (struct cobalt_sem_shadow __user *u_sem))
 {
        struct cobalt_sem *sm;
        xnhandle_t handle;
@@ -506,10 +515,11 @@ int cobalt_sem_broadcast_np(struct cobalt_sem_shadow 
__user *u_sem)
        return err;
 }
 
-int cobalt_sem_inquire(struct cobalt_sem_shadow __user *u_sem,
-                      struct cobalt_sem_info __user *u_info,
-                      pid_t __user *u_waitlist,
-                      size_t waitsz)
+COBALT_SYSCALL(sem_inquire, current,
+              int, (struct cobalt_sem_shadow __user *u_sem,
+                    struct cobalt_sem_info __user *u_info,
+                    pid_t __user *u_waitlist,
+                    size_t waitsz))
 {
        int val = 0, nrwait = 0, nrpids, ret = 0;
        unsigned long pstamp, nstamp = 0;
diff --git a/kernel/cobalt/posix/sem.h b/kernel/cobalt/posix/sem.h
index a5bbdaf..1d62807 100644
--- a/kernel/cobalt/posix/sem.h
+++ b/kernel/cobalt/posix/sem.h
@@ -22,6 +22,7 @@
 #include <linux/fcntl.h>
 #include <cobalt/kernel/thread.h>
 #include <cobalt/kernel/registry.h>
+#include <xenomai/posix/syscall.h>
 
 struct cobalt_process;
 
@@ -68,37 +69,48 @@ struct cobalt_sem *
 __cobalt_sem_init(const char *name, struct cobalt_sem_shadow *sem,
                  int flags, unsigned value);
 
-int cobalt_sem_init(struct cobalt_sem_shadow __user *u_sem,
-                   int flags, unsigned value);
+COBALT_SYSCALL_DECL(sem_init,
+                   int, (struct cobalt_sem_shadow __user *u_sem,
+                         int flags, unsigned value));
 
-int cobalt_sem_post(struct cobalt_sem_shadow __user *u_sem);
+COBALT_SYSCALL_DECL(sem_post,
+                   int, (struct cobalt_sem_shadow __user *u_sem));
 
-int cobalt_sem_wait(struct cobalt_sem_shadow __user *u_sem);
+COBALT_SYSCALL_DECL(sem_wait,
+                   int, (struct cobalt_sem_shadow __user *u_sem));
 
-int cobalt_sem_timedwait(struct cobalt_sem_shadow __user *u_sem,
-                        struct timespec __user *u_ts);
+COBALT_SYSCALL_DECL(sem_timedwait,
+                   int, (struct cobalt_sem_shadow __user *u_sem,
+                         struct timespec __user *u_ts));
 
-int cobalt_sem_trywait(struct cobalt_sem_shadow __user *u_sem);
+COBALT_SYSCALL_DECL(sem_trywait,
+                   int, (struct cobalt_sem_shadow __user *u_sem));
 
-int cobalt_sem_getvalue(struct cobalt_sem_shadow __user *u_sem,
-                       int __user *u_sval);
+COBALT_SYSCALL_DECL(sem_getvalue, int,
+                   (struct cobalt_sem_shadow __user *u_sem,
+                    int __user *u_sval));
 
-int cobalt_sem_destroy(struct cobalt_sem_shadow __user *u_sem);
+COBALT_SYSCALL_DECL(sem_destroy,
+                   int, (struct cobalt_sem_shadow __user *u_sem));
 
-int cobalt_sem_open(struct cobalt_sem_shadow __user *__user *u_addr,
-                   const char __user *u_name,
-                   int oflags, mode_t mode, unsigned value);
+COBALT_SYSCALL_DECL(sem_open,
+                   int, (struct cobalt_sem_shadow __user *__user *u_addr,
+                         const char __user *u_name,
+                         int oflags, mode_t mode, unsigned value));
 
-int cobalt_sem_close(struct cobalt_sem_shadow __user *usm);
+COBALT_SYSCALL_DECL(sem_close,
+                   int, (struct cobalt_sem_shadow __user *usm));
 
-int cobalt_sem_unlink(const char __user *u_name);
+COBALT_SYSCALL_DECL(sem_unlink, int, (const char __user *u_name));
 
-int cobalt_sem_broadcast_np(struct cobalt_sem_shadow __user *u_sem);
+COBALT_SYSCALL_DECL(sem_broadcast_np,
+                   int, (struct cobalt_sem_shadow __user *u_sem));
 
-int cobalt_sem_inquire(struct cobalt_sem_shadow __user *u_sem,
-                      struct cobalt_sem_info __user *u_info,
-                      pid_t __user *u_waitlist,
-                      size_t waitsz);
+COBALT_SYSCALL_DECL(sem_inquire,
+                   int, (struct cobalt_sem_shadow __user *u_sem,
+                         struct cobalt_sem_info __user *u_info,
+                         pid_t __user *u_waitlist,
+                         size_t waitsz));
 
 void cobalt_semq_cleanup(struct cobalt_kqueues *q);
 
diff --git a/kernel/cobalt/posix/signal.c b/kernel/cobalt/posix/signal.c
index aa84e55..1259cc4 100644
--- a/kernel/cobalt/posix/signal.c
+++ b/kernel/cobalt/posix/signal.c
@@ -355,7 +355,8 @@ fail:
        return ret;
 }
 
-int cobalt_sigwait(const sigset_t __user *u_set, int __user *u_sig)
+COBALT_SYSCALL(sigwait, primary,
+              int, (const sigset_t __user *u_set, int __user *u_sig))
 {
        sigset_t set;
        int sig;
@@ -373,8 +374,10 @@ int cobalt_sigwait(const sigset_t __user *u_set, int 
__user *u_sig)
        return 0;
 }
 
-int cobalt_sigtimedwait(const sigset_t __user *u_set, struct siginfo __user 
*u_si,
-                       const struct timespec __user *u_timeout)
+COBALT_SYSCALL(sigtimedwait, nonrestartable,
+              int, (const sigset_t __user *u_set,
+                    struct siginfo __user *u_si,
+                    const struct timespec __user *u_timeout))
 {
        struct timespec timeout;
        xnticks_t ticks;
@@ -396,7 +399,9 @@ int cobalt_sigtimedwait(const sigset_t __user *u_set, 
struct siginfo __user *u_s
        return signal_wait(&set, ticks, u_si);
 }
 
-int cobalt_sigwaitinfo(const sigset_t __user *u_set, struct siginfo __user 
*u_si)
+COBALT_SYSCALL(sigwaitinfo, nonrestartable,
+              int, (const sigset_t __user *u_set,
+                    struct siginfo __user *u_si))
 {
        sigset_t set;
 
@@ -406,7 +411,7 @@ int cobalt_sigwaitinfo(const sigset_t __user *u_set, struct 
siginfo __user *u_si
        return signal_wait(&set, XN_INFINITE, u_si);
 }
 
-int cobalt_sigpending(sigset_t __user *u_set)
+COBALT_SYSCALL(sigpending, primary, int, (sigset_t __user *u_set))
 {
        struct cobalt_thread *curr;
 
@@ -479,7 +484,7 @@ int __cobalt_kill(struct cobalt_thread *thread, int sig, 
int group) /* nklocked,
        return ret;
 }
 
-int cobalt_kill(pid_t pid, int sig)
+COBALT_SYSCALL(kill, conforming, int, (pid_t pid, int sig))
 {
        struct cobalt_thread *thread;
        int ret;
@@ -498,8 +503,9 @@ int cobalt_kill(pid_t pid, int sig)
        return ret;
 }
 
-int cobalt_sigqueue(pid_t pid, int sig,
-                   const union sigval __user *u_value)
+COBALT_SYSCALL(sigqueue, conforming,
+              int, (pid_t pid, int sig,
+                    const union sigval __user *u_value))
 {
        struct cobalt_sigpending *sigp;
        struct cobalt_thread *thread;
diff --git a/kernel/cobalt/posix/signal.h b/kernel/cobalt/posix/signal.h
index 821c347..5c4e682 100644
--- a/kernel/cobalt/posix/signal.h
+++ b/kernel/cobalt/posix/signal.h
@@ -22,6 +22,7 @@
 #include <cobalt/kernel/timer.h>
 #include <cobalt/kernel/list.h>
 #include <cobalt/uapi/signal.h>
+#include <xenomai/posix/syscall.h>
 
 struct cobalt_thread;
 
@@ -71,24 +72,30 @@ void cobalt_signal_flush(struct cobalt_thread *thread);
 int cobalt_signal_wait(sigset_t *set, struct siginfo *si,
                       xnticks_t timeout, xntmode_t tmode);
 
-int cobalt_sigwait(const sigset_t __user *u_set, int __user *u_sig);
+int __cobalt_kill(struct cobalt_thread *thread,
+                 int sig, int group);
 
-int cobalt_sigtimedwait(const sigset_t __user *u_set,
-                       struct siginfo __user *u_si,
-                       const struct timespec __user *u_timeout);
+COBALT_SYSCALL_DECL(sigwait,
+                   int, (const sigset_t __user *u_set,
+                         int __user *u_sig));
 
-int cobalt_sigwaitinfo(const sigset_t __user *u_set,
-                      struct siginfo __user *u_si);
+COBALT_SYSCALL_DECL(sigtimedwait,
+                   int, (const sigset_t __user *u_set,
+                         struct siginfo __user *u_si,
+                         const struct timespec __user *u_timeout));
 
-int cobalt_sigpending(sigset_t __user *u_set);
+COBALT_SYSCALL_DECL(sigwaitinfo,
+                   int, (const sigset_t __user *u_set,
+                         struct siginfo __user *u_si));
 
-int __cobalt_kill(struct cobalt_thread *thread,
-                 int sig, int group);
+COBALT_SYSCALL_DECL(sigpending,
+                   int, (sigset_t __user *u_set));
 
-int cobalt_kill(pid_t pid, int sig);
+COBALT_SYSCALL_DECL(kill, int, (pid_t pid, int sig));
 
-int cobalt_sigqueue(pid_t pid, int sig,
-                   const union sigval __user *u_value);
+COBALT_SYSCALL_DECL(sigqueue,
+                   int, (pid_t pid, int sig,
+                         const union sigval __user *u_value));
 
 int cobalt_signal_pkg_init(void);
 
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 55e1a3a..da4bba6 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -78,9 +78,9 @@ typedef int (*cobalt_handler)(unsigned long arg1, unsigned 
long arg2,
                              unsigned long arg3, unsigned long arg4,
                              unsigned long arg5);
 
-static cobalt_handler cobalt_syscalls[];
+static const cobalt_handler cobalt_syscalls[];
 
-static int cobalt_sysmodes[];
+static const int cobalt_sysmodes[];
 
 static void prepare_for_signal(struct task_struct *p,
                               struct xnthread *thread,
@@ -403,7 +403,7 @@ int ipipe_fastcall_hook(struct pt_regs *regs)
        return ret;
 }
 
-static int cobalt_migrate(int domain)
+static COBALT_SYSCALL(migrate, current, int, (int domain))
 {
        struct xnthread *thread = xnthread_current();
 
@@ -433,7 +433,8 @@ static int cobalt_migrate(int domain)
        return 0;
 }
 
-static int cobalt_info(struct cobalt_sysinfo __user *u_info)
+static COBALT_SYSCALL(info, lostage,
+                     int, (struct cobalt_sysinfo __user *u_info))
 {
        struct cobalt_sysinfo info;
 
@@ -444,8 +445,9 @@ static int cobalt_info(struct cobalt_sysinfo __user *u_info)
        return __xn_safe_copy_to_user(u_info, &info, sizeof(info));
 }
 
-static int cobalt_trace(int op, unsigned long a1,
-                       unsigned long a2, unsigned long a3)
+static COBALT_SYSCALL(trace, current,
+                     int, (int op, unsigned long a1,
+                           unsigned long a2, unsigned long a3))
 {
        int ret = -EINVAL;
 
@@ -486,8 +488,17 @@ static int cobalt_trace(int op, unsigned long a1,
        return ret;
 }
 
-static int cobalt_heapstat(struct cobalt_heapstat __user *u_hd,
-                          unsigned int heap_nr)
+static COBALT_SYSCALL(archcall, current,
+                     int, (unsigned long a1, unsigned long a2,
+                           unsigned long a3, unsigned long a4,
+                           unsigned long a5))
+{
+       return xnarch_local_syscall(a1, a2, a3, a4, a5);
+}
+
+static COBALT_SYSCALL(heap_getstat, lostage,
+                     int, (struct cobalt_heapstat __user *u_hd,
+                           unsigned int heap_nr))
 {
        struct cobalt_heapstat hd;
        struct xnheap *heap;
@@ -512,7 +523,8 @@ static int cobalt_heapstat(struct cobalt_heapstat __user 
*u_hd,
        return __xn_safe_copy_to_user(u_hd, &hd, sizeof(*u_hd));
 }
 
-static int cobalt_get_current(xnhandle_t __user *u_handle)
+static COBALT_SYSCALL(get_current, current,
+                     int, (xnhandle_t __user *u_handle))
 {
        struct xnthread *cur = xnthread_current();
 
@@ -523,13 +535,16 @@ static int cobalt_get_current(xnhandle_t __user *u_handle)
                                      sizeof(*u_handle));
 }
 
-static int cobalt_backtrace(int nr, unsigned long __user *u_backtrace, int 
reason)
+static COBALT_SYSCALL(backtrace, current,
+                     int, (int nr, unsigned long __user *u_backtrace,
+                           int reason))
 {
        xndebug_trace_relax(nr, u_backtrace, reason);
        return 0;
 }
 
-static int cobalt_serialdbg(const char __user *u_msg, int len)
+static COBALT_SYSCALL(serialdbg, current,
+                     int, (const char __user *u_msg, int len))
 {
        char buf[128];
        int n;
@@ -548,7 +563,7 @@ static int cobalt_serialdbg(const char __user *u_msg, int 
len)
        return 0;
 }
 
-static int cobalt_mayday(void)
+static COBALT_SYSCALL(mayday, oneway, int, (void))
 {
        struct pt_regs *regs = task_pt_regs(current);
        struct xnthread *cur;
@@ -597,7 +612,8 @@ static void stringify_feature_set(unsigned long fset, char 
*buf, int size)
        }
 }
 
-static int cobalt_bind(struct cobalt_bindreq __user *u_breq)
+static COBALT_SYSCALL(bind, lostage,
+                     int, (struct cobalt_bindreq __user *u_breq))
 {
        unsigned long featreq, featmis;
        struct cobalt_bindreq breq;
@@ -647,12 +663,13 @@ static int cobalt_bind(struct cobalt_bindreq __user 
*u_breq)
        return cobalt_bind_core();
 }
 
-static int cobalt_extend(unsigned int magic)
+static COBALT_SYSCALL(extend, lostage, int, (unsigned int magic))
 {
        return cobalt_bind_personality(magic);
 }
 
-static int cobalt_sysconf(int option, void __user *u_buf, size_t u_bufsz)
+static COBALT_SYSCALL(sysconf, current,
+                     int, (int option, void __user *u_buf, size_t u_bufsz))
 {
        int ret, val = 0;
 
@@ -713,209 +730,209 @@ static int cobalt_ni(void)
        return -ENOSYS;
 }
 
-#define __syscast__(__handler)         ((cobalt_handler)(__handler))
-#define __COBALT_CALL(__nr, __handler) [__nr] = __syscast__(__handler)
-#define __COBALT_MODE(__nr, __flags)   [__nr] = __xn_exec_##__flags
-#define __COBALT_NI                    __syscast__(cobalt_ni)
+#define __syshand__(__name)            ((cobalt_handler)(cobalt_ ## __name))
+#define __COBALT_CALL(__name)          [sc_cobalt_ ## __name] = 
__syshand__(__name)
+#define __COBALT_MODE(__name, __flags) [sc_cobalt_ ## __name] = 
__xn_exec_##__flags
+#define __COBALT_NI                    __syshand__(ni)
 
-static cobalt_handler cobalt_syscalls[] = {
+static const cobalt_handler cobalt_syscalls[] = {
        [0 ... __NR_COBALT_SYSCALLS-1] = __COBALT_NI,
-       __COBALT_CALL(sc_cobalt_thread_create, cobalt_thread_create),
-       __COBALT_CALL(sc_cobalt_thread_getpid, cobalt_thread_pid),
-       __COBALT_CALL(sc_cobalt_thread_setschedparam_ex, 
cobalt_thread_setschedparam_ex),
-       __COBALT_CALL(sc_cobalt_thread_getschedparam_ex, 
cobalt_thread_getschedparam_ex),
-       __COBALT_CALL(sc_cobalt_sched_weightprio, cobalt_sched_weighted_prio),
-       __COBALT_CALL(sc_cobalt_sched_yield, cobalt_sched_yield),
-       __COBALT_CALL(sc_cobalt_thread_setmode, cobalt_thread_setmode_np),
-       __COBALT_CALL(sc_cobalt_thread_setname, cobalt_thread_setname_np),
-       __COBALT_CALL(sc_cobalt_thread_kill, cobalt_thread_kill),
-       __COBALT_CALL(sc_cobalt_thread_getstat, cobalt_thread_stat),
-       __COBALT_CALL(sc_cobalt_thread_join, cobalt_thread_join),
-       __COBALT_CALL(sc_cobalt_sem_init, cobalt_sem_init),
-       __COBALT_CALL(sc_cobalt_sem_destroy, cobalt_sem_destroy),
-       __COBALT_CALL(sc_cobalt_sem_post, cobalt_sem_post),
-       __COBALT_CALL(sc_cobalt_sem_wait, cobalt_sem_wait),
-       __COBALT_CALL(sc_cobalt_sem_timedwait, cobalt_sem_timedwait),
-       __COBALT_CALL(sc_cobalt_sem_trywait, cobalt_sem_trywait),
-       __COBALT_CALL(sc_cobalt_sem_getvalue, cobalt_sem_getvalue),
-       __COBALT_CALL(sc_cobalt_sem_open, cobalt_sem_open),
-       __COBALT_CALL(sc_cobalt_sem_close, cobalt_sem_close),
-       __COBALT_CALL(sc_cobalt_sem_unlink, cobalt_sem_unlink),
-       __COBALT_CALL(sc_cobalt_sem_broadcast_np, cobalt_sem_broadcast_np),
-       __COBALT_CALL(sc_cobalt_sem_inquire, cobalt_sem_inquire),
-       __COBALT_CALL(sc_cobalt_clock_getres, cobalt_clock_getres),
-       __COBALT_CALL(sc_cobalt_clock_gettime, cobalt_clock_gettime),
-       __COBALT_CALL(sc_cobalt_clock_settime, cobalt_clock_settime),
-       __COBALT_CALL(sc_cobalt_clock_nanosleep, cobalt_clock_nanosleep),
-       __COBALT_CALL(sc_cobalt_mutex_init, cobalt_mutex_init),
-       __COBALT_CALL(sc_cobalt_mutex_check_init, cobalt_mutex_check_init),
-       __COBALT_CALL(sc_cobalt_mutex_destroy, cobalt_mutex_destroy),
-       __COBALT_CALL(sc_cobalt_mutex_lock, cobalt_mutex_lock),
-       __COBALT_CALL(sc_cobalt_mutex_timedlock, cobalt_mutex_timedlock),
-       __COBALT_CALL(sc_cobalt_mutex_trylock, cobalt_mutex_trylock),
-       __COBALT_CALL(sc_cobalt_mutex_unlock, cobalt_mutex_unlock),
-       __COBALT_CALL(sc_cobalt_cond_init, cobalt_cond_init),
-       __COBALT_CALL(sc_cobalt_cond_destroy, cobalt_cond_destroy),
-       __COBALT_CALL(sc_cobalt_cond_wait_prologue, cobalt_cond_wait_prologue),
-       __COBALT_CALL(sc_cobalt_cond_wait_epilogue, cobalt_cond_wait_epilogue),
-       __COBALT_CALL(sc_cobalt_mq_open, cobalt_mq_open),
-       __COBALT_CALL(sc_cobalt_mq_close, cobalt_mq_close),
-       __COBALT_CALL(sc_cobalt_mq_unlink, cobalt_mq_unlink),
-       __COBALT_CALL(sc_cobalt_mq_getattr, cobalt_mq_getattr),
-       __COBALT_CALL(sc_cobalt_mq_setattr, cobalt_mq_setattr),
-       __COBALT_CALL(sc_cobalt_mq_timedsend, cobalt_mq_timedsend),
-       __COBALT_CALL(sc_cobalt_mq_timedreceive, cobalt_mq_timedreceive),
-       __COBALT_CALL(sc_cobalt_mq_notify, cobalt_mq_notify),
-       __COBALT_CALL(sc_cobalt_sigwait, cobalt_sigwait),
-       __COBALT_CALL(sc_cobalt_sigwaitinfo, cobalt_sigwaitinfo),
-       __COBALT_CALL(sc_cobalt_sigtimedwait, cobalt_sigtimedwait),
-       __COBALT_CALL(sc_cobalt_sigpending, cobalt_sigpending),
-       __COBALT_CALL(sc_cobalt_kill, cobalt_kill),
-       __COBALT_CALL(sc_cobalt_sigqueue, cobalt_sigqueue),
-       __COBALT_CALL(sc_cobalt_timer_create, cobalt_timer_create),
-       __COBALT_CALL(sc_cobalt_timer_delete, cobalt_timer_delete),
-       __COBALT_CALL(sc_cobalt_timer_settime, cobalt_timer_settime),
-       __COBALT_CALL(sc_cobalt_timer_gettime, cobalt_timer_gettime),
-       __COBALT_CALL(sc_cobalt_timer_getoverrun, cobalt_timer_getoverrun),
-       __COBALT_CALL(sc_cobalt_timerfd_create, cobalt_timerfd_create),
-       __COBALT_CALL(sc_cobalt_timerfd_gettime, cobalt_timerfd_gettime),
-       __COBALT_CALL(sc_cobalt_timerfd_settime, cobalt_timerfd_settime),
-       __COBALT_CALL(sc_cobalt_select, cobalt_select),
-       __COBALT_CALL(sc_cobalt_sched_minprio, cobalt_sched_min_prio),
-       __COBALT_CALL(sc_cobalt_sched_maxprio, cobalt_sched_max_prio),
-       __COBALT_CALL(sc_cobalt_monitor_init, cobalt_monitor_init),
-       __COBALT_CALL(sc_cobalt_monitor_destroy, cobalt_monitor_destroy),
-       __COBALT_CALL(sc_cobalt_monitor_enter, cobalt_monitor_enter),
-       __COBALT_CALL(sc_cobalt_monitor_wait, cobalt_monitor_wait),
-       __COBALT_CALL(sc_cobalt_monitor_sync, cobalt_monitor_sync),
-       __COBALT_CALL(sc_cobalt_monitor_exit, cobalt_monitor_exit),
-       __COBALT_CALL(sc_cobalt_event_init, cobalt_event_init),
-       __COBALT_CALL(sc_cobalt_event_destroy, cobalt_event_destroy),
-       __COBALT_CALL(sc_cobalt_event_wait, cobalt_event_wait),
-       __COBALT_CALL(sc_cobalt_event_sync, cobalt_event_sync),
-       __COBALT_CALL(sc_cobalt_event_inquire, cobalt_event_inquire),
-       __COBALT_CALL(sc_cobalt_sched_setconfig_np, cobalt_sched_setconfig_np),
-       __COBALT_CALL(sc_cobalt_sched_getconfig_np, cobalt_sched_getconfig_np),
-       __COBALT_CALL(sc_cobalt_open, cobalt_open),
-       __COBALT_CALL(sc_cobalt_socket, cobalt_socket),
-       __COBALT_CALL(sc_cobalt_close, cobalt_close),
-       __COBALT_CALL(sc_cobalt_mmap, cobalt_mmap),
-       __COBALT_CALL(sc_cobalt_ioctl, cobalt_ioctl),
-       __COBALT_CALL(sc_cobalt_read, cobalt_read),
-       __COBALT_CALL(sc_cobalt_write, cobalt_write),
-       __COBALT_CALL(sc_cobalt_recvmsg, cobalt_recvmsg),
-       __COBALT_CALL(sc_cobalt_sendmsg, cobalt_sendmsg),
-       __COBALT_CALL(sc_cobalt_migrate, cobalt_migrate),
-       __COBALT_CALL(sc_cobalt_arch, xnarch_local_syscall),
-       __COBALT_CALL(sc_cobalt_bind, cobalt_bind),
-       __COBALT_CALL(sc_cobalt_extend, cobalt_extend),
-       __COBALT_CALL(sc_cobalt_info, cobalt_info),
-       __COBALT_CALL(sc_cobalt_trace, cobalt_trace),
-       __COBALT_CALL(sc_cobalt_heap_getstat, cobalt_heapstat),
-       __COBALT_CALL(sc_cobalt_current, cobalt_get_current),
-       __COBALT_CALL(sc_cobalt_mayday, cobalt_mayday),
-       __COBALT_CALL(sc_cobalt_backtrace, cobalt_backtrace),
-       __COBALT_CALL(sc_cobalt_serialdbg, cobalt_serialdbg),
-       __COBALT_CALL(sc_cobalt_sysconf, cobalt_sysconf),
+       __COBALT_CALL(thread_create),
+       __COBALT_CALL(thread_getpid),
+       __COBALT_CALL(thread_setschedparam_ex),
+       __COBALT_CALL(thread_getschedparam_ex),
+       __COBALT_CALL(sched_weightprio),
+       __COBALT_CALL(sched_yield),
+       __COBALT_CALL(thread_setmode),
+       __COBALT_CALL(thread_setname),
+       __COBALT_CALL(thread_kill),
+       __COBALT_CALL(thread_getstat),
+       __COBALT_CALL(thread_join),
+       __COBALT_CALL(sem_init),
+       __COBALT_CALL(sem_destroy),
+       __COBALT_CALL(sem_post),
+       __COBALT_CALL(sem_wait),
+       __COBALT_CALL(sem_timedwait),
+       __COBALT_CALL(sem_trywait),
+       __COBALT_CALL(sem_getvalue),
+       __COBALT_CALL(sem_open),
+       __COBALT_CALL(sem_close),
+       __COBALT_CALL(sem_unlink),
+       __COBALT_CALL(sem_broadcast_np),
+       __COBALT_CALL(sem_inquire),
+       __COBALT_CALL(clock_getres),
+       __COBALT_CALL(clock_gettime),
+       __COBALT_CALL(clock_settime),
+       __COBALT_CALL(clock_nanosleep),
+       __COBALT_CALL(mutex_init),
+       __COBALT_CALL(mutex_check_init),
+       __COBALT_CALL(mutex_destroy),
+       __COBALT_CALL(mutex_lock),
+       __COBALT_CALL(mutex_timedlock),
+       __COBALT_CALL(mutex_trylock),
+       __COBALT_CALL(mutex_unlock),
+       __COBALT_CALL(cond_init),
+       __COBALT_CALL(cond_destroy),
+       __COBALT_CALL(cond_wait_prologue),
+       __COBALT_CALL(cond_wait_epilogue),
+       __COBALT_CALL(mq_open),
+       __COBALT_CALL(mq_close),
+       __COBALT_CALL(mq_unlink),
+       __COBALT_CALL(mq_getattr),
+       __COBALT_CALL(mq_setattr),
+       __COBALT_CALL(mq_timedsend),
+       __COBALT_CALL(mq_timedreceive),
+       __COBALT_CALL(mq_notify),
+       __COBALT_CALL(sigwait),
+       __COBALT_CALL(sigwaitinfo),
+       __COBALT_CALL(sigtimedwait),
+       __COBALT_CALL(sigpending),
+       __COBALT_CALL(kill),
+       __COBALT_CALL(sigqueue),
+       __COBALT_CALL(timer_create),
+       __COBALT_CALL(timer_delete),
+       __COBALT_CALL(timer_settime),
+       __COBALT_CALL(timer_gettime),
+       __COBALT_CALL(timer_getoverrun),
+       __COBALT_CALL(timerfd_create),
+       __COBALT_CALL(timerfd_gettime),
+       __COBALT_CALL(timerfd_settime),
+       __COBALT_CALL(select),
+       __COBALT_CALL(sched_minprio),
+       __COBALT_CALL(sched_maxprio),
+       __COBALT_CALL(monitor_init),
+       __COBALT_CALL(monitor_destroy),
+       __COBALT_CALL(monitor_enter),
+       __COBALT_CALL(monitor_wait),
+       __COBALT_CALL(monitor_sync),
+       __COBALT_CALL(monitor_exit),
+       __COBALT_CALL(event_init),
+       __COBALT_CALL(event_destroy),
+       __COBALT_CALL(event_wait),
+       __COBALT_CALL(event_sync),
+       __COBALT_CALL(event_inquire),
+       __COBALT_CALL(sched_setconfig_np),
+       __COBALT_CALL(sched_getconfig_np),
+       __COBALT_CALL(open),
+       __COBALT_CALL(socket),
+       __COBALT_CALL(close),
+       __COBALT_CALL(mmap),
+       __COBALT_CALL(ioctl),
+       __COBALT_CALL(read),
+       __COBALT_CALL(write),
+       __COBALT_CALL(recvmsg),
+       __COBALT_CALL(sendmsg),
+       __COBALT_CALL(migrate),
+       __COBALT_CALL(archcall),
+       __COBALT_CALL(bind),
+       __COBALT_CALL(extend),
+       __COBALT_CALL(info),
+       __COBALT_CALL(trace),
+       __COBALT_CALL(heap_getstat),
+       __COBALT_CALL(get_current),
+       __COBALT_CALL(mayday),
+       __COBALT_CALL(backtrace),
+       __COBALT_CALL(serialdbg),
+       __COBALT_CALL(sysconf),
 };
 
-static int cobalt_sysmodes[] = {
+static const int cobalt_sysmodes[] = {
        [0 ... __NR_COBALT_SYSCALLS-1] = 0,
-       __COBALT_MODE(sc_cobalt_thread_create, init),
-       __COBALT_MODE(sc_cobalt_thread_getpid, current),
-       __COBALT_MODE(sc_cobalt_thread_setschedparam_ex, conforming),
-       __COBALT_MODE(sc_cobalt_thread_getschedparam_ex, current),
-       __COBALT_MODE(sc_cobalt_sched_weightprio, current),
-       __COBALT_MODE(sc_cobalt_sched_yield, primary),
-       __COBALT_MODE(sc_cobalt_thread_setmode, primary),
-       __COBALT_MODE(sc_cobalt_thread_setname, current),
-       __COBALT_MODE(sc_cobalt_thread_kill, conforming),
-       __COBALT_MODE(sc_cobalt_thread_getstat, current),
-       __COBALT_MODE(sc_cobalt_thread_join, primary),
-       __COBALT_MODE(sc_cobalt_sem_init, current),
-       __COBALT_MODE(sc_cobalt_sem_destroy, current),
-       __COBALT_MODE(sc_cobalt_sem_post, current),
-       __COBALT_MODE(sc_cobalt_sem_wait, primary),
-       __COBALT_MODE(sc_cobalt_sem_timedwait, primary),
-       __COBALT_MODE(sc_cobalt_sem_trywait, primary),
-       __COBALT_MODE(sc_cobalt_sem_getvalue, current),
-       __COBALT_MODE(sc_cobalt_sem_open, current),
-       __COBALT_MODE(sc_cobalt_sem_close, current),
-       __COBALT_MODE(sc_cobalt_sem_unlink, current),
-       __COBALT_MODE(sc_cobalt_sem_broadcast_np, current),
-       __COBALT_MODE(sc_cobalt_sem_inquire, current),
-       __COBALT_MODE(sc_cobalt_clock_getres, current),
-       __COBALT_MODE(sc_cobalt_clock_gettime, current),
-       __COBALT_MODE(sc_cobalt_clock_settime, current),
-       __COBALT_MODE(sc_cobalt_clock_nanosleep, nonrestartable),
-       __COBALT_MODE(sc_cobalt_mutex_init, current),
-       __COBALT_MODE(sc_cobalt_mutex_check_init, current),
-       __COBALT_MODE(sc_cobalt_mutex_destroy, current),
-       __COBALT_MODE(sc_cobalt_mutex_lock, primary),
-       __COBALT_MODE(sc_cobalt_mutex_timedlock, primary),
-       __COBALT_MODE(sc_cobalt_mutex_trylock, primary),
-       __COBALT_MODE(sc_cobalt_mutex_unlock, nonrestartable),
-       __COBALT_MODE(sc_cobalt_cond_init, current),
-       __COBALT_MODE(sc_cobalt_cond_destroy, current),
-       __COBALT_MODE(sc_cobalt_cond_wait_prologue, nonrestartable),
-       __COBALT_MODE(sc_cobalt_cond_wait_epilogue, primary),
-       __COBALT_MODE(sc_cobalt_mq_open, lostage),
-       __COBALT_MODE(sc_cobalt_mq_close, lostage),
-       __COBALT_MODE(sc_cobalt_mq_unlink, lostage),
-       __COBALT_MODE(sc_cobalt_mq_getattr, current),
-       __COBALT_MODE(sc_cobalt_mq_setattr, current),
-       __COBALT_MODE(sc_cobalt_mq_timedsend, primary),
-       __COBALT_MODE(sc_cobalt_mq_timedreceive, primary),
-       __COBALT_MODE(sc_cobalt_mq_notify, primary),
-       __COBALT_MODE(sc_cobalt_sigwait, primary),
-       __COBALT_MODE(sc_cobalt_sigwaitinfo, nonrestartable),
-       __COBALT_MODE(sc_cobalt_sigtimedwait, nonrestartable),
-       __COBALT_MODE(sc_cobalt_sigpending, primary),
-       __COBALT_MODE(sc_cobalt_kill, conforming),
-       __COBALT_MODE(sc_cobalt_sigqueue, conforming),
-       __COBALT_MODE(sc_cobalt_timer_create, current),
-       __COBALT_MODE(sc_cobalt_timer_delete, current),
-       __COBALT_MODE(sc_cobalt_timer_settime, primary),
-       __COBALT_MODE(sc_cobalt_timer_gettime, current),
-       __COBALT_MODE(sc_cobalt_timer_getoverrun, current),
-       __COBALT_MODE(sc_cobalt_timerfd_create, lostage),
-       __COBALT_MODE(sc_cobalt_timerfd_gettime, current),
-       __COBALT_MODE(sc_cobalt_timerfd_settime, current),
-       __COBALT_MODE(sc_cobalt_select, nonrestartable),
-       __COBALT_MODE(sc_cobalt_sched_minprio, current),
-       __COBALT_MODE(sc_cobalt_sched_maxprio, current),
-       __COBALT_MODE(sc_cobalt_monitor_init, current),
-       __COBALT_MODE(sc_cobalt_monitor_destroy, primary),
-       __COBALT_MODE(sc_cobalt_monitor_enter, primary),
-       __COBALT_MODE(sc_cobalt_monitor_wait, nonrestartable),
-       __COBALT_MODE(sc_cobalt_monitor_sync, nonrestartable),
-       __COBALT_MODE(sc_cobalt_monitor_exit, primary),
-       __COBALT_MODE(sc_cobalt_event_init, current),
-       __COBALT_MODE(sc_cobalt_event_destroy, current),
-       __COBALT_MODE(sc_cobalt_event_wait, primary),
-       __COBALT_MODE(sc_cobalt_event_sync, current),
-       __COBALT_MODE(sc_cobalt_event_inquire, current),
-       __COBALT_MODE(sc_cobalt_sched_setconfig_np, current),
-       __COBALT_MODE(sc_cobalt_sched_getconfig_np, current),
-       __COBALT_MODE(sc_cobalt_open, lostage),
-       __COBALT_MODE(sc_cobalt_socket, lostage),
-       __COBALT_MODE(sc_cobalt_close, lostage),
-       __COBALT_MODE(sc_cobalt_mmap, lostage),
-       __COBALT_MODE(sc_cobalt_ioctl, probing),
-       __COBALT_MODE(sc_cobalt_read, probing),
-       __COBALT_MODE(sc_cobalt_write, probing),
-       __COBALT_MODE(sc_cobalt_recvmsg, probing),
-       __COBALT_MODE(sc_cobalt_sendmsg, probing),
-       __COBALT_MODE(sc_cobalt_migrate, current),
-       __COBALT_MODE(sc_cobalt_arch, current),
-       __COBALT_MODE(sc_cobalt_bind, lostage),
-       __COBALT_MODE(sc_cobalt_extend, lostage),
-       __COBALT_MODE(sc_cobalt_info, lostage),
-       __COBALT_MODE(sc_cobalt_trace, current),
-       __COBALT_MODE(sc_cobalt_heap_getstat, lostage),
-       __COBALT_MODE(sc_cobalt_current, current),
-       __COBALT_MODE(sc_cobalt_mayday, oneway),
-       __COBALT_MODE(sc_cobalt_backtrace, current),
-       __COBALT_MODE(sc_cobalt_serialdbg, current),
-       __COBALT_MODE(sc_cobalt_sysconf, current),
+       __COBALT_MODE(thread_create, init),
+       __COBALT_MODE(thread_getpid, current),
+       __COBALT_MODE(thread_setschedparam_ex, conforming),
+       __COBALT_MODE(thread_getschedparam_ex, current),
+       __COBALT_MODE(sched_weightprio, current),
+       __COBALT_MODE(sched_yield, primary),
+       __COBALT_MODE(thread_setmode, primary),
+       __COBALT_MODE(thread_setname, current),
+       __COBALT_MODE(thread_kill, conforming),
+       __COBALT_MODE(thread_getstat, current),
+       __COBALT_MODE(thread_join, primary),
+       __COBALT_MODE(sem_init, current),
+       __COBALT_MODE(sem_destroy, current),
+       __COBALT_MODE(sem_post, current),
+       __COBALT_MODE(sem_wait, primary),
+       __COBALT_MODE(sem_timedwait, primary),
+       __COBALT_MODE(sem_trywait, primary),
+       __COBALT_MODE(sem_getvalue, current),
+       __COBALT_MODE(sem_open, current),
+       __COBALT_MODE(sem_close, current),
+       __COBALT_MODE(sem_unlink, current),
+       __COBALT_MODE(sem_broadcast_np, current),
+       __COBALT_MODE(sem_inquire, current),
+       __COBALT_MODE(clock_getres, current),
+       __COBALT_MODE(clock_gettime, current),
+       __COBALT_MODE(clock_settime, current),
+       __COBALT_MODE(clock_nanosleep, nonrestartable),
+       __COBALT_MODE(mutex_init, current),
+       __COBALT_MODE(mutex_check_init, current),
+       __COBALT_MODE(mutex_destroy, current),
+       __COBALT_MODE(mutex_lock, primary),
+       __COBALT_MODE(mutex_timedlock, primary),
+       __COBALT_MODE(mutex_trylock, primary),
+       __COBALT_MODE(mutex_unlock, nonrestartable),
+       __COBALT_MODE(cond_init, current),
+       __COBALT_MODE(cond_destroy, current),
+       __COBALT_MODE(cond_wait_prologue, nonrestartable),
+       __COBALT_MODE(cond_wait_epilogue, primary),
+       __COBALT_MODE(mq_open, lostage),
+       __COBALT_MODE(mq_close, lostage),
+       __COBALT_MODE(mq_unlink, lostage),
+       __COBALT_MODE(mq_getattr, current),
+       __COBALT_MODE(mq_setattr, current),
+       __COBALT_MODE(mq_timedsend, primary),
+       __COBALT_MODE(mq_timedreceive, primary),
+       __COBALT_MODE(mq_notify, primary),
+       __COBALT_MODE(sigwait, primary),
+       __COBALT_MODE(sigwaitinfo, nonrestartable),
+       __COBALT_MODE(sigtimedwait, nonrestartable),
+       __COBALT_MODE(sigpending, primary),
+       __COBALT_MODE(kill, conforming),
+       __COBALT_MODE(sigqueue, conforming),
+       __COBALT_MODE(timer_create, current),
+       __COBALT_MODE(timer_delete, current),
+       __COBALT_MODE(timer_settime, primary),
+       __COBALT_MODE(timer_gettime, current),
+       __COBALT_MODE(timer_getoverrun, current),
+       __COBALT_MODE(timerfd_create, lostage),
+       __COBALT_MODE(timerfd_gettime, current),
+       __COBALT_MODE(timerfd_settime, current),
+       __COBALT_MODE(select, nonrestartable),
+       __COBALT_MODE(sched_minprio, current),
+       __COBALT_MODE(sched_maxprio, current),
+       __COBALT_MODE(monitor_init, current),
+       __COBALT_MODE(monitor_destroy, primary),
+       __COBALT_MODE(monitor_enter, primary),
+       __COBALT_MODE(monitor_wait, nonrestartable),
+       __COBALT_MODE(monitor_sync, nonrestartable),
+       __COBALT_MODE(monitor_exit, primary),
+       __COBALT_MODE(event_init, current),
+       __COBALT_MODE(event_destroy, current),
+       __COBALT_MODE(event_wait, primary),
+       __COBALT_MODE(event_sync, current),
+       __COBALT_MODE(event_inquire, current),
+       __COBALT_MODE(sched_setconfig_np, current),
+       __COBALT_MODE(sched_getconfig_np, current),
+       __COBALT_MODE(open, lostage),
+       __COBALT_MODE(socket, lostage),
+       __COBALT_MODE(close, lostage),
+       __COBALT_MODE(mmap, lostage),
+       __COBALT_MODE(ioctl, probing),
+       __COBALT_MODE(read, probing),
+       __COBALT_MODE(write, probing),
+       __COBALT_MODE(recvmsg, probing),
+       __COBALT_MODE(sendmsg, probing),
+       __COBALT_MODE(migrate, current),
+       __COBALT_MODE(archcall, current),
+       __COBALT_MODE(bind, lostage),
+       __COBALT_MODE(extend, lostage),
+       __COBALT_MODE(info, lostage),
+       __COBALT_MODE(trace, current),
+       __COBALT_MODE(heap_getstat, lostage),
+       __COBALT_MODE(get_current, current),
+       __COBALT_MODE(mayday, oneway),
+       __COBALT_MODE(backtrace, current),
+       __COBALT_MODE(serialdbg, current),
+       __COBALT_MODE(sysconf, current),
 };
diff --git a/kernel/cobalt/posix/syscall.h b/kernel/cobalt/posix/syscall.h
new file mode 100644
index 0000000..8c41475
--- /dev/null
+++ b/kernel/cobalt/posix/syscall.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef _COBALT_POSIX_SYSCALL_H
+#define _COBALT_POSIX_SYSCALL_H
+
+#define COBALT_SYSCALL(__name, __mode, __type, __args) \
+       __typeof__(__type) cobalt_ ## __name __args
+
+#define COBALT_SYSCALL_DECL(__name, __type, __args)    \
+       __typeof__(__type) cobalt_ ## __name __args
+
+#endif /* !_COBALT_POSIX_SYSCALL_H */
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index eb87caa..7ed7f92 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -445,11 +445,12 @@ static inline int pthread_setmode_np(int clrmask, int 
setmask, int *mode_r)
  * the Cobalt ABI. Useland changes scheduling parameters only via the
  * extended cobalt_thread_setschedparam_ex syscall.
  */
-int cobalt_thread_setschedparam_ex(unsigned long pth,
-                                  int policy,
-                                  const struct sched_param_ex __user *u_param,
-                                  unsigned long __user *u_window_offset,
-                                  int __user *u_promoted)
+COBALT_SYSCALL(thread_setschedparam_ex, conforming,
+              int, (unsigned long pth,
+                    int policy,
+                    const struct sched_param_ex __user *u_param,
+                    unsigned long __user *u_window_offset,
+                    int __user *u_promoted))
 {
        struct sched_param_ex param_ex;
        struct cobalt_local_hkey hkey;
@@ -489,9 +490,10 @@ int cobalt_thread_setschedparam_ex(unsigned long pth,
  * the Cobalt ABI. Useland retrieves scheduling parameters only via
  * the extended cobalt_thread_getschedparam_ex syscall.
  */
-int cobalt_thread_getschedparam_ex(unsigned long pth,
-                                  int __user *u_policy,
-                                  struct sched_param_ex __user *u_param)
+COBALT_SYSCALL(thread_getschedparam_ex, current,
+              int, (unsigned long pth,
+                    int __user *u_policy,
+                    struct sched_param_ex __user *u_param))
 {
        struct sched_param_ex param_ex;
        struct cobalt_local_hkey hkey;
@@ -516,10 +518,11 @@ int cobalt_thread_getschedparam_ex(unsigned long pth,
        return __xn_safe_copy_to_user(u_param, &param_ex, sizeof(param_ex));
 }
 
-int cobalt_thread_create(unsigned long pth, int policy,
-                        struct sched_param_ex __user *u_param,
-                        int xid,
-                        unsigned long __user *u_window_offset)
+COBALT_SYSCALL(thread_create, init,
+              int, (unsigned long pth, int policy,
+                    struct sched_param_ex __user *u_param,
+                    int xid,
+                    unsigned long __user *u_window_offset))
 {
        struct cobalt_thread *thread = NULL;
        struct task_struct *p = current;
@@ -602,7 +605,8 @@ fail:
        return ERR_PTR(ret);
 }
 
-int cobalt_thread_setmode_np(int clrmask, int setmask, int __user *u_mode_r)
+COBALT_SYSCALL(thread_setmode, primary,
+              int, (int clrmask, int setmask, int __user *u_mode_r))
 {
        int ret, old;
 
@@ -618,7 +622,8 @@ int cobalt_thread_setmode_np(int clrmask, int setmask, int 
__user *u_mode_r)
        return 0;
 }
 
-int cobalt_thread_setname_np(unsigned long pth, const char __user *u_name)
+COBALT_SYSCALL(thread_setname, current,
+              int, (unsigned long pth, const char __user *u_name))
 {
        struct cobalt_local_hkey hkey;
        struct cobalt_thread *thread;
@@ -657,7 +662,8 @@ int cobalt_thread_setname_np(unsigned long pth, const char 
__user *u_name)
        return 0;
 }
 
-int cobalt_thread_kill(unsigned long pth, int sig)
+COBALT_SYSCALL(thread_kill, conforming,
+              int, (unsigned long pth, int sig))
 {
        struct cobalt_local_hkey hkey;
        struct cobalt_thread *thread;
@@ -681,7 +687,7 @@ int cobalt_thread_kill(unsigned long pth, int sig)
        return ret;
 }
 
-int cobalt_thread_join(unsigned long pth)
+COBALT_SYSCALL(thread_join, primary, int, (unsigned long pth))
 {
        struct cobalt_local_hkey hkey;
        struct cobalt_thread *thread;
@@ -703,7 +709,7 @@ int cobalt_thread_join(unsigned long pth)
        return xnthread_join(&thread->threadbase, false);
 }
 
-pid_t cobalt_thread_pid(unsigned long pth)
+COBALT_SYSCALL(thread_getpid, current, pid_t, (unsigned long pth))
 {
        struct cobalt_local_hkey hkey;
        struct cobalt_thread *thread;
@@ -727,8 +733,9 @@ pid_t cobalt_thread_pid(unsigned long pth)
        return pid;
 }
 
-int cobalt_thread_stat(pid_t pid,
-                      struct cobalt_threadstat __user *u_stat)
+COBALT_SYSCALL(thread_getstat, current,
+              int, (pid_t pid,
+                    struct cobalt_threadstat __user *u_stat))
 {
        struct cobalt_threadstat stat;
        struct cobalt_thread *p;
diff --git a/kernel/cobalt/posix/thread.h b/kernel/cobalt/posix/thread.h
index 8613c2e..ee78c04 100644
--- a/kernel/cobalt/posix/thread.h
+++ b/kernel/cobalt/posix/thread.h
@@ -25,6 +25,7 @@
 #include <cobalt/kernel/thread.h>
 #include <cobalt/uapi/thread.h>
 #include <cobalt/uapi/sched.h>
+#include <xenomai/posix/syscall.h> /* CAUTION: rtdm/cobalt.h reads this. */
 
 #define PTHREAD_PROCESS_PRIVATE 0
 #define PTHREAD_PROCESS_SHARED  1
@@ -127,57 +128,46 @@ struct cobalt_thread *cobalt_thread_find_local(pid_t pid);
 
 struct cobalt_thread *cobalt_thread_lookup(unsigned long pth);
 
-int cobalt_thread_create(unsigned long pth, int policy,
-                        struct sched_param_ex __user *u_param,
-                        int xid,
-                        unsigned long __user *u_window_offset);
+COBALT_SYSCALL_DECL(thread_create,
+                   int, (unsigned long pth, int policy,
+                         struct sched_param_ex __user *u_param,
+                         int xid,
+                         unsigned long __user *u_window_offset));
 
 struct cobalt_thread *
 cobalt_thread_shadow(struct task_struct *p,
                     struct cobalt_local_hkey *lhkey,
                     unsigned long __user *u_window_offset);
 
-int cobalt_thread_setmode_np(int clrmask, int setmask, int __user *u_mode_r);
+COBALT_SYSCALL_DECL(thread_setmode,
+                   int, (int clrmask, int setmask, int __user *u_mode_r));
 
-int cobalt_thread_setname_np(unsigned long pth, const char __user *u_name);
+COBALT_SYSCALL_DECL(thread_setname,
+                   int, (unsigned long pth, const char __user *u_name));
 
-int cobalt_thread_kill(unsigned long pth, int sig);
+COBALT_SYSCALL_DECL(thread_kill,
+                   int, (unsigned long pth, int sig));
 
-int cobalt_thread_join(unsigned long pth);
+COBALT_SYSCALL_DECL(thread_join, int, (unsigned long pth));
 
-pid_t cobalt_thread_pid(unsigned long pth);
+COBALT_SYSCALL_DECL(thread_getpid,
+                   pid_t, (unsigned long pth));
 
-int cobalt_thread_stat(pid_t pid,
-                      struct cobalt_threadstat __user *u_stat);
+COBALT_SYSCALL_DECL(thread_getstat,
+                   int, (pid_t pid,
+                         struct cobalt_threadstat __user *u_stat));
 
-int cobalt_thread_setschedparam_ex(unsigned long pth,
-                                  int policy,
-                                  const struct sched_param_ex __user *u_param,
-                                  unsigned long __user *u_window_offset,
-                                  int __user *u_promoted);
+COBALT_SYSCALL_DECL(thread_setschedparam_ex,
+                   int, (unsigned long pth,
+                         int policy,
+                         const struct sched_param_ex __user *u_param,
+                         unsigned long __user *u_window_offset,
+                         int __user *u_promoted));
 
-int cobalt_thread_getschedparam_ex(unsigned long pth,
-                                  int __user *u_policy,
-                                  struct sched_param_ex __user *u_param);
-
-int cobalt_sched_yield(void);
-
-int cobalt_sched_weighted_prio(int policy,
-                              const struct sched_param_ex __user *u_param);
-
-int cobalt_sched_min_prio(int policy);
-
-int cobalt_sched_max_prio(int policy);
-
-int cobalt_sched_setconfig_np(int cpu,
-                             int policy,
-                             const union sched_config __user *u_config,
-                             size_t len);
-
-ssize_t cobalt_sched_getconfig_np(int cpu,
-                                 int policy,
-                                 union sched_config __user *u_config,
-                                 size_t len);
+COBALT_SYSCALL_DECL(thread_getschedparam_ex,
+                   int, (unsigned long pth,
+                         int __user *u_policy,
+                         struct sched_param_ex __user *u_param));
 
 void cobalt_thread_map(struct xnthread *curr);
 
diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c
index cf3c48f..741ccf2 100644
--- a/kernel/cobalt/posix/timer.c
+++ b/kernel/cobalt/posix/timer.c
@@ -445,9 +445,10 @@ int cobalt_timer_delete(timer_t timerid)
        return timer_delete(timerid);
 }
 
-int cobalt_timer_create(clockid_t clock,
-                       const struct sigevent __user *u_sev,
-                       timer_t __user *u_tm)
+COBALT_SYSCALL(timer_create, current,
+              int, (clockid_t clock,
+                    const struct sigevent __user *u_sev,
+                    timer_t __user *u_tm))
 {
        struct sigevent sev, *evp = NULL;
        timer_t timerid = 0;
@@ -471,9 +472,10 @@ int cobalt_timer_create(clockid_t clock,
        return 0;
 }
 
-int cobalt_timer_settime(timer_t tm, int flags,
-                        const struct itimerspec __user *u_newval,
-                        struct itimerspec __user *u_oldval)
+COBALT_SYSCALL(timer_settime, primary,
+              int, (timer_t tm, int flags,
+                    const struct itimerspec __user *u_newval,
+                    struct itimerspec __user *u_oldval))
 {
        struct itimerspec newv, oldv, *oldvp;
        int ret;
@@ -495,7 +497,8 @@ int cobalt_timer_settime(timer_t tm, int flags,
        return 0;
 }
 
-int cobalt_timer_gettime(timer_t tm, struct itimerspec __user *u_val)
+COBALT_SYSCALL(timer_gettime, current,
+              int, (timer_t tm, struct itimerspec __user *u_val))
 {
        struct itimerspec val;
        int ret;
@@ -507,7 +510,8 @@ int cobalt_timer_gettime(timer_t tm, struct itimerspec 
__user *u_val)
        return __xn_safe_copy_to_user(u_val, &val, sizeof(val));
 }
 
-int cobalt_timer_getoverrun(timer_t timerid)
+COBALT_SYSCALL(timer_getoverrun, current,
+              int, (timer_t timerid))
 {
        struct cobalt_timer *timer;
        struct cobalt_process *cc;
diff --git a/kernel/cobalt/posix/timer.h b/kernel/cobalt/posix/timer.h
index 7e8f4c8..05434fd 100644
--- a/kernel/cobalt/posix/timer.h
+++ b/kernel/cobalt/posix/timer.h
@@ -22,7 +22,8 @@
 #include <linux/time.h>
 #include <linux/list.h>
 #include <cobalt/kernel/timer.h>
-#include "signal.h"
+#include <xenomai/posix/signal.h>
+#include <xenomai/posix/syscall.h>
 
 struct cobalt_thread;
 struct cobalt_kqueues;
@@ -37,21 +38,6 @@ struct cobalt_timer {
        struct cobalt_extref extref;
 };
 
-int cobalt_timer_create(clockid_t clock,
-                       const struct sigevent __user *u_sev,
-                       timer_t __user *u_tm);
-
-int cobalt_timer_delete(timer_t tm);
-
-int cobalt_timer_settime(timer_t tm,
-                        int flags,
-                        const struct itimerspec __user *u_newval,
-                        struct itimerspec __user *u_oldval);
-
-int cobalt_timer_gettime(timer_t tm, struct itimerspec __user *u_val);
-
-int cobalt_timer_getoverrun(timer_t tm);
-
 int cobalt_timer_deliver(timer_t timerid);
 
 void cobalt_timers_cleanup(struct cobalt_process *p);
@@ -72,4 +58,21 @@ int cobalt_xntimer_settime(struct xntimer *__restrict__ 
timer, int clock_flag,
 
 void cobalt_timer_handler(struct xntimer *xntimer);
 
+COBALT_SYSCALL_DECL(timer_create,
+                   int, (clockid_t clock,
+                         const struct sigevent __user *u_sev,
+                         timer_t __user *u_tm));
+
+COBALT_SYSCALL_DECL(timer_delete, int, (timer_t tm));
+
+COBALT_SYSCALL_DECL(timer_settime,
+                   int, (timer_t tm, int flags,
+                         const struct itimerspec __user *u_newval,
+                         struct itimerspec __user *u_oldval));
+
+COBALT_SYSCALL_DECL(timer_gettime,
+                   int, (timer_t tm, struct itimerspec __user *u_val));
+
+COBALT_SYSCALL_DECL(timer_getoverrun, int, (timer_t tm));
+
 #endif /* !_COBALT_POSIX_TIMER_H */
diff --git a/kernel/cobalt/posix/timerfd.c b/kernel/cobalt/posix/timerfd.c
index 60a45bc..c9e54c0 100644
--- a/kernel/cobalt/posix/timerfd.c
+++ b/kernel/cobalt/posix/timerfd.c
@@ -161,7 +161,8 @@ static void timerfd_handler(struct xntimer *xntimer)
                xnthread_unblock(tfd->target);
 }
 
-int cobalt_timerfd_create(int ufd, int clockid, int flags)
+COBALT_SYSCALL(timerfd_create, lostage,
+              int, (int ufd, int clockid, int flags))
 {
        struct cobalt_tfd *tfd;
        struct xnthread *curr;
@@ -214,9 +215,10 @@ static inline void tfd_put(struct cobalt_tfd *tfd)
        rtdm_fd_put(&tfd->fd);
 }
 
-int cobalt_timerfd_settime(int fd, int flags,
-                       const struct itimerspec __user *new_value,
-                       struct itimerspec __user *old_value)
+COBALT_SYSCALL(timerfd_settime, current,
+              int, (int fd, int flags,
+                    const struct itimerspec __user *new_value,
+                    struct itimerspec __user *old_value))
 {
        struct itimerspec ovalue, value;
        struct cobalt_tfd *tfd;
@@ -276,7 +278,8 @@ int cobalt_timerfd_settime(int fd, int flags,
        return err;
 }
 
-int cobalt_timerfd_gettime(int fd, struct itimerspec __user *curr_value)
+COBALT_SYSCALL(timerfd_gettime, current,
+              int, (int fd, struct itimerspec __user *curr_value))
 {
        struct itimerspec value;
        struct cobalt_tfd *tfd;
diff --git a/kernel/cobalt/posix/timerfd.h b/kernel/cobalt/posix/timerfd.h
index 12535e4..c833c83 100644
--- a/kernel/cobalt/posix/timerfd.h
+++ b/kernel/cobalt/posix/timerfd.h
@@ -2,13 +2,17 @@
 #define TIMERFD_H
 
 #include <linux/time.h>
+#include <xenomai/posix/syscall.h>
 
-int cobalt_timerfd_create(int fd, int clockid, int flags);
+COBALT_SYSCALL_DECL(timerfd_create,
+                   int, (int fd, int clockid, int flags));
 
-int cobalt_timerfd_settime(int fd, int flags,
-                       const struct itimerspec __user *new_value,
-                       struct itimerspec __user *old_value);
+COBALT_SYSCALL_DECL(timerfd_settime,
+                   int, (int fd, int flags,
+                         const struct itimerspec __user *new_value,
+                         struct itimerspec __user *old_value));
 
-int cobalt_timerfd_gettime(int fd, struct itimerspec __user *curr_value);
+COBALT_SYSCALL_DECL(timerfd_gettime,
+                   int, (int fd, struct itimerspec __user *curr_value));
 
 #endif /* TIMERFD_H */
diff --git a/lib/cobalt/arch/arm/features.c b/lib/cobalt/arch/arm/features.c
index a15e7c8..83d2846 100644
--- a/lib/cobalt/arch/arm/features.c
+++ b/lib/cobalt/arch/arm/features.c
@@ -47,7 +47,7 @@ void cobalt_check_features(struct cobalt_featinfo *finfo)
        if (__xn_tscinfo.kinfo.counter != NULL)
                return;
 
-       err = XENOMAI_SYSCALL2(sc_cobalt_arch,
+       err = XENOMAI_SYSCALL2(sc_cobalt_archcall,
                               XENOMAI_SYSARCH_TSCINFO, &__xn_tscinfo.kinfo);
        if (err) {
                report_error("Your board/configuration does not "
diff --git a/lib/cobalt/current.c b/lib/cobalt/current.c
index ce6a85e..aaf7dc9 100644
--- a/lib/cobalt/current.c
+++ b/lib/cobalt/current.c
@@ -117,7 +117,7 @@ xnhandle_t cobalt_get_current_slow(void)
        xnhandle_t current;
        int err;
 
-       err = XENOMAI_SYSCALL1(sc_cobalt_current, &current);
+       err = XENOMAI_SYSCALL1(sc_cobalt_get_current, &current);
 
        return err ? XN_NO_HANDLE : current;
 }
@@ -128,7 +128,7 @@ void cobalt_set_tsd(unsigned long u_winoff)
        xnhandle_t current;
        int ret;
 
-       ret = XENOMAI_SYSCALL1(sc_cobalt_current, &current);
+       ret = XENOMAI_SYSCALL1(sc_cobalt_get_current, &current);
        if (ret) {
                report_error("error retrieving current handle: %s",
                             strerror(-ret));


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to