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