Source file
src/syscall/zsyscall_freebsd_386.go
1
2
3
4
5
6 package syscall
7
8 import "unsafe"
9
10
11
12 func getgroups(ngid int, gid *_Gid_t) (n int, err error) {
13 r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0)
14 n = int(r0)
15 if e1 != 0 {
16 err = errnoErr(e1)
17 }
18 return
19 }
20
21
22
23 func setgroups(ngid int, gid *_Gid_t) (err error) {
24 _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0)
25 if e1 != 0 {
26 err = errnoErr(e1)
27 }
28 return
29 }
30
31
32
33 func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) {
34 r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0)
35 wpid = int(r0)
36 if e1 != 0 {
37 err = errnoErr(e1)
38 }
39 return
40 }
41
42
43
44 func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
45 r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
46 fd = int(r0)
47 if e1 != 0 {
48 err = errnoErr(e1)
49 }
50 return
51 }
52
53
54
55 func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
56 _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen))
57 if e1 != 0 {
58 err = errnoErr(e1)
59 }
60 return
61 }
62
63
64
65 func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
66 _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen))
67 if e1 != 0 {
68 err = errnoErr(e1)
69 }
70 return
71 }
72
73
74
75 func socket(domain int, typ int, proto int) (fd int, err error) {
76 r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
77 fd = int(r0)
78 if e1 != 0 {
79 err = errnoErr(e1)
80 }
81 return
82 }
83
84
85
86 func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
87 _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
88 if e1 != 0 {
89 err = errnoErr(e1)
90 }
91 return
92 }
93
94
95
96 func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
97 _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
98 if e1 != 0 {
99 err = errnoErr(e1)
100 }
101 return
102 }
103
104
105
106 func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
107 _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
108 if e1 != 0 {
109 err = errnoErr(e1)
110 }
111 return
112 }
113
114
115
116 func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
117 _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
118 if e1 != 0 {
119 err = errnoErr(e1)
120 }
121 return
122 }
123
124
125
126 func Shutdown(s int, how int) (err error) {
127 _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0)
128 if e1 != 0 {
129 err = errnoErr(e1)
130 }
131 return
132 }
133
134
135
136 func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
137 _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
138 if e1 != 0 {
139 err = errnoErr(e1)
140 }
141 return
142 }
143
144
145
146 func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
147 var _p0 unsafe.Pointer
148 if len(p) > 0 {
149 _p0 = unsafe.Pointer(&p[0])
150 } else {
151 _p0 = unsafe.Pointer(&_zero)
152 }
153 r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
154 n = int(r0)
155 if e1 != 0 {
156 err = errnoErr(e1)
157 }
158 return
159 }
160
161
162
163 func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
164 var _p0 unsafe.Pointer
165 if len(buf) > 0 {
166 _p0 = unsafe.Pointer(&buf[0])
167 } else {
168 _p0 = unsafe.Pointer(&_zero)
169 }
170 _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
171 if e1 != 0 {
172 err = errnoErr(e1)
173 }
174 return
175 }
176
177
178
179 func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
180 r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
181 n = int(r0)
182 if e1 != 0 {
183 err = errnoErr(e1)
184 }
185 return
186 }
187
188
189
190 func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
191 r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
192 n = int(r0)
193 if e1 != 0 {
194 err = errnoErr(e1)
195 }
196 return
197 }
198
199
200
201 func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) {
202 r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout)))
203 n = int(r0)
204 if e1 != 0 {
205 err = errnoErr(e1)
206 }
207 return
208 }
209
210
211
212 func utimes(path string, timeval *[2]Timeval) (err error) {
213 var _p0 *byte
214 _p0, err = BytePtrFromString(path)
215 if err != nil {
216 return
217 }
218 _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
219 if e1 != 0 {
220 err = errnoErr(e1)
221 }
222 return
223 }
224
225
226
227 func futimes(fd int, timeval *[2]Timeval) (err error) {
228 _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0)
229 if e1 != 0 {
230 err = errnoErr(e1)
231 }
232 return
233 }
234
235
236
237 func fcntl(fd int, cmd int, arg int) (val int, err error) {
238 r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
239 val = int(r0)
240 if e1 != 0 {
241 err = errnoErr(e1)
242 }
243 return
244 }
245
246
247
248 func fcntlPtr(fd int, cmd int, arg unsafe.Pointer) (val int, err error) {
249 r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
250 val = int(r0)
251 if e1 != 0 {
252 err = errnoErr(e1)
253 }
254 return
255 }
256
257
258
259 func ioctl(fd int, req int, arg int) (err error) {
260 _, _, e1 := RawSyscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
261 if e1 != 0 {
262 err = errnoErr(e1)
263 }
264 return
265 }
266
267
268
269 func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
270 _, _, e1 := RawSyscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
271 if e1 != 0 {
272 err = errnoErr(e1)
273 }
274 return
275 }
276
277
278
279 func pipe2(p *[2]_C_int, flags int) (err error) {
280 _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
281 if e1 != 0 {
282 err = errnoErr(e1)
283 }
284 return
285 }
286
287
288
289 func Access(path string, mode uint32) (err error) {
290 var _p0 *byte
291 _p0, err = BytePtrFromString(path)
292 if err != nil {
293 return
294 }
295 _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
296 if e1 != 0 {
297 err = errnoErr(e1)
298 }
299 return
300 }
301
302
303
304 func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
305 _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0)
306 if e1 != 0 {
307 err = errnoErr(e1)
308 }
309 return
310 }
311
312
313
314 func Chdir(path string) (err error) {
315 var _p0 *byte
316 _p0, err = BytePtrFromString(path)
317 if err != nil {
318 return
319 }
320 _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
321 if e1 != 0 {
322 err = errnoErr(e1)
323 }
324 return
325 }
326
327
328
329 func Chflags(path string, flags int) (err error) {
330 var _p0 *byte
331 _p0, err = BytePtrFromString(path)
332 if err != nil {
333 return
334 }
335 _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
336 if e1 != 0 {
337 err = errnoErr(e1)
338 }
339 return
340 }
341
342
343
344 func Chmod(path string, mode uint32) (err error) {
345 var _p0 *byte
346 _p0, err = BytePtrFromString(path)
347 if err != nil {
348 return
349 }
350 _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
351 if e1 != 0 {
352 err = errnoErr(e1)
353 }
354 return
355 }
356
357
358
359 func Chown(path string, uid int, gid int) (err error) {
360 var _p0 *byte
361 _p0, err = BytePtrFromString(path)
362 if err != nil {
363 return
364 }
365 _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
366 if e1 != 0 {
367 err = errnoErr(e1)
368 }
369 return
370 }
371
372
373
374 func Chroot(path string) (err error) {
375 var _p0 *byte
376 _p0, err = BytePtrFromString(path)
377 if err != nil {
378 return
379 }
380 _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
381 if e1 != 0 {
382 err = errnoErr(e1)
383 }
384 return
385 }
386
387
388
389 func Close(fd int) (err error) {
390 _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
391 if e1 != 0 {
392 err = errnoErr(e1)
393 }
394 return
395 }
396
397
398
399 func Dup(fd int) (nfd int, err error) {
400 r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0)
401 nfd = int(r0)
402 if e1 != 0 {
403 err = errnoErr(e1)
404 }
405 return
406 }
407
408
409
410 func Dup2(from int, to int) (err error) {
411 _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0)
412 if e1 != 0 {
413 err = errnoErr(e1)
414 }
415 return
416 }
417
418
419
420 func Fchdir(fd int) (err error) {
421 _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
422 if e1 != 0 {
423 err = errnoErr(e1)
424 }
425 return
426 }
427
428
429
430 func Fchflags(fd int, flags int) (err error) {
431 _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
432 if e1 != 0 {
433 err = errnoErr(e1)
434 }
435 return
436 }
437
438
439
440 func Fchmod(fd int, mode uint32) (err error) {
441 _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
442 if e1 != 0 {
443 err = errnoErr(e1)
444 }
445 return
446 }
447
448
449
450 func Fchown(fd int, uid int, gid int) (err error) {
451 _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
452 if e1 != 0 {
453 err = errnoErr(e1)
454 }
455 return
456 }
457
458
459
460 func Flock(fd int, how int) (err error) {
461 _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0)
462 if e1 != 0 {
463 err = errnoErr(e1)
464 }
465 return
466 }
467
468
469
470 func Fpathconf(fd int, name int) (val int, err error) {
471 r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0)
472 val = int(r0)
473 if e1 != 0 {
474 err = errnoErr(e1)
475 }
476 return
477 }
478
479
480
481 func Fstat(fd int, stat *Stat_t) (err error) {
482 _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
483 if e1 != 0 {
484 err = errnoErr(e1)
485 }
486 return
487 }
488
489
490
491 func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
492 var _p0 *byte
493 _p0, err = BytePtrFromString(path)
494 if err != nil {
495 return
496 }
497 _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
498 if e1 != 0 {
499 err = errnoErr(e1)
500 }
501 return
502 }
503
504
505
506 func Fstatfs(fd int, stat *Statfs_t) (err error) {
507 _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
508 if e1 != 0 {
509 err = errnoErr(e1)
510 }
511 return
512 }
513
514
515
516 func Fsync(fd int) (err error) {
517 _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0)
518 if e1 != 0 {
519 err = errnoErr(e1)
520 }
521 return
522 }
523
524
525
526 func Ftruncate(fd int, length int64) (err error) {
527 _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32))
528 if e1 != 0 {
529 err = errnoErr(e1)
530 }
531 return
532 }
533
534
535
536 func getdirentries(fd int, buf []byte, basep *uint64) (n int, err error) {
537 var _p0 unsafe.Pointer
538 if len(buf) > 0 {
539 _p0 = unsafe.Pointer(&buf[0])
540 } else {
541 _p0 = unsafe.Pointer(&_zero)
542 }
543 r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0)
544 n = int(r0)
545 if e1 != 0 {
546 err = errnoErr(e1)
547 }
548 return
549 }
550
551
552
553 func Getdtablesize() (size int) {
554 r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0)
555 size = int(r0)
556 return
557 }
558
559
560
561 func Getegid() (egid int) {
562 r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
563 egid = int(r0)
564 return
565 }
566
567
568
569 func Geteuid() (uid int) {
570 r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
571 uid = int(r0)
572 return
573 }
574
575
576
577 func Getgid() (gid int) {
578 r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
579 gid = int(r0)
580 return
581 }
582
583
584
585 func Getpgid(pid int) (pgid int, err error) {
586 r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0)
587 pgid = int(r0)
588 if e1 != 0 {
589 err = errnoErr(e1)
590 }
591 return
592 }
593
594
595
596 func Getpgrp() (pgrp int) {
597 r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0)
598 pgrp = int(r0)
599 return
600 }
601
602
603
604 func Getpid() (pid int) {
605 r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
606 pid = int(r0)
607 return
608 }
609
610
611
612 func Getppid() (ppid int) {
613 r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
614 ppid = int(r0)
615 return
616 }
617
618
619
620 func Getpriority(which int, who int) (prio int, err error) {
621 r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
622 prio = int(r0)
623 if e1 != 0 {
624 err = errnoErr(e1)
625 }
626 return
627 }
628
629
630
631 func Getrlimit(which int, lim *Rlimit) (err error) {
632 _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
633 if e1 != 0 {
634 err = errnoErr(e1)
635 }
636 return
637 }
638
639
640
641 func Getrusage(who int, rusage *Rusage) (err error) {
642 _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
643 if e1 != 0 {
644 err = errnoErr(e1)
645 }
646 return
647 }
648
649
650
651 func Getsid(pid int) (sid int, err error) {
652 r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0)
653 sid = int(r0)
654 if e1 != 0 {
655 err = errnoErr(e1)
656 }
657 return
658 }
659
660
661
662 func Gettimeofday(tv *Timeval) (err error) {
663 _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
664 if e1 != 0 {
665 err = errnoErr(e1)
666 }
667 return
668 }
669
670
671
672 func Getuid() (uid int) {
673 r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
674 uid = int(r0)
675 return
676 }
677
678
679
680 func Issetugid() (tainted bool) {
681 r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0)
682 tainted = bool(r0 != 0)
683 return
684 }
685
686
687
688 func Kill(pid int, signum Signal) (err error) {
689 _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0)
690 if e1 != 0 {
691 err = errnoErr(e1)
692 }
693 return
694 }
695
696
697
698 func Kqueue() (fd int, err error) {
699 r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0)
700 fd = int(r0)
701 if e1 != 0 {
702 err = errnoErr(e1)
703 }
704 return
705 }
706
707
708
709 func Lchown(path string, uid int, gid int) (err error) {
710 var _p0 *byte
711 _p0, err = BytePtrFromString(path)
712 if err != nil {
713 return
714 }
715 _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
716 if e1 != 0 {
717 err = errnoErr(e1)
718 }
719 return
720 }
721
722
723
724 func Link(path string, link string) (err error) {
725 var _p0 *byte
726 _p0, err = BytePtrFromString(path)
727 if err != nil {
728 return
729 }
730 var _p1 *byte
731 _p1, err = BytePtrFromString(link)
732 if err != nil {
733 return
734 }
735 _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
736 if e1 != 0 {
737 err = errnoErr(e1)
738 }
739 return
740 }
741
742
743
744 func Listen(s int, backlog int) (err error) {
745 _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0)
746 if e1 != 0 {
747 err = errnoErr(e1)
748 }
749 return
750 }
751
752
753
754 func Mkdir(path string, mode uint32) (err error) {
755 var _p0 *byte
756 _p0, err = BytePtrFromString(path)
757 if err != nil {
758 return
759 }
760 _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
761 if e1 != 0 {
762 err = errnoErr(e1)
763 }
764 return
765 }
766
767
768
769 func Mkfifo(path string, mode uint32) (err error) {
770 var _p0 *byte
771 _p0, err = BytePtrFromString(path)
772 if err != nil {
773 return
774 }
775 _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
776 if e1 != 0 {
777 err = errnoErr(e1)
778 }
779 return
780 }
781
782
783
784 func mknodat(fd int, path string, mode uint32, dev uint64) (err error) {
785 var _p0 *byte
786 _p0, err = BytePtrFromString(path)
787 if err != nil {
788 return
789 }
790 _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
791 if e1 != 0 {
792 err = errnoErr(e1)
793 }
794 return
795 }
796
797
798
799 func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
800 _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
801 if e1 != 0 {
802 err = errnoErr(e1)
803 }
804 return
805 }
806
807
808
809 func Open(path string, mode int, perm uint32) (fd int, err error) {
810 var _p0 *byte
811 _p0, err = BytePtrFromString(path)
812 if err != nil {
813 return
814 }
815 r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
816 fd = int(r0)
817 if e1 != 0 {
818 err = errnoErr(e1)
819 }
820 return
821 }
822
823
824
825 func Pathconf(path string, name int) (val int, err error) {
826 var _p0 *byte
827 _p0, err = BytePtrFromString(path)
828 if err != nil {
829 return
830 }
831 r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
832 val = int(r0)
833 if e1 != 0 {
834 err = errnoErr(e1)
835 }
836 return
837 }
838
839
840
841 func pread(fd int, p []byte, offset int64) (n int, err error) {
842 var _p0 unsafe.Pointer
843 if len(p) > 0 {
844 _p0 = unsafe.Pointer(&p[0])
845 } else {
846 _p0 = unsafe.Pointer(&_zero)
847 }
848 r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
849 n = int(r0)
850 if e1 != 0 {
851 err = errnoErr(e1)
852 }
853 return
854 }
855
856
857
858 func pwrite(fd int, p []byte, offset int64) (n int, err error) {
859 var _p0 unsafe.Pointer
860 if len(p) > 0 {
861 _p0 = unsafe.Pointer(&p[0])
862 } else {
863 _p0 = unsafe.Pointer(&_zero)
864 }
865 r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
866 n = int(r0)
867 if e1 != 0 {
868 err = errnoErr(e1)
869 }
870 return
871 }
872
873
874
875 func read(fd int, p []byte) (n int, err error) {
876 var _p0 unsafe.Pointer
877 if len(p) > 0 {
878 _p0 = unsafe.Pointer(&p[0])
879 } else {
880 _p0 = unsafe.Pointer(&_zero)
881 }
882 r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
883 n = int(r0)
884 if e1 != 0 {
885 err = errnoErr(e1)
886 }
887 return
888 }
889
890
891
892 func Readlink(path string, buf []byte) (n int, err error) {
893 var _p0 *byte
894 _p0, err = BytePtrFromString(path)
895 if err != nil {
896 return
897 }
898 var _p1 unsafe.Pointer
899 if len(buf) > 0 {
900 _p1 = unsafe.Pointer(&buf[0])
901 } else {
902 _p1 = unsafe.Pointer(&_zero)
903 }
904 r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
905 n = int(r0)
906 if e1 != 0 {
907 err = errnoErr(e1)
908 }
909 return
910 }
911
912
913
914 func Rename(from string, to string) (err error) {
915 var _p0 *byte
916 _p0, err = BytePtrFromString(from)
917 if err != nil {
918 return
919 }
920 var _p1 *byte
921 _p1, err = BytePtrFromString(to)
922 if err != nil {
923 return
924 }
925 _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
926 if e1 != 0 {
927 err = errnoErr(e1)
928 }
929 return
930 }
931
932
933
934 func Revoke(path string) (err error) {
935 var _p0 *byte
936 _p0, err = BytePtrFromString(path)
937 if err != nil {
938 return
939 }
940 _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
941 if e1 != 0 {
942 err = errnoErr(e1)
943 }
944 return
945 }
946
947
948
949 func Rmdir(path string) (err error) {
950 var _p0 *byte
951 _p0, err = BytePtrFromString(path)
952 if err != nil {
953 return
954 }
955 _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
956 if e1 != 0 {
957 err = errnoErr(e1)
958 }
959 return
960 }
961
962
963
964 func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
965 r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0)
966 newoffset = int64(int64(r1)<<32 | int64(r0))
967 if e1 != 0 {
968 err = errnoErr(e1)
969 }
970 return
971 }
972
973
974
975 func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) {
976 _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
977 if e1 != 0 {
978 err = errnoErr(e1)
979 }
980 return
981 }
982
983
984
985 func Setegid(egid int) (err error) {
986 _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0)
987 if e1 != 0 {
988 err = errnoErr(e1)
989 }
990 return
991 }
992
993
994
995 func Seteuid(euid int) (err error) {
996 _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0)
997 if e1 != 0 {
998 err = errnoErr(e1)
999 }
1000 return
1001 }
1002
1003
1004
1005 func Setgid(gid int) (err error) {
1006 _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0)
1007 if e1 != 0 {
1008 err = errnoErr(e1)
1009 }
1010 return
1011 }
1012
1013
1014
1015 func Setlogin(name string) (err error) {
1016 var _p0 *byte
1017 _p0, err = BytePtrFromString(name)
1018 if err != nil {
1019 return
1020 }
1021 _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
1022 if e1 != 0 {
1023 err = errnoErr(e1)
1024 }
1025 return
1026 }
1027
1028
1029
1030 func Setpgid(pid int, pgid int) (err error) {
1031 _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
1032 if e1 != 0 {
1033 err = errnoErr(e1)
1034 }
1035 return
1036 }
1037
1038
1039
1040 func Setpriority(which int, who int, prio int) (err error) {
1041 _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
1042 if e1 != 0 {
1043 err = errnoErr(e1)
1044 }
1045 return
1046 }
1047
1048
1049
1050 func Setregid(rgid int, egid int) (err error) {
1051 _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
1052 if e1 != 0 {
1053 err = errnoErr(e1)
1054 }
1055 return
1056 }
1057
1058
1059
1060 func Setreuid(ruid int, euid int) (err error) {
1061 _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
1062 if e1 != 0 {
1063 err = errnoErr(e1)
1064 }
1065 return
1066 }
1067
1068
1069
1070 func setrlimit(which int, lim *Rlimit) (err error) {
1071 _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
1072 if e1 != 0 {
1073 err = errnoErr(e1)
1074 }
1075 return
1076 }
1077
1078
1079
1080 func Setsid() (pid int, err error) {
1081 r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
1082 pid = int(r0)
1083 if e1 != 0 {
1084 err = errnoErr(e1)
1085 }
1086 return
1087 }
1088
1089
1090
1091 func Settimeofday(tp *Timeval) (err error) {
1092 _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0)
1093 if e1 != 0 {
1094 err = errnoErr(e1)
1095 }
1096 return
1097 }
1098
1099
1100
1101 func Setuid(uid int) (err error) {
1102 _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0)
1103 if e1 != 0 {
1104 err = errnoErr(e1)
1105 }
1106 return
1107 }
1108
1109
1110
1111 func Statfs(path string, stat *Statfs_t) (err error) {
1112 var _p0 *byte
1113 _p0, err = BytePtrFromString(path)
1114 if err != nil {
1115 return
1116 }
1117 _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
1118 if e1 != 0 {
1119 err = errnoErr(e1)
1120 }
1121 return
1122 }
1123
1124
1125
1126 func Symlink(path string, link string) (err error) {
1127 var _p0 *byte
1128 _p0, err = BytePtrFromString(path)
1129 if err != nil {
1130 return
1131 }
1132 var _p1 *byte
1133 _p1, err = BytePtrFromString(link)
1134 if err != nil {
1135 return
1136 }
1137 _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
1138 if e1 != 0 {
1139 err = errnoErr(e1)
1140 }
1141 return
1142 }
1143
1144
1145
1146 func Sync() (err error) {
1147 _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0)
1148 if e1 != 0 {
1149 err = errnoErr(e1)
1150 }
1151 return
1152 }
1153
1154
1155
1156 func Truncate(path string, length int64) (err error) {
1157 var _p0 *byte
1158 _p0, err = BytePtrFromString(path)
1159 if err != nil {
1160 return
1161 }
1162 _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32))
1163 if e1 != 0 {
1164 err = errnoErr(e1)
1165 }
1166 return
1167 }
1168
1169
1170
1171 func Umask(newmask int) (oldmask int) {
1172 r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0)
1173 oldmask = int(r0)
1174 return
1175 }
1176
1177
1178
1179 func Undelete(path string) (err error) {
1180 var _p0 *byte
1181 _p0, err = BytePtrFromString(path)
1182 if err != nil {
1183 return
1184 }
1185 _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
1186 if e1 != 0 {
1187 err = errnoErr(e1)
1188 }
1189 return
1190 }
1191
1192
1193
1194 func Unlink(path string) (err error) {
1195 var _p0 *byte
1196 _p0, err = BytePtrFromString(path)
1197 if err != nil {
1198 return
1199 }
1200 _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
1201 if e1 != 0 {
1202 err = errnoErr(e1)
1203 }
1204 return
1205 }
1206
1207
1208
1209 func Unmount(path string, flags int) (err error) {
1210 var _p0 *byte
1211 _p0, err = BytePtrFromString(path)
1212 if err != nil {
1213 return
1214 }
1215 _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
1216 if e1 != 0 {
1217 err = errnoErr(e1)
1218 }
1219 return
1220 }
1221
1222
1223
1224 func write(fd int, p []byte) (n int, err error) {
1225 var _p0 unsafe.Pointer
1226 if len(p) > 0 {
1227 _p0 = unsafe.Pointer(&p[0])
1228 } else {
1229 _p0 = unsafe.Pointer(&_zero)
1230 }
1231 r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
1232 n = int(r0)
1233 if e1 != 0 {
1234 err = errnoErr(e1)
1235 }
1236 return
1237 }
1238
1239
1240
1241 func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
1242 r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0)
1243 ret = uintptr(r0)
1244 if e1 != 0 {
1245 err = errnoErr(e1)
1246 }
1247 return
1248 }
1249
1250
1251
1252 func munmap(addr uintptr, length uintptr) (err error) {
1253 _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
1254 if e1 != 0 {
1255 err = errnoErr(e1)
1256 }
1257 return
1258 }
1259
1260
1261
1262 func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
1263 r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
1264 n = int(r0)
1265 if e1 != 0 {
1266 err = errnoErr(e1)
1267 }
1268 return
1269 }
1270
1271
1272
1273 func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
1274 r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
1275 nfd = int(r0)
1276 if e1 != 0 {
1277 err = errnoErr(e1)
1278 }
1279 return
1280 }
1281
1282
1283
1284 func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) {
1285 var _p0 *byte
1286 _p0, err = BytePtrFromString(path)
1287 if err != nil {
1288 return
1289 }
1290 _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0)
1291 if e1 != 0 {
1292 err = errnoErr(e1)
1293 }
1294 return
1295 }
1296
1297
1298
1299 func getcwd(buf []byte) (n int, err error) {
1300 var _p0 unsafe.Pointer
1301 if len(buf) > 0 {
1302 _p0 = unsafe.Pointer(&buf[0])
1303 } else {
1304 _p0 = unsafe.Pointer(&_zero)
1305 }
1306 r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
1307 n = int(r0)
1308 if e1 != 0 {
1309 err = errnoErr(e1)
1310 }
1311 return
1312 }
1313
1314
1315
1316 func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
1317 var _p0 unsafe.Pointer
1318 if len(mib) > 0 {
1319 _p0 = unsafe.Pointer(&mib[0])
1320 } else {
1321 _p0 = unsafe.Pointer(&_zero)
1322 }
1323 _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
1324 if e1 != 0 {
1325 err = errnoErr(e1)
1326 }
1327 return
1328 }
1329
View as plain text