MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / include / asm-nios2nommu / unistd.h
blob248ce0a2fd9e1b3b7c6fa1c3cbe503823853aba9
1 #ifndef _ASM_NIOS_UNISTD_H_
2 #define _ASM_NIOS_UNISTD_H_
4 /*--------------------------------------------------------------------
6 * include/asm-nios2nommu/unistd.h
8 * Derived from various works, Alpha, ix86, M68K, Sparc, ...et al
10 * Copyright (C) 2004 Microtronix Datacom Ltd
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
23 * //vic - kernel_thread moved to process.c
24 * Jan/20/2004 dgt NiosII
26 ---------------------------------------------------------------------*/
29 #include <asm/traps.h>
31 /* TRAP isr expects the trap# (syscall=#TRAP_ID_SYSCALL) in r2,
32 * the syscall # in r3, and arguments in r4, r5, ...
33 * Return argument expected in r2.
36 #define __NR_restart_syscall 0
37 #define __NR_exit 1
38 #define __NR_fork 2
39 #define __NR_read 3
40 #define __NR_write 4
41 #define __NR_open 5
42 #define __NR_close 6
43 #define __NR_waitpid 7
44 #define __NR_creat 8
45 #define __NR_link 9
46 #define __NR_unlink 10
47 #define __NR_execve 11
48 #define __NR_chdir 12
49 #define __NR_time 13
50 #define __NR_mknod 14
51 #define __NR_chmod 15
52 #define __NR_chown 16
53 #define __NR_break 17
54 #define __NR_oldstat 18
55 #define __NR_lseek 19
56 #define __NR_getpid 20
57 #define __NR_mount 21
58 #define __NR_umount 22
59 #define __NR_setuid 23
60 #define __NR_getuid 24
61 #define __NR_stime 25
62 #define __NR_ptrace 26
63 #define __NR_alarm 27
64 #define __NR_oldfstat 28
65 #define __NR_pause 29
66 #define __NR_utime 30
67 #define __NR_stty 31
68 #define __NR_gtty 32
69 #define __NR_access 33
70 #define __NR_nice 34
71 #define __NR_ftime 35
72 #define __NR_sync 36
73 #define __NR_kill 37
74 #define __NR_rename 38
75 #define __NR_mkdir 39
76 #define __NR_rmdir 40
77 #define __NR_dup 41
78 #define __NR_pipe 42
79 #define __NR_times 43
80 #define __NR_prof 44
81 #define __NR_brk 45
82 #define __NR_setgid 46
83 #define __NR_getgid 47
84 #define __NR_signal 48
85 #define __NR_geteuid 49
86 #define __NR_getegid 50
87 #define __NR_acct 51
88 #define __NR_umount2 52 //vic #define __NR_phys 52
89 #define __NR_lock 53
90 #define __NR_ioctl 54
91 #define __NR_fcntl 55
92 #define __NR_mpx 56
93 #define __NR_setpgid 57
94 #define __NR_ulimit 58
95 #define __NR_oldolduname 59
96 #define __NR_umask 60
97 #define __NR_chroot 61
98 #define __NR_ustat 62
99 #define __NR_dup2 63
100 #define __NR_getppid 64
101 #define __NR_getpgrp 65
102 #define __NR_setsid 66
103 #define __NR_sigaction 67
104 #define __NR_sgetmask 68
105 #define __NR_ssetmask 69
106 #define __NR_setreuid 70
107 #define __NR_setregid 71
108 #define __NR_sigsuspend 72
109 #define __NR_sigpending 73
110 #define __NR_sethostname 74
111 #define __NR_setrlimit 75
112 #define __NR_getrlimit 76
113 #define __NR_getrusage 77
114 #define __NR_gettimeofday 78
115 #define __NR_settimeofday 79
116 #define __NR_getgroups 80
117 #define __NR_setgroups 81
118 #define __NR_select 82
119 #define __NR_symlink 83
120 #define __NR_oldlstat 84
121 #define __NR_readlink 85
122 #define __NR_uselib 86
123 #define __NR_swapon 87
124 #define __NR_reboot 88
125 #define __NR_readdir 89
126 #define __NR_mmap 90
127 #define __NR_munmap 91
128 #define __NR_truncate 92
129 #define __NR_ftruncate 93
130 #define __NR_fchmod 94
131 #define __NR_fchown 95
132 #define __NR_getpriority 96
133 #define __NR_setpriority 97
134 #define __NR_profil 98
135 #define __NR_statfs 99
136 #define __NR_fstatfs 100
137 #define __NR_ioperm 101
138 #define __NR_socketcall 102
139 #define __NR_syslog 103
140 #define __NR_setitimer 104
141 #define __NR_getitimer 105
142 #define __NR_stat 106
143 #define __NR_lstat 107
144 #define __NR_fstat 108
145 #define __NR_olduname 109
146 #define __NR_iopl /* 110 */ not supported
147 #define __NR_vhangup 111
148 #define __NR_idle /* 112 */ Obsolete
149 #define __NR_vm86 /* 113 */ not supported
150 #define __NR_wait4 114
151 #define __NR_swapoff 115
152 #define __NR_sysinfo 116
153 #define __NR_ipc 117
154 #define __NR_fsync 118
155 #define __NR_sigreturn 119
156 #define __NR_clone 120
157 #define __NR_setdomainname 121
158 #define __NR_uname 122
159 #define __NR_cacheflush 123
160 #define __NR_adjtimex 124
161 #define __NR_mprotect 125
162 #define __NR_sigprocmask 126
163 #define __NR_create_module 127
164 #define __NR_init_module 128
165 #define __NR_delete_module 129
166 #define __NR_get_kernel_syms 130
167 #define __NR_quotactl 131
168 #define __NR_getpgid 132
169 #define __NR_fchdir 133
170 #define __NR_bdflush 134
171 #define __NR_sysfs 135
172 #define __NR_personality 136
173 #define __NR_afs_syscall 137 /* Syscall for Andrew File System */
174 #define __NR_setfsuid 138
175 #define __NR_setfsgid 139
176 #define __NR__llseek 140
177 #define __NR_getdents 141
178 #define __NR__newselect 142
179 #define __NR_flock 143
180 #define __NR_msync 144
181 #define __NR_readv 145
182 #define __NR_writev 146
183 #define __NR_getsid 147
184 #define __NR_fdatasync 148
185 #define __NR__sysctl 149
186 #define __NR_mlock 150
187 #define __NR_munlock 151
188 #define __NR_mlockall 152
189 #define __NR_munlockall 153
190 #define __NR_sched_setparam 154
191 #define __NR_sched_getparam 155
192 #define __NR_sched_setscheduler 156
193 #define __NR_sched_getscheduler 157
194 #define __NR_sched_yield 158
195 #define __NR_sched_get_priority_max 159
196 #define __NR_sched_get_priority_min 160
197 #define __NR_sched_rr_get_interval 161
198 #define __NR_nanosleep 162
199 #define __NR_mremap 163
200 #define __NR_setresuid 164
201 #define __NR_getresuid 165
202 #define __NR_getpagesize 166
203 #define __NR_query_module 167
204 #define __NR_poll 168
205 #define __NR_nfsservctl 169
206 #define __NR_setresgid 170
207 #define __NR_getresgid 171
208 #define __NR_prctl 172
209 #define __NR_rt_sigreturn 173
210 #define __NR_rt_sigaction 174
211 #define __NR_rt_sigprocmask 175
212 #define __NR_rt_sigpending 176
213 #define __NR_rt_sigtimedwait 177
214 #define __NR_rt_sigqueueinfo 178
215 #define __NR_rt_sigsuspend 179
216 #define __NR_pread64 180
217 #define __NR_pwrite64 181
218 #define __NR_lchown 182
219 #define __NR_getcwd 183
220 #define __NR_capget 184
221 #define __NR_capset 185
222 #define __NR_sigaltstack 186
223 #define __NR_sendfile 187
224 #define __NR_getpmsg 188 /* some people actually want streams */
225 #define __NR_putpmsg 189 /* some people actually want streams */
226 #define __NR_vfork 190
227 #define __NR_ugetrlimit 191
228 #define __NR_mmap2 192
229 #define __NR_truncate64 193
230 #define __NR_ftruncate64 194
231 #define __NR_stat64 195
232 #define __NR_lstat64 196
233 #define __NR_fstat64 197
234 #define __NR_chown32 198
235 #define __NR_getuid32 199
236 #define __NR_getgid32 200
237 #define __NR_geteuid32 201
238 #define __NR_getegid32 202
239 #define __NR_setreuid32 203
240 #define __NR_setregid32 204
241 #define __NR_getgroups32 205
242 #define __NR_setgroups32 206
243 #define __NR_fchown32 207
244 #define __NR_setresuid32 208
245 #define __NR_getresuid32 209
246 #define __NR_setresgid32 210
247 #define __NR_getresgid32 211
248 #define __NR_lchown32 212
249 #define __NR_setuid32 213
250 #define __NR_setgid32 214
251 #define __NR_setfsuid32 215
252 #define __NR_setfsgid32 216
253 #define __NR_pivot_root 217
254 #define __NR_getdents64 220
255 #define __NR_fcntl64 221
256 #define __NR_security 223
257 #define __NR_gettid 224
258 #define __NR_readahead 225
259 #define __NR_setxattr 226
260 #define __NR_lsetxattr 227
261 #define __NR_fsetxattr 228
262 #define __NR_getxattr 229
263 #define __NR_lgetxattr 230
264 #define __NR_fgetxattr 231
265 #define __NR_listxattr 232
266 #define __NR_llistxattr 233
267 #define __NR_flistxattr 234
268 #define __NR_removexattr 235
269 #define __NR_lremovexattr 236
270 #define __NR_fremovexattr 237
271 #define __NR_tkill 238
272 #define __NR_sendfile64 239
273 #define __NR_futex 240
274 #define __NR_sched_setaffinity 241
275 #define __NR_sched_getaffinity 242
276 #define __NR_set_thread_area 243
277 #define __NR_get_thread_area 244
278 #define __NR_io_setup 245
279 #define __NR_io_destroy 246
280 #define __NR_io_getevents 247
281 #define __NR_io_submit 248
282 #define __NR_io_cancel 249
283 #define __NR_alloc_hugepages 250
284 #define __NR_free_hugepages 251
285 #define __NR_exit_group 252
286 #define __NR_lookup_dcookie 253
287 #define __NR_sys_epoll_create 254
288 #define __NR_sys_epoll_ctl 255
289 #define __NR_sys_epoll_wait 256
290 #define __NR_remap_file_pages 257
291 #define __NR_set_tid_address 258
292 #define __NR_timer_create 259
293 #define __NR_timer_settime (__NR_timer_create+1)
294 #define __NR_timer_gettime (__NR_timer_create+2)
295 #define __NR_timer_getoverrun (__NR_timer_create+3)
296 #define __NR_timer_delete (__NR_timer_create+4)
297 #define __NR_clock_settime (__NR_timer_create+5)
298 #define __NR_clock_gettime (__NR_timer_create+6)
299 #define __NR_clock_getres (__NR_timer_create+7)
300 #define __NR_clock_nanosleep (__NR_timer_create+8)
301 #define __NR_statfs64 268
302 #define __NR_fstatfs64 269
303 #define __NR_tgkill 270
304 #define __NR_utimes 271
305 #define __NR_fadvise64_64 272
306 #define __NR_vserver 273
307 #define __NR_mbind 274
308 #define __NR_get_mempolicy 275
309 #define __NR_set_mempolicy 276
310 #define __NR_mq_open 277
311 #define __NR_mq_unlink (__NR_mq_open+1)
312 #define __NR_mq_timedsend (__NR_mq_open+2)
313 #define __NR_mq_timedreceive (__NR_mq_open+3)
314 #define __NR_mq_notify (__NR_mq_open+4)
315 #define __NR_mq_getsetattr (__NR_mq_open+5)
316 #define __NR_sys_kexec_load 283
317 #define __NR_waitid 284
318 /* #define __NR_sys_setaltroot 285 */
319 #define __NR_add_key 286
320 #define __NR_request_key 287
321 #define __NR_keyctl 288
323 #define NR_syscalls 289
326 /* user-visible error numbers are in the range -1 - -122: see
327 <asm-nios2nommu/errno.h> */
329 #define __syscall_return(type, res) \
330 do { \
331 if ((unsigned long)(res) >= (unsigned long)(-125)) { \
333 /* avoid using res which is declared to be in \
334 register r2; errno might expand to a function \
335 call and clobber it. */ \
337 int __err = -(res); \
338 errno = __err; \
339 res = -1; \
341 return (type) (res); \
342 } while (0)
344 #define _syscall0(type,name) \
345 type name(void) \
347 long __res; \
349 __asm__ __volatile__ ( \
351 " \n\t" \
353 " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
354 " movi r3, %1\n\t" /* __NR_##name */ \
356 " trap\n\t" \
357 " mov %0, r2\n\t" /* syscall rtn */ \
359 " \n\t" \
361 : "=r" (__res) /* %0 */ \
363 : "i" (__NR_##name) /* %1 */ \
364 , "i" (TRAP_ID_SYSCALL) /* %2 */ \
366 : "r2" /* Clobbered */ \
367 , "r3" /* Clobbered */ \
368 ); \
370 __syscall_return(type,__res); \
373 //;dgt2;tmp;can we RELY on syscall1 arg a
374 //;dgt2;tmp; already being in r4 ?
375 #define _syscall1(type,name,atype,a) \
376 type name(atype a) \
378 long __res; \
380 __asm__ __volatile__ ( \
382 " \n\t" \
384 " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
385 " movi r3, %1\n\t" /* __NR_##name */ \
386 " mov r4, %3\n\t" /* (long) a */ \
388 " trap\n\t" \
389 " mov %0, r2\n\t" /* syscall rtn */ \
391 " \n\t" \
393 : "=r" (__res) /* %0 */ \
395 : "i" (__NR_##name) /* %1 */ \
396 , "i" (TRAP_ID_SYSCALL) /* %2 */ \
397 , "r" ((long) a) /* %3 */ \
399 : "r2" /* Clobbered */ \
400 , "r3" /* Clobbered */ \
401 , "r4" /* Clobbered */ \
402 ); \
404 __syscall_return(type,__res); \
407 //;dgt2;tmp;can we RELY on syscall2 args a,b
408 //;dgt2;tmp; already being in r4,r5 ?
409 #define _syscall2(type,name,atype,a,btype,b) \
410 type name(atype a,btype b) \
412 long __res; \
414 __asm__ __volatile__ ( \
416 " \n\t" \
418 " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
419 " movi r3, %1\n\t" /* __NR_##name */ \
420 " mov r4, %3\n\t" /* (long) a */ \
421 " mov r5, %4\n\t" /* (long) b */ \
423 " trap\n\t" \
424 " mov %0, r2\n\t" /* syscall rtn */ \
426 " \n\t" \
428 : "=r" (__res) /* %0 */ \
430 : "i" (__NR_##name) /* %1 */ \
431 , "i" (TRAP_ID_SYSCALL) /* %2 */ \
432 , "r" ((long) a) /* %3 */ \
433 , "r" ((long) b) /* %4 */ \
435 : "r2" /* Clobbered */ \
436 , "r3" /* Clobbered */ \
437 , "r4" /* Clobbered */ \
438 , "r5" /* Clobbered */ \
439 ); \
441 __syscall_return(type,__res); \
444 //;dgt2;tmp;can we RELY on syscall3 args a,b,c
445 //;dgt2;tmp; already being in r4,r5,r6 ?
446 #define _syscall3(type,name,atype,a,btype,b,ctype,c) \
447 type name(atype a,btype b,ctype c) \
449 long __res; \
451 __asm__ __volatile__ ( \
453 " \n\t" \
455 " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
456 " movi r3, %1\n\t" /* __NR_##name */ \
457 " mov r4, %3\n\t" /* (long) a */ \
458 " mov r5, %4\n\t" /* (long) b */ \
459 " mov r6, %5\n\t" /* (long) c */ \
461 " trap\n\t" \
462 " mov %0, r2\n\t" /* syscall rtn */ \
464 " \n\t" \
466 : "=r" (__res) /* %0 */ \
468 : "i" (__NR_##name) /* %1 */ \
469 , "i" (TRAP_ID_SYSCALL) /* %2 */ \
470 , "r" ((long) a) /* %3 */ \
471 , "r" ((long) b) /* %4 */ \
472 , "r" ((long) c) /* %5 */ \
474 : "r2" /* Clobbered */ \
475 , "r3" /* Clobbered */ \
476 , "r4" /* Clobbered */ \
477 , "r5" /* Clobbered */ \
478 , "r6" /* Clobbered */ \
479 ); \
481 __syscall_return(type,__res); \
484 //;dgt2;tmp;can we RELY on syscall4 args a,b,c,d
485 //;dgt2;tmp; already being in r4,r5,r6,r7 ?
486 #define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
487 type name (atype a, btype b, ctype c, dtype d) \
489 long __res; \
491 __asm__ __volatile__ ( \
493 " \n\t" \
495 " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
496 " movi r3, %1\n\t" /* __NR_##name */ \
497 " mov r4, %3\n\t" /* (long) a */ \
498 " mov r5, %4\n\t" /* (long) b */ \
499 " mov r6, %5\n\t" /* (long) c */ \
500 " mov r7, %6\n\t" /* (long) d */ \
502 " trap\n\t" \
503 " mov %0, r2\n\t" /* syscall rtn */ \
505 " \n\t" \
507 : "=r" (__res) /* %0 */ \
509 : "i" (__NR_##name) /* %1 */ \
510 , "i" (TRAP_ID_SYSCALL) /* %2 */ \
511 , "r" ((long) a) /* %3 */ \
512 , "r" ((long) b) /* %4 */ \
513 , "r" ((long) c) /* %5 */ \
514 , "r" ((long) d) /* %6 */ \
516 : "r2" /* Clobbered */ \
517 , "r3" /* Clobbered */ \
518 , "r4" /* Clobbered */ \
519 , "r5" /* Clobbered */ \
520 , "r6" /* Clobbered */ \
521 , "r7" /* Clobbered */ \
522 ); \
524 __syscall_return(type,__res); \
527 //;dgt2;tmp;can we RELY on syscall5 args a,b,c,d
528 //;dgt2;tmp; already being in r4,r5,r6,r7 ?
529 #define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
530 type name (atype a,btype b,ctype c,dtype d,etype e) \
532 long __res; \
534 __asm__ __volatile__ ( \
536 " \n\t" \
538 " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
539 " movi r3, %1\n\t" /* __NR_##name */ \
540 " mov r4, %3\n\t" /* (long) a */ \
541 " mov r5, %4\n\t" /* (long) b */ \
542 " mov r6, %5\n\t" /* (long) c */ \
543 " mov r7, %6\n\t" /* (long) c */ \
544 " mov r8, %7\n\t" /* (long) e */ \
546 " trap\n\t" \
547 " mov %0, r2\n\t" /* syscall rtn */ \
549 " \n\t" \
551 : "=r" (__res) /* %0 */ \
553 : "i" (__NR_##name) /* %1 */ \
554 , "i" (TRAP_ID_SYSCALL) /* %2 */ \
555 , "r" ((long) a) /* %3 */ \
556 , "r" ((long) b) /* %4 */ \
557 , "r" ((long) c) /* %5 */ \
558 , "r" ((long) d) /* %6 */ \
559 , "r" ((long) e) /* %7 */ \
561 : "r2" /* Clobbered */ \
562 , "r3" /* Clobbered */ \
563 , "r4" /* Clobbered */ \
564 , "r5" /* Clobbered */ \
565 , "r6" /* Clobbered */ \
566 , "r7" /* Clobbered */ \
567 , "r8" /* Clobbered */ \
568 ); \
570 __syscall_return(type,__res); \
573 //;dgt2;tmp;can we RELY on syscall6 args a,b,c,d
574 //;dgt2;tmp; already being in r4,r5,r6,r7 ?
575 #define _syscall6(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e,ftype,f) \
576 type name (atype a,btype b,ctype c,dtype d,etype e,ftype f) \
578 long __res; \
580 __asm__ __volatile__ ( \
582 " \n\t" \
584 " movi r2, %2\n\t" /* TRAP_ID_SYSCALL */ \
585 " movi r3, %1\n\t" /* __NR_##name */ \
586 " mov r4, %3\n\t" /* (long) a */ \
587 " mov r5, %4\n\t" /* (long) b */ \
588 " mov r6, %5\n\t" /* (long) c */ \
589 " mov r7, %6\n\t" /* (long) c */ \
590 " mov r8, %7\n\t" /* (long) e */ \
591 " mov r9, %8\n\t" /* (long) f */ \
593 " trap\n\t" \
594 " mov %0, r2\n\t" /* syscall rtn */ \
596 " \n\t" \
598 : "=r" (__res) /* %0 */ \
600 : "i" (__NR_##name) /* %1 */ \
601 , "i" (TRAP_ID_SYSCALL) /* %2 */ \
602 , "r" ((long) a) /* %3 */ \
603 , "r" ((long) b) /* %4 */ \
604 , "r" ((long) c) /* %5 */ \
605 , "r" ((long) d) /* %6 */ \
606 , "r" ((long) e) /* %7 */ \
607 , "r" ((long) f) /* %8 */ \
609 : "r2" /* Clobbered */ \
610 , "r3" /* Clobbered */ \
611 , "r4" /* Clobbered */ \
612 , "r5" /* Clobbered */ \
613 , "r6" /* Clobbered */ \
614 , "r7" /* Clobbered */ \
615 , "r8" /* Clobbered */ \
616 , "r9" /* Clobbered */ \
617 ); \
619 __syscall_return(type,__res); \
622 #ifdef __KERNEL__
623 #define __ARCH_WANT_IPC_PARSE_VERSION
624 #define __ARCH_WANT_OLD_READDIR
625 #define __ARCH_WANT_OLD_STAT
626 #define __ARCH_WANT_STAT64
627 #define __ARCH_WANT_SYS_ALARM
628 #define __ARCH_WANT_SYS_GETHOSTNAME
629 #define __ARCH_WANT_SYS_PAUSE
630 #define __ARCH_WANT_SYS_SGETMASK
631 #define __ARCH_WANT_SYS_SIGNAL
632 #define __ARCH_WANT_SYS_TIME
633 #define __ARCH_WANT_SYS_UTIME
634 #define __ARCH_WANT_SYS_WAITPID
635 #define __ARCH_WANT_SYS_SOCKETCALL
636 #define __ARCH_WANT_SYS_FADVISE64
637 #define __ARCH_WANT_SYS_GETPGRP
638 #define __ARCH_WANT_SYS_LLSEEK
639 #define __ARCH_WANT_SYS_NICE
640 #define __ARCH_WANT_SYS_OLD_GETRLIMIT
641 #define __ARCH_WANT_SYS_OLDUMOUNT
642 #define __ARCH_WANT_SYS_SIGPENDING
643 #define __ARCH_WANT_SYS_SIGPROCMASK
644 #define __ARCH_WANT_SYS_RT_SIGACTION
645 #endif
647 #ifdef __KERNEL_SYSCALLS__
649 #include <linux/compiler.h>
650 #include <linux/types.h>
653 * we need this inline - forking from kernel space will result
654 * in NO COPY ON WRITE (!!!), until an execve is executed. This
655 * is no problem, but for the stack. This is handled by not letting
656 * main() use the stack at all after fork(). Thus, no function
657 * calls - which means inline code for fork too, as otherwise we
658 * would use the stack upon exit from 'fork()'.
660 * Actually only pause and fork are needed inline, so that there
661 * won't be any messing with the stack from main(), but we define
662 * some others too.
664 #define __NR__exit __NR_exit
665 static inline _syscall0(int,pause)
666 static inline _syscall0(int,sync)
667 static inline _syscall0(pid_t,setsid)
668 static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
669 static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
670 static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
671 static inline _syscall1(int,dup,int,fd)
672 static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
673 static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
674 static inline _syscall1(int,close,int,fd)
675 static inline _syscall1(int,_exit,int,exitcode)
676 static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
677 static inline _syscall1(int,delete_module,const char *,name)
679 static inline pid_t wait(int * wait_stat)
681 return waitpid(-1,wait_stat,0);
684 #endif
687 * "Conditional" syscalls
689 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
690 * but it doesn't work on all toolchains, so we just do it by hand
692 #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
694 #endif /* _ASM_NIOS_UNISTD_H_ */