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