1
2
3
4
5
6 package unix
7
8 import (
9 "syscall"
10 "unsafe"
11 )
12
13 var _ syscall.Errno
14
15
16
17 func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
18 _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)), 0)
19 if e1 != 0 {
20 err = errnoErr(e1)
21 }
22 return
23 }
24
25
26
27 func Fallocate(fd int, mode uint32, off int64, len int64) (err error) {
28 _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0)
29 if e1 != 0 {
30 err = errnoErr(e1)
31 }
32 return
33 }
34
35
36
37 func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
38 r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0)
39 n = int64(r0)
40 if e1 != 0 {
41 err = errnoErr(e1)
42 }
43 return
44 }
45
46
47
48 func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
49 var _p0 unsafe.Pointer
50 if len(events) > 0 {
51 _p0 = unsafe.Pointer(&events[0])
52 } else {
53 _p0 = unsafe.Pointer(&_zero)
54 }
55 r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
56 n = int(r0)
57 if e1 != 0 {
58 err = errnoErr(e1)
59 }
60 return
61 }
62
63
64
65 func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
66 _, _, e1 := Syscall6(SYS_FADVISE64, uintptr(fd), uintptr(offset), uintptr(length), uintptr(advice), 0, 0)
67 if e1 != 0 {
68 err = errnoErr(e1)
69 }
70 return
71 }
72
73
74
75 func Fchown(fd int, uid int, gid int) (err error) {
76 _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
77 if e1 != 0 {
78 err = errnoErr(e1)
79 }
80 return
81 }
82
83
84
85 func Fstat(fd int, stat *Stat_t) (err error) {
86 _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
87 if e1 != 0 {
88 err = errnoErr(e1)
89 }
90 return
91 }
92
93
94
95 func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) {
96 var _p0 *byte
97 _p0, err = BytePtrFromString(path)
98 if err != nil {
99 return
100 }
101 _, _, e1 := Syscall6(SYS_NEWFSTATAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
102 if e1 != 0 {
103 err = errnoErr(e1)
104 }
105 return
106 }
107
108
109
110 func Fstatfs(fd int, buf *Statfs_t) (err error) {
111 _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0)
112 if e1 != 0 {
113 err = errnoErr(e1)
114 }
115 return
116 }
117
118
119
120 func Ftruncate(fd int, length int64) (err error) {
121 _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0)
122 if e1 != 0 {
123 err = errnoErr(e1)
124 }
125 return
126 }
127
128
129
130 func Getegid() (egid int) {
131 r0, _ := RawSyscallNoError(SYS_GETEGID, 0, 0, 0)
132 egid = int(r0)
133 return
134 }
135
136
137
138 func Geteuid() (euid int) {
139 r0, _ := RawSyscallNoError(SYS_GETEUID, 0, 0, 0)
140 euid = int(r0)
141 return
142 }
143
144
145
146 func Getgid() (gid int) {
147 r0, _ := RawSyscallNoError(SYS_GETGID, 0, 0, 0)
148 gid = int(r0)
149 return
150 }
151
152
153
154 func Getrlimit(resource int, rlim *Rlimit) (err error) {
155 _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
156 if e1 != 0 {
157 err = errnoErr(e1)
158 }
159 return
160 }
161
162
163
164 func Getuid() (uid int) {
165 r0, _ := RawSyscallNoError(SYS_GETUID, 0, 0, 0)
166 uid = int(r0)
167 return
168 }
169
170
171
172 func Lchown(path string, uid int, gid int) (err error) {
173 var _p0 *byte
174 _p0, err = BytePtrFromString(path)
175 if err != nil {
176 return
177 }
178 _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
179 if e1 != 0 {
180 err = errnoErr(e1)
181 }
182 return
183 }
184
185
186
187 func Lstat(path string, stat *Stat_t) (err error) {
188 var _p0 *byte
189 _p0, err = BytePtrFromString(path)
190 if err != nil {
191 return
192 }
193 _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
194 if e1 != 0 {
195 err = errnoErr(e1)
196 }
197 return
198 }
199
200
201
202 func Pause() (err error) {
203 _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0)
204 if e1 != 0 {
205 err = errnoErr(e1)
206 }
207 return
208 }
209
210
211
212 func pread(fd int, p []byte, offset int64) (n int, err error) {
213 var _p0 unsafe.Pointer
214 if len(p) > 0 {
215 _p0 = unsafe.Pointer(&p[0])
216 } else {
217 _p0 = unsafe.Pointer(&_zero)
218 }
219 r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
220 n = int(r0)
221 if e1 != 0 {
222 err = errnoErr(e1)
223 }
224 return
225 }
226
227
228
229 func pwrite(fd int, p []byte, offset int64) (n int, err error) {
230 var _p0 unsafe.Pointer
231 if len(p) > 0 {
232 _p0 = unsafe.Pointer(&p[0])
233 } else {
234 _p0 = unsafe.Pointer(&_zero)
235 }
236 r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
237 n = int(r0)
238 if e1 != 0 {
239 err = errnoErr(e1)
240 }
241 return
242 }
243
244
245
246 func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
247 var _p0 *byte
248 _p0, err = BytePtrFromString(oldpath)
249 if err != nil {
250 return
251 }
252 var _p1 *byte
253 _p1, err = BytePtrFromString(newpath)
254 if err != nil {
255 return
256 }
257 _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
258 if e1 != 0 {
259 err = errnoErr(e1)
260 }
261 return
262 }
263
264
265
266 func Seek(fd int, offset int64, whence int) (off int64, err error) {
267 r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
268 off = int64(r0)
269 if e1 != 0 {
270 err = errnoErr(e1)
271 }
272 return
273 }
274
275
276
277 func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
278 r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
279 n = int(r0)
280 if e1 != 0 {
281 err = errnoErr(e1)
282 }
283 return
284 }
285
286
287
288 func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
289 r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0)
290 written = int(r0)
291 if e1 != 0 {
292 err = errnoErr(e1)
293 }
294 return
295 }
296
297
298
299 func setfsgid(gid int) (prev int, err error) {
300 r0, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0)
301 prev = int(r0)
302 if e1 != 0 {
303 err = errnoErr(e1)
304 }
305 return
306 }
307
308
309
310 func setfsuid(uid int) (prev int, err error) {
311 r0, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0)
312 prev = int(r0)
313 if e1 != 0 {
314 err = errnoErr(e1)
315 }
316 return
317 }
318
319
320
321 func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
322 r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
323 n = int64(r0)
324 if e1 != 0 {
325 err = errnoErr(e1)
326 }
327 return
328 }
329
330
331
332 func Stat(path string, stat *Stat_t) (err error) {
333 var _p0 *byte
334 _p0, err = BytePtrFromString(path)
335 if err != nil {
336 return
337 }
338 _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
339 if e1 != 0 {
340 err = errnoErr(e1)
341 }
342 return
343 }
344
345
346
347 func Statfs(path string, buf *Statfs_t) (err error) {
348 var _p0 *byte
349 _p0, err = BytePtrFromString(path)
350 if err != nil {
351 return
352 }
353 _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
354 if e1 != 0 {
355 err = errnoErr(e1)
356 }
357 return
358 }
359
360
361
362 func SyncFileRange(fd int, off int64, n int64, flags int) (err error) {
363 _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE, uintptr(fd), uintptr(off), uintptr(n), uintptr(flags), 0, 0)
364 if e1 != 0 {
365 err = errnoErr(e1)
366 }
367 return
368 }
369
370
371
372 func Truncate(path string, length int64) (err error) {
373 var _p0 *byte
374 _p0, err = BytePtrFromString(path)
375 if err != nil {
376 return
377 }
378 _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
379 if e1 != 0 {
380 err = errnoErr(e1)
381 }
382 return
383 }
384
385
386
387 func Ustat(dev int, ubuf *Ustat_t) (err error) {
388 _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0)
389 if e1 != 0 {
390 err = errnoErr(e1)
391 }
392 return
393 }
394
395
396
397 func getgroups(n int, list *_Gid_t) (nn int, err error) {
398 r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
399 nn = int(r0)
400 if e1 != 0 {
401 err = errnoErr(e1)
402 }
403 return
404 }
405
406
407
408 func setgroups(n int, list *_Gid_t) (err error) {
409 _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
410 if e1 != 0 {
411 err = errnoErr(e1)
412 }
413 return
414 }
415
416
417
418 func futimesat(dirfd int, path string, times *[2]Timeval) (err error) {
419 var _p0 *byte
420 _p0, err = BytePtrFromString(path)
421 if err != nil {
422 return
423 }
424 _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)))
425 if e1 != 0 {
426 err = errnoErr(e1)
427 }
428 return
429 }
430
431
432
433 func Gettimeofday(tv *Timeval) (err error) {
434 _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
435 if e1 != 0 {
436 err = errnoErr(e1)
437 }
438 return
439 }
440
441
442
443 func Utime(path string, buf *Utimbuf) (err error) {
444 var _p0 *byte
445 _p0, err = BytePtrFromString(path)
446 if err != nil {
447 return
448 }
449 _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
450 if e1 != 0 {
451 err = errnoErr(e1)
452 }
453 return
454 }
455
456
457
458 func utimes(path string, times *[2]Timeval) (err error) {
459 var _p0 *byte
460 _p0, err = BytePtrFromString(path)
461 if err != nil {
462 return
463 }
464 _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
465 if e1 != 0 {
466 err = errnoErr(e1)
467 }
468 return
469 }
470
471
472
473 func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) {
474 var _p0 *byte
475 _p0, err = BytePtrFromString(cmdline)
476 if err != nil {
477 return
478 }
479 _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
480 if e1 != 0 {
481 err = errnoErr(e1)
482 }
483 return
484 }
485
486
487
488 func Alarm(seconds uint) (remaining uint, err error) {
489 r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0)
490 remaining = uint(r0)
491 if e1 != 0 {
492 err = errnoErr(e1)
493 }
494 return
495 }
496
View as plain text