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