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 getgroups(ngid int, gid *_Gid_t) (n int, err error) {
18 r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0)
19 n = int(r0)
20 if e1 != 0 {
21 err = errnoErr(e1)
22 }
23 return
24 }
25
26
27
28 func setgroups(ngid int, gid *_Gid_t) (err error) {
29 _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0)
30 if e1 != 0 {
31 err = errnoErr(e1)
32 }
33 return
34 }
35
36
37
38 func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) {
39 r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0)
40 wpid = int(r0)
41 if e1 != 0 {
42 err = errnoErr(e1)
43 }
44 return
45 }
46
47
48
49 func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
50 r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
51 fd = int(r0)
52 if e1 != 0 {
53 err = errnoErr(e1)
54 }
55 return
56 }
57
58
59
60 func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
61 _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen))
62 if e1 != 0 {
63 err = errnoErr(e1)
64 }
65 return
66 }
67
68
69
70 func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
71 _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen))
72 if e1 != 0 {
73 err = errnoErr(e1)
74 }
75 return
76 }
77
78
79
80 func socket(domain int, typ int, proto int) (fd int, err error) {
81 r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
82 fd = int(r0)
83 if e1 != 0 {
84 err = errnoErr(e1)
85 }
86 return
87 }
88
89
90
91 func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
92 _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
93 if e1 != 0 {
94 err = errnoErr(e1)
95 }
96 return
97 }
98
99
100
101 func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
102 _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
103 if e1 != 0 {
104 err = errnoErr(e1)
105 }
106 return
107 }
108
109
110
111 func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
112 _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
113 if e1 != 0 {
114 err = errnoErr(e1)
115 }
116 return
117 }
118
119
120
121 func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
122 _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
123 if e1 != 0 {
124 err = errnoErr(e1)
125 }
126 return
127 }
128
129
130
131 func Shutdown(s int, how int) (err error) {
132 _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0)
133 if e1 != 0 {
134 err = errnoErr(e1)
135 }
136 return
137 }
138
139
140
141 func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
142 _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
143 if e1 != 0 {
144 err = errnoErr(e1)
145 }
146 return
147 }
148
149
150
151 func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
152 var _p0 unsafe.Pointer
153 if len(p) > 0 {
154 _p0 = unsafe.Pointer(&p[0])
155 } else {
156 _p0 = unsafe.Pointer(&_zero)
157 }
158 r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
159 n = int(r0)
160 if e1 != 0 {
161 err = errnoErr(e1)
162 }
163 return
164 }
165
166
167
168 func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
169 var _p0 unsafe.Pointer
170 if len(buf) > 0 {
171 _p0 = unsafe.Pointer(&buf[0])
172 } else {
173 _p0 = unsafe.Pointer(&_zero)
174 }
175 _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
176 if e1 != 0 {
177 err = errnoErr(e1)
178 }
179 return
180 }
181
182
183
184 func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
185 r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
186 n = int(r0)
187 if e1 != 0 {
188 err = errnoErr(e1)
189 }
190 return
191 }
192
193
194
195 func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
196 r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
197 n = int(r0)
198 if e1 != 0 {
199 err = errnoErr(e1)
200 }
201 return
202 }
203
204
205
206 func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) {
207 r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout)))
208 n = int(r0)
209 if e1 != 0 {
210 err = errnoErr(e1)
211 }
212 return
213 }
214
215
216
217 func utimes(path string, timeval *[2]Timeval) (err error) {
218 var _p0 *byte
219 _p0, err = BytePtrFromString(path)
220 if err != nil {
221 return
222 }
223 _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
224 if e1 != 0 {
225 err = errnoErr(e1)
226 }
227 return
228 }
229
230
231
232 func futimes(fd int, timeval *[2]Timeval) (err error) {
233 _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0)
234 if e1 != 0 {
235 err = errnoErr(e1)
236 }
237 return
238 }
239
240
241
242 func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
243 r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
244 n = int(r0)
245 if e1 != 0 {
246 err = errnoErr(e1)
247 }
248 return
249 }
250
251
252
253 func Madvise(b []byte, behav int) (err error) {
254 var _p0 unsafe.Pointer
255 if len(b) > 0 {
256 _p0 = unsafe.Pointer(&b[0])
257 } else {
258 _p0 = unsafe.Pointer(&_zero)
259 }
260 _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav))
261 if e1 != 0 {
262 err = errnoErr(e1)
263 }
264 return
265 }
266
267
268
269 func Mlock(b []byte) (err error) {
270 var _p0 unsafe.Pointer
271 if len(b) > 0 {
272 _p0 = unsafe.Pointer(&b[0])
273 } else {
274 _p0 = unsafe.Pointer(&_zero)
275 }
276 _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0)
277 if e1 != 0 {
278 err = errnoErr(e1)
279 }
280 return
281 }
282
283
284
285 func Mlockall(flags int) (err error) {
286 _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0)
287 if e1 != 0 {
288 err = errnoErr(e1)
289 }
290 return
291 }
292
293
294
295 func Mprotect(b []byte, prot int) (err error) {
296 var _p0 unsafe.Pointer
297 if len(b) > 0 {
298 _p0 = unsafe.Pointer(&b[0])
299 } else {
300 _p0 = unsafe.Pointer(&_zero)
301 }
302 _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
303 if e1 != 0 {
304 err = errnoErr(e1)
305 }
306 return
307 }
308
309
310
311 func Msync(b []byte, flags int) (err error) {
312 var _p0 unsafe.Pointer
313 if len(b) > 0 {
314 _p0 = unsafe.Pointer(&b[0])
315 } else {
316 _p0 = unsafe.Pointer(&_zero)
317 }
318 _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
319 if e1 != 0 {
320 err = errnoErr(e1)
321 }
322 return
323 }
324
325
326
327 func Munlock(b []byte) (err error) {
328 var _p0 unsafe.Pointer
329 if len(b) > 0 {
330 _p0 = unsafe.Pointer(&b[0])
331 } else {
332 _p0 = unsafe.Pointer(&_zero)
333 }
334 _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0)
335 if e1 != 0 {
336 err = errnoErr(e1)
337 }
338 return
339 }
340
341
342
343 func Munlockall() (err error) {
344 _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0)
345 if e1 != 0 {
346 err = errnoErr(e1)
347 }
348 return
349 }
350
351
352
353 func pipe() (r int, w int, err error) {
354 r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
355 r = int(r0)
356 w = int(r1)
357 if e1 != 0 {
358 err = errnoErr(e1)
359 }
360 return
361 }
362
363
364
365 func pipe2(p *[2]_C_int, flags int) (r int, w int, err error) {
366 r0, r1, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
367 r = int(r0)
368 w = int(r1)
369 if e1 != 0 {
370 err = errnoErr(e1)
371 }
372 return
373 }
374
375
376
377 func extpread(fd int, p []byte, flags int, offset int64) (n int, err error) {
378 var _p0 unsafe.Pointer
379 if len(p) > 0 {
380 _p0 = unsafe.Pointer(&p[0])
381 } else {
382 _p0 = unsafe.Pointer(&_zero)
383 }
384 r0, _, e1 := Syscall6(SYS_EXTPREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(offset), 0)
385 n = int(r0)
386 if e1 != 0 {
387 err = errnoErr(e1)
388 }
389 return
390 }
391
392
393
394 func extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error) {
395 var _p0 unsafe.Pointer
396 if len(p) > 0 {
397 _p0 = unsafe.Pointer(&p[0])
398 } else {
399 _p0 = unsafe.Pointer(&_zero)
400 }
401 r0, _, e1 := Syscall6(SYS_EXTPWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(offset), 0)
402 n = int(r0)
403 if e1 != 0 {
404 err = errnoErr(e1)
405 }
406 return
407 }
408
409
410
411 func Getcwd(buf []byte) (n int, err error) {
412 var _p0 unsafe.Pointer
413 if len(buf) > 0 {
414 _p0 = unsafe.Pointer(&buf[0])
415 } else {
416 _p0 = unsafe.Pointer(&_zero)
417 }
418 r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
419 n = int(r0)
420 if e1 != 0 {
421 err = errnoErr(e1)
422 }
423 return
424 }
425
426
427
428 func ioctl(fd int, req uint, arg uintptr) (err error) {
429 _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
430 if e1 != 0 {
431 err = errnoErr(e1)
432 }
433 return
434 }
435
436
437
438 func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
439 _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
440 if e1 != 0 {
441 err = errnoErr(e1)
442 }
443 return
444 }
445
446
447
448 func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
449 var _p0 unsafe.Pointer
450 if len(mib) > 0 {
451 _p0 = unsafe.Pointer(&mib[0])
452 } else {
453 _p0 = unsafe.Pointer(&_zero)
454 }
455 _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
456 if e1 != 0 {
457 err = errnoErr(e1)
458 }
459 return
460 }
461
462
463
464 func Access(path string, mode uint32) (err error) {
465 var _p0 *byte
466 _p0, err = BytePtrFromString(path)
467 if err != nil {
468 return
469 }
470 _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
471 if e1 != 0 {
472 err = errnoErr(e1)
473 }
474 return
475 }
476
477
478
479 func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
480 _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0)
481 if e1 != 0 {
482 err = errnoErr(e1)
483 }
484 return
485 }
486
487
488
489 func Chdir(path string) (err error) {
490 var _p0 *byte
491 _p0, err = BytePtrFromString(path)
492 if err != nil {
493 return
494 }
495 _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
496 if e1 != 0 {
497 err = errnoErr(e1)
498 }
499 return
500 }
501
502
503
504 func Chflags(path string, flags int) (err error) {
505 var _p0 *byte
506 _p0, err = BytePtrFromString(path)
507 if err != nil {
508 return
509 }
510 _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
511 if e1 != 0 {
512 err = errnoErr(e1)
513 }
514 return
515 }
516
517
518
519 func Chmod(path string, mode uint32) (err error) {
520 var _p0 *byte
521 _p0, err = BytePtrFromString(path)
522 if err != nil {
523 return
524 }
525 _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
526 if e1 != 0 {
527 err = errnoErr(e1)
528 }
529 return
530 }
531
532
533
534 func Chown(path string, uid int, gid int) (err error) {
535 var _p0 *byte
536 _p0, err = BytePtrFromString(path)
537 if err != nil {
538 return
539 }
540 _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
541 if e1 != 0 {
542 err = errnoErr(e1)
543 }
544 return
545 }
546
547
548
549 func Chroot(path string) (err error) {
550 var _p0 *byte
551 _p0, err = BytePtrFromString(path)
552 if err != nil {
553 return
554 }
555 _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
556 if e1 != 0 {
557 err = errnoErr(e1)
558 }
559 return
560 }
561
562
563
564 func ClockGettime(clockid int32, time *Timespec) (err error) {
565 _, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
566 if e1 != 0 {
567 err = errnoErr(e1)
568 }
569 return
570 }
571
572
573
574 func Close(fd int) (err error) {
575 _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
576 if e1 != 0 {
577 err = errnoErr(e1)
578 }
579 return
580 }
581
582
583
584 func Dup(fd int) (nfd int, err error) {
585 r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0)
586 nfd = int(r0)
587 if e1 != 0 {
588 err = errnoErr(e1)
589 }
590 return
591 }
592
593
594
595 func Dup2(from int, to int) (err error) {
596 _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0)
597 if e1 != 0 {
598 err = errnoErr(e1)
599 }
600 return
601 }
602
603
604
605 func Exit(code int) {
606 Syscall(SYS_EXIT, uintptr(code), 0, 0)
607 return
608 }
609
610
611
612 func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
613 var _p0 *byte
614 _p0, err = BytePtrFromString(path)
615 if err != nil {
616 return
617 }
618 _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
619 if e1 != 0 {
620 err = errnoErr(e1)
621 }
622 return
623 }
624
625
626
627 func Fchdir(fd int) (err error) {
628 _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
629 if e1 != 0 {
630 err = errnoErr(e1)
631 }
632 return
633 }
634
635
636
637 func Fchflags(fd int, flags int) (err error) {
638 _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
639 if e1 != 0 {
640 err = errnoErr(e1)
641 }
642 return
643 }
644
645
646
647 func Fchmod(fd int, mode uint32) (err error) {
648 _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
649 if e1 != 0 {
650 err = errnoErr(e1)
651 }
652 return
653 }
654
655
656
657 func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
658 var _p0 *byte
659 _p0, err = BytePtrFromString(path)
660 if err != nil {
661 return
662 }
663 _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
664 if e1 != 0 {
665 err = errnoErr(e1)
666 }
667 return
668 }
669
670
671
672 func Fchown(fd int, uid int, gid int) (err error) {
673 _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
674 if e1 != 0 {
675 err = errnoErr(e1)
676 }
677 return
678 }
679
680
681
682 func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
683 var _p0 *byte
684 _p0, err = BytePtrFromString(path)
685 if err != nil {
686 return
687 }
688 _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
689 if e1 != 0 {
690 err = errnoErr(e1)
691 }
692 return
693 }
694
695
696
697 func Flock(fd int, how int) (err error) {
698 _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0)
699 if e1 != 0 {
700 err = errnoErr(e1)
701 }
702 return
703 }
704
705
706
707 func Fpathconf(fd int, name int) (val int, err error) {
708 r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0)
709 val = int(r0)
710 if e1 != 0 {
711 err = errnoErr(e1)
712 }
713 return
714 }
715
716
717
718 func Fstat(fd int, stat *Stat_t) (err error) {
719 _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
720 if e1 != 0 {
721 err = errnoErr(e1)
722 }
723 return
724 }
725
726
727
728 func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
729 var _p0 *byte
730 _p0, err = BytePtrFromString(path)
731 if err != nil {
732 return
733 }
734 _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
735 if e1 != 0 {
736 err = errnoErr(e1)
737 }
738 return
739 }
740
741
742
743 func Fstatfs(fd int, stat *Statfs_t) (err error) {
744 _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
745 if e1 != 0 {
746 err = errnoErr(e1)
747 }
748 return
749 }
750
751
752
753 func Fsync(fd int) (err error) {
754 _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0)
755 if e1 != 0 {
756 err = errnoErr(e1)
757 }
758 return
759 }
760
761
762
763 func Ftruncate(fd int, length int64) (err error) {
764 _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length))
765 if e1 != 0 {
766 err = errnoErr(e1)
767 }
768 return
769 }
770
771
772
773 func Getdents(fd int, buf []byte) (n int, err error) {
774 var _p0 unsafe.Pointer
775 if len(buf) > 0 {
776 _p0 = unsafe.Pointer(&buf[0])
777 } else {
778 _p0 = unsafe.Pointer(&_zero)
779 }
780 r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
781 n = int(r0)
782 if e1 != 0 {
783 err = errnoErr(e1)
784 }
785 return
786 }
787
788
789
790 func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
791 var _p0 unsafe.Pointer
792 if len(buf) > 0 {
793 _p0 = unsafe.Pointer(&buf[0])
794 } else {
795 _p0 = unsafe.Pointer(&_zero)
796 }
797 r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0)
798 n = int(r0)
799 if e1 != 0 {
800 err = errnoErr(e1)
801 }
802 return
803 }
804
805
806
807 func Getdtablesize() (size int) {
808 r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0)
809 size = int(r0)
810 return
811 }
812
813
814
815 func Getegid() (egid int) {
816 r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
817 egid = int(r0)
818 return
819 }
820
821
822
823 func Geteuid() (uid int) {
824 r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
825 uid = int(r0)
826 return
827 }
828
829
830
831 func Getgid() (gid int) {
832 r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
833 gid = int(r0)
834 return
835 }
836
837
838
839 func Getpgid(pid int) (pgid int, err error) {
840 r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0)
841 pgid = int(r0)
842 if e1 != 0 {
843 err = errnoErr(e1)
844 }
845 return
846 }
847
848
849
850 func Getpgrp() (pgrp int) {
851 r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0)
852 pgrp = int(r0)
853 return
854 }
855
856
857
858 func Getpid() (pid int) {
859 r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
860 pid = int(r0)
861 return
862 }
863
864
865
866 func Getppid() (ppid int) {
867 r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
868 ppid = int(r0)
869 return
870 }
871
872
873
874 func Getpriority(which int, who int) (prio int, err error) {
875 r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
876 prio = int(r0)
877 if e1 != 0 {
878 err = errnoErr(e1)
879 }
880 return
881 }
882
883
884
885 func Getrlimit(which int, lim *Rlimit) (err error) {
886 _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
887 if e1 != 0 {
888 err = errnoErr(e1)
889 }
890 return
891 }
892
893
894
895 func Getrusage(who int, rusage *Rusage) (err error) {
896 _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
897 if e1 != 0 {
898 err = errnoErr(e1)
899 }
900 return
901 }
902
903
904
905 func Getsid(pid int) (sid int, err error) {
906 r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0)
907 sid = int(r0)
908 if e1 != 0 {
909 err = errnoErr(e1)
910 }
911 return
912 }
913
914
915
916 func Gettimeofday(tv *Timeval) (err error) {
917 _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
918 if e1 != 0 {
919 err = errnoErr(e1)
920 }
921 return
922 }
923
924
925
926 func Getuid() (uid int) {
927 r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
928 uid = int(r0)
929 return
930 }
931
932
933
934 func Issetugid() (tainted bool) {
935 r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0)
936 tainted = bool(r0 != 0)
937 return
938 }
939
940
941
942 func Kill(pid int, signum syscall.Signal) (err error) {
943 _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0)
944 if e1 != 0 {
945 err = errnoErr(e1)
946 }
947 return
948 }
949
950
951
952 func Kqueue() (fd int, err error) {
953 r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0)
954 fd = int(r0)
955 if e1 != 0 {
956 err = errnoErr(e1)
957 }
958 return
959 }
960
961
962
963 func Lchown(path string, uid int, gid int) (err error) {
964 var _p0 *byte
965 _p0, err = BytePtrFromString(path)
966 if err != nil {
967 return
968 }
969 _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
970 if e1 != 0 {
971 err = errnoErr(e1)
972 }
973 return
974 }
975
976
977
978 func Link(path string, link string) (err error) {
979 var _p0 *byte
980 _p0, err = BytePtrFromString(path)
981 if err != nil {
982 return
983 }
984 var _p1 *byte
985 _p1, err = BytePtrFromString(link)
986 if err != nil {
987 return
988 }
989 _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
990 if e1 != 0 {
991 err = errnoErr(e1)
992 }
993 return
994 }
995
996
997
998 func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) {
999 var _p0 *byte
1000 _p0, err = BytePtrFromString(path)
1001 if err != nil {
1002 return
1003 }
1004 var _p1 *byte
1005 _p1, err = BytePtrFromString(link)
1006 if err != nil {
1007 return
1008 }
1009 _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
1010 if e1 != 0 {
1011 err = errnoErr(e1)
1012 }
1013 return
1014 }
1015
1016
1017
1018 func Listen(s int, backlog int) (err error) {
1019 _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0)
1020 if e1 != 0 {
1021 err = errnoErr(e1)
1022 }
1023 return
1024 }
1025
1026
1027
1028 func Lstat(path string, stat *Stat_t) (err error) {
1029 var _p0 *byte
1030 _p0, err = BytePtrFromString(path)
1031 if err != nil {
1032 return
1033 }
1034 _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
1035 if e1 != 0 {
1036 err = errnoErr(e1)
1037 }
1038 return
1039 }
1040
1041
1042
1043 func Mkdir(path string, mode uint32) (err error) {
1044 var _p0 *byte
1045 _p0, err = BytePtrFromString(path)
1046 if err != nil {
1047 return
1048 }
1049 _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
1050 if e1 != 0 {
1051 err = errnoErr(e1)
1052 }
1053 return
1054 }
1055
1056
1057
1058 func Mkdirat(dirfd int, path string, mode uint32) (err error) {
1059 var _p0 *byte
1060 _p0, err = BytePtrFromString(path)
1061 if err != nil {
1062 return
1063 }
1064 _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
1065 if e1 != 0 {
1066 err = errnoErr(e1)
1067 }
1068 return
1069 }
1070
1071
1072
1073 func Mkfifo(path string, mode uint32) (err error) {
1074 var _p0 *byte
1075 _p0, err = BytePtrFromString(path)
1076 if err != nil {
1077 return
1078 }
1079 _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
1080 if e1 != 0 {
1081 err = errnoErr(e1)
1082 }
1083 return
1084 }
1085
1086
1087
1088 func Mknod(path string, mode uint32, dev int) (err error) {
1089 var _p0 *byte
1090 _p0, err = BytePtrFromString(path)
1091 if err != nil {
1092 return
1093 }
1094 _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
1095 if e1 != 0 {
1096 err = errnoErr(e1)
1097 }
1098 return
1099 }
1100
1101
1102
1103 func Mknodat(fd int, path string, mode uint32, dev int) (err error) {
1104 var _p0 *byte
1105 _p0, err = BytePtrFromString(path)
1106 if err != nil {
1107 return
1108 }
1109 _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
1110 if e1 != 0 {
1111 err = errnoErr(e1)
1112 }
1113 return
1114 }
1115
1116
1117
1118 func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
1119 _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
1120 if e1 != 0 {
1121 err = errnoErr(e1)
1122 }
1123 return
1124 }
1125
1126
1127
1128 func Open(path string, mode int, perm uint32) (fd int, err error) {
1129 var _p0 *byte
1130 _p0, err = BytePtrFromString(path)
1131 if err != nil {
1132 return
1133 }
1134 r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
1135 fd = int(r0)
1136 if e1 != 0 {
1137 err = errnoErr(e1)
1138 }
1139 return
1140 }
1141
1142
1143
1144 func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) {
1145 var _p0 *byte
1146 _p0, err = BytePtrFromString(path)
1147 if err != nil {
1148 return
1149 }
1150 r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0)
1151 fd = int(r0)
1152 if e1 != 0 {
1153 err = errnoErr(e1)
1154 }
1155 return
1156 }
1157
1158
1159
1160 func Pathconf(path string, name int) (val int, err error) {
1161 var _p0 *byte
1162 _p0, err = BytePtrFromString(path)
1163 if err != nil {
1164 return
1165 }
1166 r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
1167 val = int(r0)
1168 if e1 != 0 {
1169 err = errnoErr(e1)
1170 }
1171 return
1172 }
1173
1174
1175
1176 func read(fd int, p []byte) (n int, err error) {
1177 var _p0 unsafe.Pointer
1178 if len(p) > 0 {
1179 _p0 = unsafe.Pointer(&p[0])
1180 } else {
1181 _p0 = unsafe.Pointer(&_zero)
1182 }
1183 r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
1184 n = int(r0)
1185 if e1 != 0 {
1186 err = errnoErr(e1)
1187 }
1188 return
1189 }
1190
1191
1192
1193 func Readlink(path string, buf []byte) (n int, err error) {
1194 var _p0 *byte
1195 _p0, err = BytePtrFromString(path)
1196 if err != nil {
1197 return
1198 }
1199 var _p1 unsafe.Pointer
1200 if len(buf) > 0 {
1201 _p1 = unsafe.Pointer(&buf[0])
1202 } else {
1203 _p1 = unsafe.Pointer(&_zero)
1204 }
1205 r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
1206 n = int(r0)
1207 if e1 != 0 {
1208 err = errnoErr(e1)
1209 }
1210 return
1211 }
1212
1213
1214
1215 func Rename(from string, to string) (err error) {
1216 var _p0 *byte
1217 _p0, err = BytePtrFromString(from)
1218 if err != nil {
1219 return
1220 }
1221 var _p1 *byte
1222 _p1, err = BytePtrFromString(to)
1223 if err != nil {
1224 return
1225 }
1226 _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
1227 if e1 != 0 {
1228 err = errnoErr(e1)
1229 }
1230 return
1231 }
1232
1233
1234
1235 func Renameat(fromfd int, from string, tofd int, to string) (err error) {
1236 var _p0 *byte
1237 _p0, err = BytePtrFromString(from)
1238 if err != nil {
1239 return
1240 }
1241 var _p1 *byte
1242 _p1, err = BytePtrFromString(to)
1243 if err != nil {
1244 return
1245 }
1246 _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0)
1247 if e1 != 0 {
1248 err = errnoErr(e1)
1249 }
1250 return
1251 }
1252
1253
1254
1255 func Revoke(path string) (err error) {
1256 var _p0 *byte
1257 _p0, err = BytePtrFromString(path)
1258 if err != nil {
1259 return
1260 }
1261 _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
1262 if e1 != 0 {
1263 err = errnoErr(e1)
1264 }
1265 return
1266 }
1267
1268
1269
1270 func Rmdir(path string) (err error) {
1271 var _p0 *byte
1272 _p0, err = BytePtrFromString(path)
1273 if err != nil {
1274 return
1275 }
1276 _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
1277 if e1 != 0 {
1278 err = errnoErr(e1)
1279 }
1280 return
1281 }
1282
1283
1284
1285 func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
1286 r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0)
1287 newoffset = int64(r0)
1288 if e1 != 0 {
1289 err = errnoErr(e1)
1290 }
1291 return
1292 }
1293
1294
1295
1296 func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
1297 r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
1298 n = int(r0)
1299 if e1 != 0 {
1300 err = errnoErr(e1)
1301 }
1302 return
1303 }
1304
1305
1306
1307 func Setegid(egid int) (err error) {
1308 _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0)
1309 if e1 != 0 {
1310 err = errnoErr(e1)
1311 }
1312 return
1313 }
1314
1315
1316
1317 func Seteuid(euid int) (err error) {
1318 _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0)
1319 if e1 != 0 {
1320 err = errnoErr(e1)
1321 }
1322 return
1323 }
1324
1325
1326
1327 func Setgid(gid int) (err error) {
1328 _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0)
1329 if e1 != 0 {
1330 err = errnoErr(e1)
1331 }
1332 return
1333 }
1334
1335
1336
1337 func Setlogin(name string) (err error) {
1338 var _p0 *byte
1339 _p0, err = BytePtrFromString(name)
1340 if err != nil {
1341 return
1342 }
1343 _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
1344 if e1 != 0 {
1345 err = errnoErr(e1)
1346 }
1347 return
1348 }
1349
1350
1351
1352 func Setpgid(pid int, pgid int) (err error) {
1353 _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
1354 if e1 != 0 {
1355 err = errnoErr(e1)
1356 }
1357 return
1358 }
1359
1360
1361
1362 func Setpriority(which int, who int, prio int) (err error) {
1363 _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
1364 if e1 != 0 {
1365 err = errnoErr(e1)
1366 }
1367 return
1368 }
1369
1370
1371
1372 func Setregid(rgid int, egid int) (err error) {
1373 _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
1374 if e1 != 0 {
1375 err = errnoErr(e1)
1376 }
1377 return
1378 }
1379
1380
1381
1382 func Setreuid(ruid int, euid int) (err error) {
1383 _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
1384 if e1 != 0 {
1385 err = errnoErr(e1)
1386 }
1387 return
1388 }
1389
1390
1391
1392 func Setresgid(rgid int, egid int, sgid int) (err error) {
1393 _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid))
1394 if e1 != 0 {
1395 err = errnoErr(e1)
1396 }
1397 return
1398 }
1399
1400
1401
1402 func Setresuid(ruid int, euid int, suid int) (err error) {
1403 _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid))
1404 if e1 != 0 {
1405 err = errnoErr(e1)
1406 }
1407 return
1408 }
1409
1410
1411
1412 func Setsid() (pid int, err error) {
1413 r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
1414 pid = int(r0)
1415 if e1 != 0 {
1416 err = errnoErr(e1)
1417 }
1418 return
1419 }
1420
1421
1422
1423 func Settimeofday(tp *Timeval) (err error) {
1424 _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0)
1425 if e1 != 0 {
1426 err = errnoErr(e1)
1427 }
1428 return
1429 }
1430
1431
1432
1433 func Setuid(uid int) (err error) {
1434 _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0)
1435 if e1 != 0 {
1436 err = errnoErr(e1)
1437 }
1438 return
1439 }
1440
1441
1442
1443 func Stat(path string, stat *Stat_t) (err error) {
1444 var _p0 *byte
1445 _p0, err = BytePtrFromString(path)
1446 if err != nil {
1447 return
1448 }
1449 _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
1450 if e1 != 0 {
1451 err = errnoErr(e1)
1452 }
1453 return
1454 }
1455
1456
1457
1458 func Statfs(path string, stat *Statfs_t) (err error) {
1459 var _p0 *byte
1460 _p0, err = BytePtrFromString(path)
1461 if err != nil {
1462 return
1463 }
1464 _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
1465 if e1 != 0 {
1466 err = errnoErr(e1)
1467 }
1468 return
1469 }
1470
1471
1472
1473 func Symlink(path string, link string) (err error) {
1474 var _p0 *byte
1475 _p0, err = BytePtrFromString(path)
1476 if err != nil {
1477 return
1478 }
1479 var _p1 *byte
1480 _p1, err = BytePtrFromString(link)
1481 if err != nil {
1482 return
1483 }
1484 _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
1485 if e1 != 0 {
1486 err = errnoErr(e1)
1487 }
1488 return
1489 }
1490
1491
1492
1493 func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
1494 var _p0 *byte
1495 _p0, err = BytePtrFromString(oldpath)
1496 if err != nil {
1497 return
1498 }
1499 var _p1 *byte
1500 _p1, err = BytePtrFromString(newpath)
1501 if err != nil {
1502 return
1503 }
1504 _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
1505 if e1 != 0 {
1506 err = errnoErr(e1)
1507 }
1508 return
1509 }
1510
1511
1512
1513 func Sync() (err error) {
1514 _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0)
1515 if e1 != 0 {
1516 err = errnoErr(e1)
1517 }
1518 return
1519 }
1520
1521
1522
1523 func Truncate(path string, length int64) (err error) {
1524 var _p0 *byte
1525 _p0, err = BytePtrFromString(path)
1526 if err != nil {
1527 return
1528 }
1529 _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length))
1530 if e1 != 0 {
1531 err = errnoErr(e1)
1532 }
1533 return
1534 }
1535
1536
1537
1538 func Umask(newmask int) (oldmask int) {
1539 r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0)
1540 oldmask = int(r0)
1541 return
1542 }
1543
1544
1545
1546 func Undelete(path string) (err error) {
1547 var _p0 *byte
1548 _p0, err = BytePtrFromString(path)
1549 if err != nil {
1550 return
1551 }
1552 _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
1553 if e1 != 0 {
1554 err = errnoErr(e1)
1555 }
1556 return
1557 }
1558
1559
1560
1561 func Unlink(path string) (err error) {
1562 var _p0 *byte
1563 _p0, err = BytePtrFromString(path)
1564 if err != nil {
1565 return
1566 }
1567 _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
1568 if e1 != 0 {
1569 err = errnoErr(e1)
1570 }
1571 return
1572 }
1573
1574
1575
1576 func Unlinkat(dirfd int, path string, flags int) (err error) {
1577 var _p0 *byte
1578 _p0, err = BytePtrFromString(path)
1579 if err != nil {
1580 return
1581 }
1582 _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
1583 if e1 != 0 {
1584 err = errnoErr(e1)
1585 }
1586 return
1587 }
1588
1589
1590
1591 func Unmount(path string, flags int) (err error) {
1592 var _p0 *byte
1593 _p0, err = BytePtrFromString(path)
1594 if err != nil {
1595 return
1596 }
1597 _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
1598 if e1 != 0 {
1599 err = errnoErr(e1)
1600 }
1601 return
1602 }
1603
1604
1605
1606 func write(fd int, p []byte) (n int, err error) {
1607 var _p0 unsafe.Pointer
1608 if len(p) > 0 {
1609 _p0 = unsafe.Pointer(&p[0])
1610 } else {
1611 _p0 = unsafe.Pointer(&_zero)
1612 }
1613 r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
1614 n = int(r0)
1615 if e1 != 0 {
1616 err = errnoErr(e1)
1617 }
1618 return
1619 }
1620
1621
1622
1623 func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
1624 r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0)
1625 ret = uintptr(r0)
1626 if e1 != 0 {
1627 err = errnoErr(e1)
1628 }
1629 return
1630 }
1631
1632
1633
1634 func munmap(addr uintptr, length uintptr) (err error) {
1635 _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
1636 if e1 != 0 {
1637 err = errnoErr(e1)
1638 }
1639 return
1640 }
1641
1642
1643
1644 func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
1645 r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
1646 nfd = int(r0)
1647 if e1 != 0 {
1648 err = errnoErr(e1)
1649 }
1650 return
1651 }
1652
1653
1654
1655 func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
1656 var _p0 *byte
1657 _p0, err = BytePtrFromString(path)
1658 if err != nil {
1659 return
1660 }
1661 _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
1662 if e1 != 0 {
1663 err = errnoErr(e1)
1664 }
1665 return
1666 }
1667
View as plain text