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