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