| 1 |
// Copyright 2009,2010 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 |
// Darwin system calls. |
| 6 |
// This file is compiled as ordinary Go code, |
| 7 |
// but it is also input to mksyscall, |
| 8 |
// which parses the //sys lines and generates system call stubs. |
| 9 |
// Note that sometimes we use a lowercase //sys name and wrap |
| 10 |
// it in our own nicer implementation, either here or in |
| 11 |
// syscall_bsd.go or syscall_unix.go. |
| 12 |
|
| 13 |
package unix |
| 14 |
|
| 15 |
import ( |
| 16 |
"errors" |
| 17 |
"syscall" |
| 18 |
"unsafe" |
| 19 |
) |
| 20 |
|
| 21 |
const ImplementsGetwd = true |
| 22 |
|
| 23 |
func Getwd() (string, error) { |
| 24 |
buf := make([]byte, 2048) |
| 25 |
attrs, err := getAttrList(".", attrList{CommonAttr: attrCmnFullpath}, buf, 0) |
| 26 |
if err == nil && len(attrs) == 1 && len(attrs[0]) >= 2 { |
| 27 |
wd := string(attrs[0]) |
| 28 |
// Sanity check that it's an absolute path and ends |
| 29 |
// in a null byte, which we then strip. |
| 30 |
if wd[0] == '/' && wd[len(wd)-1] == 0 { |
| 31 |
return wd[:len(wd)-1], nil |
| 32 |
} |
| 33 |
} |
| 34 |
// If pkg/os/getwd.go gets ENOTSUP, it will fall back to the |
| 35 |
// slow algorithm. |
| 36 |
return "", ENOTSUP |
| 37 |
} |
| 38 |
|
| 39 |
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. |
| 40 |
type SockaddrDatalink struct { |
| 41 |
Len uint8 |
| 42 |
Family uint8 |
| 43 |
Index uint16 |
| 44 |
Type uint8 |
| 45 |
Nlen uint8 |
| 46 |
Alen uint8 |
| 47 |
Slen uint8 |
| 48 |
Data [12]int8 |
| 49 |
raw RawSockaddrDatalink |
| 50 |
} |
| 51 |
|
| 52 |
// Translate "kern.hostname" to []_C_int{0,1,2,3}. |
| 53 |
func nametomib(name string) (mib []_C_int, err error) { |
| 54 |
const siz = unsafe.Sizeof(mib[0]) |
| 55 |
|
| 56 |
// NOTE(rsc): It seems strange to set the buffer to have |
| 57 |
// size CTL_MAXNAME+2 but use only CTL_MAXNAME |
| 58 |
// as the size. I don't know why the +2 is here, but the |
| 59 |
// kernel uses +2 for its own implementation of this function. |
| 60 |
// I am scared that if we don't include the +2 here, the kernel |
| 61 |
// will silently write 2 words farther than we specify |
| 62 |
// and we'll get memory corruption. |
| 63 |
var buf [CTL_MAXNAME + 2]_C_int |
| 64 |
n := uintptr(CTL_MAXNAME) * siz |
| 65 |
|
| 66 |
p := (*byte)(unsafe.Pointer(&buf[0])) |
| 67 |
bytes, err := ByteSliceFromString(name) |
| 68 |
if err != nil { |
| 69 |
return nil, err |
| 70 |
} |
| 71 |
|
| 72 |
// Magic sysctl: "setting" 0.3 to a string name |
| 73 |
// lets you read back the array of integers form. |
| 74 |
if err = sysctl([]_C_int{0, 3}, p, &n, &bytes[0], uintptr(len(name))); err != nil { |
| 75 |
return nil, err |
| 76 |
} |
| 77 |
return buf[0 : n/siz], nil |
| 78 |
} |
| 79 |
|
| 80 |
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) |
| 81 |
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) } |
| 82 |
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) } |
| 83 |
|
| 84 |
const ( |
| 85 |
attrBitMapCount = 5 |
| 86 |
attrCmnFullpath = 0x08000000 |
| 87 |
) |
| 88 |
|
| 89 |
type attrList struct { |
| 90 |
bitmapCount uint16 |
| 91 |
_ uint16 |
| 92 |
CommonAttr uint32 |
| 93 |
VolAttr uint32 |
| 94 |
DirAttr uint32 |
| 95 |
FileAttr uint32 |
| 96 |
Forkattr uint32 |
| 97 |
} |
| 98 |
|
| 99 |
func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (attrs [][]byte, err error) { |
| 100 |
if len(attrBuf) < 4 { |
| 101 |
return nil, errors.New("attrBuf too small") |
| 102 |
} |
| 103 |
attrList.bitmapCount = attrBitMapCount |
| 104 |
|
| 105 |
var _p0 *byte |
| 106 |
_p0, err = BytePtrFromString(path) |
| 107 |
if err != nil { |
| 108 |
return nil, err |
| 109 |
} |
| 110 |
|
| 111 |
_, _, e1 := Syscall6( |
| 112 |
SYS_GETATTRLIST, |
| 113 |
uintptr(unsafe.Pointer(_p0)), |
| 114 |
uintptr(unsafe.Pointer(&attrList)), |
| 115 |
uintptr(unsafe.Pointer(&attrBuf[0])), |
| 116 |
uintptr(len(attrBuf)), |
| 117 |
uintptr(options), |
| 118 |
0, |
| 119 |
) |
| 120 |
if e1 != 0 { |
| 121 |
return nil, e1 |
| 122 |
} |
| 123 |
size := *(*uint32)(unsafe.Pointer(&attrBuf[0])) |
| 124 |
|
| 125 |
// dat is the section of attrBuf that contains valid data, |
| 126 |
// without the 4 byte length header. All attribute offsets |
| 127 |
// are relative to dat. |
| 128 |
dat := attrBuf |
| 129 |
if int(size) < len(attrBuf) { |
| 130 |
dat = dat[:size] |
| 131 |
} |
| 132 |
dat = dat[4:] // remove length prefix |
| 133 |
|
| 134 |
for i := uint32(0); int(i) < len(dat); { |
| 135 |
header := dat[i:] |
| 136 |
if len(header) < 8 { |
| 137 |
return attrs, errors.New("truncated attribute header") |
| 138 |
} |
| 139 |
datOff := *(*int32)(unsafe.Pointer(&header[0])) |
| 140 |
attrLen := *(*uint32)(unsafe.Pointer(&header[4])) |
| 141 |
if datOff < 0 || uint32(datOff)+attrLen > uint32(len(dat)) { |
| 142 |
return attrs, errors.New("truncated results; attrBuf too small") |
| 143 |
} |
| 144 |
end := uint32(datOff) + attrLen |
| 145 |
attrs = append(attrs, dat[datOff:end]) |
| 146 |
i = end |
| 147 |
if r := i % 4; r != 0 { |
| 148 |
i += (4 - r) |
| 149 |
} |
| 150 |
} |
| 151 |
return |
| 152 |
} |
| 153 |
|
| 154 |
//sysnb pipe() (r int, w int, err error) |
| 155 |
|
| 156 |
func Pipe(p []int) (err error) { |
| 157 |
if len(p) != 2 { |
| 158 |
return EINVAL |
| 159 |
} |
| 160 |
p[0], p[1], err = pipe() |
| 161 |
return |
| 162 |
} |
| 163 |
|
| 164 |
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { |
| 165 |
var _p0 unsafe.Pointer |
| 166 |
var bufsize uintptr |
| 167 |
if len(buf) > 0 { |
| 168 |
_p0 = unsafe.Pointer(&buf[0]) |
| 169 |
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) |
| 170 |
} |
| 171 |
r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags)) |
| 172 |
n = int(r0) |
| 173 |
if e1 != 0 { |
| 174 |
err = e1 |
| 175 |
} |
| 176 |
return |
| 177 |
} |
| 178 |
|
| 179 |
func xattrPointer(dest []byte) *byte { |
| 180 |
// It's only when dest is set to NULL that the OS X implementations of |
| 181 |
// getxattr() and listxattr() return the current sizes of the named attributes. |
| 182 |
// An empty byte array is not sufficient. To maintain the same behaviour as the |
| 183 |
// linux implementation, we wrap around the system calls and pass in NULL when |
| 184 |
// dest is empty. |
| 185 |
var destp *byte |
| 186 |
if len(dest) > 0 { |
| 187 |
destp = &dest[0] |
| 188 |
} |
| 189 |
return destp |
| 190 |
} |
| 191 |
|
| 192 |
//sys getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) |
| 193 |
|
| 194 |
func Getxattr(path string, attr string, dest []byte) (sz int, err error) { |
| 195 |
return getxattr(path, attr, xattrPointer(dest), len(dest), 0, 0) |
| 196 |
} |
| 197 |
|
| 198 |
func Lgetxattr(link string, attr string, dest []byte) (sz int, err error) { |
| 199 |
return getxattr(link, attr, xattrPointer(dest), len(dest), 0, XATTR_NOFOLLOW) |
| 200 |
} |
| 201 |
|
| 202 |
//sys fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) |
| 203 |
|
| 204 |
func Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) { |
| 205 |
return fgetxattr(fd, attr, xattrPointer(dest), len(dest), 0, 0) |
| 206 |
} |
| 207 |
|
| 208 |
//sys setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) |
| 209 |
|
| 210 |
func Setxattr(path string, attr string, data []byte, flags int) (err error) { |
| 211 |
// The parameters for the OS X implementation vary slightly compared to the |
| 212 |
// linux system call, specifically the position parameter: |
| 213 |
// |
| 214 |
// linux: |
| 215 |
// int setxattr( |
| 216 |
// const char *path, |
| 217 |
// const char *name, |
| 218 |
// const void *value, |
| 219 |
// size_t size, |
| 220 |
// int flags |
| 221 |
// ); |
| 222 |
// |
| 223 |
// darwin: |
| 224 |
// int setxattr( |
| 225 |
// const char *path, |
| 226 |
// const char *name, |
| 227 |
// void *value, |
| 228 |
// size_t size, |
| 229 |
// u_int32_t position, |
| 230 |
// int options |
| 231 |
// ); |
| 232 |
// |
| 233 |
// position specifies the offset within the extended attribute. In the |
| 234 |
// current implementation, only the resource fork extended attribute makes |
| 235 |
// use of this argument. For all others, position is reserved. We simply |
| 236 |
// default to setting it to zero. |
| 237 |
return setxattr(path, attr, xattrPointer(data), len(data), 0, flags) |
| 238 |
} |
| 239 |
|
| 240 |
func Lsetxattr(link string, attr string, data []byte, flags int) (err error) { |
| 241 |
return setxattr(link, attr, xattrPointer(data), len(data), 0, flags|XATTR_NOFOLLOW) |
| 242 |
} |
| 243 |
|
| 244 |
//sys fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) |
| 245 |
|
| 246 |
func Fsetxattr(fd int, attr string, data []byte, flags int) (err error) { |
| 247 |
return fsetxattr(fd, attr, xattrPointer(data), len(data), 0, 0) |
| 248 |
} |
| 249 |
|
| 250 |
//sys removexattr(path string, attr string, options int) (err error) |
| 251 |
|
| 252 |
func Removexattr(path string, attr string) (err error) { |
| 253 |
// We wrap around and explicitly zero out the options provided to the OS X |
| 254 |
// implementation of removexattr, we do so for interoperability with the |
| 255 |
// linux variant. |
| 256 |
return removexattr(path, attr, 0) |
| 257 |
} |
| 258 |
|
| 259 |
func Lremovexattr(link string, attr string) (err error) { |
| 260 |
return removexattr(link, attr, XATTR_NOFOLLOW) |
| 261 |
} |
| 262 |
|
| 263 |
//sys fremovexattr(fd int, attr string, options int) (err error) |
| 264 |
|
| 265 |
func Fremovexattr(fd int, attr string) (err error) { |
| 266 |
return fremovexattr(fd, attr, 0) |
| 267 |
} |
| 268 |
|
| 269 |
//sys listxattr(path string, dest *byte, size int, options int) (sz int, err error) |
| 270 |
|
| 271 |
func Listxattr(path string, dest []byte) (sz int, err error) { |
| 272 |
return listxattr(path, xattrPointer(dest), len(dest), 0) |
| 273 |
} |
| 274 |
|
| 275 |
func Llistxattr(link string, dest []byte) (sz int, err error) { |
| 276 |
return listxattr(link, xattrPointer(dest), len(dest), XATTR_NOFOLLOW) |
| 277 |
} |
| 278 |
|
| 279 |
//sys flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) |
| 280 |
|
| 281 |
func Flistxattr(fd int, dest []byte) (sz int, err error) { |
| 282 |
return flistxattr(fd, xattrPointer(dest), len(dest), 0) |
| 283 |
} |
| 284 |
|
| 285 |
func setattrlistTimes(path string, times []Timespec, flags int) error { |
| 286 |
_p0, err := BytePtrFromString(path) |
| 287 |
if err != nil { |
| 288 |
return err |
| 289 |
} |
| 290 |
|
| 291 |
var attrList attrList |
| 292 |
attrList.bitmapCount = ATTR_BIT_MAP_COUNT |
| 293 |
attrList.CommonAttr = ATTR_CMN_MODTIME | ATTR_CMN_ACCTIME |
| 294 |
|
| 295 |
// order is mtime, atime: the opposite of Chtimes |
| 296 |
attributes := [2]Timespec{times[1], times[0]} |
| 297 |
options := 0 |
| 298 |
if flags&AT_SYMLINK_NOFOLLOW != 0 { |
| 299 |
options |= FSOPT_NOFOLLOW |
| 300 |
} |
| 301 |
_, _, e1 := Syscall6( |
| 302 |
SYS_SETATTRLIST, |
| 303 |
uintptr(unsafe.Pointer(_p0)), |
| 304 |
uintptr(unsafe.Pointer(&attrList)), |
| 305 |
uintptr(unsafe.Pointer(&attributes)), |
| 306 |
uintptr(unsafe.Sizeof(attributes)), |
| 307 |
uintptr(options), |
| 308 |
0, |
| 309 |
) |
| 310 |
if e1 != 0 { |
| 311 |
return e1 |
| 312 |
} |
| 313 |
return nil |
| 314 |
} |
| 315 |
|
| 316 |
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error { |
| 317 |
// Darwin doesn't support SYS_UTIMENSAT |
| 318 |
return ENOSYS |
| 319 |
} |
| 320 |
|
| 321 |
/* |
| 322 |
* Wrapped |
| 323 |
*/ |
| 324 |
|
| 325 |
//sys kill(pid int, signum int, posix int) (err error) |
| 326 |
|
| 327 |
func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) } |
| 328 |
|
| 329 |
//sys ioctl(fd int, req uint, arg uintptr) (err error) |
| 330 |
|
| 331 |
// ioctl itself should not be exposed directly, but additional get/set |
| 332 |
// functions for specific types are permissible. |
| 333 |
|
| 334 |
// IoctlSetInt performs an ioctl operation which sets an integer value |
| 335 |
// on fd, using the specified request number. |
| 336 |
func IoctlSetInt(fd int, req uint, value int) error { |
| 337 |
return ioctl(fd, req, uintptr(value)) |
| 338 |
} |
| 339 |
|
| 340 |
func ioctlSetWinsize(fd int, req uint, value *Winsize) error { |
| 341 |
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) |
| 342 |
} |
| 343 |
|
| 344 |
func ioctlSetTermios(fd int, req uint, value *Termios) error { |
| 345 |
return ioctl(fd, req, uintptr(unsafe.Pointer(value))) |
| 346 |
} |
| 347 |
|
| 348 |
// IoctlGetInt performs an ioctl operation which gets an integer value |
| 349 |
// from fd, using the specified request number. |
| 350 |
func IoctlGetInt(fd int, req uint) (int, error) { |
| 351 |
var value int |
| 352 |
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) |
| 353 |
return value, err |
| 354 |
} |
| 355 |
|
| 356 |
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { |
| 357 |
var value Winsize |
| 358 |
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) |
| 359 |
return &value, err |
| 360 |
} |
| 361 |
|
| 362 |
func IoctlGetTermios(fd int, req uint) (*Termios, error) { |
| 363 |
var value Termios |
| 364 |
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) |
| 365 |
return &value, err |
| 366 |
} |
| 367 |
|
| 368 |
func Uname(uname *Utsname) error { |
| 369 |
mib := []_C_int{CTL_KERN, KERN_OSTYPE} |
| 370 |
n := unsafe.Sizeof(uname.Sysname) |
| 371 |
if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil { |
| 372 |
return err |
| 373 |
} |
| 374 |
|
| 375 |
mib = []_C_int{CTL_KERN, KERN_HOSTNAME} |
| 376 |
n = unsafe.Sizeof(uname.Nodename) |
| 377 |
if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil { |
| 378 |
return err |
| 379 |
} |
| 380 |
|
| 381 |
mib = []_C_int{CTL_KERN, KERN_OSRELEASE} |
| 382 |
n = unsafe.Sizeof(uname.Release) |
| 383 |
if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil { |
| 384 |
return err |
| 385 |
} |
| 386 |
|
| 387 |
mib = []_C_int{CTL_KERN, KERN_VERSION} |
| 388 |
n = unsafe.Sizeof(uname.Version) |
| 389 |
if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil { |
| 390 |
return err |
| 391 |
} |
| 392 |
|
| 393 |
// The version might have newlines or tabs in it, convert them to |
| 394 |
// spaces. |
| 395 |
for i, b := range uname.Version { |
| 396 |
if b == '\n' || b == '\t' { |
| 397 |
if i == len(uname.Version)-1 { |
| 398 |
uname.Version[i] = 0 |
| 399 |
} else { |
| 400 |
uname.Version[i] = ' ' |
| 401 |
} |
| 402 |
} |
| 403 |
} |
| 404 |
|
| 405 |
mib = []_C_int{CTL_HW, HW_MACHINE} |
| 406 |
n = unsafe.Sizeof(uname.Machine) |
| 407 |
if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil { |
| 408 |
return err |
| 409 |
} |
| 410 |
|
| 411 |
return nil |
| 412 |
} |
| 413 |
|
| 414 |
/* |
| 415 |
* Exposed directly |
| 416 |
*/ |
| 417 |
//sys Access(path string, mode uint32) (err error) |
| 418 |
//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error) |
| 419 |
//sys Chdir(path string) (err error) |
| 420 |
//sys Chflags(path string, flags int) (err error) |
| 421 |
//sys Chmod(path string, mode uint32) (err error) |
| 422 |
//sys Chown(path string, uid int, gid int) (err error) |
| 423 |
//sys Chroot(path string) (err error) |
| 424 |
//sys Close(fd int) (err error) |
| 425 |
//sys Dup(fd int) (nfd int, err error) |
| 426 |
//sys Dup2(from int, to int) (err error) |
| 427 |
//sys Exchangedata(path1 string, path2 string, options int) (err error) |
| 428 |
//sys Exit(code int) |
| 429 |
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) |
| 430 |
//sys Fchdir(fd int) (err error) |
| 431 |
//sys Fchflags(fd int, flags int) (err error) |
| 432 |
//sys Fchmod(fd int, mode uint32) (err error) |
| 433 |
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) |
| 434 |
//sys Fchown(fd int, uid int, gid int) (err error) |
| 435 |
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) |
| 436 |
//sys Flock(fd int, how int) (err error) |
| 437 |
//sys Fpathconf(fd int, name int) (val int, err error) |
| 438 |
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 |
| 439 |
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 |
| 440 |
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 |
| 441 |
//sys Fsync(fd int) (err error) |
| 442 |
//sys Ftruncate(fd int, length int64) (err error) |
| 443 |
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 |
| 444 |
//sys Getdtablesize() (size int) |
| 445 |
//sysnb Getegid() (egid int) |
| 446 |
//sysnb Geteuid() (uid int) |
| 447 |
//sysnb Getgid() (gid int) |
| 448 |
//sysnb Getpgid(pid int) (pgid int, err error) |
| 449 |
//sysnb Getpgrp() (pgrp int) |
| 450 |
//sysnb Getpid() (pid int) |
| 451 |
//sysnb Getppid() (ppid int) |
| 452 |
//sys Getpriority(which int, who int) (prio int, err error) |
| 453 |
//sysnb Getrlimit(which int, lim *Rlimit) (err error) |
| 454 |
//sysnb Getrusage(who int, rusage *Rusage) (err error) |
| 455 |
//sysnb Getsid(pid int) (sid int, err error) |
| 456 |
//sysnb Getuid() (uid int) |
| 457 |
//sysnb Issetugid() (tainted bool) |
| 458 |
//sys Kqueue() (fd int, err error) |
| 459 |
//sys Lchown(path string, uid int, gid int) (err error) |
| 460 |
//sys Link(path string, link string) (err error) |
| 461 |
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) |
| 462 |
//sys Listen(s int, backlog int) (err error) |
| 463 |
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 |
| 464 |
//sys Mkdir(path string, mode uint32) (err error) |
| 465 |
//sys Mkdirat(dirfd int, path string, mode uint32) (err error) |
| 466 |
//sys Mkfifo(path string, mode uint32) (err error) |
| 467 |
//sys Mknod(path string, mode uint32, dev int) (err error) |
| 468 |
//sys Open(path string, mode int, perm uint32) (fd int, err error) |
| 469 |
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) |
| 470 |
//sys Pathconf(path string, name int) (val int, err error) |
| 471 |
//sys Pread(fd int, p []byte, offset int64) (n int, err error) |
| 472 |
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) |
| 473 |
//sys read(fd int, p []byte) (n int, err error) |
| 474 |
//sys Readlink(path string, buf []byte) (n int, err error) |
| 475 |
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error) |
| 476 |
//sys Rename(from string, to string) (err error) |
| 477 |
//sys Renameat(fromfd int, from string, tofd int, to string) (err error) |
| 478 |
//sys Revoke(path string) (err error) |
| 479 |
//sys Rmdir(path string) (err error) |
| 480 |
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK |
| 481 |
//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) |
| 482 |
//sys Setegid(egid int) (err error) |
| 483 |
//sysnb Seteuid(euid int) (err error) |
| 484 |
//sysnb Setgid(gid int) (err error) |
| 485 |
//sys Setlogin(name string) (err error) |
| 486 |
//sysnb Setpgid(pid int, pgid int) (err error) |
| 487 |
//sys Setpriority(which int, who int, prio int) (err error) |
| 488 |
//sys Setprivexec(flag int) (err error) |
| 489 |
//sysnb Setregid(rgid int, egid int) (err error) |
| 490 |
//sysnb Setreuid(ruid int, euid int) (err error) |
| 491 |
//sysnb Setrlimit(which int, lim *Rlimit) (err error) |
| 492 |
//sysnb Setsid() (pid int, err error) |
| 493 |
//sysnb Settimeofday(tp *Timeval) (err error) |
| 494 |
//sysnb Setuid(uid int) (err error) |
| 495 |
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 |
| 496 |
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 |
| 497 |
//sys Symlink(path string, link string) (err error) |
| 498 |
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error) |
| 499 |
//sys Sync() (err error) |
| 500 |
//sys Truncate(path string, length int64) (err error) |
| 501 |
//sys Umask(newmask int) (oldmask int) |
| 502 |
//sys Undelete(path string) (err error) |
| 503 |
//sys Unlink(path string) (err error) |
| 504 |
//sys Unlinkat(dirfd int, path string, flags int) (err error) |
| 505 |
//sys Unmount(path string, flags int) (err error) |
| 506 |
//sys write(fd int, p []byte) (n int, err error) |
| 507 |
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) |
| 508 |
//sys munmap(addr uintptr, length uintptr) (err error) |
| 509 |
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ |
| 510 |
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE |
| 511 |
|
| 512 |
/* |
| 513 |
* Unimplemented |
| 514 |
*/ |
| 515 |
// Profil |
| 516 |
// Sigaction |
| 517 |
// Sigprocmask |
| 518 |
// Getlogin |
| 519 |
// Sigpending |
| 520 |
// Sigaltstack |
| 521 |
// Ioctl |
| 522 |
// Reboot |
| 523 |
// Execve |
| 524 |
// Vfork |
| 525 |
// Sbrk |
| 526 |
// Sstk |
| 527 |
// Ovadvise |
| 528 |
// Mincore |
| 529 |
// Setitimer |
| 530 |
// Swapon |
| 531 |
// Select |
| 532 |
// Sigsuspend |
| 533 |
// Readv |
| 534 |
// Writev |
| 535 |
// Nfssvc |
| 536 |
// Getfh |
| 537 |
// Quotactl |
| 538 |
// Mount |
| 539 |
// Csops |
| 540 |
// Waitid |
| 541 |
// Add_profil |
| 542 |
// Kdebug_trace |
| 543 |
// Sigreturn |
| 544 |
// Atsocket |
| 545 |
// Kqueue_from_portset_np |
| 546 |
// Kqueue_portset |
| 547 |
// Getattrlist |
| 548 |
// Setattrlist |
| 549 |
// Getdirentriesattr |
| 550 |
// Searchfs |
| 551 |
// Delete |
| 552 |
// Copyfile |
| 553 |
// Watchevent |
| 554 |
// Waitevent |
| 555 |
// Modwatch |
| 556 |
// Fsctl |
| 557 |
// Initgroups |
| 558 |
// Posix_spawn |
| 559 |
// Nfsclnt |
| 560 |
// Fhopen |
| 561 |
// Minherit |
| 562 |
// Semsys |
| 563 |
// Msgsys |
| 564 |
// Shmsys |
| 565 |
// Semctl |
| 566 |
// Semget |
| 567 |
// Semop |
| 568 |
// Msgctl |
| 569 |
// Msgget |
| 570 |
// Msgsnd |
| 571 |
// Msgrcv |
| 572 |
// Shmat |
| 573 |
// Shmctl |
| 574 |
// Shmdt |
| 575 |
// Shmget |
| 576 |
// Shm_open |
| 577 |
// Shm_unlink |
| 578 |
// Sem_open |
| 579 |
// Sem_close |
| 580 |
// Sem_unlink |
| 581 |
// Sem_wait |
| 582 |
// Sem_trywait |
| 583 |
// Sem_post |
| 584 |
// Sem_getvalue |
| 585 |
// Sem_init |
| 586 |
// Sem_destroy |
| 587 |
// Open_extended |
| 588 |
// Umask_extended |
| 589 |
// Stat_extended |
| 590 |
// Lstat_extended |
| 591 |
// Fstat_extended |
| 592 |
// Chmod_extended |
| 593 |
// Fchmod_extended |
| 594 |
// Access_extended |
| 595 |
// Settid |
| 596 |
// Gettid |
| 597 |
// Setsgroups |
| 598 |
// Getsgroups |
| 599 |
// Setwgroups |
| 600 |
// Getwgroups |
| 601 |
// Mkfifo_extended |
| 602 |
// Mkdir_extended |
| 603 |
// Identitysvc |
| 604 |
// Shared_region_check_np |
| 605 |
// Shared_region_map_np |
| 606 |
// __pthread_mutex_destroy |
| 607 |
// __pthread_mutex_init |
| 608 |
// __pthread_mutex_lock |
| 609 |
// __pthread_mutex_trylock |
| 610 |
// __pthread_mutex_unlock |
| 611 |
// __pthread_cond_init |
| 612 |
// __pthread_cond_destroy |
| 613 |
// __pthread_cond_broadcast |
| 614 |
// __pthread_cond_signal |
| 615 |
// Setsid_with_pid |
| 616 |
// __pthread_cond_timedwait |
| 617 |
// Aio_fsync |
| 618 |
// Aio_return |
| 619 |
// Aio_suspend |
| 620 |
// Aio_cancel |
| 621 |
// Aio_error |
| 622 |
// Aio_read |
| 623 |
// Aio_write |
| 624 |
// Lio_listio |
| 625 |
// __pthread_cond_wait |
| 626 |
// Iopolicysys |
| 627 |
// __pthread_kill |
| 628 |
// __pthread_sigmask |
| 629 |
// __sigwait |
| 630 |
// __disable_threadsignal |
| 631 |
// __pthread_markcancel |
| 632 |
// __pthread_canceled |
| 633 |
// __semwait_signal |
| 634 |
// Proc_info |
| 635 |
// sendfile |
| 636 |
// Stat64_extended |
| 637 |
// Lstat64_extended |
| 638 |
// Fstat64_extended |
| 639 |
// __pthread_chdir |
| 640 |
// __pthread_fchdir |
| 641 |
// Audit |
| 642 |
// Auditon |
| 643 |
// Getauid |
| 644 |
// Setauid |
| 645 |
// Getaudit |
| 646 |
// Setaudit |
| 647 |
// Getaudit_addr |
| 648 |
// Setaudit_addr |
| 649 |
// Auditctl |
| 650 |
// Bsdthread_create |
| 651 |
// Bsdthread_terminate |
| 652 |
// Stack_snapshot |
| 653 |
// Bsdthread_register |
| 654 |
// Workq_open |
| 655 |
// Workq_ops |
| 656 |
// __mac_execve |
| 657 |
// __mac_syscall |
| 658 |
// __mac_get_file |
| 659 |
// __mac_set_file |
| 660 |
// __mac_get_link |
| 661 |
// __mac_set_link |
| 662 |
// __mac_get_proc |
| 663 |
// __mac_set_proc |
| 664 |
// __mac_get_fd |
| 665 |
// __mac_set_fd |
| 666 |
// __mac_get_pid |
| 667 |
// __mac_get_lcid |
| 668 |
// __mac_get_lctx |
| 669 |
// __mac_set_lctx |
| 670 |
// Setlcid |
| 671 |
// Read_nocancel |
| 672 |
// Write_nocancel |
| 673 |
// Open_nocancel |
| 674 |
// Close_nocancel |
| 675 |
// Wait4_nocancel |
| 676 |
// Recvmsg_nocancel |
| 677 |
// Sendmsg_nocancel |
| 678 |
// Recvfrom_nocancel |
| 679 |
// Accept_nocancel |
| 680 |
// Fcntl_nocancel |
| 681 |
// Select_nocancel |
| 682 |
// Fsync_nocancel |
| 683 |
// Connect_nocancel |
| 684 |
// Sigsuspend_nocancel |
| 685 |
// Readv_nocancel |
| 686 |
// Writev_nocancel |
| 687 |
// Sendto_nocancel |
| 688 |
// Pread_nocancel |
| 689 |
// Pwrite_nocancel |
| 690 |
// Waitid_nocancel |
| 691 |
// Poll_nocancel |
| 692 |
// Msgsnd_nocancel |
| 693 |
// Msgrcv_nocancel |
| 694 |
// Sem_wait_nocancel |
| 695 |
// Aio_suspend_nocancel |
| 696 |
// __sigwait_nocancel |
| 697 |
// __semwait_signal_nocancel |
| 698 |
// __mac_mount |
| 699 |
// __mac_get_mount |
| 700 |
// __mac_getfsstat |