1
2
3
4
5
6
7 package unix
8
9 import (
10 "unsafe"
11 )
12
13
14
15 func fcntl(fd int, cmd int, arg int) (val int, err error) {
16 r0, _, e1 := syscall_syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
17 val = int(r0)
18 if e1 != 0 {
19 err = errnoErr(e1)
20 }
21 return
22 }
23
24
25
26 func read(fd int, p []byte) (n int, err error) {
27 var _p0 unsafe.Pointer
28 if len(p) > 0 {
29 _p0 = unsafe.Pointer(&p[0])
30 } else {
31 _p0 = unsafe.Pointer(&_zero)
32 }
33 r0, _, e1 := syscall_syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
34 n = int(r0)
35 if e1 != 0 {
36 err = errnoErr(e1)
37 }
38 return
39 }
40
41
42
43 func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
44 r0, _, e1 := syscall_syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
45 n = int(r0)
46 if e1 != 0 {
47 err = errnoErr(e1)
48 }
49 return
50 }
51
52
53
54 func write(fd int, p []byte) (n int, err error) {
55 var _p0 unsafe.Pointer
56 if len(p) > 0 {
57 _p0 = unsafe.Pointer(&p[0])
58 } else {
59 _p0 = unsafe.Pointer(&_zero)
60 }
61 r0, _, e1 := syscall_syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
62 n = int(r0)
63 if e1 != 0 {
64 err = errnoErr(e1)
65 }
66 return
67 }
68
69
70
71 func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
72 r0, _, e1 := syscall_syscall(SYS___ACCEPT_A, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
73 fd = int(r0)
74 if e1 != 0 {
75 err = errnoErr(e1)
76 }
77 return
78 }
79
80
81
82 func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
83 _, _, e1 := syscall_syscall(SYS___BIND_A, uintptr(s), uintptr(addr), uintptr(addrlen))
84 if e1 != 0 {
85 err = errnoErr(e1)
86 }
87 return
88 }
89
90
91
92 func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
93 _, _, e1 := syscall_syscall(SYS___CONNECT_A, uintptr(s), uintptr(addr), uintptr(addrlen))
94 if e1 != 0 {
95 err = errnoErr(e1)
96 }
97 return
98 }
99
100
101
102 func getgroups(n int, list *_Gid_t) (nn int, err error) {
103 r0, _, e1 := syscall_rawsyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
104 nn = int(r0)
105 if e1 != 0 {
106 err = errnoErr(e1)
107 }
108 return
109 }
110
111
112
113 func setgroups(n int, list *_Gid_t) (err error) {
114 _, _, e1 := syscall_rawsyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
115 if e1 != 0 {
116 err = errnoErr(e1)
117 }
118 return
119 }
120
121
122
123 func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
124 _, _, e1 := syscall_syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
125 if e1 != 0 {
126 err = errnoErr(e1)
127 }
128 return
129 }
130
131
132
133 func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
134 _, _, e1 := syscall_syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
135 if e1 != 0 {
136 err = errnoErr(e1)
137 }
138 return
139 }
140
141
142
143 func socket(domain int, typ int, proto int) (fd int, err error) {
144 r0, _, e1 := syscall_rawsyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
145 fd = int(r0)
146 if e1 != 0 {
147 err = errnoErr(e1)
148 }
149 return
150 }
151
152
153
154 func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
155 _, _, e1 := syscall_rawsyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
156 if e1 != 0 {
157 err = errnoErr(e1)
158 }
159 return
160 }
161
162
163
164 func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
165 _, _, e1 := syscall_rawsyscall(SYS___GETPEERNAME_A, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
166 if e1 != 0 {
167 err = errnoErr(e1)
168 }
169 return
170 }
171
172
173
174 func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
175 _, _, e1 := syscall_rawsyscall(SYS___GETSOCKNAME_A, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
176 if e1 != 0 {
177 err = errnoErr(e1)
178 }
179 return
180 }
181
182
183
184 func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
185 var _p0 unsafe.Pointer
186 if len(p) > 0 {
187 _p0 = unsafe.Pointer(&p[0])
188 } else {
189 _p0 = unsafe.Pointer(&_zero)
190 }
191 r0, _, e1 := syscall_syscall6(SYS___RECVFROM_A, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
192 n = int(r0)
193 if e1 != 0 {
194 err = errnoErr(e1)
195 }
196 return
197 }
198
199
200
201 func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
202 var _p0 unsafe.Pointer
203 if len(buf) > 0 {
204 _p0 = unsafe.Pointer(&buf[0])
205 } else {
206 _p0 = unsafe.Pointer(&_zero)
207 }
208 _, _, e1 := syscall_syscall6(SYS___SENDTO_A, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
209 if e1 != 0 {
210 err = errnoErr(e1)
211 }
212 return
213 }
214
215
216
217 func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
218 r0, _, e1 := syscall_syscall(SYS___RECVMSG_A, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
219 n = int(r0)
220 if e1 != 0 {
221 err = errnoErr(e1)
222 }
223 return
224 }
225
226
227
228 func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
229 r0, _, e1 := syscall_syscall(SYS___SENDMSG_A, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
230 n = int(r0)
231 if e1 != 0 {
232 err = errnoErr(e1)
233 }
234 return
235 }
236
237
238
239 func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
240 r0, _, e1 := syscall_syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
241 ret = uintptr(r0)
242 if e1 != 0 {
243 err = errnoErr(e1)
244 }
245 return
246 }
247
248
249
250 func munmap(addr uintptr, length uintptr) (err error) {
251 _, _, e1 := syscall_syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
252 if e1 != 0 {
253 err = errnoErr(e1)
254 }
255 return
256 }
257
258
259
260 func ioctl(fd int, req uint, arg uintptr) (err error) {
261 _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
262 if e1 != 0 {
263 err = errnoErr(e1)
264 }
265 return
266 }
267
268
269
270 func Access(path string, mode uint32) (err error) {
271 var _p0 *byte
272 _p0, err = BytePtrFromString(path)
273 if err != nil {
274 return
275 }
276 _, _, e1 := syscall_syscall(SYS___ACCESS_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
277 if e1 != 0 {
278 err = errnoErr(e1)
279 }
280 return
281 }
282
283
284
285 func Chdir(path string) (err error) {
286 var _p0 *byte
287 _p0, err = BytePtrFromString(path)
288 if err != nil {
289 return
290 }
291 _, _, e1 := syscall_syscall(SYS___CHDIR_A, uintptr(unsafe.Pointer(_p0)), 0, 0)
292 if e1 != 0 {
293 err = errnoErr(e1)
294 }
295 return
296 }
297
298
299
300 func Chown(path string, uid int, gid int) (err error) {
301 var _p0 *byte
302 _p0, err = BytePtrFromString(path)
303 if err != nil {
304 return
305 }
306 _, _, e1 := syscall_syscall(SYS___CHOWN_A, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
307 if e1 != 0 {
308 err = errnoErr(e1)
309 }
310 return
311 }
312
313
314
315 func Chmod(path string, mode uint32) (err error) {
316 var _p0 *byte
317 _p0, err = BytePtrFromString(path)
318 if err != nil {
319 return
320 }
321 _, _, e1 := syscall_syscall(SYS___CHMOD_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
322 if e1 != 0 {
323 err = errnoErr(e1)
324 }
325 return
326 }
327
328
329
330 func Creat(path string, mode uint32) (fd int, err error) {
331 var _p0 *byte
332 _p0, err = BytePtrFromString(path)
333 if err != nil {
334 return
335 }
336 r0, _, e1 := syscall_syscall(SYS___CREAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
337 fd = int(r0)
338 if e1 != 0 {
339 err = errnoErr(e1)
340 }
341 return
342 }
343
344
345
346 func Dup(oldfd int) (fd int, err error) {
347 r0, _, e1 := syscall_syscall(SYS_DUP, uintptr(oldfd), 0, 0)
348 fd = int(r0)
349 if e1 != 0 {
350 err = errnoErr(e1)
351 }
352 return
353 }
354
355
356
357 func Dup2(oldfd int, newfd int) (err error) {
358 _, _, e1 := syscall_syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
359 if e1 != 0 {
360 err = errnoErr(e1)
361 }
362 return
363 }
364
365
366
367 func Errno2() (er2 int) {
368 uer2, _, _ := syscall_syscall(SYS___ERRNO2, 0, 0, 0)
369 er2 = int(uer2)
370 return
371 }
372
373
374
375 func Err2ad() (eadd *int) {
376 ueadd, _, _ := syscall_syscall(SYS___ERR2AD, 0, 0, 0)
377 eadd = (*int)(unsafe.Pointer(ueadd))
378 return
379 }
380
381
382
383 func Exit(code int) {
384 syscall_syscall(SYS_EXIT, uintptr(code), 0, 0)
385 return
386 }
387
388
389
390 func Fchdir(fd int) (err error) {
391 _, _, e1 := syscall_syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
392 if e1 != 0 {
393 err = errnoErr(e1)
394 }
395 return
396 }
397
398
399
400 func Fchmod(fd int, mode uint32) (err error) {
401 _, _, e1 := syscall_syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
402 if e1 != 0 {
403 err = errnoErr(e1)
404 }
405 return
406 }
407
408
409
410 func Fchown(fd int, uid int, gid int) (err error) {
411 _, _, e1 := syscall_syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
412 if e1 != 0 {
413 err = errnoErr(e1)
414 }
415 return
416 }
417
418
419
420 func FcntlInt(fd uintptr, cmd int, arg int) (retval int, err error) {
421 r0, _, e1 := syscall_syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
422 retval = int(r0)
423 if e1 != 0 {
424 err = errnoErr(e1)
425 }
426 return
427 }
428
429
430
431 func fstat(fd int, stat *Stat_LE_t) (err error) {
432 _, _, e1 := syscall_syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
433 if e1 != 0 {
434 err = errnoErr(e1)
435 }
436 return
437 }
438
439
440
441 func Fstatvfs(fd int, stat *Statvfs_t) (err error) {
442 _, _, e1 := syscall_syscall(SYS_FSTATVFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
443 if e1 != 0 {
444 err = errnoErr(e1)
445 }
446 return
447 }
448
449
450
451 func Fsync(fd int) (err error) {
452 _, _, e1 := syscall_syscall(SYS_FSYNC, uintptr(fd), 0, 0)
453 if e1 != 0 {
454 err = errnoErr(e1)
455 }
456 return
457 }
458
459
460
461 func Ftruncate(fd int, length int64) (err error) {
462 _, _, e1 := syscall_syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0)
463 if e1 != 0 {
464 err = errnoErr(e1)
465 }
466 return
467 }
468
469
470
471 func Getpagesize() (pgsize int) {
472 r0, _, _ := syscall_syscall(SYS_GETPAGESIZE, 0, 0, 0)
473 pgsize = int(r0)
474 return
475 }
476
477
478
479 func Mprotect(b []byte, prot int) (err error) {
480 var _p0 unsafe.Pointer
481 if len(b) > 0 {
482 _p0 = unsafe.Pointer(&b[0])
483 } else {
484 _p0 = unsafe.Pointer(&_zero)
485 }
486 _, _, e1 := syscall_syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
487 if e1 != 0 {
488 err = errnoErr(e1)
489 }
490 return
491 }
492
493
494
495 func Msync(b []byte, flags int) (err error) {
496 var _p0 unsafe.Pointer
497 if len(b) > 0 {
498 _p0 = unsafe.Pointer(&b[0])
499 } else {
500 _p0 = unsafe.Pointer(&_zero)
501 }
502 _, _, e1 := syscall_syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
503 if e1 != 0 {
504 err = errnoErr(e1)
505 }
506 return
507 }
508
509
510
511 func Poll(fds []PollFd, timeout int) (n int, err error) {
512 var _p0 unsafe.Pointer
513 if len(fds) > 0 {
514 _p0 = unsafe.Pointer(&fds[0])
515 } else {
516 _p0 = unsafe.Pointer(&_zero)
517 }
518 r0, _, e1 := syscall_syscall(SYS_POLL, uintptr(_p0), uintptr(len(fds)), uintptr(timeout))
519 n = int(r0)
520 if e1 != 0 {
521 err = errnoErr(e1)
522 }
523 return
524 }
525
526
527
528 func Times(tms *Tms) (ticks uintptr, err error) {
529 r0, _, e1 := syscall_syscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0)
530 ticks = uintptr(r0)
531 if e1 != 0 {
532 err = errnoErr(e1)
533 }
534 return
535 }
536
537
538
539 func W_Getmntent(buff *byte, size int) (lastsys int, err error) {
540 r0, _, e1 := syscall_syscall(SYS_W_GETMNTENT, uintptr(unsafe.Pointer(buff)), uintptr(size), 0)
541 lastsys = int(r0)
542 if e1 != 0 {
543 err = errnoErr(e1)
544 }
545 return
546 }
547
548
549
550 func W_Getmntent_A(buff *byte, size int) (lastsys int, err error) {
551 r0, _, e1 := syscall_syscall(SYS___W_GETMNTENT_A, uintptr(unsafe.Pointer(buff)), uintptr(size), 0)
552 lastsys = int(r0)
553 if e1 != 0 {
554 err = errnoErr(e1)
555 }
556 return
557 }
558
559
560
561 func mount_LE(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) {
562 var _p0 *byte
563 _p0, err = BytePtrFromString(path)
564 if err != nil {
565 return
566 }
567 var _p1 *byte
568 _p1, err = BytePtrFromString(filesystem)
569 if err != nil {
570 return
571 }
572 var _p2 *byte
573 _p2, err = BytePtrFromString(fstype)
574 if err != nil {
575 return
576 }
577 var _p3 *byte
578 _p3, err = BytePtrFromString(parm)
579 if err != nil {
580 return
581 }
582 _, _, e1 := syscall_syscall6(SYS___MOUNT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(mtm), uintptr(parmlen), uintptr(unsafe.Pointer(_p3)))
583 if e1 != 0 {
584 err = errnoErr(e1)
585 }
586 return
587 }
588
589
590
591 func unmount(filesystem string, mtm int) (err error) {
592 var _p0 *byte
593 _p0, err = BytePtrFromString(filesystem)
594 if err != nil {
595 return
596 }
597 _, _, e1 := syscall_syscall(SYS___UMOUNT_A, uintptr(unsafe.Pointer(_p0)), uintptr(mtm), 0)
598 if e1 != 0 {
599 err = errnoErr(e1)
600 }
601 return
602 }
603
604
605
606 func Chroot(path string) (err error) {
607 var _p0 *byte
608 _p0, err = BytePtrFromString(path)
609 if err != nil {
610 return
611 }
612 _, _, e1 := syscall_syscall(SYS___CHROOT_A, uintptr(unsafe.Pointer(_p0)), 0, 0)
613 if e1 != 0 {
614 err = errnoErr(e1)
615 }
616 return
617 }
618
619
620
621 func Uname(buf *Utsname) (err error) {
622 _, _, e1 := syscall_rawsyscall(SYS___UNAME_A, uintptr(unsafe.Pointer(buf)), 0, 0)
623 if e1 != 0 {
624 err = errnoErr(e1)
625 }
626 return
627 }
628
629
630
631 func Gethostname(buf []byte) (err error) {
632 var _p0 unsafe.Pointer
633 if len(buf) > 0 {
634 _p0 = unsafe.Pointer(&buf[0])
635 } else {
636 _p0 = unsafe.Pointer(&_zero)
637 }
638 _, _, e1 := syscall_syscall(SYS___GETHOSTNAME_A, uintptr(_p0), uintptr(len(buf)), 0)
639 if e1 != 0 {
640 err = errnoErr(e1)
641 }
642 return
643 }
644
645
646
647 func Getegid() (egid int) {
648 r0, _, _ := syscall_rawsyscall(SYS_GETEGID, 0, 0, 0)
649 egid = int(r0)
650 return
651 }
652
653
654
655 func Geteuid() (uid int) {
656 r0, _, _ := syscall_rawsyscall(SYS_GETEUID, 0, 0, 0)
657 uid = int(r0)
658 return
659 }
660
661
662
663 func Getgid() (gid int) {
664 r0, _, _ := syscall_rawsyscall(SYS_GETGID, 0, 0, 0)
665 gid = int(r0)
666 return
667 }
668
669
670
671 func Getpid() (pid int) {
672 r0, _, _ := syscall_rawsyscall(SYS_GETPID, 0, 0, 0)
673 pid = int(r0)
674 return
675 }
676
677
678
679 func Getpgid(pid int) (pgid int, err error) {
680 r0, _, e1 := syscall_rawsyscall(SYS_GETPGID, uintptr(pid), 0, 0)
681 pgid = int(r0)
682 if e1 != 0 {
683 err = errnoErr(e1)
684 }
685 return
686 }
687
688
689
690 func Getppid() (pid int) {
691 r0, _, _ := syscall_rawsyscall(SYS_GETPPID, 0, 0, 0)
692 pid = int(r0)
693 return
694 }
695
696
697
698 func Getpriority(which int, who int) (prio int, err error) {
699 r0, _, e1 := syscall_syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
700 prio = int(r0)
701 if e1 != 0 {
702 err = errnoErr(e1)
703 }
704 return
705 }
706
707
708
709 func Getrlimit(resource int, rlim *Rlimit) (err error) {
710 _, _, e1 := syscall_rawsyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
711 if e1 != 0 {
712 err = errnoErr(e1)
713 }
714 return
715 }
716
717
718
719 func getrusage(who int, rusage *rusage_zos) (err error) {
720 _, _, e1 := syscall_rawsyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
721 if e1 != 0 {
722 err = errnoErr(e1)
723 }
724 return
725 }
726
727
728
729 func Getsid(pid int) (sid int, err error) {
730 r0, _, e1 := syscall_rawsyscall(SYS_GETSID, uintptr(pid), 0, 0)
731 sid = int(r0)
732 if e1 != 0 {
733 err = errnoErr(e1)
734 }
735 return
736 }
737
738
739
740 func Getuid() (uid int) {
741 r0, _, _ := syscall_rawsyscall(SYS_GETUID, 0, 0, 0)
742 uid = int(r0)
743 return
744 }
745
746
747
748 func Kill(pid int, sig Signal) (err error) {
749 _, _, e1 := syscall_rawsyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0)
750 if e1 != 0 {
751 err = errnoErr(e1)
752 }
753 return
754 }
755
756
757
758 func Lchown(path string, uid int, gid int) (err error) {
759 var _p0 *byte
760 _p0, err = BytePtrFromString(path)
761 if err != nil {
762 return
763 }
764 _, _, e1 := syscall_syscall(SYS___LCHOWN_A, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
765 if e1 != 0 {
766 err = errnoErr(e1)
767 }
768 return
769 }
770
771
772
773 func Link(path string, link string) (err error) {
774 var _p0 *byte
775 _p0, err = BytePtrFromString(path)
776 if err != nil {
777 return
778 }
779 var _p1 *byte
780 _p1, err = BytePtrFromString(link)
781 if err != nil {
782 return
783 }
784 _, _, e1 := syscall_syscall(SYS___LINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
785 if e1 != 0 {
786 err = errnoErr(e1)
787 }
788 return
789 }
790
791
792
793 func Listen(s int, n int) (err error) {
794 _, _, e1 := syscall_syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0)
795 if e1 != 0 {
796 err = errnoErr(e1)
797 }
798 return
799 }
800
801
802
803 func lstat(path string, stat *Stat_LE_t) (err error) {
804 var _p0 *byte
805 _p0, err = BytePtrFromString(path)
806 if err != nil {
807 return
808 }
809 _, _, e1 := syscall_syscall(SYS___LSTAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
810 if e1 != 0 {
811 err = errnoErr(e1)
812 }
813 return
814 }
815
816
817
818 func Mkdir(path string, mode uint32) (err error) {
819 var _p0 *byte
820 _p0, err = BytePtrFromString(path)
821 if err != nil {
822 return
823 }
824 _, _, e1 := syscall_syscall(SYS___MKDIR_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
825 if e1 != 0 {
826 err = errnoErr(e1)
827 }
828 return
829 }
830
831
832
833 func Mkfifo(path string, mode uint32) (err error) {
834 var _p0 *byte
835 _p0, err = BytePtrFromString(path)
836 if err != nil {
837 return
838 }
839 _, _, e1 := syscall_syscall(SYS___MKFIFO_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
840 if e1 != 0 {
841 err = errnoErr(e1)
842 }
843 return
844 }
845
846
847
848 func Mknod(path string, mode uint32, dev int) (err error) {
849 var _p0 *byte
850 _p0, err = BytePtrFromString(path)
851 if err != nil {
852 return
853 }
854 _, _, e1 := syscall_syscall(SYS___MKNOD_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
855 if e1 != 0 {
856 err = errnoErr(e1)
857 }
858 return
859 }
860
861
862
863 func Pread(fd int, p []byte, offset int64) (n int, err error) {
864 var _p0 unsafe.Pointer
865 if len(p) > 0 {
866 _p0 = unsafe.Pointer(&p[0])
867 } else {
868 _p0 = unsafe.Pointer(&_zero)
869 }
870 r0, _, e1 := syscall_syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
871 n = int(r0)
872 if e1 != 0 {
873 err = errnoErr(e1)
874 }
875 return
876 }
877
878
879
880 func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
881 var _p0 unsafe.Pointer
882 if len(p) > 0 {
883 _p0 = unsafe.Pointer(&p[0])
884 } else {
885 _p0 = unsafe.Pointer(&_zero)
886 }
887 r0, _, e1 := syscall_syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
888 n = int(r0)
889 if e1 != 0 {
890 err = errnoErr(e1)
891 }
892 return
893 }
894
895
896
897 func Readlink(path string, buf []byte) (n int, err error) {
898 var _p0 *byte
899 _p0, err = BytePtrFromString(path)
900 if err != nil {
901 return
902 }
903 var _p1 unsafe.Pointer
904 if len(buf) > 0 {
905 _p1 = unsafe.Pointer(&buf[0])
906 } else {
907 _p1 = unsafe.Pointer(&_zero)
908 }
909 r0, _, e1 := syscall_syscall(SYS___READLINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
910 n = int(r0)
911 if e1 != 0 {
912 err = errnoErr(e1)
913 }
914 return
915 }
916
917
918
919 func Rename(from string, to string) (err error) {
920 var _p0 *byte
921 _p0, err = BytePtrFromString(from)
922 if err != nil {
923 return
924 }
925 var _p1 *byte
926 _p1, err = BytePtrFromString(to)
927 if err != nil {
928 return
929 }
930 _, _, e1 := syscall_syscall(SYS___RENAME_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
931 if e1 != 0 {
932 err = errnoErr(e1)
933 }
934 return
935 }
936
937
938
939 func Rmdir(path string) (err error) {
940 var _p0 *byte
941 _p0, err = BytePtrFromString(path)
942 if err != nil {
943 return
944 }
945 _, _, e1 := syscall_syscall(SYS___RMDIR_A, uintptr(unsafe.Pointer(_p0)), 0, 0)
946 if e1 != 0 {
947 err = errnoErr(e1)
948 }
949 return
950 }
951
952
953
954 func Seek(fd int, offset int64, whence int) (off int64, err error) {
955 r0, _, e1 := syscall_syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
956 off = int64(r0)
957 if e1 != 0 {
958 err = errnoErr(e1)
959 }
960 return
961 }
962
963
964
965 func Setpriority(which int, who int, prio int) (err error) {
966 _, _, e1 := syscall_syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
967 if e1 != 0 {
968 err = errnoErr(e1)
969 }
970 return
971 }
972
973
974
975 func Setpgid(pid int, pgid int) (err error) {
976 _, _, e1 := syscall_rawsyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
977 if e1 != 0 {
978 err = errnoErr(e1)
979 }
980 return
981 }
982
983
984
985 func Setrlimit(resource int, lim *Rlimit) (err error) {
986 _, _, e1 := syscall_rawsyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(lim)), 0)
987 if e1 != 0 {
988 err = errnoErr(e1)
989 }
990 return
991 }
992
993
994
995 func Setregid(rgid int, egid int) (err error) {
996 _, _, e1 := syscall_rawsyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
997 if e1 != 0 {
998 err = errnoErr(e1)
999 }
1000 return
1001 }
1002
1003
1004
1005 func Setreuid(ruid int, euid int) (err error) {
1006 _, _, e1 := syscall_rawsyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
1007 if e1 != 0 {
1008 err = errnoErr(e1)
1009 }
1010 return
1011 }
1012
1013
1014
1015 func Setsid() (pid int, err error) {
1016 r0, _, e1 := syscall_rawsyscall(SYS_SETSID, 0, 0, 0)
1017 pid = int(r0)
1018 if e1 != 0 {
1019 err = errnoErr(e1)
1020 }
1021 return
1022 }
1023
1024
1025
1026 func Setuid(uid int) (err error) {
1027 _, _, e1 := syscall_syscall(SYS_SETUID, uintptr(uid), 0, 0)
1028 if e1 != 0 {
1029 err = errnoErr(e1)
1030 }
1031 return
1032 }
1033
1034
1035
1036 func Setgid(uid int) (err error) {
1037 _, _, e1 := syscall_syscall(SYS_SETGID, uintptr(uid), 0, 0)
1038 if e1 != 0 {
1039 err = errnoErr(e1)
1040 }
1041 return
1042 }
1043
1044
1045
1046 func Shutdown(fd int, how int) (err error) {
1047 _, _, e1 := syscall_syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
1048 if e1 != 0 {
1049 err = errnoErr(e1)
1050 }
1051 return
1052 }
1053
1054
1055
1056 func stat(path string, statLE *Stat_LE_t) (err error) {
1057 var _p0 *byte
1058 _p0, err = BytePtrFromString(path)
1059 if err != nil {
1060 return
1061 }
1062 _, _, e1 := syscall_syscall(SYS___STAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statLE)), 0)
1063 if e1 != 0 {
1064 err = errnoErr(e1)
1065 }
1066 return
1067 }
1068
1069
1070
1071 func Symlink(path string, link string) (err error) {
1072 var _p0 *byte
1073 _p0, err = BytePtrFromString(path)
1074 if err != nil {
1075 return
1076 }
1077 var _p1 *byte
1078 _p1, err = BytePtrFromString(link)
1079 if err != nil {
1080 return
1081 }
1082 _, _, e1 := syscall_syscall(SYS___SYMLINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
1083 if e1 != 0 {
1084 err = errnoErr(e1)
1085 }
1086 return
1087 }
1088
1089
1090
1091 func Sync() {
1092 syscall_syscall(SYS_SYNC, 0, 0, 0)
1093 return
1094 }
1095
1096
1097
1098 func Truncate(path string, length int64) (err error) {
1099 var _p0 *byte
1100 _p0, err = BytePtrFromString(path)
1101 if err != nil {
1102 return
1103 }
1104 _, _, e1 := syscall_syscall(SYS___TRUNCATE_A, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
1105 if e1 != 0 {
1106 err = errnoErr(e1)
1107 }
1108 return
1109 }
1110
1111
1112
1113 func Tcgetattr(fildes int, termptr *Termios) (err error) {
1114 _, _, e1 := syscall_syscall(SYS_TCGETATTR, uintptr(fildes), uintptr(unsafe.Pointer(termptr)), 0)
1115 if e1 != 0 {
1116 err = errnoErr(e1)
1117 }
1118 return
1119 }
1120
1121
1122
1123 func Tcsetattr(fildes int, when int, termptr *Termios) (err error) {
1124 _, _, e1 := syscall_syscall(SYS_TCSETATTR, uintptr(fildes), uintptr(when), uintptr(unsafe.Pointer(termptr)))
1125 if e1 != 0 {
1126 err = errnoErr(e1)
1127 }
1128 return
1129 }
1130
1131
1132
1133 func Umask(mask int) (oldmask int) {
1134 r0, _, _ := syscall_syscall(SYS_UMASK, uintptr(mask), 0, 0)
1135 oldmask = int(r0)
1136 return
1137 }
1138
1139
1140
1141 func Unlink(path string) (err error) {
1142 var _p0 *byte
1143 _p0, err = BytePtrFromString(path)
1144 if err != nil {
1145 return
1146 }
1147 _, _, e1 := syscall_syscall(SYS___UNLINK_A, uintptr(unsafe.Pointer(_p0)), 0, 0)
1148 if e1 != 0 {
1149 err = errnoErr(e1)
1150 }
1151 return
1152 }
1153
1154
1155
1156 func Utime(path string, utim *Utimbuf) (err error) {
1157 var _p0 *byte
1158 _p0, err = BytePtrFromString(path)
1159 if err != nil {
1160 return
1161 }
1162 _, _, e1 := syscall_syscall(SYS___UTIME_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(utim)), 0)
1163 if e1 != 0 {
1164 err = errnoErr(e1)
1165 }
1166 return
1167 }
1168
1169
1170
1171 func open(path string, mode int, perm uint32) (fd int, err error) {
1172 var _p0 *byte
1173 _p0, err = BytePtrFromString(path)
1174 if err != nil {
1175 return
1176 }
1177 r0, _, e1 := syscall_syscall(SYS___OPEN_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
1178 fd = int(r0)
1179 if e1 != 0 {
1180 err = errnoErr(e1)
1181 }
1182 return
1183 }
1184
1185
1186
1187 func remove(path string) (err error) {
1188 var _p0 *byte
1189 _p0, err = BytePtrFromString(path)
1190 if err != nil {
1191 return
1192 }
1193 _, _, e1 := syscall_syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0)
1194 if e1 != 0 {
1195 err = errnoErr(e1)
1196 }
1197 return
1198 }
1199
1200
1201
1202 func waitpid(pid int, wstatus *_C_int, options int) (wpid int, err error) {
1203 r0, _, e1 := syscall_syscall(SYS_WAITPID, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options))
1204 wpid = int(r0)
1205 if e1 != 0 {
1206 err = errnoErr(e1)
1207 }
1208 return
1209 }
1210
1211
1212
1213 func gettimeofday(tv *timeval_zos) (err error) {
1214 _, _, e1 := syscall_rawsyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
1215 if e1 != 0 {
1216 err = errnoErr(e1)
1217 }
1218 return
1219 }
1220
1221
1222
1223 func pipe(p *[2]_C_int) (err error) {
1224 _, _, e1 := syscall_rawsyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
1225 if e1 != 0 {
1226 err = errnoErr(e1)
1227 }
1228 return
1229 }
1230
1231
1232
1233 func utimes(path string, timeval *[2]Timeval) (err error) {
1234 var _p0 *byte
1235 _p0, err = BytePtrFromString(path)
1236 if err != nil {
1237 return
1238 }
1239 _, _, e1 := syscall_syscall(SYS___UTIMES_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
1240 if e1 != 0 {
1241 err = errnoErr(e1)
1242 }
1243 return
1244 }
1245
1246
1247
1248 func Select(nmsgsfds int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (ret int, err error) {
1249 r0, _, e1 := syscall_syscall6(SYS_SELECT, uintptr(nmsgsfds), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
1250 ret = int(r0)
1251 if e1 != 0 {
1252 err = errnoErr(e1)
1253 }
1254 return
1255 }
1256
View as plain text