Rob Pike | cd32498 | 2009-08-13 13:22:37 -0700 | [diff] [blame] | 1 | // mksyscall.sh syscall_darwin.go syscall_darwin_amd64.go |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 2 | // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT |
| 3 | |
| 4 | package syscall |
| 5 | |
Russ Cox | b04ac10 | 2009-08-12 13:19:17 -0700 | [diff] [blame] | 6 | import "unsafe" |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 7 | |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 8 | func getgroups(ngid int, gid *_Gid_t) (n int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 9 | r0, _, e1 := Syscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 10 | n = int(r0); |
| 11 | errno = int(e1); |
| 12 | return; |
| 13 | } |
| 14 | |
| 15 | func setgroups(ngid int, gid *_Gid_t) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 16 | _, _, e1 := Syscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 17 | errno = int(e1); |
| 18 | return; |
| 19 | } |
| 20 | |
| 21 | func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 22 | r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 23 | wpid = int(r0); |
| 24 | errno = int(e1); |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | func pipe() (r int, w int, errno int) { |
| 29 | r0, r1, e1 := Syscall(SYS_PIPE, 0, 0, 0); |
| 30 | r = int(r0); |
| 31 | w = int(r1); |
| 32 | errno = int(e1); |
| 33 | return; |
| 34 | } |
| 35 | |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 36 | func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 37 | r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 38 | fd = int(r0); |
| 39 | errno = int(e1); |
| 40 | return; |
| 41 | } |
| 42 | |
| 43 | func bind(s int, addr uintptr, addrlen _Socklen) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 44 | _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 45 | errno = int(e1); |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | func connect(s int, addr uintptr, addrlen _Socklen) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 50 | _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 51 | errno = int(e1); |
| 52 | return; |
| 53 | } |
| 54 | |
| 55 | func socket(domain int, typ int, proto int) (fd int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 56 | r0, _, e1 := Syscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 57 | fd = int(r0); |
| 58 | errno = int(e1); |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 63 | _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 64 | errno = int(e1); |
| 65 | return; |
| 66 | } |
| 67 | |
Russ Cox | 5d2ee9d | 2009-06-17 21:44:26 -0700 | [diff] [blame] | 68 | func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 69 | _, _, e1 := Syscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))); |
Russ Cox | 5d2ee9d | 2009-06-17 21:44:26 -0700 | [diff] [blame] | 70 | errno = int(e1); |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 75 | _, _, e1 := Syscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))); |
Russ Cox | 5d2ee9d | 2009-06-17 21:44:26 -0700 | [diff] [blame] | 76 | errno = int(e1); |
| 77 | return; |
| 78 | } |
| 79 | |
Russ Cox | 0b126c1 | 2009-12-01 16:53:43 -0800 | [diff] [blame^] | 80 | func Shutdown(s int, how int) (errno int) { |
| 81 | _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0); |
| 82 | errno = int(e1); |
| 83 | return; |
| 84 | } |
| 85 | |
Russ Cox | fd1add2 | 2009-11-01 11:13:27 -0800 | [diff] [blame] | 86 | func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int) { |
| 87 | var _p0 *byte; |
| 88 | if len(p) > 0 { |
Robert Griesemer | 40621d5 | 2009-11-09 12:07:39 -0800 | [diff] [blame] | 89 | _p0 = &p[0] |
Russ Cox | fd1add2 | 2009-11-01 11:13:27 -0800 | [diff] [blame] | 90 | } |
| 91 | r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))); |
| 92 | n = int(r0); |
| 93 | errno = int(e1); |
| 94 | return; |
| 95 | } |
| 96 | |
| 97 | func sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno int) { |
| 98 | var _p0 *byte; |
| 99 | if len(buf) > 0 { |
Robert Griesemer | 40621d5 | 2009-11-09 12:07:39 -0800 | [diff] [blame] | 100 | _p0 = &buf[0] |
Russ Cox | fd1add2 | 2009-11-01 11:13:27 -0800 | [diff] [blame] | 101 | } |
| 102 | _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)); |
| 103 | errno = int(e1); |
| 104 | return; |
| 105 | } |
| 106 | |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 107 | func kevent(kq int, change uintptr, nchange int, event uintptr, nevent int, timeout *Timespec) (n int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 108 | r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 109 | n = int(r0); |
| 110 | errno = int(e1); |
| 111 | return; |
| 112 | } |
| 113 | |
Russ Cox | b32769b | 2009-06-29 13:44:46 -0700 | [diff] [blame] | 114 | func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (errno int) { |
| 115 | var _p0 *_C_int; |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 116 | if len(mib) > 0 { |
Robert Griesemer | 40621d5 | 2009-11-09 12:07:39 -0800 | [diff] [blame] | 117 | _p0 = &mib[0] |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 118 | } |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 119 | _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(unsafe.Pointer(_p0)), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)); |
Russ Cox | b32769b | 2009-06-29 13:44:46 -0700 | [diff] [blame] | 120 | errno = int(e1); |
| 121 | return; |
| 122 | } |
| 123 | |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 124 | func fcntl(fd int, cmd int, arg int) (val int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 125 | r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 126 | val = int(r0); |
| 127 | errno = int(e1); |
| 128 | return; |
| 129 | } |
| 130 | |
| 131 | func Access(path string, flags int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 132 | _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 133 | errno = int(e1); |
| 134 | return; |
| 135 | } |
| 136 | |
| 137 | func Adjtime(delta *Timeval, olddelta *Timeval) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 138 | _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 139 | errno = int(e1); |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | func Chdir(path string) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 144 | _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 145 | errno = int(e1); |
| 146 | return; |
| 147 | } |
| 148 | |
| 149 | func Chflags(path string, flags int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 150 | _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 151 | errno = int(e1); |
| 152 | return; |
| 153 | } |
| 154 | |
| 155 | func Chmod(path string, mode int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 156 | _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 157 | errno = int(e1); |
| 158 | return; |
| 159 | } |
| 160 | |
| 161 | func Chown(path string, uid int, gid int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 162 | _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(uid), uintptr(gid)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 163 | errno = int(e1); |
| 164 | return; |
| 165 | } |
| 166 | |
| 167 | func Chroot(path string) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 168 | _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 169 | errno = int(e1); |
| 170 | return; |
| 171 | } |
| 172 | |
| 173 | func Close(fd int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 174 | _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 175 | errno = int(e1); |
| 176 | return; |
| 177 | } |
| 178 | |
| 179 | func Dup(fd int) (nfd int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 180 | r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 181 | nfd = int(r0); |
| 182 | errno = int(e1); |
| 183 | return; |
| 184 | } |
| 185 | |
| 186 | func Dup2(from int, to int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 187 | _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 188 | errno = int(e1); |
| 189 | return; |
| 190 | } |
| 191 | |
| 192 | func Exchangedata(path1 string, path2 string, options int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 193 | _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(StringBytePtr(path1))), uintptr(unsafe.Pointer(StringBytePtr(path2))), uintptr(options)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 194 | errno = int(e1); |
| 195 | return; |
| 196 | } |
| 197 | |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 198 | func Exit(code int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 199 | Syscall(SYS_EXIT, uintptr(code), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 200 | return; |
| 201 | } |
| 202 | |
| 203 | func Fchdir(fd int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 204 | _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 205 | errno = int(e1); |
| 206 | return; |
| 207 | } |
| 208 | |
| 209 | func Fchflags(path string, flags int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 210 | _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 211 | errno = int(e1); |
| 212 | return; |
| 213 | } |
| 214 | |
| 215 | func Fchmod(fd int, mode int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 216 | _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 217 | errno = int(e1); |
| 218 | return; |
| 219 | } |
| 220 | |
| 221 | func Fchown(fd int, uid int, gid int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 222 | _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 223 | errno = int(e1); |
| 224 | return; |
| 225 | } |
| 226 | |
| 227 | func Flock(fd int, how int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 228 | _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 229 | errno = int(e1); |
| 230 | return; |
| 231 | } |
| 232 | |
| 233 | func Fpathconf(fd int, name int) (val int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 234 | r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 235 | val = int(r0); |
| 236 | errno = int(e1); |
| 237 | return; |
| 238 | } |
| 239 | |
| 240 | func Fstat(fd int, stat *Stat_t) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 241 | _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 242 | errno = int(e1); |
| 243 | return; |
| 244 | } |
| 245 | |
| 246 | func Fstatfs(fd int, stat *Statfs_t) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 247 | _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 248 | errno = int(e1); |
| 249 | return; |
| 250 | } |
| 251 | |
| 252 | func Fsync(fd int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 253 | _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 254 | errno = int(e1); |
| 255 | return; |
| 256 | } |
| 257 | |
| 258 | func Ftruncate(fd int, length int64) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 259 | _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 260 | errno = int(e1); |
| 261 | return; |
| 262 | } |
| 263 | |
| 264 | func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, errno int) { |
| 265 | var _p0 *byte; |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 266 | if len(buf) > 0 { |
Robert Griesemer | 40621d5 | 2009-11-09 12:07:39 -0800 | [diff] [blame] | 267 | _p0 = &buf[0] |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 268 | } |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 269 | r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 270 | n = int(r0); |
| 271 | errno = int(e1); |
| 272 | return; |
| 273 | } |
| 274 | |
| 275 | func Getdtablesize() (size int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 276 | r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 277 | size = int(r0); |
| 278 | return; |
| 279 | } |
| 280 | |
| 281 | func Getegid() (egid int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 282 | r0, _, _ := Syscall(SYS_GETEGID, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 283 | egid = int(r0); |
| 284 | return; |
| 285 | } |
| 286 | |
| 287 | func Geteuid() (uid int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 288 | r0, _, _ := Syscall(SYS_GETEUID, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 289 | uid = int(r0); |
| 290 | return; |
| 291 | } |
| 292 | |
Russ Cox | 01b695d | 2009-06-08 22:10:48 -0700 | [diff] [blame] | 293 | func Getfsstat(buf []Statfs_t, flags int) (n int, errno int) { |
| 294 | var _p0 *Statfs_t; |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 295 | if len(buf) > 0 { |
Robert Griesemer | 40621d5 | 2009-11-09 12:07:39 -0800 | [diff] [blame] | 296 | _p0 = &buf[0] |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 297 | } |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 298 | r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags)); |
Russ Cox | 01b695d | 2009-06-08 22:10:48 -0700 | [diff] [blame] | 299 | n = int(r0); |
| 300 | errno = int(e1); |
| 301 | return; |
| 302 | } |
| 303 | |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 304 | func Getgid() (gid int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 305 | r0, _, _ := Syscall(SYS_GETGID, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 306 | gid = int(r0); |
| 307 | return; |
| 308 | } |
| 309 | |
| 310 | func Getpgid(pid int) (pgid int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 311 | r0, _, e1 := Syscall(SYS_GETPGID, uintptr(pid), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 312 | pgid = int(r0); |
| 313 | errno = int(e1); |
| 314 | return; |
| 315 | } |
| 316 | |
| 317 | func Getpgrp() (pgrp int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 318 | r0, _, _ := Syscall(SYS_GETPGRP, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 319 | pgrp = int(r0); |
| 320 | return; |
| 321 | } |
| 322 | |
| 323 | func Getpid() (pid int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 324 | r0, _, _ := Syscall(SYS_GETPID, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 325 | pid = int(r0); |
| 326 | return; |
| 327 | } |
| 328 | |
| 329 | func Getppid() (ppid int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 330 | r0, _, _ := Syscall(SYS_GETPPID, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 331 | ppid = int(r0); |
| 332 | return; |
| 333 | } |
| 334 | |
| 335 | func Getpriority(which int, who int) (prio int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 336 | r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 337 | prio = int(r0); |
| 338 | errno = int(e1); |
| 339 | return; |
| 340 | } |
| 341 | |
| 342 | func Getrlimit(which int, lim *Rlimit) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 343 | _, _, e1 := Syscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 344 | errno = int(e1); |
| 345 | return; |
| 346 | } |
| 347 | |
| 348 | func Getrusage(who int, rusage *Rusage) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 349 | _, _, e1 := Syscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 350 | errno = int(e1); |
| 351 | return; |
| 352 | } |
| 353 | |
| 354 | func Getsid(pid int) (sid int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 355 | r0, _, e1 := Syscall(SYS_GETSID, uintptr(pid), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 356 | sid = int(r0); |
| 357 | errno = int(e1); |
| 358 | return; |
| 359 | } |
| 360 | |
| 361 | func Getuid() (uid int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 362 | r0, _, _ := Syscall(SYS_GETUID, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 363 | uid = int(r0); |
| 364 | return; |
| 365 | } |
| 366 | |
| 367 | func Issetugid() (tainted bool) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 368 | r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 369 | tainted = bool(r0 != 0); |
| 370 | return; |
| 371 | } |
| 372 | |
| 373 | func Kill(pid int, signum int, posix int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 374 | _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 375 | errno = int(e1); |
| 376 | return; |
| 377 | } |
| 378 | |
| 379 | func Kqueue() (fd int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 380 | r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 381 | fd = int(r0); |
| 382 | errno = int(e1); |
| 383 | return; |
| 384 | } |
| 385 | |
| 386 | func Lchown(path string, uid int, gid int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 387 | _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(uid), uintptr(gid)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 388 | errno = int(e1); |
| 389 | return; |
| 390 | } |
| 391 | |
| 392 | func Link(path string, link string) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 393 | _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Pointer(StringBytePtr(link))), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 394 | errno = int(e1); |
| 395 | return; |
| 396 | } |
| 397 | |
| 398 | func Listen(s int, backlog int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 399 | _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 400 | errno = int(e1); |
| 401 | return; |
| 402 | } |
| 403 | |
| 404 | func Lstat(path string, stat *Stat_t) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 405 | _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Pointer(stat)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 406 | errno = int(e1); |
| 407 | return; |
| 408 | } |
| 409 | |
| 410 | func Mkdir(path string, mode int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 411 | _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 412 | errno = int(e1); |
| 413 | return; |
| 414 | } |
| 415 | |
| 416 | func Mkfifo(path string, mode int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 417 | _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 418 | errno = int(e1); |
| 419 | return; |
| 420 | } |
| 421 | |
| 422 | func Mknod(path string, mode int, dev int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 423 | _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(dev)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 424 | errno = int(e1); |
| 425 | return; |
| 426 | } |
| 427 | |
| 428 | func Open(path string, mode int, perm int) (fd int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 429 | r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 430 | fd = int(r0); |
| 431 | errno = int(e1); |
| 432 | return; |
| 433 | } |
| 434 | |
| 435 | func Pathconf(path string, name int) (val int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 436 | r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(name), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 437 | val = int(r0); |
| 438 | errno = int(e1); |
| 439 | return; |
| 440 | } |
| 441 | |
| 442 | func Pread(fd int, p []byte, offset int64) (n int, errno int) { |
| 443 | var _p0 *byte; |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 444 | if len(p) > 0 { |
Robert Griesemer | 40621d5 | 2009-11-09 12:07:39 -0800 | [diff] [blame] | 445 | _p0 = &p[0] |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 446 | } |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 447 | r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 448 | n = int(r0); |
| 449 | errno = int(e1); |
| 450 | return; |
| 451 | } |
| 452 | |
| 453 | func Pwrite(fd int, p []byte, offset int64) (n int, errno int) { |
| 454 | var _p0 *byte; |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 455 | if len(p) > 0 { |
Robert Griesemer | 40621d5 | 2009-11-09 12:07:39 -0800 | [diff] [blame] | 456 | _p0 = &p[0] |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 457 | } |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 458 | r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p)), uintptr(offset), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 459 | n = int(r0); |
| 460 | errno = int(e1); |
| 461 | return; |
| 462 | } |
| 463 | |
| 464 | func Read(fd int, p []byte) (n int, errno int) { |
| 465 | var _p0 *byte; |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 466 | if len(p) > 0 { |
Robert Griesemer | 40621d5 | 2009-11-09 12:07:39 -0800 | [diff] [blame] | 467 | _p0 = &p[0] |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 468 | } |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 469 | r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p))); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 470 | n = int(r0); |
| 471 | errno = int(e1); |
| 472 | return; |
| 473 | } |
| 474 | |
| 475 | func Readlink(path string, buf []byte) (n int, errno int) { |
| 476 | var _p0 *byte; |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 477 | if len(buf) > 0 { |
Robert Griesemer | 40621d5 | 2009-11-09 12:07:39 -0800 | [diff] [blame] | 478 | _p0 = &buf[0] |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 479 | } |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 480 | r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf))); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 481 | n = int(r0); |
| 482 | errno = int(e1); |
| 483 | return; |
| 484 | } |
| 485 | |
| 486 | func Rename(from string, to string) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 487 | _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(StringBytePtr(from))), uintptr(unsafe.Pointer(StringBytePtr(to))), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 488 | errno = int(e1); |
| 489 | return; |
| 490 | } |
| 491 | |
| 492 | func Revoke(path string) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 493 | _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 494 | errno = int(e1); |
| 495 | return; |
| 496 | } |
| 497 | |
| 498 | func Rmdir(path string) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 499 | _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 500 | errno = int(e1); |
| 501 | return; |
| 502 | } |
| 503 | |
Russ Cox | 76c87d5 | 2009-06-16 17:17:02 -0700 | [diff] [blame] | 504 | func Seek(fd int, offset int64, whence int) (newoffset int64, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 505 | r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)); |
Russ Cox | 76c87d5 | 2009-06-16 17:17:02 -0700 | [diff] [blame] | 506 | newoffset = int64(r0); |
| 507 | errno = int(e1); |
| 508 | return; |
| 509 | } |
| 510 | |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 511 | func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 512 | _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 513 | errno = int(e1); |
| 514 | return; |
| 515 | } |
| 516 | |
| 517 | func Setegid(egid int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 518 | _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 519 | errno = int(e1); |
| 520 | return; |
| 521 | } |
| 522 | |
| 523 | func Seteuid(euid int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 524 | _, _, e1 := Syscall(SYS_SETEUID, uintptr(euid), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 525 | errno = int(e1); |
| 526 | return; |
| 527 | } |
| 528 | |
| 529 | func Setgid(gid int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 530 | _, _, e1 := Syscall(SYS_SETGID, uintptr(gid), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 531 | errno = int(e1); |
| 532 | return; |
| 533 | } |
| 534 | |
| 535 | func Setlogin(name string) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 536 | _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(StringBytePtr(name))), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 537 | errno = int(e1); |
| 538 | return; |
| 539 | } |
| 540 | |
| 541 | func Setpgid(pid int, pgid int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 542 | _, _, e1 := Syscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 543 | errno = int(e1); |
| 544 | return; |
| 545 | } |
| 546 | |
| 547 | func Setpriority(which int, who int, prio int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 548 | _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 549 | errno = int(e1); |
| 550 | return; |
| 551 | } |
| 552 | |
| 553 | func Setprivexec(flag int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 554 | _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 555 | errno = int(e1); |
| 556 | return; |
| 557 | } |
| 558 | |
| 559 | func Setregid(rgid int, egid int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 560 | _, _, e1 := Syscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 561 | errno = int(e1); |
| 562 | return; |
| 563 | } |
| 564 | |
| 565 | func Setreuid(ruid int, euid int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 566 | _, _, e1 := Syscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 567 | errno = int(e1); |
| 568 | return; |
| 569 | } |
| 570 | |
| 571 | func Setrlimit(which int, lim *Rlimit) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 572 | _, _, e1 := Syscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 573 | errno = int(e1); |
| 574 | return; |
| 575 | } |
| 576 | |
| 577 | func Setsid() (pid int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 578 | r0, _, e1 := Syscall(SYS_SETSID, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 579 | pid = int(r0); |
| 580 | errno = int(e1); |
| 581 | return; |
| 582 | } |
| 583 | |
| 584 | func Settimeofday(tp *Timeval) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 585 | _, _, e1 := Syscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 586 | errno = int(e1); |
| 587 | return; |
| 588 | } |
| 589 | |
| 590 | func Setuid(uid int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 591 | _, _, e1 := Syscall(SYS_SETUID, uintptr(uid), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 592 | errno = int(e1); |
| 593 | return; |
| 594 | } |
| 595 | |
| 596 | func Stat(path string, stat *Stat_t) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 597 | _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Pointer(stat)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 598 | errno = int(e1); |
| 599 | return; |
| 600 | } |
| 601 | |
| 602 | func Statfs(path string, stat *Statfs_t) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 603 | _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Pointer(stat)), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 604 | errno = int(e1); |
| 605 | return; |
| 606 | } |
| 607 | |
| 608 | func Symlink(path string, link string) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 609 | _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Pointer(StringBytePtr(link))), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 610 | errno = int(e1); |
| 611 | return; |
| 612 | } |
| 613 | |
| 614 | func Sync() (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 615 | _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 616 | errno = int(e1); |
| 617 | return; |
| 618 | } |
| 619 | |
| 620 | func Truncate(path string, length int64) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 621 | _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(length), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 622 | errno = int(e1); |
| 623 | return; |
| 624 | } |
| 625 | |
| 626 | func Umask(newmask int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 627 | _, _, e1 := Syscall(SYS_UMASK, uintptr(newmask), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 628 | errno = int(e1); |
| 629 | return; |
| 630 | } |
| 631 | |
| 632 | func Undelete(path string) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 633 | _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 634 | errno = int(e1); |
| 635 | return; |
| 636 | } |
| 637 | |
| 638 | func Unlink(path string) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 639 | _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 640 | errno = int(e1); |
| 641 | return; |
| 642 | } |
| 643 | |
| 644 | func Unmount(path string, flags int) (errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 645 | _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), 0); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 646 | errno = int(e1); |
| 647 | return; |
| 648 | } |
| 649 | |
| 650 | func Write(fd int, p []byte) (n int, errno int) { |
| 651 | var _p0 *byte; |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 652 | if len(p) > 0 { |
Robert Griesemer | 40621d5 | 2009-11-09 12:07:39 -0800 | [diff] [blame] | 653 | _p0 = &p[0] |
Russ Cox | 6faacd2 | 2009-10-06 19:38:30 -0700 | [diff] [blame] | 654 | } |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 655 | r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(len(p))); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 656 | n = int(r0); |
| 657 | errno = int(e1); |
| 658 | return; |
| 659 | } |
| 660 | |
| 661 | func read(fd int, buf *byte, nbuf int) (n int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 662 | r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 663 | n = int(r0); |
| 664 | errno = int(e1); |
| 665 | return; |
| 666 | } |
| 667 | |
| 668 | func write(fd int, buf *byte, nbuf int) (n int, errno int) { |
Russ Cox | 98c9819 | 2009-09-15 13:51:33 -0700 | [diff] [blame] | 669 | r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)); |
Russ Cox | e11f833 | 2009-06-01 22:15:08 -0700 | [diff] [blame] | 670 | n = int(r0); |
| 671 | errno = int(e1); |
| 672 | return; |
| 673 | } |
| 674 | |
Russ Cox | 01b695d | 2009-06-08 22:10:48 -0700 | [diff] [blame] | 675 | func gettimeofday(tp *Timeval) (sec int64, usec int32, errno int) { |
| 676 | r0, r1, e1 := Syscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0); |
| 677 | sec = int64(r0); |
| 678 | usec = int32(r1); |
| 679 | errno = int(e1); |
| 680 | return; |
| 681 | } |