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