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