1// Copyright 2009 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// +build sparc64,linux 6 7package unix 8 9//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) 10//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 11//sys Dup2(oldfd int, newfd int) (err error) 12//sys Fchown(fd int, uid int, gid int) (err error) 13//sys Fstat(fd int, stat *Stat_t) (err error) 14//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 15//sys Fstatfs(fd int, buf *Statfs_t) (err error) 16//sys Ftruncate(fd int, length int64) (err error) 17//sysnb Getegid() (egid int) 18//sysnb Geteuid() (euid int) 19//sysnb Getgid() (gid int) 20//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) 21//sysnb Getuid() (uid int) 22//sysnb InotifyInit() (fd int, err error) 23//sys Lchown(path string, uid int, gid int) (err error) 24//sys Listen(s int, n int) (err error) 25//sys Lstat(path string, stat *Stat_t) (err error) 26//sys Pause() (err error) 27//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 28//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 29//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK 30//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) 31//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) 32//sys Setfsgid(gid int) (err error) 33//sys Setfsuid(uid int) (err error) 34//sysnb Setregid(rgid int, egid int) (err error) 35//sysnb Setresgid(rgid int, egid int, sgid int) (err error) 36//sysnb Setresuid(ruid int, euid int, suid int) (err error) 37//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) 38//sysnb Setreuid(ruid int, euid int) (err error) 39//sys Shutdown(fd int, how int) (err error) 40//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) 41//sys Stat(path string, stat *Stat_t) (err error) 42//sys Statfs(path string, buf *Statfs_t) (err error) 43//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) 44//sys Truncate(path string, length int64) (err error) 45//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) 46//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) 47//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 48//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 49//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) 50//sysnb setgroups(n int, list *_Gid_t) (err error) 51//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) 52//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) 53//sysnb socket(domain int, typ int, proto int) (fd int, err error) 54//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) 55//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 56//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 57//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) 58//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) 59//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) 60//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) 61//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 62 63func Ioperm(from int, num int, on int) (err error) { 64 return ENOSYS 65} 66 67func Iopl(level int) (err error) { 68 return ENOSYS 69} 70 71//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) 72//sysnb Gettimeofday(tv *Timeval) (err error) 73 74func Time(t *Time_t) (tt Time_t, err error) { 75 var tv Timeval 76 err = Gettimeofday(&tv) 77 if err != nil { 78 return 0, err 79 } 80 if t != nil { 81 *t = Time_t(tv.Sec) 82 } 83 return Time_t(tv.Sec), nil 84} 85 86//sys Utime(path string, buf *Utimbuf) (err error) 87//sys utimes(path string, times *[2]Timeval) (err error) 88 89func setTimespec(sec, nsec int64) Timespec { 90 return Timespec{Sec: sec, Nsec: nsec} 91} 92 93func setTimeval(sec, usec int64) Timeval { 94 return Timeval{Sec: sec, Usec: int32(usec)} 95} 96 97func (r *PtraceRegs) PC() uint64 { return r.Tpc } 98 99func (r *PtraceRegs) SetPC(pc uint64) { r.Tpc = pc } 100 101func (iov *Iovec) SetLen(length int) { 102 iov.Len = uint64(length) 103} 104 105func (msghdr *Msghdr) SetControllen(length int) { 106 msghdr.Controllen = uint64(length) 107} 108 109func (cmsg *Cmsghdr) SetLen(length int) { 110 cmsg.Len = uint64(length) 111} 112 113//sysnb pipe(p *[2]_C_int) (err error) 114 115func Pipe(p []int) (err error) { 116 if len(p) != 2 { 117 return EINVAL 118 } 119 var pp [2]_C_int 120 err = pipe(&pp) 121 p[0] = int(pp[0]) 122 p[1] = int(pp[1]) 123 return 124} 125 126//sysnb pipe2(p *[2]_C_int, flags int) (err error) 127 128func Pipe2(p []int, flags int) (err error) { 129 if len(p) != 2 { 130 return EINVAL 131 } 132 var pp [2]_C_int 133 err = pipe2(&pp, flags) 134 p[0] = int(pp[0]) 135 p[1] = int(pp[1]) 136 return 137} 138 139//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) 140 141func Poll(fds []PollFd, timeout int) (n int, err error) { 142 if len(fds) == 0 { 143 return poll(nil, 0, timeout) 144 } 145 return poll(&fds[0], len(fds), timeout) 146} 147