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