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