diff options
Diffstat (limited to 'vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go')
-rw-r--r-- | vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go | 233 |
1 files changed, 233 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go new file mode 100644 index 0000000..99e0e99 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go | |||
@@ -0,0 +1,233 @@ | |||
1 | // Copyright 2016 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 mips mipsle | ||
7 | |||
8 | package unix | ||
9 | |||
10 | import ( | ||
11 | "syscall" | ||
12 | "unsafe" | ||
13 | ) | ||
14 | |||
15 | func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) | ||
16 | |||
17 | //sys Dup2(oldfd int, newfd int) (err error) | ||
18 | //sysnb EpollCreate(size int) (fd int, err error) | ||
19 | //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) | ||
20 | //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 | ||
21 | //sys Fchown(fd int, uid int, gid int) (err error) | ||
22 | //sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64 | ||
23 | //sysnb Getegid() (egid int) | ||
24 | //sysnb Geteuid() (euid int) | ||
25 | //sysnb Getgid() (gid int) | ||
26 | //sysnb Getuid() (uid int) | ||
27 | //sys Lchown(path string, uid int, gid int) (err error) | ||
28 | //sys Listen(s int, n int) (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 Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT | ||
32 | //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 | ||
33 | //sys Setfsgid(gid int) (err error) | ||
34 | //sys Setfsuid(uid int) (err error) | ||
35 | //sysnb Setregid(rgid int, egid int) (err error) | ||
36 | //sysnb Setresgid(rgid int, egid int, sgid int) (err error) | ||
37 | //sysnb Setresuid(ruid int, euid int, suid int) (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 int, err error) | ||
41 | //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) | ||
42 | //sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64 | ||
43 | //sys Ustat(dev int, ubuf *Ustat_t) (err error) | ||
44 | //sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) | ||
45 | //sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) | ||
46 | //sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) | ||
47 | //sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) | ||
48 | //sysnb getgroups(n int, list *_Gid_t) (nn int, err error) | ||
49 | //sysnb setgroups(n int, list *_Gid_t) (err error) | ||
50 | //sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) | ||
51 | //sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) | ||
52 | //sysnb socket(domain int, typ int, proto int) (fd int, err error) | ||
53 | //sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) | ||
54 | //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) | ||
55 | //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) | ||
56 | //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) | ||
57 | //sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) | ||
58 | //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) | ||
59 | //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) | ||
60 | |||
61 | //sysnb InotifyInit() (fd int, err error) | ||
62 | //sys Ioperm(from int, num int, on int) (err error) | ||
63 | //sys Iopl(level int) (err error) | ||
64 | |||
65 | //sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) | ||
66 | //sysnb Gettimeofday(tv *Timeval) (err error) | ||
67 | //sysnb Time(t *Time_t) (tt Time_t, err error) | ||
68 | //sys Utime(path string, buf *Utimbuf) (err error) | ||
69 | //sys utimes(path string, times *[2]Timeval) (err error) | ||
70 | |||
71 | //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 | ||
72 | //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 | ||
73 | //sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 | ||
74 | //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 | ||
75 | |||
76 | //sys Pause() (err error) | ||
77 | |||
78 | func Fstatfs(fd int, buf *Statfs_t) (err error) { | ||
79 | _, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) | ||
80 | if e != 0 { | ||
81 | err = errnoErr(e) | ||
82 | } | ||
83 | return | ||
84 | } | ||
85 | |||
86 | func Statfs(path string, buf *Statfs_t) (err error) { | ||
87 | p, err := BytePtrFromString(path) | ||
88 | if err != nil { | ||
89 | return err | ||
90 | } | ||
91 | _, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(p)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) | ||
92 | if e != 0 { | ||
93 | err = errnoErr(e) | ||
94 | } | ||
95 | return | ||
96 | } | ||
97 | |||
98 | func Seek(fd int, offset int64, whence int) (off int64, err error) { | ||
99 | _, _, e := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offset>>32), uintptr(offset), uintptr(unsafe.Pointer(&off)), uintptr(whence), 0) | ||
100 | if e != 0 { | ||
101 | err = errnoErr(e) | ||
102 | } | ||
103 | return | ||
104 | } | ||
105 | |||
106 | func setTimespec(sec, nsec int64) Timespec { | ||
107 | return Timespec{Sec: int32(sec), Nsec: int32(nsec)} | ||
108 | } | ||
109 | |||
110 | func setTimeval(sec, usec int64) Timeval { | ||
111 | return Timeval{Sec: int32(sec), Usec: int32(usec)} | ||
112 | } | ||
113 | |||
114 | //sysnb pipe2(p *[2]_C_int, flags int) (err error) | ||
115 | |||
116 | func Pipe2(p []int, flags int) (err error) { | ||
117 | if len(p) != 2 { | ||
118 | return EINVAL | ||
119 | } | ||
120 | var pp [2]_C_int | ||
121 | err = pipe2(&pp, flags) | ||
122 | p[0] = int(pp[0]) | ||
123 | p[1] = int(pp[1]) | ||
124 | return | ||
125 | } | ||
126 | |||
127 | //sysnb pipe() (p1 int, p2 int, err error) | ||
128 | |||
129 | func Pipe(p []int) (err error) { | ||
130 | if len(p) != 2 { | ||
131 | return EINVAL | ||
132 | } | ||
133 | p[0], p[1], err = pipe() | ||
134 | return | ||
135 | } | ||
136 | |||
137 | //sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) | ||
138 | |||
139 | func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { | ||
140 | page := uintptr(offset / 4096) | ||
141 | if offset != int64(page)*4096 { | ||
142 | return 0, EINVAL | ||
143 | } | ||
144 | return mmap2(addr, length, prot, flags, fd, page) | ||
145 | } | ||
146 | |||
147 | const rlimInf32 = ^uint32(0) | ||
148 | const rlimInf64 = ^uint64(0) | ||
149 | |||
150 | type rlimit32 struct { | ||
151 | Cur uint32 | ||
152 | Max uint32 | ||
153 | } | ||
154 | |||
155 | //sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT | ||
156 | |||
157 | func Getrlimit(resource int, rlim *Rlimit) (err error) { | ||
158 | err = prlimit(0, resource, nil, rlim) | ||
159 | if err != ENOSYS { | ||
160 | return err | ||
161 | } | ||
162 | |||
163 | rl := rlimit32{} | ||
164 | err = getrlimit(resource, &rl) | ||
165 | if err != nil { | ||
166 | return | ||
167 | } | ||
168 | |||
169 | if rl.Cur == rlimInf32 { | ||
170 | rlim.Cur = rlimInf64 | ||
171 | } else { | ||
172 | rlim.Cur = uint64(rl.Cur) | ||
173 | } | ||
174 | |||
175 | if rl.Max == rlimInf32 { | ||
176 | rlim.Max = rlimInf64 | ||
177 | } else { | ||
178 | rlim.Max = uint64(rl.Max) | ||
179 | } | ||
180 | return | ||
181 | } | ||
182 | |||
183 | //sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT | ||
184 | |||
185 | func Setrlimit(resource int, rlim *Rlimit) (err error) { | ||
186 | err = prlimit(0, resource, rlim, nil) | ||
187 | if err != ENOSYS { | ||
188 | return err | ||
189 | } | ||
190 | |||
191 | rl := rlimit32{} | ||
192 | if rlim.Cur == rlimInf64 { | ||
193 | rl.Cur = rlimInf32 | ||
194 | } else if rlim.Cur < uint64(rlimInf32) { | ||
195 | rl.Cur = uint32(rlim.Cur) | ||
196 | } else { | ||
197 | return EINVAL | ||
198 | } | ||
199 | if rlim.Max == rlimInf64 { | ||
200 | rl.Max = rlimInf32 | ||
201 | } else if rlim.Max < uint64(rlimInf32) { | ||
202 | rl.Max = uint32(rlim.Max) | ||
203 | } else { | ||
204 | return EINVAL | ||
205 | } | ||
206 | |||
207 | return setrlimit(resource, &rl) | ||
208 | } | ||
209 | |||
210 | func (r *PtraceRegs) PC() uint64 { return r.Epc } | ||
211 | |||
212 | func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc } | ||
213 | |||
214 | func (iov *Iovec) SetLen(length int) { | ||
215 | iov.Len = uint32(length) | ||
216 | } | ||
217 | |||
218 | func (msghdr *Msghdr) SetControllen(length int) { | ||
219 | msghdr.Controllen = uint32(length) | ||
220 | } | ||
221 | |||
222 | func (cmsg *Cmsghdr) SetLen(length int) { | ||
223 | cmsg.Len = uint32(length) | ||
224 | } | ||
225 | |||
226 | //sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) | ||
227 | |||
228 | func Poll(fds []PollFd, timeout int) (n int, err error) { | ||
229 | if len(fds) == 0 { | ||
230 | return poll(nil, 0, timeout) | ||
231 | } | ||
232 | return poll(&fds[0], len(fds), timeout) | ||
233 | } | ||