1 /* generally used "internal syscalls"
2 Copyright (C) 2009 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #ifndef KFREEBSD_INTERNAL_SYSCALLS_H
21 #define KFREEBSD_INTERNAL_SYSCALLS_H
23 #include <sys/syscall.h>
26 for now, we do not care whether syscall succeeded,
27 we do not have defined
28 INTERNAL_SYSCALL_ERROR_P and INTERNAL_SYSCALL_ERRNO
29 we do not store errno at all
30 to be sure, we return void
33 #undef INTERNAL_SYSCALL_DECL
34 #undef INTERNAL_SYSCALL_NCS
35 #undef INTERNAL_SYSCALL
36 #undef INTERNAL_SYSCALL_ERROR_P
37 #undef INTERNAL_SYSCALL_ERRNO
39 #define INTERNAL_SYSCALL_DECL(err) \
42 #define INTERNAL_SYSCALL(name, err, nr, args...) \
43 INTERNAL_SYSCALL_##name(name, err, nr, ##args)
46 #define INTERNAL_SYSCALL_clock_gettime(name, err, nr, clkid, ts) \
48 register long int _a1 = (long int) (clkid); \
49 register long int _a2 = (long int) (ts); \
50 register long int result; \
54 : "0" ((long int) SYS_##name), \
57 : "memory", "cc", "cx", "dx", "r8", "r9", "r10", "r11"); \
61 #define INTERNAL_SYSCALL_close(name, err, nr, fd) \
63 register long int _a1 = (long int) (fd); \
64 register long int result; \
68 : "0" ((long int) SYS_##name), \
70 : "memory", "cc", "cx", "dx", "r8", "r9", "r10", "r11"); \
74 #define INTERNAL_SYSCALL_kill(name, err, nr, pid, sig) \
76 register long int _a1 = (long int) (pid); \
77 register long int _a2 = (long int) (sig); \
78 register long int result; \
82 : "0" ((long int) SYS_##name), \
85 : "memory", "cc", "cx", "dx", "r8", "r9", "r10", "r11"); \
89 #define INTERNAL_SYSCALL_write(name, err, nr, fd, buf, cnt) \
91 register long int _a1 = (long int) (fd); \
92 register long int _a2 = (long int) (buf); \
93 register long int _a3 = (long int) (cnt); \
94 register long int result; \
95 register long int _trash; \
100 : "0" ((long int) SYS_##name), \
104 /* beware rdx is not preserved after syscall */ \
105 : "memory", "cc", "cx", "r8", "r9", "r10", "r11"); \
109 #define INTERNAL_SYSCALL_writev(name, err, nr, fd, iov, cnt) \
111 register long int _a1 = (long int) (fd); \
112 register long int _a2 = (long int) (iov); \
113 register long int _a3 = (long int) (cnt); \
114 register long int result; \
115 register long int _trash; \
120 : "0" ((long int) SYS_##name), \
124 /* beware rdx is not preserved after syscall */ \
125 : "memory", "cc", "cx", "r8", "r9", "r10", "r11"); \