Source file
src/runtime/syscall_aix.go
Documentation: runtime
1
2
3
4
5 package runtime
6
7 import "unsafe"
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 var (
41 libc_chdir,
42 libc_chroot,
43 libc_dup2,
44 libc_execve,
45 libc_fcntl,
46 libc_fork,
47 libc_ioctl,
48 libc_setgid,
49 libc_setgroups,
50 libc_setrlimit,
51 libc_setsid,
52 libc_setuid,
53 libc_setpgid libFunc
54 )
55
56
57
58
59
60
61
62
63
64
65
66
67
68 func syscall_Syscall(fn, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
69 return 0, 0, _EINVAL
70 }
71
72
73
74
75
76
77
78 func syscall_RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
79 panic("RawSyscall not available on AIX")
80 }
81
82
83
84
85
86
87 func syscall_syscall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
88 c := libcall{
89 fn: fn,
90 n: nargs,
91 args: uintptr(unsafe.Pointer(&a1)),
92 }
93
94 entersyscallblock()
95 asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(&c))
96 exitsyscall()
97 return c.r1, 0, c.err
98 }
99
100
101
102
103
104
105 func syscall_rawSyscall6(fn, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) {
106 c := libcall{
107 fn: fn,
108 n: nargs,
109 args: uintptr(unsafe.Pointer(&a1)),
110 }
111
112 asmcgocall(unsafe.Pointer(&asmsyscall6), unsafe.Pointer(&c))
113
114 return c.r1, 0, c.err
115 }
116
117
118
119 func syscall_chdir(path uintptr) (err uintptr) {
120 _, err = syscall1(&libc_chdir, path)
121 return
122 }
123
124
125
126 func syscall_chroot1(path uintptr) (err uintptr) {
127 _, err = syscall1(&libc_chroot, path)
128 return
129 }
130
131
132
133
134
135 func syscall_closeFD(fd int32) int32 {
136 _, err := syscall1(&libc_close, uintptr(fd))
137 return int32(err)
138 }
139
140
141
142 func syscall_dup2child(old, new uintptr) (val, err uintptr) {
143 val, err = syscall2(&libc_dup2, old, new)
144 return
145 }
146
147
148
149 func syscall_execve(path, argv, envp uintptr) (err uintptr) {
150 _, err = syscall3(&libc_execve, path, argv, envp)
151 return
152 }
153
154
155
156
157
158 func syscall_exit(code uintptr) {
159 syscall1(&libc_exit, code)
160 }
161
162
163
164 func syscall_fcntl1(fd, cmd, arg uintptr) (val, err uintptr) {
165 val, err = syscall3(&libc_fcntl, fd, cmd, arg)
166 return
167 }
168
169
170
171 func syscall_forkx(flags uintptr) (pid uintptr, err uintptr) {
172 pid, err = syscall1(&libc_fork, flags)
173 return
174 }
175
176
177
178 func syscall_getpid() (pid, err uintptr) {
179 pid, err = syscall0(&libc_getpid)
180 return
181 }
182
183
184
185 func syscall_ioctl(fd, req, arg uintptr) (err uintptr) {
186 _, err = syscall3(&libc_ioctl, fd, req, arg)
187 return
188 }
189
190
191
192 func syscall_setgid(gid uintptr) (err uintptr) {
193 _, err = syscall1(&libc_setgid, gid)
194 return
195 }
196
197
198
199 func syscall_setgroups1(ngid, gid uintptr) (err uintptr) {
200 _, err = syscall2(&libc_setgroups, ngid, gid)
201 return
202 }
203
204
205
206 func syscall_setrlimit1(which uintptr, lim unsafe.Pointer) (err uintptr) {
207 _, err = syscall2(&libc_setrlimit, which, uintptr(lim))
208 return
209 }
210
211
212
213 func syscall_setsid() (pid, err uintptr) {
214 pid, err = syscall0(&libc_setsid)
215 return
216 }
217
218
219
220 func syscall_setuid(uid uintptr) (err uintptr) {
221 _, err = syscall1(&libc_setuid, uid)
222 return
223 }
224
225
226
227 func syscall_setpgid(pid, pgid uintptr) (err uintptr) {
228 _, err = syscall2(&libc_setpgid, pid, pgid)
229 return
230 }
231
232
233
234 func syscall_write1(fd, buf, nbyte uintptr) (n, err uintptr) {
235 n, err = syscall3(&libc_write, fd, buf, nbyte)
236 return
237 }
238
View as plain text