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>>32), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)))
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>>32), uintptr(off), uintptr(len>>32), uintptr(len))
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, r1, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0)
39 n = int64(int64(r0)<<32 | int64(r1))
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 Fchown(fd int, uid int, gid int) (err error) {
66 _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
67 if e1 != 0 {
68 err = errnoErr(e1)
69 }
70 return
71 }
72
73
74
75 func Fstat(fd int, stat *Stat_t) (err error) {
76 _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
77 if e1 != 0 {
78 err = errnoErr(e1)
79 }
80 return
81 }
82
83
84
85 func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) {
86 var _p0 *byte
87 _p0, err = BytePtrFromString(path)
88 if err != nil {
89 return
90 }
91 _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
92 if e1 != 0 {
93 err = errnoErr(e1)
94 }
95 return
96 }
97
98
99
100 func Ftruncate(fd int, length int64) (err error) {
101 _, _, e1 := Syscall(SYS_FTRUNCATE64, uintptr(fd), uintptr(length>>32), uintptr(length))
102 if e1 != 0 {
103 err = errnoErr(e1)
104 }
105 return
106 }
107
108
109
110 func Getegid() (egid int) {
111 r0, _ := RawSyscallNoError(SYS_GETEGID, 0, 0, 0)
112 egid = int(r0)
113 return
114 }
115
116
117
118 func Geteuid() (euid int) {
119 r0, _ := RawSyscallNoError(SYS_GETEUID, 0, 0, 0)
120 euid = int(r0)
121 return
122 }
123
124
125
126 func Getgid() (gid int) {
127 r0, _ := RawSyscallNoError(SYS_GETGID, 0, 0, 0)
128 gid = int(r0)
129 return
130 }
131
132
133
134 func Getuid() (uid int) {
135 r0, _ := RawSyscallNoError(SYS_GETUID, 0, 0, 0)
136 uid = int(r0)
137 return
138 }
139
140
141
142 func Ioperm(from int, num int, on int) (err error) {
143 _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on))
144 if e1 != 0 {
145 err = errnoErr(e1)
146 }
147 return
148 }
149
150
151
152 func Iopl(level int) (err error) {
153 _, _, e1 := Syscall(SYS_IOPL, uintptr(level), 0, 0)
154 if e1 != 0 {
155 err = errnoErr(e1)
156 }
157 return
158 }
159
160
161
162 func Lchown(path string, uid int, gid int) (err error) {
163 var _p0 *byte
164 _p0, err = BytePtrFromString(path)
165 if err != nil {
166 return
167 }
168 _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
169 if e1 != 0 {
170 err = errnoErr(e1)
171 }
172 return
173 }
174
175
176
177 func Listen(s int, n int) (err error) {
178 _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0)
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_LSTAT64, 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>>32), uintptr(offset), 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>>32), uintptr(offset), 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 Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
267 r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
268 n = int(r0)
269 if e1 != 0 {
270 err = errnoErr(e1)
271 }
272 return
273 }
274
275
276
277 func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
278 r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0)
279 written = int(r0)
280 if e1 != 0 {
281 err = errnoErr(e1)
282 }
283 return
284 }
285
286
287
288 func setfsgid(gid int) (prev int, err error) {
289 r0, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0)
290 prev = int(r0)
291 if e1 != 0 {
292 err = errnoErr(e1)
293 }
294 return
295 }
296
297
298
299 func setfsuid(uid int) (prev int, err error) {
300 r0, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0)
301 prev = int(r0)
302 if e1 != 0 {
303 err = errnoErr(e1)
304 }
305 return
306 }
307
308
309
310 func Shutdown(fd int, how int) (err error) {
311 _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
312 if e1 != 0 {
313 err = errnoErr(e1)
314 }
315 return
316 }
317
318
319
320 func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
321 r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
322 n = int(r0)
323 if e1 != 0 {
324 err = errnoErr(e1)
325 }
326 return
327 }
328
329
330
331 func Stat(path string, stat *Stat_t) (err error) {
332 var _p0 *byte
333 _p0, err = BytePtrFromString(path)
334 if err != nil {
335 return
336 }
337 _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
338 if e1 != 0 {
339 err = errnoErr(e1)
340 }
341 return
342 }
343
344
345
346 func Truncate(path string, length int64) (err error) {
347 var _p0 *byte
348 _p0, err = BytePtrFromString(path)
349 if err != nil {
350 return
351 }
352 _, _, e1 := Syscall(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), uintptr(length>>32), uintptr(length))
353 if e1 != 0 {
354 err = errnoErr(e1)
355 }
356 return
357 }
358
359
360
361 func Ustat(dev int, ubuf *Ustat_t) (err error) {
362 _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0)
363 if e1 != 0 {
364 err = errnoErr(e1)
365 }
366 return
367 }
368
369
370
371 func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
372 r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
373 fd = int(r0)
374 if e1 != 0 {
375 err = errnoErr(e1)
376 }
377 return
378 }
379
380
381
382 func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
383 _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen))
384 if e1 != 0 {
385 err = errnoErr(e1)
386 }
387 return
388 }
389
390
391
392 func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
393 _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen))
394 if e1 != 0 {
395 err = errnoErr(e1)
396 }
397 return
398 }
399
400
401
402 func getgroups(n int, list *_Gid_t) (nn int, err error) {
403 r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
404 nn = int(r0)
405 if e1 != 0 {
406 err = errnoErr(e1)
407 }
408 return
409 }
410
411
412
413 func setgroups(n int, list *_Gid_t) (err error) {
414 _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
415 if e1 != 0 {
416 err = errnoErr(e1)
417 }
418 return
419 }
420
421
422
423 func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
424 _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
425 if e1 != 0 {
426 err = errnoErr(e1)
427 }
428 return
429 }
430
431
432
433 func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
434 _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
435 if e1 != 0 {
436 err = errnoErr(e1)
437 }
438 return
439 }
440
441
442
443 func socket(domain int, typ int, proto int) (fd int, err error) {
444 r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
445 fd = int(r0)
446 if e1 != 0 {
447 err = errnoErr(e1)
448 }
449 return
450 }
451
452
453
454 func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
455 _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
456 if e1 != 0 {
457 err = errnoErr(e1)
458 }
459 return
460 }
461
462
463
464 func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
465 _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
466 if e1 != 0 {
467 err = errnoErr(e1)
468 }
469 return
470 }
471
472
473
474 func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
475 _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
476 if e1 != 0 {
477 err = errnoErr(e1)
478 }
479 return
480 }
481
482
483
484 func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
485 var _p0 unsafe.Pointer
486 if len(p) > 0 {
487 _p0 = unsafe.Pointer(&p[0])
488 } else {
489 _p0 = unsafe.Pointer(&_zero)
490 }
491 r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
492 n = int(r0)
493 if e1 != 0 {
494 err = errnoErr(e1)
495 }
496 return
497 }
498
499
500
501 func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
502 var _p0 unsafe.Pointer
503 if len(buf) > 0 {
504 _p0 = unsafe.Pointer(&buf[0])
505 } else {
506 _p0 = unsafe.Pointer(&_zero)
507 }
508 _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
509 if e1 != 0 {
510 err = errnoErr(e1)
511 }
512 return
513 }
514
515
516
517 func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
518 r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
519 n = int(r0)
520 if e1 != 0 {
521 err = errnoErr(e1)
522 }
523 return
524 }
525
526
527
528 func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
529 r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
530 n = int(r0)
531 if e1 != 0 {
532 err = errnoErr(e1)
533 }
534 return
535 }
536
537
538
539 func futimesat(dirfd int, path string, times *[2]Timeval) (err error) {
540 var _p0 *byte
541 _p0, err = BytePtrFromString(path)
542 if err != nil {
543 return
544 }
545 _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)))
546 if e1 != 0 {
547 err = errnoErr(e1)
548 }
549 return
550 }
551
552
553
554 func Gettimeofday(tv *Timeval) (err error) {
555 _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
556 if e1 != 0 {
557 err = errnoErr(e1)
558 }
559 return
560 }
561
562
563
564 func Time(t *Time_t) (tt Time_t, err error) {
565 r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0)
566 tt = Time_t(r0)
567 if e1 != 0 {
568 err = errnoErr(e1)
569 }
570 return
571 }
572
573
574
575 func Utime(path string, buf *Utimbuf) (err error) {
576 var _p0 *byte
577 _p0, err = BytePtrFromString(path)
578 if err != nil {
579 return
580 }
581 _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
582 if e1 != 0 {
583 err = errnoErr(e1)
584 }
585 return
586 }
587
588
589
590 func utimes(path string, times *[2]Timeval) (err error) {
591 var _p0 *byte
592 _p0, err = BytePtrFromString(path)
593 if err != nil {
594 return
595 }
596 _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
597 if e1 != 0 {
598 err = errnoErr(e1)
599 }
600 return
601 }
602
603
604
605 func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) {
606 r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset))
607 xaddr = uintptr(r0)
608 if e1 != 0 {
609 err = errnoErr(e1)
610 }
611 return
612 }
613
614
615
616 func getrlimit(resource int, rlim *rlimit32) (err error) {
617 _, _, e1 := RawSyscall(SYS_UGETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
618 if e1 != 0 {
619 err = errnoErr(e1)
620 }
621 return
622 }
623
624
625
626 func syncFileRange2(fd int, flags int, off int64, n int64) (err error) {
627 _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off>>32), uintptr(off), uintptr(n>>32), uintptr(n))
628 if e1 != 0 {
629 err = errnoErr(e1)
630 }
631 return
632 }
633
634
635
636 func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) {
637 var _p0 *byte
638 _p0, err = BytePtrFromString(cmdline)
639 if err != nil {
640 return
641 }
642 _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
643 if e1 != 0 {
644 err = errnoErr(e1)
645 }
646 return
647 }
648
649
650
651 func Alarm(seconds uint) (remaining uint, err error) {
652 r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0)
653 remaining = uint(r0)
654 if e1 != 0 {
655 err = errnoErr(e1)
656 }
657 return
658 }
659
View as plain text