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