Source file src/syscall/syscall_linux_mips64x.go
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 //go:build linux && (mips64 || mips64le) 6 7 package syscall 8 9 const ( 10 _SYS_setgroups = SYS_SETGROUPS 11 _SYS_clone3 = 5435 12 _SYS_faccessat2 = 5439 13 _SYS_fchmodat2 = 5452 14 ) 15 16 //sys Dup2(oldfd int, newfd int) (err error) 17 //sys Fchown(fd int, uid int, gid int) (err error) 18 //sys Fstatfs(fd int, buf *Statfs_t) (err error) 19 //sys fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT 20 //sys Ftruncate(fd int, length int64) (err error) 21 //sysnb Getegid() (egid int) 22 //sysnb Geteuid() (euid int) 23 //sysnb Getgid() (gid int) 24 //sysnb Getuid() (uid int) 25 //sysnb InotifyInit() (fd int, err error) 26 //sys Lchown(path string, uid int, gid int) (err error) 27 //sys Listen(s int, n int) (err error) 28 //sys Pause() (err error) 29 //sys pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 30 //sys pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 31 //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) 32 //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK 33 //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) 34 //sys Setfsgid(gid int) (err error) 35 //sys Setfsuid(uid int) (err error) 36 //sys Shutdown(fd int, how int) (err error) 37 //sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) 38 //sys Statfs(path string, buf *Statfs_t) (err error) 39 //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) 40 //sys Truncate(path string, length int64) (err error) 41 //sys Ustat(dev int, ubuf *Ustat_t) (err error) 42 //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) 43 //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 44 //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) 45 //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) 46 //sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) 47 //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) 48 //sysnb socket(domain int, typ int, proto int) (fd int, err error) 49 //sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) 50 //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 51 //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) 52 //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) 53 //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) 54 //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) 55 //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) 56 //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) 57 //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) 58 59 type sigset_t struct { 60 X__val [16]uint64 61 } 62 63 //sys pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *sigset_t) (n int, err error) = SYS_PSELECT6 64 65 func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { 66 var ts *Timespec 67 if timeout != nil { 68 ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} 69 } 70 return pselect(nfd, r, w, e, ts, nil) 71 } 72 73 //sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) 74 //sysnb Gettimeofday(tv *Timeval) (err error) 75 76 func Time(t *Time_t) (tt Time_t, err error) { 77 var tv Timeval 78 err = Gettimeofday(&tv) 79 if err != nil { 80 return 0, err 81 } 82 if t != nil { 83 *t = Time_t(tv.Sec) 84 } 85 return Time_t(tv.Sec), nil 86 } 87 88 //sys Utime(path string, buf *Utimbuf) (err error) 89 //sys utimes(path string, times *[2]Timeval) (err error) 90 91 func setTimespec(sec, nsec int64) Timespec { 92 return Timespec{Sec: sec, Nsec: nsec} 93 } 94 95 func setTimeval(sec, usec int64) Timeval { 96 return Timeval{Sec: sec, Usec: usec} 97 } 98 99 func Ioperm(from int, num int, on int) (err error) { 100 return ENOSYS 101 } 102 103 func Iopl(level int) (err error) { 104 return ENOSYS 105 } 106 107 type stat_t struct { 108 Dev uint32 109 Pad0 [3]int32 110 Ino uint64 111 Mode uint32 112 Nlink uint32 113 Uid uint32 114 Gid uint32 115 Rdev uint32 116 Pad1 [3]uint32 117 Size int64 118 Atime uint32 119 Atime_nsec uint32 120 Mtime uint32 121 Mtime_nsec uint32 122 Ctime uint32 123 Ctime_nsec uint32 124 Blksize uint32 125 Pad2 uint32 126 Blocks int64 127 } 128 129 //sys fstat(fd int, st *stat_t) (err error) 130 //sys lstat(path string, st *stat_t) (err error) 131 //sys stat(path string, st *stat_t) (err error) 132 133 func Fstat(fd int, s *Stat_t) (err error) { 134 st := &stat_t{} 135 err = fstat(fd, st) 136 fillStat_t(s, st) 137 return 138 } 139 140 func Lstat(path string, s *Stat_t) (err error) { 141 st := &stat_t{} 142 err = lstat(path, st) 143 fillStat_t(s, st) 144 return 145 } 146 147 func Stat(path string, s *Stat_t) (err error) { 148 st := &stat_t{} 149 err = stat(path, st) 150 fillStat_t(s, st) 151 return 152 } 153 154 func fillStat_t(s *Stat_t, st *stat_t) { 155 s.Dev = st.Dev 156 s.Ino = st.Ino 157 s.Mode = st.Mode 158 s.Nlink = st.Nlink 159 s.Uid = st.Uid 160 s.Gid = st.Gid 161 s.Rdev = st.Rdev 162 s.Size = st.Size 163 s.Atim = Timespec{int64(st.Atime), int64(st.Atime_nsec)} 164 s.Mtim = Timespec{int64(st.Mtime), int64(st.Mtime_nsec)} 165 s.Ctim = Timespec{int64(st.Ctime), int64(st.Ctime_nsec)} 166 s.Blksize = st.Blksize 167 s.Blocks = st.Blocks 168 } 169 170 func (r *PtraceRegs) PC() uint64 { return r.Regs[64] } 171 172 func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = pc } 173 174 func (iov *Iovec) SetLen(length int) { 175 iov.Len = uint64(length) 176 } 177 178 func (msghdr *Msghdr) SetControllen(length int) { 179 msghdr.Controllen = uint64(length) 180 } 181 182 func (cmsg *Cmsghdr) SetLen(length int) { 183 cmsg.Len = uint64(length) 184 } 185