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 sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
213 var _p0 unsafe.Pointer
214 if len(mib) > 0 {
215 _p0 = unsafe.Pointer(&mib[0])
216 } else {
217 _p0 = unsafe.Pointer(&_zero)
218 }
219 _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
220 if e1 != 0 {
221 err = errnoErr(e1)
222 }
223 return
224 }
225
226
227
228 func utimes(path string, timeval *[2]Timeval) (err error) {
229 var _p0 *byte
230 _p0, err = BytePtrFromString(path)
231 if err != nil {
232 return
233 }
234 _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
235 if e1 != 0 {
236 err = errnoErr(e1)
237 }
238 return
239 }
240
241
242
243 func futimes(fd int, timeval *[2]Timeval) (err error) {
244 _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0)
245 if e1 != 0 {
246 err = errnoErr(e1)
247 }
248 return
249 }
250
251
252
253 func fcntl(fd int, cmd int, arg int) (val int, err error) {
254 r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
255 val = int(r0)
256 if e1 != 0 {
257 err = errnoErr(e1)
258 }
259 return
260 }
261
262
263
264 func pipe2(p *[2]_C_int, flags int) (err error) {
265 _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
266 if e1 != 0 {
267 err = errnoErr(e1)
268 }
269 return
270 }
271
272
273
274 func Access(path string, mode uint32) (err error) {
275 var _p0 *byte
276 _p0, err = BytePtrFromString(path)
277 if err != nil {
278 return
279 }
280 _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
281 if e1 != 0 {
282 err = errnoErr(e1)
283 }
284 return
285 }
286
287
288
289 func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
290 _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0)
291 if e1 != 0 {
292 err = errnoErr(e1)
293 }
294 return
295 }
296
297
298
299 func Chdir(path string) (err error) {
300 var _p0 *byte
301 _p0, err = BytePtrFromString(path)
302 if err != nil {
303 return
304 }
305 _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
306 if e1 != 0 {
307 err = errnoErr(e1)
308 }
309 return
310 }
311
312
313
314 func Chflags(path string, flags int) (err error) {
315 var _p0 *byte
316 _p0, err = BytePtrFromString(path)
317 if err != nil {
318 return
319 }
320 _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
321 if e1 != 0 {
322 err = errnoErr(e1)
323 }
324 return
325 }
326
327
328
329 func Chmod(path string, mode uint32) (err error) {
330 var _p0 *byte
331 _p0, err = BytePtrFromString(path)
332 if err != nil {
333 return
334 }
335 _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
336 if e1 != 0 {
337 err = errnoErr(e1)
338 }
339 return
340 }
341
342
343
344 func Chown(path string, uid int, gid int) (err error) {
345 var _p0 *byte
346 _p0, err = BytePtrFromString(path)
347 if err != nil {
348 return
349 }
350 _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
351 if e1 != 0 {
352 err = errnoErr(e1)
353 }
354 return
355 }
356
357
358
359 func Chroot(path string) (err error) {
360 var _p0 *byte
361 _p0, err = BytePtrFromString(path)
362 if err != nil {
363 return
364 }
365 _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
366 if e1 != 0 {
367 err = errnoErr(e1)
368 }
369 return
370 }
371
372
373
374 func Close(fd int) (err error) {
375 _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
376 if e1 != 0 {
377 err = errnoErr(e1)
378 }
379 return
380 }
381
382
383
384 func Dup(fd int) (nfd int, err error) {
385 r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0)
386 nfd = int(r0)
387 if e1 != 0 {
388 err = errnoErr(e1)
389 }
390 return
391 }
392
393
394
395 func Dup2(from int, to int) (err error) {
396 _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0)
397 if e1 != 0 {
398 err = errnoErr(e1)
399 }
400 return
401 }
402
403
404
405 func Fchdir(fd int) (err error) {
406 _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
407 if e1 != 0 {
408 err = errnoErr(e1)
409 }
410 return
411 }
412
413
414
415 func Fchflags(fd int, flags int) (err error) {
416 _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
417 if e1 != 0 {
418 err = errnoErr(e1)
419 }
420 return
421 }
422
423
424
425 func Fchmod(fd int, mode uint32) (err error) {
426 _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
427 if e1 != 0 {
428 err = errnoErr(e1)
429 }
430 return
431 }
432
433
434
435 func Fchown(fd int, uid int, gid int) (err error) {
436 _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
437 if e1 != 0 {
438 err = errnoErr(e1)
439 }
440 return
441 }
442
443
444
445 func Flock(fd int, how int) (err error) {
446 _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0)
447 if e1 != 0 {
448 err = errnoErr(e1)
449 }
450 return
451 }
452
453
454
455 func Fpathconf(fd int, name int) (val int, err error) {
456 r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0)
457 val = int(r0)
458 if e1 != 0 {
459 err = errnoErr(e1)
460 }
461 return
462 }
463
464
465
466 func fstat(fd int, stat *stat_freebsd11_t) (err error) {
467 _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
468 if e1 != 0 {
469 err = errnoErr(e1)
470 }
471 return
472 }
473
474
475
476 func fstat_freebsd12(fd int, stat *Stat_t) (err error) {
477 _, _, e1 := Syscall(_SYS_FSTAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
478 if e1 != 0 {
479 err = errnoErr(e1)
480 }
481 return
482 }
483
484
485
486 func fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error) {
487 var _p0 *byte
488 _p0, err = BytePtrFromString(path)
489 if err != nil {
490 return
491 }
492 _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
493 if e1 != 0 {
494 err = errnoErr(e1)
495 }
496 return
497 }
498
499
500
501 func fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error) {
502 var _p0 *byte
503 _p0, err = BytePtrFromString(path)
504 if err != nil {
505 return
506 }
507 _, _, e1 := Syscall6(_SYS_FSTATAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
508 if e1 != 0 {
509 err = errnoErr(e1)
510 }
511 return
512 }
513
514
515
516 func fstatfs(fd int, stat *statfs_freebsd11_t) (err error) {
517 _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
518 if e1 != 0 {
519 err = errnoErr(e1)
520 }
521 return
522 }
523
524
525
526 func fstatfs_freebsd12(fd int, stat *Statfs_t) (err error) {
527 _, _, e1 := Syscall(_SYS_FSTATFS_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
528 if e1 != 0 {
529 err = errnoErr(e1)
530 }
531 return
532 }
533
534
535
536 func Fsync(fd int) (err error) {
537 _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0)
538 if e1 != 0 {
539 err = errnoErr(e1)
540 }
541 return
542 }
543
544
545
546 func Ftruncate(fd int, length int64) (err error) {
547 _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32))
548 if e1 != 0 {
549 err = errnoErr(e1)
550 }
551 return
552 }
553
554
555
556 func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
557 var _p0 unsafe.Pointer
558 if len(buf) > 0 {
559 _p0 = unsafe.Pointer(&buf[0])
560 } else {
561 _p0 = unsafe.Pointer(&_zero)
562 }
563 r0, _, e1 := Syscall6(SYS_GETDIRENTRIES, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0)
564 n = int(r0)
565 if e1 != 0 {
566 err = errnoErr(e1)
567 }
568 return
569 }
570
571
572
573 func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) {
574 var _p0 unsafe.Pointer
575 if len(buf) > 0 {
576 _p0 = unsafe.Pointer(&buf[0])
577 } else {
578 _p0 = unsafe.Pointer(&_zero)
579 }
580 r0, _, e1 := Syscall6(_SYS_GETDIRENTRIES_FREEBSD12, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0)
581 n = int(r0)
582 if e1 != 0 {
583 err = errnoErr(e1)
584 }
585 return
586 }
587
588
589
590 func Getdtablesize() (size int) {
591 r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0)
592 size = int(r0)
593 return
594 }
595
596
597
598 func Getegid() (egid int) {
599 r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
600 egid = int(r0)
601 return
602 }
603
604
605
606 func Geteuid() (uid int) {
607 r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
608 uid = int(r0)
609 return
610 }
611
612
613
614 func Getgid() (gid int) {
615 r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
616 gid = int(r0)
617 return
618 }
619
620
621
622 func Getpgid(pid int) (pgid int, err error) {
623 r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0)
624 pgid = int(r0)
625 if e1 != 0 {
626 err = errnoErr(e1)
627 }
628 return
629 }
630
631
632
633 func Getpgrp() (pgrp int) {
634 r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0)
635 pgrp = int(r0)
636 return
637 }
638
639
640
641 func Getpid() (pid int) {
642 r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
643 pid = int(r0)
644 return
645 }
646
647
648
649 func Getppid() (ppid int) {
650 r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
651 ppid = int(r0)
652 return
653 }
654
655
656
657 func Getpriority(which int, who int) (prio int, err error) {
658 r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
659 prio = int(r0)
660 if e1 != 0 {
661 err = errnoErr(e1)
662 }
663 return
664 }
665
666
667
668 func Getrlimit(which int, lim *Rlimit) (err error) {
669 _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
670 if e1 != 0 {
671 err = errnoErr(e1)
672 }
673 return
674 }
675
676
677
678 func Getrusage(who int, rusage *Rusage) (err error) {
679 _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
680 if e1 != 0 {
681 err = errnoErr(e1)
682 }
683 return
684 }
685
686
687
688 func Getsid(pid int) (sid int, err error) {
689 r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0)
690 sid = int(r0)
691 if e1 != 0 {
692 err = errnoErr(e1)
693 }
694 return
695 }
696
697
698
699 func Gettimeofday(tv *Timeval) (err error) {
700 _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
701 if e1 != 0 {
702 err = errnoErr(e1)
703 }
704 return
705 }
706
707
708
709 func Getuid() (uid int) {
710 r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
711 uid = int(r0)
712 return
713 }
714
715
716
717 func Issetugid() (tainted bool) {
718 r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0)
719 tainted = bool(r0 != 0)
720 return
721 }
722
723
724
725 func Kill(pid int, signum Signal) (err error) {
726 _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0)
727 if e1 != 0 {
728 err = errnoErr(e1)
729 }
730 return
731 }
732
733
734
735 func Kqueue() (fd int, err error) {
736 r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0)
737 fd = int(r0)
738 if e1 != 0 {
739 err = errnoErr(e1)
740 }
741 return
742 }
743
744
745
746 func Lchown(path string, uid int, gid int) (err error) {
747 var _p0 *byte
748 _p0, err = BytePtrFromString(path)
749 if err != nil {
750 return
751 }
752 _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
753 if e1 != 0 {
754 err = errnoErr(e1)
755 }
756 return
757 }
758
759
760
761 func Link(path string, link string) (err error) {
762 var _p0 *byte
763 _p0, err = BytePtrFromString(path)
764 if err != nil {
765 return
766 }
767 var _p1 *byte
768 _p1, err = BytePtrFromString(link)
769 if err != nil {
770 return
771 }
772 _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
773 if e1 != 0 {
774 err = errnoErr(e1)
775 }
776 return
777 }
778
779
780
781 func Listen(s int, backlog int) (err error) {
782 _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0)
783 if e1 != 0 {
784 err = errnoErr(e1)
785 }
786 return
787 }
788
789
790
791 func lstat(path string, stat *stat_freebsd11_t) (err error) {
792 var _p0 *byte
793 _p0, err = BytePtrFromString(path)
794 if err != nil {
795 return
796 }
797 _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
798 if e1 != 0 {
799 err = errnoErr(e1)
800 }
801 return
802 }
803
804
805
806 func Mkdir(path string, mode uint32) (err error) {
807 var _p0 *byte
808 _p0, err = BytePtrFromString(path)
809 if err != nil {
810 return
811 }
812 _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
813 if e1 != 0 {
814 err = errnoErr(e1)
815 }
816 return
817 }
818
819
820
821 func Mkfifo(path string, mode uint32) (err error) {
822 var _p0 *byte
823 _p0, err = BytePtrFromString(path)
824 if err != nil {
825 return
826 }
827 _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
828 if e1 != 0 {
829 err = errnoErr(e1)
830 }
831 return
832 }
833
834
835
836 func mknod(path string, mode uint32, dev int) (err error) {
837 var _p0 *byte
838 _p0, err = BytePtrFromString(path)
839 if err != nil {
840 return
841 }
842 _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
843 if e1 != 0 {
844 err = errnoErr(e1)
845 }
846 return
847 }
848
849
850
851 func mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error) {
852 var _p0 *byte
853 _p0, err = BytePtrFromString(path)
854 if err != nil {
855 return
856 }
857 _, _, e1 := Syscall6(_SYS_MKNODAT_FREEBSD12, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
858 if e1 != 0 {
859 err = errnoErr(e1)
860 }
861 return
862 }
863
864
865
866 func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
867 _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
868 if e1 != 0 {
869 err = errnoErr(e1)
870 }
871 return
872 }
873
874
875
876 func Open(path string, mode int, perm uint32) (fd int, err error) {
877 var _p0 *byte
878 _p0, err = BytePtrFromString(path)
879 if err != nil {
880 return
881 }
882 r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
883 fd = int(r0)
884 if e1 != 0 {
885 err = errnoErr(e1)
886 }
887 return
888 }
889
890
891
892 func Pathconf(path string, name int) (val int, err error) {
893 var _p0 *byte
894 _p0, err = BytePtrFromString(path)
895 if err != nil {
896 return
897 }
898 r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
899 val = int(r0)
900 if e1 != 0 {
901 err = errnoErr(e1)
902 }
903 return
904 }
905
906
907
908 func Pread(fd int, p []byte, offset int64) (n int, err error) {
909 var _p0 unsafe.Pointer
910 if len(p) > 0 {
911 _p0 = unsafe.Pointer(&p[0])
912 } else {
913 _p0 = unsafe.Pointer(&_zero)
914 }
915 r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
916 n = int(r0)
917 if e1 != 0 {
918 err = errnoErr(e1)
919 }
920 return
921 }
922
923
924
925 func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
926 var _p0 unsafe.Pointer
927 if len(p) > 0 {
928 _p0 = unsafe.Pointer(&p[0])
929 } else {
930 _p0 = unsafe.Pointer(&_zero)
931 }
932 r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
933 n = int(r0)
934 if e1 != 0 {
935 err = errnoErr(e1)
936 }
937 return
938 }
939
940
941
942 func read(fd int, p []byte) (n int, err error) {
943 var _p0 unsafe.Pointer
944 if len(p) > 0 {
945 _p0 = unsafe.Pointer(&p[0])
946 } else {
947 _p0 = unsafe.Pointer(&_zero)
948 }
949 r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
950 n = int(r0)
951 if e1 != 0 {
952 err = errnoErr(e1)
953 }
954 return
955 }
956
957
958
959 func Readlink(path string, buf []byte) (n int, err error) {
960 var _p0 *byte
961 _p0, err = BytePtrFromString(path)
962 if err != nil {
963 return
964 }
965 var _p1 unsafe.Pointer
966 if len(buf) > 0 {
967 _p1 = unsafe.Pointer(&buf[0])
968 } else {
969 _p1 = unsafe.Pointer(&_zero)
970 }
971 r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
972 n = int(r0)
973 if e1 != 0 {
974 err = errnoErr(e1)
975 }
976 return
977 }
978
979
980
981 func Rename(from string, to string) (err error) {
982 var _p0 *byte
983 _p0, err = BytePtrFromString(from)
984 if err != nil {
985 return
986 }
987 var _p1 *byte
988 _p1, err = BytePtrFromString(to)
989 if err != nil {
990 return
991 }
992 _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
993 if e1 != 0 {
994 err = errnoErr(e1)
995 }
996 return
997 }
998
999
1000
1001 func Revoke(path string) (err error) {
1002 var _p0 *byte
1003 _p0, err = BytePtrFromString(path)
1004 if err != nil {
1005 return
1006 }
1007 _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
1008 if e1 != 0 {
1009 err = errnoErr(e1)
1010 }
1011 return
1012 }
1013
1014
1015
1016 func Rmdir(path string) (err error) {
1017 var _p0 *byte
1018 _p0, err = BytePtrFromString(path)
1019 if err != nil {
1020 return
1021 }
1022 _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
1023 if e1 != 0 {
1024 err = errnoErr(e1)
1025 }
1026 return
1027 }
1028
1029
1030
1031 func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
1032 r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0)
1033 newoffset = int64(int64(r1)<<32 | int64(r0))
1034 if e1 != 0 {
1035 err = errnoErr(e1)
1036 }
1037 return
1038 }
1039
1040
1041
1042 func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) {
1043 _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
1044 if e1 != 0 {
1045 err = errnoErr(e1)
1046 }
1047 return
1048 }
1049
1050
1051
1052 func Setegid(egid int) (err error) {
1053 _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0)
1054 if e1 != 0 {
1055 err = errnoErr(e1)
1056 }
1057 return
1058 }
1059
1060
1061
1062 func Seteuid(euid int) (err error) {
1063 _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0)
1064 if e1 != 0 {
1065 err = errnoErr(e1)
1066 }
1067 return
1068 }
1069
1070
1071
1072 func Setgid(gid int) (err error) {
1073 _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0)
1074 if e1 != 0 {
1075 err = errnoErr(e1)
1076 }
1077 return
1078 }
1079
1080
1081
1082 func Setlogin(name string) (err error) {
1083 var _p0 *byte
1084 _p0, err = BytePtrFromString(name)
1085 if err != nil {
1086 return
1087 }
1088 _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
1089 if e1 != 0 {
1090 err = errnoErr(e1)
1091 }
1092 return
1093 }
1094
1095
1096
1097 func Setpgid(pid int, pgid int) (err error) {
1098 _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
1099 if e1 != 0 {
1100 err = errnoErr(e1)
1101 }
1102 return
1103 }
1104
1105
1106
1107 func Setpriority(which int, who int, prio int) (err error) {
1108 _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
1109 if e1 != 0 {
1110 err = errnoErr(e1)
1111 }
1112 return
1113 }
1114
1115
1116
1117 func Setregid(rgid int, egid int) (err error) {
1118 _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
1119 if e1 != 0 {
1120 err = errnoErr(e1)
1121 }
1122 return
1123 }
1124
1125
1126
1127 func Setreuid(ruid int, euid int) (err error) {
1128 _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
1129 if e1 != 0 {
1130 err = errnoErr(e1)
1131 }
1132 return
1133 }
1134
1135
1136
1137 func Setrlimit(which int, lim *Rlimit) (err error) {
1138 _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
1139 if e1 != 0 {
1140 err = errnoErr(e1)
1141 }
1142 return
1143 }
1144
1145
1146
1147 func Setsid() (pid int, err error) {
1148 r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
1149 pid = int(r0)
1150 if e1 != 0 {
1151 err = errnoErr(e1)
1152 }
1153 return
1154 }
1155
1156
1157
1158 func Settimeofday(tp *Timeval) (err error) {
1159 _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0)
1160 if e1 != 0 {
1161 err = errnoErr(e1)
1162 }
1163 return
1164 }
1165
1166
1167
1168 func Setuid(uid int) (err error) {
1169 _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0)
1170 if e1 != 0 {
1171 err = errnoErr(e1)
1172 }
1173 return
1174 }
1175
1176
1177
1178 func stat(path string, stat *stat_freebsd11_t) (err error) {
1179 var _p0 *byte
1180 _p0, err = BytePtrFromString(path)
1181 if err != nil {
1182 return
1183 }
1184 _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
1185 if e1 != 0 {
1186 err = errnoErr(e1)
1187 }
1188 return
1189 }
1190
1191
1192
1193 func statfs(path string, stat *statfs_freebsd11_t) (err error) {
1194 var _p0 *byte
1195 _p0, err = BytePtrFromString(path)
1196 if err != nil {
1197 return
1198 }
1199 _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
1200 if e1 != 0 {
1201 err = errnoErr(e1)
1202 }
1203 return
1204 }
1205
1206
1207
1208 func statfs_freebsd12(path string, stat *Statfs_t) (err error) {
1209 var _p0 *byte
1210 _p0, err = BytePtrFromString(path)
1211 if err != nil {
1212 return
1213 }
1214 _, _, e1 := Syscall(_SYS_STATFS_FREEBSD12, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
1215 if e1 != 0 {
1216 err = errnoErr(e1)
1217 }
1218 return
1219 }
1220
1221
1222
1223 func Symlink(path string, link string) (err error) {
1224 var _p0 *byte
1225 _p0, err = BytePtrFromString(path)
1226 if err != nil {
1227 return
1228 }
1229 var _p1 *byte
1230 _p1, err = BytePtrFromString(link)
1231 if err != nil {
1232 return
1233 }
1234 _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
1235 if e1 != 0 {
1236 err = errnoErr(e1)
1237 }
1238 return
1239 }
1240
1241
1242
1243 func Sync() (err error) {
1244 _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0)
1245 if e1 != 0 {
1246 err = errnoErr(e1)
1247 }
1248 return
1249 }
1250
1251
1252
1253 func Truncate(path string, length int64) (err error) {
1254 var _p0 *byte
1255 _p0, err = BytePtrFromString(path)
1256 if err != nil {
1257 return
1258 }
1259 _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32))
1260 if e1 != 0 {
1261 err = errnoErr(e1)
1262 }
1263 return
1264 }
1265
1266
1267
1268 func Umask(newmask int) (oldmask int) {
1269 r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0)
1270 oldmask = int(r0)
1271 return
1272 }
1273
1274
1275
1276 func Undelete(path string) (err error) {
1277 var _p0 *byte
1278 _p0, err = BytePtrFromString(path)
1279 if err != nil {
1280 return
1281 }
1282 _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0)
1283 if e1 != 0 {
1284 err = errnoErr(e1)
1285 }
1286 return
1287 }
1288
1289
1290
1291 func Unlink(path string) (err error) {
1292 var _p0 *byte
1293 _p0, err = BytePtrFromString(path)
1294 if err != nil {
1295 return
1296 }
1297 _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
1298 if e1 != 0 {
1299 err = errnoErr(e1)
1300 }
1301 return
1302 }
1303
1304
1305
1306 func Unmount(path string, flags int) (err error) {
1307 var _p0 *byte
1308 _p0, err = BytePtrFromString(path)
1309 if err != nil {
1310 return
1311 }
1312 _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
1313 if e1 != 0 {
1314 err = errnoErr(e1)
1315 }
1316 return
1317 }
1318
1319
1320
1321 func write(fd int, p []byte) (n int, err error) {
1322 var _p0 unsafe.Pointer
1323 if len(p) > 0 {
1324 _p0 = unsafe.Pointer(&p[0])
1325 } else {
1326 _p0 = unsafe.Pointer(&_zero)
1327 }
1328 r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
1329 n = int(r0)
1330 if e1 != 0 {
1331 err = errnoErr(e1)
1332 }
1333 return
1334 }
1335
1336
1337
1338 func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
1339 r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0)
1340 ret = uintptr(r0)
1341 if e1 != 0 {
1342 err = errnoErr(e1)
1343 }
1344 return
1345 }
1346
1347
1348
1349 func munmap(addr uintptr, length uintptr) (err error) {
1350 _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
1351 if e1 != 0 {
1352 err = errnoErr(e1)
1353 }
1354 return
1355 }
1356
1357
1358
1359 func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
1360 r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
1361 n = int(r0)
1362 if e1 != 0 {
1363 err = errnoErr(e1)
1364 }
1365 return
1366 }
1367
1368
1369
1370 func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
1371 r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
1372 n = int(r0)
1373 if e1 != 0 {
1374 err = errnoErr(e1)
1375 }
1376 return
1377 }
1378
1379
1380
1381 func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
1382 r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
1383 nfd = int(r0)
1384 if e1 != 0 {
1385 err = errnoErr(e1)
1386 }
1387 return
1388 }
1389
1390
1391
1392 func utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error) {
1393 var _p0 *byte
1394 _p0, err = BytePtrFromString(path)
1395 if err != nil {
1396 return
1397 }
1398 _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flag), 0, 0)
1399 if e1 != 0 {
1400 err = errnoErr(e1)
1401 }
1402 return
1403 }
1404
1405
1406
1407 func getcwd(buf []byte) (n int, err error) {
1408 var _p0 unsafe.Pointer
1409 if len(buf) > 0 {
1410 _p0 = unsafe.Pointer(&buf[0])
1411 } else {
1412 _p0 = unsafe.Pointer(&_zero)
1413 }
1414 r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
1415 n = int(r0)
1416 if e1 != 0 {
1417 err = errnoErr(e1)
1418 }
1419 return
1420 }
1421
View as plain text