This source file includes following definitions.
- _syscall0
1 #ifndef _ASM_I386_UNISTD_H_
2 #define _ASM_I386_UNISTD_H_
3
4
5 #define _syscall0(type,name) \
6 type name(void) \
7 { \
8 long __res; \
9 __asm__ volatile ("int $0x80" \
10 : "=a" (__res) \
11 : "0" (__NR_##name)); \
12 if (__res >= 0) \
13 return (type) __res; \
14 errno = -__res; \
15 return -1; \
16 }
17
18 #define _syscall1(type,name,type1,arg1) \
19 type name(type1 arg1) \
20 { \
21 long __res; \
22 __asm__ volatile ("int $0x80" \
23 : "=a" (__res) \
24 : "0" (__NR_##name),"b" ((long)(arg1))); \
25 if (__res >= 0) \
26 return (type) __res; \
27 errno = -__res; \
28 return -1; \
29 }
30
31 #define _syscall2(type,name,type1,arg1,type2,arg2) \
32 type name(type1 arg1,type2 arg2) \
33 { \
34 long __res; \
35 __asm__ volatile ("int $0x80" \
36 : "=a" (__res) \
37 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \
38 if (__res >= 0) \
39 return (type) __res; \
40 errno = -__res; \
41 return -1; \
42 }
43
44 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
45 type name(type1 arg1,type2 arg2,type3 arg3) \
46 { \
47 long __res; \
48 __asm__ volatile ("int $0x80" \
49 : "=a" (__res) \
50 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
51 "d" ((long)(arg3))); \
52 if (__res>=0) \
53 return (type) __res; \
54 errno=-__res; \
55 return -1; \
56 }
57
58 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
59 type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
60 { \
61 long __res; \
62 __asm__ volatile ("int $0x80" \
63 : "=a" (__res) \
64 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
65 "d" ((long)(arg3)),"S" ((long)(arg4))); \
66 if (__res>=0) \
67 return (type) __res; \
68 errno=-__res; \
69 return -1; \
70 }
71
72 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
73 type5,arg5) \
74 type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
75 { \
76 long __res; \
77 __asm__ volatile ("int $0x80" \
78 : "=a" (__res) \
79 : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
80 "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
81 if (__res>=0) \
82 return (type) __res; \
83 errno=-__res; \
84 return -1; \
85 }
86
87 #ifdef __KERNEL_SYSCALLS__
88
89
90
91
92
93
94
95
96
97
98
99
100
101 #define __NR__exit __NR_exit
102 static inline _syscall0(int,idle)
103 static inline _syscall0(int,fork)
104 static inline _syscall0(int,pause)
105 static inline _syscall0(int,setup)
106 static inline _syscall0(int,sync)
107 static inline _syscall0(pid_t,setsid)
108 static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
109 static inline _syscall1(int,dup,int,fd)
110 static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
111 static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
112 static inline _syscall1(int,close,int,fd)
113 static inline _syscall1(int,_exit,int,exitcode)
114 static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
115
116 static inline pid_t wait(int * wait_stat)
117 {
118 return waitpid(-1,wait_stat,0);
119 }
120
121 #endif
122
123 #endif