github.com/gogf/gkafka@v1.0.1-0.20190702070843-033a14468069/third/golang.org/x/sys/unix/syscall_linux_mips64x.go (about) 1 // Copyright 2015 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 linux 6 // +build mips64 mips64le 7 8 package unix 9 10 //sys Dup2(oldfd int, newfd int) (err error) 11 //sysnb EpollCreate(size int) (fd int, err error) 12 //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) 13 //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 14 //sys Fchown(fd int, uid int, gid int) (err error) 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 //sys Lchown(path string, uid int, gid int) (err error) 23 //sys Listen(s int, n int) (err error) 24 //sys Pause() (err error) 25 //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 26 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 27 //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) 28 //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK 29 30 func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { 31 var ts *Timespec 32 if timeout != nil { 33 ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} 34 } 35 return Pselect(nfd, r, w, e, ts, nil) 36 } 37 38 //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) 39 //sys Setfsgid(gid int) (err error) 40 //sys Setfsuid(uid int) (err error) 41 //sysnb Setregid(rgid int, egid int) (err error) 42 //sysnb Setresgid(rgid int, egid int, sgid int) (err error) 43 //sysnb Setresuid(ruid int, euid int, suid int) (err error) 44 //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) 45 //sysnb Setreuid(ruid int, euid int) (err error) 46 //sys Shutdown(fd int, how int) (err error) 47 //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) 48 //sys Statfs(path string, buf *Statfs_t) (err error) 49 //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) 50 //sys Truncate(path string, length int64) (err error) 51 //sys Ustat(dev int, ubuf *Ustat_t) (err error) 52 //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) 53 //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) 54 //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 55 //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 56 //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) 57 //sysnb setgroups(n int, list *_Gid_t) (err error) 58 //sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) 59 //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) 60 //sysnb socket(domain int, typ int, proto int) (fd int, err error) 61 //sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) 62 //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 63 //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 64 //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) 65 //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) 66 //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) 67 //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) 68 //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 69 70 //sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) 71 //sysnb Gettimeofday(tv *Timeval) (err error) 72 73 func Time(t *Time_t) (tt Time_t, err error) { 74 var tv Timeval 75 err = Gettimeofday(&tv) 76 if err != nil { 77 return 0, err 78 } 79 if t != nil { 80 *t = Time_t(tv.Sec) 81 } 82 return Time_t(tv.Sec), nil 83 } 84 85 //sys Utime(path string, buf *Utimbuf) (err error) 86 //sys utimes(path string, times *[2]Timeval) (err error) 87 88 func setTimespec(sec, nsec int64) Timespec { 89 return Timespec{Sec: sec, Nsec: nsec} 90 } 91 92 func setTimeval(sec, usec int64) Timeval { 93 return Timeval{Sec: sec, Usec: usec} 94 } 95 96 func Pipe(p []int) (err error) { 97 if len(p) != 2 { 98 return EINVAL 99 } 100 var pp [2]_C_int 101 err = pipe2(&pp, 0) 102 p[0] = int(pp[0]) 103 p[1] = int(pp[1]) 104 return 105 } 106 107 //sysnb pipe2(p *[2]_C_int, flags int) (err error) 108 109 func Pipe2(p []int, flags int) (err error) { 110 if len(p) != 2 { 111 return EINVAL 112 } 113 var pp [2]_C_int 114 err = pipe2(&pp, flags) 115 p[0] = int(pp[0]) 116 p[1] = int(pp[1]) 117 return 118 } 119 120 func Ioperm(from int, num int, on int) (err error) { 121 return ENOSYS 122 } 123 124 func Iopl(level int) (err error) { 125 return ENOSYS 126 } 127 128 type stat_t struct { 129 Dev uint32 130 Pad0 [3]int32 131 Ino uint64 132 Mode uint32 133 Nlink uint32 134 Uid uint32 135 Gid uint32 136 Rdev uint32 137 Pad1 [3]uint32 138 Size int64 139 Atime uint32 140 Atime_nsec uint32 141 Mtime uint32 142 Mtime_nsec uint32 143 Ctime uint32 144 Ctime_nsec uint32 145 Blksize uint32 146 Pad2 uint32 147 Blocks int64 148 } 149 150 //sys fstat(fd int, st *stat_t) (err error) 151 //sys fstatat(dirfd int, path string, st *stat_t, flags int) (err error) = SYS_NEWFSTATAT 152 //sys lstat(path string, st *stat_t) (err error) 153 //sys stat(path string, st *stat_t) (err error) 154 155 func Fstat(fd int, s *Stat_t) (err error) { 156 st := &stat_t{} 157 err = fstat(fd, st) 158 fillStat_t(s, st) 159 return 160 } 161 162 func Fstatat(dirfd int, path string, s *Stat_t, flags int) (err error) { 163 st := &stat_t{} 164 err = fstatat(dirfd, path, st, flags) 165 fillStat_t(s, st) 166 return 167 } 168 169 func Lstat(path string, s *Stat_t) (err error) { 170 st := &stat_t{} 171 err = lstat(path, st) 172 fillStat_t(s, st) 173 return 174 } 175 176 func Stat(path string, s *Stat_t) (err error) { 177 st := &stat_t{} 178 err = stat(path, st) 179 fillStat_t(s, st) 180 return 181 } 182 183 func fillStat_t(s *Stat_t, st *stat_t) { 184 s.Dev = st.Dev 185 s.Ino = st.Ino 186 s.Mode = st.Mode 187 s.Nlink = st.Nlink 188 s.Uid = st.Uid 189 s.Gid = st.Gid 190 s.Rdev = st.Rdev 191 s.Size = st.Size 192 s.Atim = Timespec{int64(st.Atime), int64(st.Atime_nsec)} 193 s.Mtim = Timespec{int64(st.Mtime), int64(st.Mtime_nsec)} 194 s.Ctim = Timespec{int64(st.Ctime), int64(st.Ctime_nsec)} 195 s.Blksize = st.Blksize 196 s.Blocks = st.Blocks 197 } 198 199 func (r *PtraceRegs) PC() uint64 { return r.Epc } 200 201 func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc } 202 203 func (iov *Iovec) SetLen(length int) { 204 iov.Len = uint64(length) 205 } 206 207 func (msghdr *Msghdr) SetControllen(length int) { 208 msghdr.Controllen = uint64(length) 209 } 210 211 func (cmsg *Cmsghdr) SetLen(length int) { 212 cmsg.Len = uint64(length) 213 } 214 215 //sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) 216 217 func Poll(fds []PollFd, timeout int) (n int, err error) { 218 if len(fds) == 0 { 219 return poll(nil, 0, timeout) 220 } 221 return poll(&fds[0], len(fds), timeout) 222 }