1
2
3
4
5
6 package unix
7
8 import (
9 "unsafe"
10 )
11
12
13
14 func utimes(path string, times *[2]Timeval) (err error) {
15 var _p0 *byte
16 _p0, err = BytePtrFromString(path)
17 if err != nil {
18 return
19 }
20 _, e1 := callutimes(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)))
21 if e1 != 0 {
22 err = errnoErr(e1)
23 }
24 return
25 }
26
27
28
29 func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) {
30 var _p0 *byte
31 _p0, err = BytePtrFromString(path)
32 if err != nil {
33 return
34 }
35 _, e1 := callutimensat(dirfd, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), flag)
36 if e1 != 0 {
37 err = errnoErr(e1)
38 }
39 return
40 }
41
42
43
44 func getcwd(buf []byte) (err error) {
45 var _p0 *byte
46 if len(buf) > 0 {
47 _p0 = &buf[0]
48 }
49 _, e1 := callgetcwd(uintptr(unsafe.Pointer(_p0)), len(buf))
50 if e1 != 0 {
51 err = errnoErr(e1)
52 }
53 return
54 }
55
56
57
58 func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
59 r0, e1 := callaccept(s, uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
60 fd = int(r0)
61 if e1 != 0 {
62 err = errnoErr(e1)
63 }
64 return
65 }
66
67
68
69 func getdirent(fd int, buf []byte) (n int, err error) {
70 var _p0 *byte
71 if len(buf) > 0 {
72 _p0 = &buf[0]
73 }
74 r0, e1 := callgetdirent(fd, uintptr(unsafe.Pointer(_p0)), len(buf))
75 n = int(r0)
76 if e1 != 0 {
77 err = errnoErr(e1)
78 }
79 return
80 }
81
82
83
84 func wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error) {
85 r0, e1 := callwait4(int(pid), uintptr(unsafe.Pointer(status)), options, uintptr(unsafe.Pointer(rusage)))
86 wpid = Pid_t(r0)
87 if e1 != 0 {
88 err = errnoErr(e1)
89 }
90 return
91 }
92
93
94
95 func ioctl(fd int, req int, arg uintptr) (err error) {
96 _, e1 := callioctl(fd, req, arg)
97 if e1 != 0 {
98 err = errnoErr(e1)
99 }
100 return
101 }
102
103
104
105 func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) {
106 _, e1 := callioctl_ptr(fd, req, arg)
107 if e1 != 0 {
108 err = errnoErr(e1)
109 }
110 return
111 }
112
113
114
115 func FcntlInt(fd uintptr, cmd int, arg int) (r int, err error) {
116 r0, e1 := callfcntl(fd, cmd, uintptr(arg))
117 r = int(r0)
118 if e1 != 0 {
119 err = errnoErr(e1)
120 }
121 return
122 }
123
124
125
126 func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) (err error) {
127 _, e1 := callfcntl(fd, cmd, uintptr(unsafe.Pointer(lk)))
128 if e1 != 0 {
129 err = errnoErr(e1)
130 }
131 return
132 }
133
134
135
136 func fcntl(fd int, cmd int, arg int) (val int, err error) {
137 r0, e1 := callfcntl(uintptr(fd), cmd, uintptr(arg))
138 val = int(r0)
139 if e1 != 0 {
140 err = errnoErr(e1)
141 }
142 return
143 }
144
145
146
147 func fsyncRange(fd int, how int, start int64, length int64) (err error) {
148 _, e1 := callfsync_range(fd, how, start, length)
149 if e1 != 0 {
150 err = errnoErr(e1)
151 }
152 return
153 }
154
155
156
157 func Acct(path string) (err error) {
158 var _p0 *byte
159 _p0, err = BytePtrFromString(path)
160 if err != nil {
161 return
162 }
163 _, e1 := callacct(uintptr(unsafe.Pointer(_p0)))
164 if e1 != 0 {
165 err = errnoErr(e1)
166 }
167 return
168 }
169
170
171
172 func Chdir(path string) (err error) {
173 var _p0 *byte
174 _p0, err = BytePtrFromString(path)
175 if err != nil {
176 return
177 }
178 _, e1 := callchdir(uintptr(unsafe.Pointer(_p0)))
179 if e1 != 0 {
180 err = errnoErr(e1)
181 }
182 return
183 }
184
185
186
187 func Chroot(path string) (err error) {
188 var _p0 *byte
189 _p0, err = BytePtrFromString(path)
190 if err != nil {
191 return
192 }
193 _, e1 := callchroot(uintptr(unsafe.Pointer(_p0)))
194 if e1 != 0 {
195 err = errnoErr(e1)
196 }
197 return
198 }
199
200
201
202 func Close(fd int) (err error) {
203 _, e1 := callclose(fd)
204 if e1 != 0 {
205 err = errnoErr(e1)
206 }
207 return
208 }
209
210
211
212 func Dup(oldfd int) (fd int, err error) {
213 r0, e1 := calldup(oldfd)
214 fd = int(r0)
215 if e1 != 0 {
216 err = errnoErr(e1)
217 }
218 return
219 }
220
221
222
223 func Exit(code int) {
224 callexit(code)
225 return
226 }
227
228
229
230 func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
231 var _p0 *byte
232 _p0, err = BytePtrFromString(path)
233 if err != nil {
234 return
235 }
236 _, e1 := callfaccessat(dirfd, uintptr(unsafe.Pointer(_p0)), mode, flags)
237 if e1 != 0 {
238 err = errnoErr(e1)
239 }
240 return
241 }
242
243
244
245 func Fchdir(fd int) (err error) {
246 _, e1 := callfchdir(fd)
247 if e1 != 0 {
248 err = errnoErr(e1)
249 }
250 return
251 }
252
253
254
255 func Fchmod(fd int, mode uint32) (err error) {
256 _, e1 := callfchmod(fd, mode)
257 if e1 != 0 {
258 err = errnoErr(e1)
259 }
260 return
261 }
262
263
264
265 func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
266 var _p0 *byte
267 _p0, err = BytePtrFromString(path)
268 if err != nil {
269 return
270 }
271 _, e1 := callfchmodat(dirfd, uintptr(unsafe.Pointer(_p0)), mode, flags)
272 if e1 != 0 {
273 err = errnoErr(e1)
274 }
275 return
276 }
277
278
279
280 func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
281 var _p0 *byte
282 _p0, err = BytePtrFromString(path)
283 if err != nil {
284 return
285 }
286 _, e1 := callfchownat(dirfd, uintptr(unsafe.Pointer(_p0)), uid, gid, flags)
287 if e1 != 0 {
288 err = errnoErr(e1)
289 }
290 return
291 }
292
293
294
295 func Fdatasync(fd int) (err error) {
296 _, e1 := callfdatasync(fd)
297 if e1 != 0 {
298 err = errnoErr(e1)
299 }
300 return
301 }
302
303
304
305 func Getpgid(pid int) (pgid int, err error) {
306 r0, e1 := callgetpgid(pid)
307 pgid = int(r0)
308 if e1 != 0 {
309 err = errnoErr(e1)
310 }
311 return
312 }
313
314
315
316 func Getpgrp() (pid int) {
317 r0, _ := callgetpgrp()
318 pid = int(r0)
319 return
320 }
321
322
323
324 func Getpid() (pid int) {
325 r0, _ := callgetpid()
326 pid = int(r0)
327 return
328 }
329
330
331
332 func Getppid() (ppid int) {
333 r0, _ := callgetppid()
334 ppid = int(r0)
335 return
336 }
337
338
339
340 func Getpriority(which int, who int) (prio int, err error) {
341 r0, e1 := callgetpriority(which, who)
342 prio = int(r0)
343 if e1 != 0 {
344 err = errnoErr(e1)
345 }
346 return
347 }
348
349
350
351 func Getrusage(who int, rusage *Rusage) (err error) {
352 _, e1 := callgetrusage(who, uintptr(unsafe.Pointer(rusage)))
353 if e1 != 0 {
354 err = errnoErr(e1)
355 }
356 return
357 }
358
359
360
361 func Getsid(pid int) (sid int, err error) {
362 r0, e1 := callgetsid(pid)
363 sid = int(r0)
364 if e1 != 0 {
365 err = errnoErr(e1)
366 }
367 return
368 }
369
370
371
372 func Kill(pid int, sig Signal) (err error) {
373 _, e1 := callkill(pid, int(sig))
374 if e1 != 0 {
375 err = errnoErr(e1)
376 }
377 return
378 }
379
380
381
382 func Klogctl(typ int, buf []byte) (n int, err error) {
383 var _p0 *byte
384 if len(buf) > 0 {
385 _p0 = &buf[0]
386 }
387 r0, e1 := callsyslog(typ, uintptr(unsafe.Pointer(_p0)), len(buf))
388 n = int(r0)
389 if e1 != 0 {
390 err = errnoErr(e1)
391 }
392 return
393 }
394
395
396
397 func Mkdir(dirfd int, path string, mode uint32) (err error) {
398 var _p0 *byte
399 _p0, err = BytePtrFromString(path)
400 if err != nil {
401 return
402 }
403 _, e1 := callmkdir(dirfd, uintptr(unsafe.Pointer(_p0)), mode)
404 if e1 != 0 {
405 err = errnoErr(e1)
406 }
407 return
408 }
409
410
411
412 func Mkdirat(dirfd int, path string, mode uint32) (err error) {
413 var _p0 *byte
414 _p0, err = BytePtrFromString(path)
415 if err != nil {
416 return
417 }
418 _, e1 := callmkdirat(dirfd, uintptr(unsafe.Pointer(_p0)), mode)
419 if e1 != 0 {
420 err = errnoErr(e1)
421 }
422 return
423 }
424
425
426
427 func Mkfifo(path string, mode uint32) (err error) {
428 var _p0 *byte
429 _p0, err = BytePtrFromString(path)
430 if err != nil {
431 return
432 }
433 _, e1 := callmkfifo(uintptr(unsafe.Pointer(_p0)), mode)
434 if e1 != 0 {
435 err = errnoErr(e1)
436 }
437 return
438 }
439
440
441
442 func Mknod(path string, mode uint32, dev int) (err error) {
443 var _p0 *byte
444 _p0, err = BytePtrFromString(path)
445 if err != nil {
446 return
447 }
448 _, e1 := callmknod(uintptr(unsafe.Pointer(_p0)), mode, dev)
449 if e1 != 0 {
450 err = errnoErr(e1)
451 }
452 return
453 }
454
455
456
457 func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
458 var _p0 *byte
459 _p0, err = BytePtrFromString(path)
460 if err != nil {
461 return
462 }
463 _, e1 := callmknodat(dirfd, uintptr(unsafe.Pointer(_p0)), mode, dev)
464 if e1 != 0 {
465 err = errnoErr(e1)
466 }
467 return
468 }
469
470
471
472 func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
473 _, e1 := callnanosleep(uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)))
474 if e1 != 0 {
475 err = errnoErr(e1)
476 }
477 return
478 }
479
480
481
482 func Open(path string, mode int, perm uint32) (fd int, err error) {
483 var _p0 *byte
484 _p0, err = BytePtrFromString(path)
485 if err != nil {
486 return
487 }
488 r0, e1 := callopen64(uintptr(unsafe.Pointer(_p0)), mode, perm)
489 fd = int(r0)
490 if e1 != 0 {
491 err = errnoErr(e1)
492 }
493 return
494 }
495
496
497
498 func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) {
499 var _p0 *byte
500 _p0, err = BytePtrFromString(path)
501 if err != nil {
502 return
503 }
504 r0, e1 := callopenat(dirfd, uintptr(unsafe.Pointer(_p0)), flags, mode)
505 fd = int(r0)
506 if e1 != 0 {
507 err = errnoErr(e1)
508 }
509 return
510 }
511
512
513
514 func read(fd int, p []byte) (n int, err error) {
515 var _p0 *byte
516 if len(p) > 0 {
517 _p0 = &p[0]
518 }
519 r0, e1 := callread(fd, uintptr(unsafe.Pointer(_p0)), len(p))
520 n = int(r0)
521 if e1 != 0 {
522 err = errnoErr(e1)
523 }
524 return
525 }
526
527
528
529 func Readlink(path string, buf []byte) (n int, err error) {
530 var _p0 *byte
531 _p0, err = BytePtrFromString(path)
532 if err != nil {
533 return
534 }
535 var _p1 *byte
536 if len(buf) > 0 {
537 _p1 = &buf[0]
538 }
539 r0, e1 := callreadlink(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), len(buf))
540 n = int(r0)
541 if e1 != 0 {
542 err = errnoErr(e1)
543 }
544 return
545 }
546
547
548
549 func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
550 var _p0 *byte
551 _p0, err = BytePtrFromString(oldpath)
552 if err != nil {
553 return
554 }
555 var _p1 *byte
556 _p1, err = BytePtrFromString(newpath)
557 if err != nil {
558 return
559 }
560 _, e1 := callrenameat(olddirfd, uintptr(unsafe.Pointer(_p0)), newdirfd, uintptr(unsafe.Pointer(_p1)))
561 if e1 != 0 {
562 err = errnoErr(e1)
563 }
564 return
565 }
566
567
568
569 func Setdomainname(p []byte) (err error) {
570 var _p0 *byte
571 if len(p) > 0 {
572 _p0 = &p[0]
573 }
574 _, e1 := callsetdomainname(uintptr(unsafe.Pointer(_p0)), len(p))
575 if e1 != 0 {
576 err = errnoErr(e1)
577 }
578 return
579 }
580
581
582
583 func Sethostname(p []byte) (err error) {
584 var _p0 *byte
585 if len(p) > 0 {
586 _p0 = &p[0]
587 }
588 _, e1 := callsethostname(uintptr(unsafe.Pointer(_p0)), len(p))
589 if e1 != 0 {
590 err = errnoErr(e1)
591 }
592 return
593 }
594
595
596
597 func Setpgid(pid int, pgid int) (err error) {
598 _, e1 := callsetpgid(pid, pgid)
599 if e1 != 0 {
600 err = errnoErr(e1)
601 }
602 return
603 }
604
605
606
607 func Setsid() (pid int, err error) {
608 r0, e1 := callsetsid()
609 pid = int(r0)
610 if e1 != 0 {
611 err = errnoErr(e1)
612 }
613 return
614 }
615
616
617
618 func Settimeofday(tv *Timeval) (err error) {
619 _, e1 := callsettimeofday(uintptr(unsafe.Pointer(tv)))
620 if e1 != 0 {
621 err = errnoErr(e1)
622 }
623 return
624 }
625
626
627
628 func Setuid(uid int) (err error) {
629 _, e1 := callsetuid(uid)
630 if e1 != 0 {
631 err = errnoErr(e1)
632 }
633 return
634 }
635
636
637
638 func Setgid(uid int) (err error) {
639 _, e1 := callsetgid(uid)
640 if e1 != 0 {
641 err = errnoErr(e1)
642 }
643 return
644 }
645
646
647
648 func Setpriority(which int, who int, prio int) (err error) {
649 _, e1 := callsetpriority(which, who, prio)
650 if e1 != 0 {
651 err = errnoErr(e1)
652 }
653 return
654 }
655
656
657
658 func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) {
659 var _p0 *byte
660 _p0, err = BytePtrFromString(path)
661 if err != nil {
662 return
663 }
664 _, e1 := callstatx(dirfd, uintptr(unsafe.Pointer(_p0)), flags, mask, uintptr(unsafe.Pointer(stat)))
665 if e1 != 0 {
666 err = errnoErr(e1)
667 }
668 return
669 }
670
671
672
673 func Sync() {
674 callsync()
675 return
676 }
677
678
679
680 func Times(tms *Tms) (ticks uintptr, err error) {
681 r0, e1 := calltimes(uintptr(unsafe.Pointer(tms)))
682 ticks = uintptr(r0)
683 if e1 != 0 {
684 err = errnoErr(e1)
685 }
686 return
687 }
688
689
690
691 func Umask(mask int) (oldmask int) {
692 r0, _ := callumask(mask)
693 oldmask = int(r0)
694 return
695 }
696
697
698
699 func Uname(buf *Utsname) (err error) {
700 _, e1 := calluname(uintptr(unsafe.Pointer(buf)))
701 if e1 != 0 {
702 err = errnoErr(e1)
703 }
704 return
705 }
706
707
708
709 func Unlink(path string) (err error) {
710 var _p0 *byte
711 _p0, err = BytePtrFromString(path)
712 if err != nil {
713 return
714 }
715 _, e1 := callunlink(uintptr(unsafe.Pointer(_p0)))
716 if e1 != 0 {
717 err = errnoErr(e1)
718 }
719 return
720 }
721
722
723
724 func Unlinkat(dirfd int, path string, flags int) (err error) {
725 var _p0 *byte
726 _p0, err = BytePtrFromString(path)
727 if err != nil {
728 return
729 }
730 _, e1 := callunlinkat(dirfd, uintptr(unsafe.Pointer(_p0)), flags)
731 if e1 != 0 {
732 err = errnoErr(e1)
733 }
734 return
735 }
736
737
738
739 func Ustat(dev int, ubuf *Ustat_t) (err error) {
740 _, e1 := callustat(dev, uintptr(unsafe.Pointer(ubuf)))
741 if e1 != 0 {
742 err = errnoErr(e1)
743 }
744 return
745 }
746
747
748
749 func write(fd int, p []byte) (n int, err error) {
750 var _p0 *byte
751 if len(p) > 0 {
752 _p0 = &p[0]
753 }
754 r0, e1 := callwrite(fd, uintptr(unsafe.Pointer(_p0)), len(p))
755 n = int(r0)
756 if e1 != 0 {
757 err = errnoErr(e1)
758 }
759 return
760 }
761
762
763
764 func Dup2(oldfd int, newfd int) (err error) {
765 _, e1 := calldup2(oldfd, newfd)
766 if e1 != 0 {
767 err = errnoErr(e1)
768 }
769 return
770 }
771
772
773
774 func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
775 _, e1 := callposix_fadvise64(fd, offset, length, advice)
776 if e1 != 0 {
777 err = errnoErr(e1)
778 }
779 return
780 }
781
782
783
784 func Fchown(fd int, uid int, gid int) (err error) {
785 _, e1 := callfchown(fd, uid, gid)
786 if e1 != 0 {
787 err = errnoErr(e1)
788 }
789 return
790 }
791
792
793
794 func fstat(fd int, stat *Stat_t) (err error) {
795 _, e1 := callfstat(fd, uintptr(unsafe.Pointer(stat)))
796 if e1 != 0 {
797 err = errnoErr(e1)
798 }
799 return
800 }
801
802
803
804 func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) {
805 var _p0 *byte
806 _p0, err = BytePtrFromString(path)
807 if err != nil {
808 return
809 }
810 _, e1 := callfstatat(dirfd, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), flags)
811 if e1 != 0 {
812 err = errnoErr(e1)
813 }
814 return
815 }
816
817
818
819 func Fstatfs(fd int, buf *Statfs_t) (err error) {
820 _, e1 := callfstatfs(fd, uintptr(unsafe.Pointer(buf)))
821 if e1 != 0 {
822 err = errnoErr(e1)
823 }
824 return
825 }
826
827
828
829 func Ftruncate(fd int, length int64) (err error) {
830 _, e1 := callftruncate(fd, length)
831 if e1 != 0 {
832 err = errnoErr(e1)
833 }
834 return
835 }
836
837
838
839 func Getegid() (egid int) {
840 r0, _ := callgetegid()
841 egid = int(r0)
842 return
843 }
844
845
846
847 func Geteuid() (euid int) {
848 r0, _ := callgeteuid()
849 euid = int(r0)
850 return
851 }
852
853
854
855 func Getgid() (gid int) {
856 r0, _ := callgetgid()
857 gid = int(r0)
858 return
859 }
860
861
862
863 func Getuid() (uid int) {
864 r0, _ := callgetuid()
865 uid = int(r0)
866 return
867 }
868
869
870
871 func Lchown(path string, uid int, gid int) (err error) {
872 var _p0 *byte
873 _p0, err = BytePtrFromString(path)
874 if err != nil {
875 return
876 }
877 _, e1 := calllchown(uintptr(unsafe.Pointer(_p0)), uid, gid)
878 if e1 != 0 {
879 err = errnoErr(e1)
880 }
881 return
882 }
883
884
885
886 func Listen(s int, n int) (err error) {
887 _, e1 := calllisten(s, n)
888 if e1 != 0 {
889 err = errnoErr(e1)
890 }
891 return
892 }
893
894
895
896 func lstat(path string, stat *Stat_t) (err error) {
897 var _p0 *byte
898 _p0, err = BytePtrFromString(path)
899 if err != nil {
900 return
901 }
902 _, e1 := calllstat(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)))
903 if e1 != 0 {
904 err = errnoErr(e1)
905 }
906 return
907 }
908
909
910
911 func Pause() (err error) {
912 _, e1 := callpause()
913 if e1 != 0 {
914 err = errnoErr(e1)
915 }
916 return
917 }
918
919
920
921 func pread(fd int, p []byte, offset int64) (n int, err error) {
922 var _p0 *byte
923 if len(p) > 0 {
924 _p0 = &p[0]
925 }
926 r0, e1 := callpread64(fd, uintptr(unsafe.Pointer(_p0)), len(p), offset)
927 n = int(r0)
928 if e1 != 0 {
929 err = errnoErr(e1)
930 }
931 return
932 }
933
934
935
936 func pwrite(fd int, p []byte, offset int64) (n int, err error) {
937 var _p0 *byte
938 if len(p) > 0 {
939 _p0 = &p[0]
940 }
941 r0, e1 := callpwrite64(fd, uintptr(unsafe.Pointer(_p0)), len(p), offset)
942 n = int(r0)
943 if e1 != 0 {
944 err = errnoErr(e1)
945 }
946 return
947 }
948
949
950
951 func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
952 r0, e1 := callselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)))
953 n = int(r0)
954 if e1 != 0 {
955 err = errnoErr(e1)
956 }
957 return
958 }
959
960
961
962 func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
963 r0, e1 := callpselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)))
964 n = int(r0)
965 if e1 != 0 {
966 err = errnoErr(e1)
967 }
968 return
969 }
970
971
972
973 func Setregid(rgid int, egid int) (err error) {
974 _, e1 := callsetregid(rgid, egid)
975 if e1 != 0 {
976 err = errnoErr(e1)
977 }
978 return
979 }
980
981
982
983 func Setreuid(ruid int, euid int) (err error) {
984 _, e1 := callsetreuid(ruid, euid)
985 if e1 != 0 {
986 err = errnoErr(e1)
987 }
988 return
989 }
990
991
992
993 func Shutdown(fd int, how int) (err error) {
994 _, e1 := callshutdown(fd, how)
995 if e1 != 0 {
996 err = errnoErr(e1)
997 }
998 return
999 }
1000
1001
1002
1003 func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
1004 r0, e1 := callsplice(rfd, uintptr(unsafe.Pointer(roff)), wfd, uintptr(unsafe.Pointer(woff)), len, flags)
1005 n = int64(r0)
1006 if e1 != 0 {
1007 err = errnoErr(e1)
1008 }
1009 return
1010 }
1011
1012
1013
1014 func stat(path string, statptr *Stat_t) (err error) {
1015 var _p0 *byte
1016 _p0, err = BytePtrFromString(path)
1017 if err != nil {
1018 return
1019 }
1020 _, e1 := callstat(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statptr)))
1021 if e1 != 0 {
1022 err = errnoErr(e1)
1023 }
1024 return
1025 }
1026
1027
1028
1029 func Statfs(path string, buf *Statfs_t) (err error) {
1030 var _p0 *byte
1031 _p0, err = BytePtrFromString(path)
1032 if err != nil {
1033 return
1034 }
1035 _, e1 := callstatfs(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)))
1036 if e1 != 0 {
1037 err = errnoErr(e1)
1038 }
1039 return
1040 }
1041
1042
1043
1044 func Truncate(path string, length int64) (err error) {
1045 var _p0 *byte
1046 _p0, err = BytePtrFromString(path)
1047 if err != nil {
1048 return
1049 }
1050 _, e1 := calltruncate(uintptr(unsafe.Pointer(_p0)), length)
1051 if e1 != 0 {
1052 err = errnoErr(e1)
1053 }
1054 return
1055 }
1056
1057
1058
1059 func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
1060 _, e1 := callbind(s, uintptr(addr), uintptr(addrlen))
1061 if e1 != 0 {
1062 err = errnoErr(e1)
1063 }
1064 return
1065 }
1066
1067
1068
1069 func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
1070 _, e1 := callconnect(s, uintptr(addr), uintptr(addrlen))
1071 if e1 != 0 {
1072 err = errnoErr(e1)
1073 }
1074 return
1075 }
1076
1077
1078
1079 func getgroups(n int, list *_Gid_t) (nn int, err error) {
1080 r0, e1 := callgetgroups(n, uintptr(unsafe.Pointer(list)))
1081 nn = int(r0)
1082 if e1 != 0 {
1083 err = errnoErr(e1)
1084 }
1085 return
1086 }
1087
1088
1089
1090 func setgroups(n int, list *_Gid_t) (err error) {
1091 _, e1 := callsetgroups(n, uintptr(unsafe.Pointer(list)))
1092 if e1 != 0 {
1093 err = errnoErr(e1)
1094 }
1095 return
1096 }
1097
1098
1099
1100 func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
1101 _, e1 := callgetsockopt(s, level, name, uintptr(val), uintptr(unsafe.Pointer(vallen)))
1102 if e1 != 0 {
1103 err = errnoErr(e1)
1104 }
1105 return
1106 }
1107
1108
1109
1110 func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
1111 _, e1 := callsetsockopt(s, level, name, uintptr(val), vallen)
1112 if e1 != 0 {
1113 err = errnoErr(e1)
1114 }
1115 return
1116 }
1117
1118
1119
1120 func socket(domain int, typ int, proto int) (fd int, err error) {
1121 r0, e1 := callsocket(domain, typ, proto)
1122 fd = int(r0)
1123 if e1 != 0 {
1124 err = errnoErr(e1)
1125 }
1126 return
1127 }
1128
1129
1130
1131 func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
1132 _, e1 := callsocketpair(domain, typ, proto, uintptr(unsafe.Pointer(fd)))
1133 if e1 != 0 {
1134 err = errnoErr(e1)
1135 }
1136 return
1137 }
1138
1139
1140
1141 func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
1142 _, e1 := callgetpeername(fd, uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
1143 if e1 != 0 {
1144 err = errnoErr(e1)
1145 }
1146 return
1147 }
1148
1149
1150
1151 func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
1152 _, e1 := callgetsockname(fd, uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
1153 if e1 != 0 {
1154 err = errnoErr(e1)
1155 }
1156 return
1157 }
1158
1159
1160
1161 func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
1162 var _p0 *byte
1163 if len(p) > 0 {
1164 _p0 = &p[0]
1165 }
1166 r0, e1 := callrecvfrom(fd, uintptr(unsafe.Pointer(_p0)), len(p), flags, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
1167 n = int(r0)
1168 if e1 != 0 {
1169 err = errnoErr(e1)
1170 }
1171 return
1172 }
1173
1174
1175
1176 func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
1177 var _p0 *byte
1178 if len(buf) > 0 {
1179 _p0 = &buf[0]
1180 }
1181 _, e1 := callsendto(s, uintptr(unsafe.Pointer(_p0)), len(buf), flags, uintptr(to), uintptr(addrlen))
1182 if e1 != 0 {
1183 err = errnoErr(e1)
1184 }
1185 return
1186 }
1187
1188
1189
1190 func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
1191 r0, e1 := callnrecvmsg(s, uintptr(unsafe.Pointer(msg)), flags)
1192 n = int(r0)
1193 if e1 != 0 {
1194 err = errnoErr(e1)
1195 }
1196 return
1197 }
1198
1199
1200
1201 func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
1202 r0, e1 := callnsendmsg(s, uintptr(unsafe.Pointer(msg)), flags)
1203 n = int(r0)
1204 if e1 != 0 {
1205 err = errnoErr(e1)
1206 }
1207 return
1208 }
1209
1210
1211
1212 func munmap(addr uintptr, length uintptr) (err error) {
1213 _, e1 := callmunmap(addr, length)
1214 if e1 != 0 {
1215 err = errnoErr(e1)
1216 }
1217 return
1218 }
1219
1220
1221
1222 func Madvise(b []byte, advice int) (err error) {
1223 var _p0 *byte
1224 if len(b) > 0 {
1225 _p0 = &b[0]
1226 }
1227 _, e1 := callmadvise(uintptr(unsafe.Pointer(_p0)), len(b), advice)
1228 if e1 != 0 {
1229 err = errnoErr(e1)
1230 }
1231 return
1232 }
1233
1234
1235
1236 func Mprotect(b []byte, prot int) (err error) {
1237 var _p0 *byte
1238 if len(b) > 0 {
1239 _p0 = &b[0]
1240 }
1241 _, e1 := callmprotect(uintptr(unsafe.Pointer(_p0)), len(b), prot)
1242 if e1 != 0 {
1243 err = errnoErr(e1)
1244 }
1245 return
1246 }
1247
1248
1249
1250 func Mlock(b []byte) (err error) {
1251 var _p0 *byte
1252 if len(b) > 0 {
1253 _p0 = &b[0]
1254 }
1255 _, e1 := callmlock(uintptr(unsafe.Pointer(_p0)), len(b))
1256 if e1 != 0 {
1257 err = errnoErr(e1)
1258 }
1259 return
1260 }
1261
1262
1263
1264 func Mlockall(flags int) (err error) {
1265 _, e1 := callmlockall(flags)
1266 if e1 != 0 {
1267 err = errnoErr(e1)
1268 }
1269 return
1270 }
1271
1272
1273
1274 func Msync(b []byte, flags int) (err error) {
1275 var _p0 *byte
1276 if len(b) > 0 {
1277 _p0 = &b[0]
1278 }
1279 _, e1 := callmsync(uintptr(unsafe.Pointer(_p0)), len(b), flags)
1280 if e1 != 0 {
1281 err = errnoErr(e1)
1282 }
1283 return
1284 }
1285
1286
1287
1288 func Munlock(b []byte) (err error) {
1289 var _p0 *byte
1290 if len(b) > 0 {
1291 _p0 = &b[0]
1292 }
1293 _, e1 := callmunlock(uintptr(unsafe.Pointer(_p0)), len(b))
1294 if e1 != 0 {
1295 err = errnoErr(e1)
1296 }
1297 return
1298 }
1299
1300
1301
1302 func Munlockall() (err error) {
1303 _, e1 := callmunlockall()
1304 if e1 != 0 {
1305 err = errnoErr(e1)
1306 }
1307 return
1308 }
1309
1310
1311
1312 func pipe(p *[2]_C_int) (err error) {
1313 _, e1 := callpipe(uintptr(unsafe.Pointer(p)))
1314 if e1 != 0 {
1315 err = errnoErr(e1)
1316 }
1317 return
1318 }
1319
1320
1321
1322 func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
1323 r0, e1 := callpoll(uintptr(unsafe.Pointer(fds)), nfds, timeout)
1324 n = int(r0)
1325 if e1 != 0 {
1326 err = errnoErr(e1)
1327 }
1328 return
1329 }
1330
1331
1332
1333 func gettimeofday(tv *Timeval, tzp *Timezone) (err error) {
1334 _, e1 := callgettimeofday(uintptr(unsafe.Pointer(tv)), uintptr(unsafe.Pointer(tzp)))
1335 if e1 != 0 {
1336 err = errnoErr(e1)
1337 }
1338 return
1339 }
1340
1341
1342
1343 func Time(t *Time_t) (tt Time_t, err error) {
1344 r0, e1 := calltime(uintptr(unsafe.Pointer(t)))
1345 tt = Time_t(r0)
1346 if e1 != 0 {
1347 err = errnoErr(e1)
1348 }
1349 return
1350 }
1351
1352
1353
1354 func Utime(path string, buf *Utimbuf) (err error) {
1355 var _p0 *byte
1356 _p0, err = BytePtrFromString(path)
1357 if err != nil {
1358 return
1359 }
1360 _, e1 := callutime(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)))
1361 if e1 != 0 {
1362 err = errnoErr(e1)
1363 }
1364 return
1365 }
1366
1367
1368
1369 func Getsystemcfg(label int) (n uint64) {
1370 r0, _ := callgetsystemcfg(label)
1371 n = uint64(r0)
1372 return
1373 }
1374
1375
1376
1377 func umount(target string) (err error) {
1378 var _p0 *byte
1379 _p0, err = BytePtrFromString(target)
1380 if err != nil {
1381 return
1382 }
1383 _, e1 := callumount(uintptr(unsafe.Pointer(_p0)))
1384 if e1 != 0 {
1385 err = errnoErr(e1)
1386 }
1387 return
1388 }
1389
1390
1391
1392 func Getrlimit(resource int, rlim *Rlimit) (err error) {
1393 _, e1 := callgetrlimit(resource, uintptr(unsafe.Pointer(rlim)))
1394 if e1 != 0 {
1395 err = errnoErr(e1)
1396 }
1397 return
1398 }
1399
1400
1401
1402 func Seek(fd int, offset int64, whence int) (off int64, err error) {
1403 r0, e1 := calllseek(fd, offset, whence)
1404 off = int64(r0)
1405 if e1 != 0 {
1406 err = errnoErr(e1)
1407 }
1408 return
1409 }
1410
1411
1412
1413 func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
1414 r0, e1 := callmmap64(addr, length, prot, flags, fd, offset)
1415 xaddr = uintptr(r0)
1416 if e1 != 0 {
1417 err = errnoErr(e1)
1418 }
1419 return
1420 }
1421
View as plain text