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 pipe2(p *[2]_C_int, flags int) (err error) {
355 _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
356 if e1 != 0 {
357 err = errnoErr(e1)
358 }
359 return
360 }
361
362
363
364 func Getdents(fd int, buf []byte) (n int, err error) {
365 var _p0 unsafe.Pointer
366 if len(buf) > 0 {
367 _p0 = unsafe.Pointer(&buf[0])
368 } else {
369 _p0 = unsafe.Pointer(&_zero)
370 }
371 r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
372 n = int(r0)
373 if e1 != 0 {
374 err = errnoErr(e1)
375 }
376 return
377 }
378
379
380
381 func Getcwd(buf []byte) (n int, err error) {
382 var _p0 unsafe.Pointer
383 if len(buf) > 0 {
384 _p0 = unsafe.Pointer(&buf[0])
385 } else {
386 _p0 = unsafe.Pointer(&_zero)
387 }
388 r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
389 n = int(r0)
390 if e1 != 0 {
391 err = errnoErr(e1)
392 }
393 return
394 }
395
396
397
398 func ioctl(fd int, req uint, arg uintptr) (err error) {
399 _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
400 if e1 != 0 {
401 err = errnoErr(e1)
402 }
403 return
404 }
405
406
407
408 func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
409 var _p0 unsafe.Pointer
410 if len(mib) > 0 {
411 _p0 = unsafe.Pointer(&mib[0])
412 } else {
413 _p0 = unsafe.Pointer(&_zero)
414 }
415 _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
416 if e1 != 0 {
417 err = errnoErr(e1)
418 }
419 return
420 }
421
422
423
424 func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
425 r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
426 n = int(r0)
427 if e1 != 0 {
428 err = errnoErr(e1)
429 }
430 return
431 }
432
433
434
435 func Access(path string, mode uint32) (err error) {
436 var _p0 *byte
437 _p0, err = BytePtrFromString(path)
438 if err != nil {
439 return
440 }
441 _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
442 if e1 != 0 {
443 err = errnoErr(e1)
444 }
445 return
446 }
447
448
449
450 func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
451 _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0)
452 if e1 != 0 {
453 err = errnoErr(e1)
454 }
455 return
456 }
457
458
459
460 func Chdir(path string) (err error) {
461 var _p0 *byte
462 _p0, err = BytePtrFromString(path)
463 if err != nil {
464 return
465 }
466 _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
467 if e1 != 0 {
468 err = errnoErr(e1)
469 }
470 return
471 }
472
473
474
475 func Chflags(path string, flags int) (err error) {
476 var _p0 *byte
477 _p0, err = BytePtrFromString(path)
478 if err != nil {
479 return
480 }
481 _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
482 if e1 != 0 {
483 err = errnoErr(e1)
484 }
485 return
486 }
487
488
489
490 func Chmod(path string, mode uint32) (err error) {
491 var _p0 *byte
492 _p0, err = BytePtrFromString(path)
493 if err != nil {
494 return
495 }
496 _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
497 if e1 != 0 {
498 err = errnoErr(e1)
499 }
500 return
501 }
502
503
504
505 func Chown(path string, uid int, gid int) (err error) {
506 var _p0 *byte
507 _p0, err = BytePtrFromString(path)
508 if err != nil {
509 return
510 }
511 _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
512 if e1 != 0 {
513 err = errnoErr(e1)
514 }
515 return
516 }
517
518
519
520 func Chroot(path string) (err error) {
521 var _p0 *byte
522 _p0, err = BytePtrFromString(path)
523 if err != nil {
524 return
525 }
526 _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
527 if e1 != 0 {
528 err = errnoErr(e1)
529 }
530 return
531 }
532
533
534
535 func Close(fd int) (err error) {
536 _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
537 if e1 != 0 {
538 err = errnoErr(e1)
539 }
540 return
541 }
542
543
544
545 func Dup(fd int) (nfd int, err error) {
546 r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0)
547 nfd = int(r0)
548 if e1 != 0 {
549 err = errnoErr(e1)
550 }
551 return
552 }
553
554
555
556 func Dup2(from int, to int) (err error) {
557 _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0)
558 if e1 != 0 {
559 err = errnoErr(e1)
560 }
561 return
562 }
563
564
565
566 func Dup3(from int, to int, flags int) (err error) {
567 _, _, e1 := Syscall(SYS_DUP3, uintptr(from), uintptr(to), uintptr(flags))
568 if e1 != 0 {
569 err = errnoErr(e1)
570 }
571 return
572 }
573
574
575
576 func Exit(code int) {
577 Syscall(SYS_EXIT, uintptr(code), 0, 0)
578 return
579 }
580
581
582
583 func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
584 var _p0 *byte
585 _p0, err = BytePtrFromString(path)
586 if err != nil {
587 return
588 }
589 _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
590 if e1 != 0 {
591 err = errnoErr(e1)
592 }
593 return
594 }
595
596
597
598 func Fchdir(fd int) (err error) {
599 _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
600 if e1 != 0 {
601 err = errnoErr(e1)
602 }
603 return
604 }
605
606
607
608 func Fchflags(fd int, flags int) (err error) {
609 _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
610 if e1 != 0 {
611 err = errnoErr(e1)
612 }
613 return
614 }
615
616
617
618 func Fchmod(fd int, mode uint32) (err error) {
619 _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
620 if e1 != 0 {
621 err = errnoErr(e1)
622 }
623 return
624 }
625
626
627
628 func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
629 var _p0 *byte
630 _p0, err = BytePtrFromString(path)
631 if err != nil {
632 return
633 }
634 _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
635 if e1 != 0 {
636 err = errnoErr(e1)
637 }
638 return
639 }
640
641
642
643 func Fchown(fd int, uid int, gid int) (err error) {
644 _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
645 if e1 != 0 {
646 err = errnoErr(e1)
647 }
648 return
649 }
650
651
652
653 func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
654 var _p0 *byte
655 _p0, err = BytePtrFromString(path)
656 if err != nil {
657 return
658 }
659 _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
660 if e1 != 0 {
661 err = errnoErr(e1)
662 }
663 return
664 }
665
666
667
668 func Flock(fd int, how int) (err error) {
669 _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0)
670 if e1 != 0 {
671 err = errnoErr(e1)
672 }
673 return
674 }
675
676
677
678 func Fpathconf(fd int, name int) (val int, err error) {
679 r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0)
680 val = int(r0)
681 if e1 != 0 {
682 err = errnoErr(e1)
683 }
684 return
685 }
686
687
688
689 func Fstat(fd int, stat *Stat_t) (err error) {
690 _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
691 if e1 != 0 {
692 err = errnoErr(e1)
693 }
694 return
695 }
696
697
698
699 func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
700 var _p0 *byte
701 _p0, err = BytePtrFromString(path)
702 if err != nil {
703 return
704 }
705 _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
706 if e1 != 0 {
707 err = errnoErr(e1)
708 }
709 return
710 }
711
712
713
714 func Fstatfs(fd int, stat *Statfs_t) (err error) {
715 _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
716 if e1 != 0 {
717 err = errnoErr(e1)
718 }
719 return
720 }
721
722
723
724 func Fsync(fd int) (err error) {
725 _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0)
726 if e1 != 0 {
727 err = errnoErr(e1)
728 }
729 return
730 }
731
732
733
734 func Ftruncate(fd int, length int64) (err error) {
735 _, _, e1 := Syscall6(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0)
736 if e1 != 0 {
737 err = errnoErr(e1)
738 }
739 return
740 }
741
742
743
744 func Getegid() (egid int) {
745 r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
746 egid = int(r0)
747 return
748 }
749
750
751
752 func Geteuid() (uid int) {
753 r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
754 uid = int(r0)
755 return
756 }
757
758
759
760 func Getgid() (gid int) {
761 r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
762 gid = int(r0)
763 return
764 }
765
766
767
768 func Getpgid(pid int) (pgid int, err error) {
769 r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0)
770 pgid = int(r0)
771 if e1 != 0 {
772 err = errnoErr(e1)
773 }
774 return
775 }
776
777
778
779 func Getpgrp() (pgrp int) {
780 r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0)
781 pgrp = int(r0)
782 return
783 }
784
785
786
787 func Getpid() (pid int) {
788 r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
789 pid = int(r0)
790 return
791 }
792
793
794
795 func Getppid() (ppid int) {
796 r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
797 ppid = int(r0)
798 return
799 }
800
801
802
803 func Getpriority(which int, who int) (prio int, err error) {
804 r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
805 prio = int(r0)
806 if e1 != 0 {
807 err = errnoErr(e1)
808 }
809 return
810 }
811
812
813
814 func Getrlimit(which int, lim *Rlimit) (err error) {
815 _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
816 if e1 != 0 {
817 err = errnoErr(e1)
818 }
819 return
820 }
821
822
823
824 func Getrtable() (rtable int, err error) {
825 r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0)
826 rtable = int(r0)
827 if e1 != 0 {
828 err = errnoErr(e1)
829 }
830 return
831 }
832
833
834
835 func Getrusage(who int, rusage *Rusage) (err error) {
836 _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
837 if e1 != 0 {
838 err = errnoErr(e1)
839 }
840 return
841 }
842
843
844
845 func Getsid(pid int) (sid int, err error) {
846 r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0)
847 sid = int(r0)
848 if e1 != 0 {
849 err = errnoErr(e1)
850 }
851 return
852 }
853
854
855
856 func Gettimeofday(tv *Timeval) (err error) {
857 _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
858 if e1 != 0 {
859 err = errnoErr(e1)
860 }
861 return
862 }
863
864
865
866 func Getuid() (uid int) {
867 r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
868 uid = int(r0)
869 return
870 }
871
872
873
874 func Issetugid() (tainted bool) {
875 r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0)
876 tainted = bool(r0 != 0)
877 return
878 }
879
880
881
882 func Kill(pid int, signum syscall.Signal) (err error) {
883 _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0)
884 if e1 != 0 {
885 err = errnoErr(e1)
886 }
887 return
888 }
889
890
891
892 func Kqueue() (fd int, err error) {
893 r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0)
894 fd = int(r0)
895 if e1 != 0 {
896 err = errnoErr(e1)
897 }
898 return
899 }
900
901
902
903 func Lchown(path string, uid int, gid int) (err error) {
904 var _p0 *byte
905 _p0, err = BytePtrFromString(path)
906 if err != nil {
907 return
908 }
909 _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
910 if e1 != 0 {
911 err = errnoErr(e1)
912 }
913 return
914 }
915
916
917
918 func Link(path string, link string) (err error) {
919 var _p0 *byte
920 _p0, err = BytePtrFromString(path)
921 if err != nil {
922 return
923 }
924 var _p1 *byte
925 _p1, err = BytePtrFromString(link)
926 if err != nil {
927 return
928 }
929 _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
930 if e1 != 0 {
931 err = errnoErr(e1)
932 }
933 return
934 }
935
936
937
938 func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) {
939 var _p0 *byte
940 _p0, err = BytePtrFromString(path)
941 if err != nil {
942 return
943 }
944 var _p1 *byte
945 _p1, err = BytePtrFromString(link)
946 if err != nil {
947 return
948 }
949 _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
950 if e1 != 0 {
951 err = errnoErr(e1)
952 }
953 return
954 }
955
956
957
958 func Listen(s int, backlog int) (err error) {
959 _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0)
960 if e1 != 0 {
961 err = errnoErr(e1)
962 }
963 return
964 }
965
966
967
968 func Lstat(path string, stat *Stat_t) (err error) {
969 var _p0 *byte
970 _p0, err = BytePtrFromString(path)
971 if err != nil {
972 return
973 }
974 _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
975 if e1 != 0 {
976 err = errnoErr(e1)
977 }
978 return
979 }
980
981
982
983 func Mkdir(path string, mode uint32) (err error) {
984 var _p0 *byte
985 _p0, err = BytePtrFromString(path)
986 if err != nil {
987 return
988 }
989 _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
990 if e1 != 0 {
991 err = errnoErr(e1)
992 }
993 return
994 }
995
996
997
998 func Mkdirat(dirfd int, path string, mode uint32) (err error) {
999 var _p0 *byte
1000 _p0, err = BytePtrFromString(path)
1001 if err != nil {
1002 return
1003 }
1004 _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
1005 if e1 != 0 {
1006 err = errnoErr(e1)
1007 }
1008 return
1009 }
1010
1011
1012
1013 func Mkfifo(path string, mode uint32) (err error) {
1014 var _p0 *byte
1015 _p0, err = BytePtrFromString(path)
1016 if err != nil {
1017 return
1018 }
1019 _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
1020 if e1 != 0 {
1021 err = errnoErr(e1)
1022 }
1023 return
1024 }
1025
1026
1027
1028 func Mkfifoat(dirfd int, path string, mode uint32) (err error) {
1029 var _p0 *byte
1030 _p0, err = BytePtrFromString(path)
1031 if err != nil {
1032 return
1033 }
1034 _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
1035 if e1 != 0 {
1036 err = errnoErr(e1)
1037 }
1038 return
1039 }
1040
1041
1042
1043 func Mknod(path string, mode uint32, dev int) (err error) {
1044 var _p0 *byte
1045 _p0, err = BytePtrFromString(path)
1046 if err != nil {
1047 return
1048 }
1049 _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
1050 if e1 != 0 {
1051 err = errnoErr(e1)
1052 }
1053 return
1054 }
1055
1056
1057
1058 func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
1059 var _p0 *byte
1060 _p0, err = BytePtrFromString(path)
1061 if err != nil {
1062 return
1063 }
1064 _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
1065 if e1 != 0 {
1066 err = errnoErr(e1)
1067 }
1068 return
1069 }
1070
1071
1072
1073 func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
1074 _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
1075 if e1 != 0 {
1076 err = errnoErr(e1)
1077 }
1078 return
1079 }
1080
1081
1082
1083 func Open(path string, mode int, perm uint32) (fd int, err error) {
1084 var _p0 *byte
1085 _p0, err = BytePtrFromString(path)
1086 if err != nil {
1087 return
1088 }
1089 r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
1090 fd = int(r0)
1091 if e1 != 0 {
1092 err = errnoErr(e1)
1093 }
1094 return
1095 }
1096
1097
1098
1099 func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) {
1100 var _p0 *byte
1101 _p0, err = BytePtrFromString(path)
1102 if err != nil {
1103 return
1104 }
1105 r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0)
1106 fd = int(r0)
1107 if e1 != 0 {
1108 err = errnoErr(e1)
1109 }
1110 return
1111 }
1112
1113
1114
1115 func Pathconf(path string, name int) (val int, err error) {
1116 var _p0 *byte
1117 _p0, err = BytePtrFromString(path)
1118 if err != nil {
1119 return
1120 }
1121 r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
1122 val = int(r0)
1123 if e1 != 0 {
1124 err = errnoErr(e1)
1125 }
1126 return
1127 }
1128
1129
1130
1131 func Pread(fd int, p []byte, offset int64) (n int, err error) {
1132 var _p0 unsafe.Pointer
1133 if len(p) > 0 {
1134 _p0 = unsafe.Pointer(&p[0])
1135 } else {
1136 _p0 = unsafe.Pointer(&_zero)
1137 }
1138 r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32))
1139 n = int(r0)
1140 if e1 != 0 {
1141 err = errnoErr(e1)
1142 }
1143 return
1144 }
1145
1146
1147
1148 func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
1149 var _p0 unsafe.Pointer
1150 if len(p) > 0 {
1151 _p0 = unsafe.Pointer(&p[0])
1152 } else {
1153 _p0 = unsafe.Pointer(&_zero)
1154 }
1155 r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32))
1156 n = int(r0)
1157 if e1 != 0 {
1158 err = errnoErr(e1)
1159 }
1160 return
1161 }
1162
1163
1164
1165 func read(fd int, p []byte) (n int, err error) {
1166 var _p0 unsafe.Pointer
1167 if len(p) > 0 {
1168 _p0 = unsafe.Pointer(&p[0])
1169 } else {
1170 _p0 = unsafe.Pointer(&_zero)
1171 }
1172 r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
1173 n = int(r0)
1174 if e1 != 0 {
1175 err = errnoErr(e1)
1176 }
1177 return
1178 }
1179
1180
1181
1182 func Readlink(path string, buf []byte) (n int, err error) {
1183 var _p0 *byte
1184 _p0, err = BytePtrFromString(path)
1185 if err != nil {
1186 return
1187 }
1188 var _p1 unsafe.Pointer
1189 if len(buf) > 0 {
1190 _p1 = unsafe.Pointer(&buf[0])
1191 } else {
1192 _p1 = unsafe.Pointer(&_zero)
1193 }
1194 r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
1195 n = int(r0)
1196 if e1 != 0 {
1197 err = errnoErr(e1)
1198 }
1199 return
1200 }
1201
1202
1203
1204 func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
1205 var _p0 *byte
1206 _p0, err = BytePtrFromString(path)
1207 if err != nil {
1208 return
1209 }
1210 var _p1 unsafe.Pointer
1211 if len(buf) > 0 {
1212 _p1 = unsafe.Pointer(&buf[0])
1213 } else {
1214 _p1 = unsafe.Pointer(&_zero)
1215 }
1216 r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
1217 n = int(r0)
1218 if e1 != 0 {
1219 err = errnoErr(e1)
1220 }
1221 return
1222 }
1223
1224
1225
1226 func Rename(from string, to string) (err error) {
1227 var _p0 *byte
1228 _p0, err = BytePtrFromString(from)
1229 if err != nil {
1230 return
1231 }
1232 var _p1 *byte
1233 _p1, err = BytePtrFromString(to)
1234 if err != nil {
1235 return
1236 }
1237 _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
1238 if e1 != 0 {
1239 err = errnoErr(e1)
1240 }
1241 return
1242 }
1243
1244
1245
1246 func Renameat(fromfd int, from string, tofd int, to string) (err error) {
1247 var _p0 *byte
1248 _p0, err = BytePtrFromString(from)
1249 if err != nil {
1250 return
1251 }
1252 var _p1 *byte
1253 _p1, err = BytePtrFromString(to)
1254 if err != nil {
1255 return
1256 }
1257 _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0)
1258 if e1 != 0 {
1259 err = errnoErr(e1)
1260 }
1261 return
1262 }
1263
1264
1265
1266 func Revoke(path string) (err error) {
1267 var _p0 *byte
1268 _p0, err = BytePtrFromString(path)
1269 if err != nil {
1270 return
1271 }
1272 _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
1273 if e1 != 0 {
1274 err = errnoErr(e1)
1275 }
1276 return
1277 }
1278
1279
1280
1281 func Rmdir(path string) (err error) {
1282 var _p0 *byte
1283 _p0, err = BytePtrFromString(path)
1284 if err != nil {
1285 return
1286 }
1287 _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
1288 if e1 != 0 {
1289 err = errnoErr(e1)
1290 }
1291 return
1292 }
1293
1294
1295
1296 func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
1297 r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(whence), 0)
1298 newoffset = int64(int64(r1)<<32 | int64(r0))
1299 if e1 != 0 {
1300 err = errnoErr(e1)
1301 }
1302 return
1303 }
1304
1305
1306
1307 func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
1308 r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
1309 n = int(r0)
1310 if e1 != 0 {
1311 err = errnoErr(e1)
1312 }
1313 return
1314 }
1315
1316
1317
1318 func Setegid(egid int) (err error) {
1319 _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0)
1320 if e1 != 0 {
1321 err = errnoErr(e1)
1322 }
1323 return
1324 }
1325
1326
1327
1328 func Seteuid(euid int) (err error) {
1329 _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0)
1330 if e1 != 0 {
1331 err = errnoErr(e1)
1332 }
1333 return
1334 }
1335
1336
1337
1338 func Setgid(gid int) (err error) {
1339 _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0)
1340 if e1 != 0 {
1341 err = errnoErr(e1)
1342 }
1343 return
1344 }
1345
1346
1347
1348 func Setlogin(name string) (err error) {
1349 var _p0 *byte
1350 _p0, err = BytePtrFromString(name)
1351 if err != nil {
1352 return
1353 }
1354 _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
1355 if e1 != 0 {
1356 err = errnoErr(e1)
1357 }
1358 return
1359 }
1360
1361
1362
1363 func Setpgid(pid int, pgid int) (err error) {
1364 _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
1365 if e1 != 0 {
1366 err = errnoErr(e1)
1367 }
1368 return
1369 }
1370
1371
1372
1373 func Setpriority(which int, who int, prio int) (err error) {
1374 _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
1375 if e1 != 0 {
1376 err = errnoErr(e1)
1377 }
1378 return
1379 }
1380
1381
1382
1383 func Setregid(rgid int, egid int) (err error) {
1384 _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
1385 if e1 != 0 {
1386 err = errnoErr(e1)
1387 }
1388 return
1389 }
1390
1391
1392
1393 func Setreuid(ruid int, euid int) (err error) {
1394 _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
1395 if e1 != 0 {
1396 err = errnoErr(e1)
1397 }
1398 return
1399 }
1400
1401
1402
1403 func Setresgid(rgid int, egid int, sgid int) (err error) {
1404 _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid))
1405 if e1 != 0 {
1406 err = errnoErr(e1)
1407 }
1408 return
1409 }
1410
1411
1412
1413 func Setresuid(ruid int, euid int, suid int) (err error) {
1414 _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid))
1415 if e1 != 0 {
1416 err = errnoErr(e1)
1417 }
1418 return
1419 }
1420
1421
1422
1423 func Setrlimit(which int, lim *Rlimit) (err error) {
1424 _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
1425 if e1 != 0 {
1426 err = errnoErr(e1)
1427 }
1428 return
1429 }
1430
1431
1432
1433 func Setrtable(rtable int) (err error) {
1434 _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0)
1435 if e1 != 0 {
1436 err = errnoErr(e1)
1437 }
1438 return
1439 }
1440
1441
1442
1443 func Setsid() (pid int, err error) {
1444 r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
1445 pid = int(r0)
1446 if e1 != 0 {
1447 err = errnoErr(e1)
1448 }
1449 return
1450 }
1451
1452
1453
1454 func Settimeofday(tp *Timeval) (err error) {
1455 _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0)
1456 if e1 != 0 {
1457 err = errnoErr(e1)
1458 }
1459 return
1460 }
1461
1462
1463
1464 func Setuid(uid int) (err error) {
1465 _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0)
1466 if e1 != 0 {
1467 err = errnoErr(e1)
1468 }
1469 return
1470 }
1471
1472
1473
1474 func Stat(path string, stat *Stat_t) (err error) {
1475 var _p0 *byte
1476 _p0, err = BytePtrFromString(path)
1477 if err != nil {
1478 return
1479 }
1480 _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
1481 if e1 != 0 {
1482 err = errnoErr(e1)
1483 }
1484 return
1485 }
1486
1487
1488
1489 func Statfs(path string, stat *Statfs_t) (err error) {
1490 var _p0 *byte
1491 _p0, err = BytePtrFromString(path)
1492 if err != nil {
1493 return
1494 }
1495 _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
1496 if e1 != 0 {
1497 err = errnoErr(e1)
1498 }
1499 return
1500 }
1501
1502
1503
1504 func Symlink(path string, link string) (err error) {
1505 var _p0 *byte
1506 _p0, err = BytePtrFromString(path)
1507 if err != nil {
1508 return
1509 }
1510 var _p1 *byte
1511 _p1, err = BytePtrFromString(link)
1512 if err != nil {
1513 return
1514 }
1515 _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
1516 if e1 != 0 {
1517 err = errnoErr(e1)
1518 }
1519 return
1520 }
1521
1522
1523
1524 func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
1525 var _p0 *byte
1526 _p0, err = BytePtrFromString(oldpath)
1527 if err != nil {
1528 return
1529 }
1530 var _p1 *byte
1531 _p1, err = BytePtrFromString(newpath)
1532 if err != nil {
1533 return
1534 }
1535 _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
1536 if e1 != 0 {
1537 err = errnoErr(e1)
1538 }
1539 return
1540 }
1541
1542
1543
1544 func Sync() (err error) {
1545 _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0)
1546 if e1 != 0 {
1547 err = errnoErr(e1)
1548 }
1549 return
1550 }
1551
1552
1553
1554 func Truncate(path string, length int64) (err error) {
1555 var _p0 *byte
1556 _p0, err = BytePtrFromString(path)
1557 if err != nil {
1558 return
1559 }
1560 _, _, e1 := Syscall6(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 0, 0)
1561 if e1 != 0 {
1562 err = errnoErr(e1)
1563 }
1564 return
1565 }
1566
1567
1568
1569 func Umask(newmask int) (oldmask int) {
1570 r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0)
1571 oldmask = int(r0)
1572 return
1573 }
1574
1575
1576
1577 func Unlink(path string) (err error) {
1578 var _p0 *byte
1579 _p0, err = BytePtrFromString(path)
1580 if err != nil {
1581 return
1582 }
1583 _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
1584 if e1 != 0 {
1585 err = errnoErr(e1)
1586 }
1587 return
1588 }
1589
1590
1591
1592 func Unlinkat(dirfd int, path string, flags int) (err error) {
1593 var _p0 *byte
1594 _p0, err = BytePtrFromString(path)
1595 if err != nil {
1596 return
1597 }
1598 _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
1599 if e1 != 0 {
1600 err = errnoErr(e1)
1601 }
1602 return
1603 }
1604
1605
1606
1607 func Unmount(path string, flags int) (err error) {
1608 var _p0 *byte
1609 _p0, err = BytePtrFromString(path)
1610 if err != nil {
1611 return
1612 }
1613 _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
1614 if e1 != 0 {
1615 err = errnoErr(e1)
1616 }
1617 return
1618 }
1619
1620
1621
1622 func write(fd int, p []byte) (n int, err error) {
1623 var _p0 unsafe.Pointer
1624 if len(p) > 0 {
1625 _p0 = unsafe.Pointer(&p[0])
1626 } else {
1627 _p0 = unsafe.Pointer(&_zero)
1628 }
1629 r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
1630 n = int(r0)
1631 if e1 != 0 {
1632 err = errnoErr(e1)
1633 }
1634 return
1635 }
1636
1637
1638
1639 func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
1640 r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0)
1641 ret = uintptr(r0)
1642 if e1 != 0 {
1643 err = errnoErr(e1)
1644 }
1645 return
1646 }
1647
1648
1649
1650 func munmap(addr uintptr, length uintptr) (err error) {
1651 _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
1652 if e1 != 0 {
1653 err = errnoErr(e1)
1654 }
1655 return
1656 }
1657
1658
1659
1660 func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
1661 r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
1662 n = int(r0)
1663 if e1 != 0 {
1664 err = errnoErr(e1)
1665 }
1666 return
1667 }
1668
1669
1670
1671 func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
1672 r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
1673 n = int(r0)
1674 if e1 != 0 {
1675 err = errnoErr(e1)
1676 }
1677 return
1678 }
1679
1680
1681
1682 func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
1683 var _p0 *byte
1684 _p0, err = BytePtrFromString(path)
1685 if err != nil {
1686 return
1687 }
1688 _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
1689 if e1 != 0 {
1690 err = errnoErr(e1)
1691 }
1692 return
1693 }
1694
View as plain text