1 /*
2 (C) Copyright IBM Corp. 2008
3 
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8 
9 * Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14 * Neither the name of IBM nor the names of its contributors may be
15 used to endorse or promote products derived from this software without
16 specific prior written permission.
17 
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 POSSIBILITY OF SUCH DAMAGE.
29 
30 Author: Ken Werner <ken.werner@de.ibm.com>
31 */
32 
33 #ifndef __LINUX_SYSCALLS_H
34 #define __LINUX_SYSCALLS_H
35 
36 #include <sys/types.h>
37 
38 /* The system call numbers. See kernel source file
39    arch/powerpc/include/asm/unistd.h.  */
40 #define __NR_read                   3
41 #define __NR_write                  4
42 #define __NR_open                   5
43 #define __NR_close                  6
44 #define __NR_waitpid                7
45 #define __NR_creat                  8
46 #define __NR_link                   9
47 #define __NR_unlink                 10
48 
49 #define __NR_chdir                  12
50 #define __NR_time                   13
51 #define __NR_mkdod                  14
52 #define __NR_chmod                  15
53 #define __NR_lchown                 16
54 
55 #define __NR_lseek                  19
56 #define __NR_getpid                 20
57 
58 #define __NR_setuid                 23
59 #define __NR_getuid                 24
60 #define __NR_stime                  25
61 
62 #define __NR_alarm                  27
63 
64 #define __NR_access                 33
65 #define __NR_nice                   34
66 
67 #define __NR_sync                   36
68 #define __NR_kill                   37
69 #define __NR_rename                 38
70 #define __NR_mkdir                  39
71 #define __NR_rmdir                  40
72 #define __NR_dup                    41
73 #define __NR_pipe                   42
74 #define __NR_times                  43
75 
76 #define __NR_brk                    45
77 #define __NR_setgid                 46
78 #define __NR_getgid                 47
79 
80 #define __NR_geteuid                49
81 #define __NR_getegid                50
82 
83 #define __NR_ioctl                  54
84 #define __NR_fcntl                  55
85 
86 #define __NR_setpgid                57
87 
88 #define __NR_umask                  60
89 #define __NR_chroot                 61
90 
91 #define __NR_dup2                   63
92 #define __NR_getppid                64
93 #define __NR_getpgrp                65
94 #define __NR_setsid                 66
95 
96 #define __NR_sgetmask               68
97 #define __NR_ssetmask               69
98 #define __NR_setreuid               70
99 #define __NR_setregid               71
100 
101 #define __NR_sethostname            74
102 #define __NR_setrlimit              75
103 
104 #define __NR_getrusage              77
105 #define __NR_gettimeofday           78
106 #define __NR_settimeofday           79
107 #define __NR_getgroups              80
108 #define __NR_setgroups              81
109 
110 #define __NR_symlink                83
111 
112 #define __NR_readlink               85
113 
114 #define __NR_mmap                   90
115 #define __NR_munmap                 91
116 #define __NR_truncate               92
117 #define __NR_ftruncate              93
118 #define __NR_fchmod                 94
119 #define __NR_fchown                 95
120 #define __NR_getpriority            96
121 #define __NR_setpriority            97
122 
123 #define __NR_socketcall             102
124 #define __NR_syslog                 103
125 #define __NR_setitimer              104
126 #define __NR_getitimer              105
127 #define __NR_newstat                106
128 #define __NR_newlstat               107
129 #define __NR_newfstat               108
130 
131 #define __NR_vhangup                111
132 
133 #define __NR_wait4                  114
134 
135 #define __NR_sysinfo                116
136 
137 #define __NR_fsync                  118
138 
139 #define __NR_setdomainname          121
140 #define __NR_newuname               122
141 
142 #define __NR_adjtimex               124
143 #define __NR_mprotect               125
144 
145 #define __NR_getpgid                132
146 #define __NR_fchdir                 133
147 #define __NR_bdflush                134
148 
149 #define __NR_personality            136
150 
151 #define __NR_setfsuid               138
152 #define __NR_setfsgid               139
153 #define __NR__llseek                140
154 #define __NR_getdents               141
155 #define __NR__newselect             142
156 #define __NR_flock                  143
157 #define __NR_msync                  144
158 #define __NR_readv                  145
159 #define __NR_writev                 146
160 #define __NR_getsid                 147
161 #define __NR_fdatasync              148
162 
163 #define __NR_mlock                  150
164 #define __NR_munlock                151
165 #define __NR_mlockall               152
166 #define __NR_munlockall             153
167 #define __NR_sched_setparam         154
168 #define __NR_sched_getparam         155
169 #define __NR_sched_setscheduler     156
170 #define __NR_sched_getscheduler     157
171 #define __NR_sched_yield            158
172 #define __NR_sched_get_priority_max 159
173 #define __NR_sched_get_priority_min 160
174 #define __NR_sched_rr_get_interval  161
175 #define __NR_nanosleep              162
176 #define __NR_mremap                 163
177 #define __NR_setresuid              164
178 #define __NR_getresuid              165
179 
180 #define __NR_poll                   167
181 
182 #define __NR_setresgid              169
183 #define __NR_getresgid              170
184 #define __NR_prctl                  171
185 
186 #define __NR_pread64                179
187 #define __NR_pwrite64               180
188 #define __NR_chown                  181
189 #define __NR_getcwd                 182
190 #define __NR_capget                 183
191 #define __NR_capset                 184
192 
193 #define __NR_sendfile               185
194 
195 #define __NR_getrlimit              190
196 #define __NR_readahead              191
197 
198 #define __NR_getdents64             202
199 #define __NR_pivot_root             203
200 
201 #define __NR_madvise                205
202 #define __NR_mincore                206
203 #define __NR_gettid                 207
204 #define __NR_tkill                  208
205 #define __NR_setxattr               209
206 #define __NR_lsetxattr              210
207 #define __NR_fsetxattr              211
208 #define __NR_getxattr               212
209 #define __NR_lgetxattr              213
210 #define __NR_fgetxattr              214
211 #define __NR_listxattr              215
212 #define __NR_llistxattr             216
213 #define __NR_flistxattr             217
214 #define __NR_removexattr            218
215 #define __NR_lremovexattr           219
216 #define __NR_fremovexattr           220
217 #define __NR_futex                  221
218 #define __NR_sched_setaffinity      222
219 #define __NR_sched_getaffinity      223
220 
221 #define __NR_io_setup               227
222 #define __NR_io_destroy             228
223 #define __NR_io_getevents           229
224 #define __NR_io_submit              230
225 #define __NR_io_cancel              231
226 
227 #define __NR_fadvise64              233
228 
229 #define __NR_epoll_create           236
230 #define __NR_epoll_ctl              237
231 #define __NR_epoll_wait             238
232 #define __NR_remap_file_pages       239
233 #define __NR_timer_create           240
234 #define __NR_timer_settime          241
235 #define __NR_timer_gettime          242
236 #define __NR_timer_getoverrun       243
237 #define __NR_timer_delete           244
238 #define __NR_clock_settime          245
239 #define __NR_clock_gettime          246
240 #define __NR_clock_getres           247
241 #define __NR_clock_nanosleep        248
242 
243 #define __NR_tgkill                 250
244 #define __NR_utimes                 251
245 #define __NR_statfs64               252
246 #define __NR_fstatfs64              253
247 
248 #define __NR_rtas                   255
249 
250 #define __NR_unshare                282
251 #define __NR_splice                 283
252 #define __NR_tee                    284
253 #define __NR_vmsplice               285
254 #define __NR_openat                 286
255 #define __NR_mkdirat                287
256 #define __NR_mknodat                288
257 #define __NR_fchownat               289
258 #define __NR_futimesat              290
259 #define __NR_fstatat64              291
260 #define __NR_unlinkat               292
261 #define __NR_renameat               293
262 #define __NR_linkat                 294
263 #define __NR_symlinkat              295
264 #define __NR_readlinkat             296
265 #define __NR_fchmodat               297
266 #define __NR_faccessat              298
267 #define __NR_get_robust_list        299
268 #define __NR_set_robust_list        300
269 #define __NR_move_pages             301
270 #define __NR_getcpu                 302
271 
272 #define __NR_utimensat              304
273 #define __NR_signalfd               305
274 #define __NR_timerfd                306
275 #define __NR_eventfd                307
276 #define __NR_sync_file_range2       308
277 #define __NR_fallocate              309
278 #define __NR_subpage_prot           310
279 #define __NR_timerfd_settime        311
280 #define __NR_timerfd_gettime        312
281 #define __NR_signalfd4              313
282 #define __NR_eventfd2               314
283 #define __NR_epoll_create1          315
284 #define __NR_dup3                   316
285 #define __NR_pipe2                  317
286 #define __NR_inotify_init1          318
287 
288 /* System callbacks from the SPU. See kernel source file
289    arch/powerpc/include/asm/spu.h.  */
290 struct spu_syscall_block
291 {
292   unsigned long long nr_ret;	/* System call nr and return value.  */
293   unsigned long long parm[6];	/* System call arguments.  */
294 };
295 
296 #ifdef __cplusplus
297 extern "C" {
298 #endif
299 
300 /* Issues a Linux system call.  */
301 int __linux_syscall (struct spu_syscall_block *s);
302 
303 /* Linux system calls.  */
304 pid_t linux_getpid(void);
305 pid_t linux_gettid(void);
306 
307 #ifdef __cplusplus
308 }
309 #endif
310 #endif
311