/usr/include/xenomai/asm-generic/syscall.h is in libxenomai-dev 2.5.5.2-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | /*
* Copyright (C) 2001,2002,2003,2004,2005 Philippe Gerum <rpm@xenomai.org>.
*
* Xenomai 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.
*
* Xenomai 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 Xenomai; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _XENO_ASM_GENERIC_SYSCALL_H
#define _XENO_ASM_GENERIC_SYSCALL_H
#include <asm/xenomai/features.h>
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/signal.h>
#include <asm/uaccess.h>
#include <asm/xenomai/wrappers.h>
#include <asm/xenomai/hal.h>
#else /* !__KERNEL__ */
#include <sys/types.h>
#include <signal.h>
#endif /* !__KERNEL__ */
/* Xenomai multiplexer syscall. */
#define __xn_sys_mux 555 /* Must fit within 15bit */
/* Xenomai nucleus syscalls. */
#define __xn_sys_bind 0 /* muxid = bind_to_interface(magic,featdep,abirev) */
#define __xn_sys_completion 1 /* xnshadow_completion(&completion) */
#define __xn_sys_migrate 2 /* switched = xnshadow_relax/harden() */
#define __xn_sys_barrier 3 /* started = xnshadow_wait_barrier(&entry,&cookie) */
#define __xn_sys_info 4 /* xnshadow_get_info(muxid,&info) */
#define __xn_sys_arch 5 /* r = xnarch_local_syscall(args) */
#define __xn_sys_trace 6 /* r = xntrace_xxx(...) */
#define __xn_sys_sem_heap 7
#define __xn_sys_current 8 /* threadh = xnthread_handle(cur) */
#define __xn_sys_current_info 9 /* r = xnshadow_current_info(&info) */
#define __xn_sys_get_next_sigs 10 /* only unqueue pending signals. */
#define __xn_sys_drop_u_mode 11 /* stop updating thread->u_mode */
#define __xn_sys_mayday 12 /* request mayday fixup */
#define XENOMAI_LINUX_DOMAIN 0
#define XENOMAI_XENO_DOMAIN 1
typedef struct xnsysinfo {
unsigned long long clockfreq; /* Real-time clock frequency */
unsigned long tickval; /* Tick duration (ns) */
unsigned long vdso; /* Offset of nkvdso in the sem heap */
} xnsysinfo_t;
#define SIGSHADOW SIGWINCH
#define SIGSHADOW_ACTION_HARDEN 1
#define SIGSHADOW_ACTION_RENICE 2
#define sigshadow_action(code) ((code) & 0xff)
#define sigshadow_arg(code) (((code) >> 8) & 0xff)
#define sigshadow_int(action, arg) ((action) | ((arg) << 8))
#define SIGDEBUG SIGXCPU
#define SIGDEBUG_UNDEFINED 0
#define SIGDEBUG_MIGRATE_SIGNAL 1
#define SIGDEBUG_MIGRATE_SYSCALL 2
#define SIGDEBUG_MIGRATE_FAULT 3
#define SIGDEBUG_MIGRATE_PRIOINV 4
#define SIGDEBUG_NOMLOCK 5
#define SIGDEBUG_WATCHDOG 6
union xnsiginfo {
struct siginfo pse51_si;
};
struct xnsig {
unsigned nsigs;
unsigned remaining;
struct {
unsigned muxid;
union xnsiginfo si;
} pending[16];
};
#ifdef __KERNEL__
struct task_struct;
struct pt_regs;
#define XENOMAI_MAX_SYSENT 255
typedef struct _xnsysent {
int (*svc)(struct pt_regs *regs);
/* Syscall must run into the Linux domain. */
#define __xn_exec_lostage 0x1
/* Syscall must run into the Xenomai domain. */
#define __xn_exec_histage 0x2
/* Shadow syscall; caller must be mapped. */
#define __xn_exec_shadow 0x4
/* Switch back toggle; caller must return to its original mode. */
#define __xn_exec_switchback 0x8
/* Exec in current domain. */
#define __xn_exec_current 0x10
/* Exec in conforming domain, Xenomai or Linux. */
#define __xn_exec_conforming 0x20
/* Attempt syscall restart in the opposite domain upon -ENOSYS. */
#define __xn_exec_adaptive 0x40
/* Do not restart syscall upon signal receipt. */
#define __xn_exec_norestart 0x80
/* Context-agnostic syscall. Will actually run in Xenomai domain. */
#define __xn_exec_any 0x0
/* Short-hand for shadow init syscall. */
#define __xn_exec_init __xn_exec_lostage
/* Short-hand for shadow syscall in Xenomai space. */
#define __xn_exec_primary (__xn_exec_shadow|__xn_exec_histage)
/* Short-hand for shadow syscall in Linux space. */
#define __xn_exec_secondary (__xn_exec_shadow|__xn_exec_lostage)
unsigned long flags;
} xnsysent_t;
extern int nkthrptd;
extern int nkerrptd;
#define xnshadow_thrptd(t) ((t)->ptd[nkthrptd])
#define xnshadow_thread(t) ((xnthread_t *)xnshadow_thrptd(t))
/* The errno field must be addressable for plain Linux tasks too. */
#define xnshadow_errno(t) (*(int *)&((t)->ptd[nkerrptd]))
#define access_rok(addr, size) access_ok(VERIFY_READ, (addr), (size))
#define access_wok(addr, size) access_ok(VERIFY_WRITE, (addr), (size))
#define __xn_copy_from_user(dstP, srcP, n) __copy_from_user_inatomic(dstP, srcP, n)
#define __xn_copy_to_user(dstP, srcP, n) __copy_to_user_inatomic(dstP, srcP, n)
#define __xn_put_user(src, dstP) __put_user(src, dstP)
#define __xn_get_user(dst, srcP) __get_user(dst, srcP)
#define __xn_strncpy_from_user(dstP, srcP, n) wrap_strncpy_from_user(dstP, srcP, n)
static inline int __xn_safe_copy_from_user(void *dst, const void __user *src,
size_t size)
{
return (!access_rok(src, size) ||
__xn_copy_from_user(dst, src, size)) ? -EFAULT : 0;
}
static inline int __xn_safe_copy_to_user(void __user *dst, const void *src,
size_t size)
{
return (!access_wok(dst, size) ||
__xn_copy_to_user(dst, src, size)) ? -EFAULT : 0;
}
static inline int __xn_safe_strncpy_from_user(char *dst,
const char __user *src, size_t count)
{
if (unlikely(!access_rok(src, 1)))
return -EFAULT;
return __xn_strncpy_from_user(dst, src, count);
}
#else /* !__KERNEL__ */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
int __xnsig_dispatch(struct xnsig *sigs, int cumulated_error, int last_error);
int __xnsig_dispatch_safe(struct xnsig *sigs, int cumulated_error, int last_error);
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* Called to dispatch signals which interrupted a system call. */
static inline int xnsig_dispatch(struct xnsig *sigs, int cumul, int last)
{
if (sigs->nsigs)
return __xnsig_dispatch(sigs, cumul, last);
return last;
}
static inline int xnsig_dispatch_safe(struct xnsig *sigs, int cumul, int last)
{
if (sigs->nsigs)
return __xnsig_dispatch_safe(sigs, cumul, last);
return last;
}
#endif /* !__KERNEL__ */
typedef struct xncompletion {
long syncflag; /* Semaphore variable. */
pid_t pid; /* Single waiter ID. */
} xncompletion_t;
#endif /* !_XENO_ASM_GENERIC_SYSCALL_H */
|