blob: 2635885582e23f086fcc8749e9bd760a76141c8f [file] [log] [blame]
Giles Leanad73de22010-03-26 13:23:54 -07001// Copyright 2009,2010 The Go Authors. All rights reserved.
Russ Cox602a4462009-06-01 22:14:57 -07002// 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.
Giles Leanad73de22010-03-26 13:23:54 -07009// 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.
Russ Cox602a4462009-06-01 22:14:57 -070012
13package syscall
14
Russ Cox602a4462009-06-01 22:14:57 -070015const OS = "darwin"
16
17/*
Russ Cox602a4462009-06-01 22:14:57 -070018 * Wrapped
19 */
20
Russ Coxf2317d32010-02-04 02:06:08 -080021//sys kill(pid int, signum int, posix int) (errno int)
22
23func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) }
24
Russ Cox602a4462009-06-01 22:14:57 -070025/*
26 * Exposed directly
27 */
28//sys Access(path string, flags int) (errno int)
29//sys Adjtime(delta *Timeval, olddelta *Timeval) (errno int)
30//sys Chdir(path string) (errno int)
31//sys Chflags(path string, flags int) (errno int)
32//sys Chmod(path string, mode int) (errno int)
33//sys Chown(path string, uid int, gid int) (errno int)
34//sys Chroot(path string) (errno int)
35//sys Close(fd int) (errno int)
36//sys Dup(fd int) (nfd int, errno int)
37//sys Dup2(from int, to int) (errno int)
38//sys Exchangedata(path1 string, path2 string, options int) (errno int)
39//sys Exit(code int)
40//sys Fchdir(fd int) (errno int)
41//sys Fchflags(path string, flags int) (errno int)
42//sys Fchmod(fd int, mode int) (errno int)
43//sys Fchown(fd int, uid int, gid int) (errno int)
44//sys Flock(fd int, how int) (errno int)
45//sys Fpathconf(fd int, name int) (val int, errno int)
46//sys Fstat(fd int, stat *Stat_t) (errno int) = SYS_FSTAT64
47//sys Fstatfs(fd int, stat *Statfs_t) (errno int) = SYS_FSTATFS64
48//sys Fsync(fd int) (errno int)
49//sys Ftruncate(fd int, length int64) (errno int)
50//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, errno int) = SYS_GETDIRENTRIES64
51//sys Getdtablesize() (size int)
52//sys Getegid() (egid int)
53//sys Geteuid() (uid int)
54//sys Getfsstat(buf []Statfs_t, flags int) (n int, errno int) = SYS_GETFSSTAT64
55//sys Getgid() (gid int)
56//sys Getpgid(pid int) (pgid int, errno int)
57//sys Getpgrp() (pgrp int)
58//sys Getpid() (pid int)
59//sys Getppid() (ppid int)
60//sys Getpriority(which int, who int) (prio int, errno int)
61//sys Getrlimit(which int, lim *Rlimit) (errno int)
62//sys Getrusage(who int, rusage *Rusage) (errno int)
63//sys Getsid(pid int) (sid int, errno int)
64//sys Getuid() (uid int)
65//sys Issetugid() (tainted bool)
Russ Cox602a4462009-06-01 22:14:57 -070066//sys Kqueue() (fd int, errno int)
67//sys Lchown(path string, uid int, gid int) (errno int)
68//sys Link(path string, link string) (errno int)
69//sys Listen(s int, backlog int) (errno int)
70//sys Lstat(path string, stat *Stat_t) (errno int) = SYS_LSTAT64
71//sys Mkdir(path string, mode int) (errno int)
72//sys Mkfifo(path string, mode int) (errno int)
73//sys Mknod(path string, mode int, dev int) (errno int)
74//sys Open(path string, mode int, perm int) (fd int, errno int)
75//sys Pathconf(path string, name int) (val int, errno int)
76//sys Pread(fd int, p []byte, offset int64) (n int, errno int)
77//sys Pwrite(fd int, p []byte, offset int64) (n int, errno int)
78//sys Read(fd int, p []byte) (n int, errno int)
79//sys Readlink(path string, buf []byte) (n int, errno int)
80//sys Rename(from string, to string) (errno int)
81//sys Revoke(path string) (errno int)
82//sys Rmdir(path string) (errno int)
Russ Cox76c87d52009-06-16 17:17:02 -070083//sys Seek(fd int, offset int64, whence int) (newoffset int64, errno int) = SYS_LSEEK
Russ Cox602a4462009-06-01 22:14:57 -070084//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (errno int)
85//sys Setegid(egid int) (errno int)
86//sys Seteuid(euid int) (errno int)
87//sys Setgid(gid int) (errno int)
88//sys Setlogin(name string) (errno int)
89//sys Setpgid(pid int, pgid int) (errno int)
90//sys Setpriority(which int, who int, prio int) (errno int)
91//sys Setprivexec(flag int) (errno int)
92//sys Setregid(rgid int, egid int) (errno int)
93//sys Setreuid(ruid int, euid int) (errno int)
94//sys Setrlimit(which int, lim *Rlimit) (errno int)
95//sys Setsid() (pid int, errno int)
96//sys Settimeofday(tp *Timeval) (errno int)
97//sys Setuid(uid int) (errno int)
98//sys Stat(path string, stat *Stat_t) (errno int) = SYS_STAT64
99//sys Statfs(path string, stat *Statfs_t) (errno int) = SYS_STATFS64
100//sys Symlink(path string, link string) (errno int)
101//sys Sync() (errno int)
102//sys Truncate(path string, length int64) (errno int)
Giles Lean5aa3a8d2010-02-16 11:43:25 -0800103//sys Umask(newmask int) (oldmask int)
Russ Cox602a4462009-06-01 22:14:57 -0700104//sys Undelete(path string) (errno int)
105//sys Unlink(path string) (errno int)
106//sys Unmount(path string, flags int) (errno int)
107//sys Write(fd int, p []byte) (n int, errno int)
108//sys read(fd int, buf *byte, nbuf int) (n int, errno int)
109//sys write(fd int, buf *byte, nbuf int) (n int, errno int)
110
111
112/*
113 * Unimplemented
114 */
115// Profil
116// Sigaction
117// Sigprocmask
118// Getlogin
119// Sigpending
120// Sigaltstack
121// Ioctl
122// Reboot
123// Execve
124// Vfork
125// Sbrk
126// Sstk
127// Ovadvise
128// Mincore
129// Setitimer
130// Swapon
131// Select
132// Sigsuspend
133// Readv
134// Writev
135// Nfssvc
136// Getfh
137// Quotactl
138// Mount
139// Csops
140// Waitid
141// Add_profil
142// Kdebug_trace
143// Sigreturn
144// Mmap
Russ Cox602a4462009-06-01 22:14:57 -0700145// Mlock
146// Munlock
147// Atsocket
148// Kqueue_from_portset_np
149// Kqueue_portset
150// Getattrlist
151// Setattrlist
152// Getdirentriesattr
153// Searchfs
154// Delete
155// Copyfile
156// Poll
157// Watchevent
158// Waitevent
159// Modwatch
160// Getxattr
161// Fgetxattr
162// Setxattr
163// Fsetxattr
164// Removexattr
165// Fremovexattr
166// Listxattr
167// Flistxattr
168// Fsctl
169// Initgroups
170// Posix_spawn
171// Nfsclnt
172// Fhopen
173// Minherit
174// Semsys
175// Msgsys
176// Shmsys
177// Semctl
178// Semget
179// Semop
180// Msgctl
181// Msgget
182// Msgsnd
183// Msgrcv
184// Shmat
185// Shmctl
186// Shmdt
187// Shmget
188// Shm_open
189// Shm_unlink
190// Sem_open
191// Sem_close
192// Sem_unlink
193// Sem_wait
194// Sem_trywait
195// Sem_post
196// Sem_getvalue
197// Sem_init
198// Sem_destroy
199// Open_extended
200// Umask_extended
201// Stat_extended
202// Lstat_extended
203// Fstat_extended
204// Chmod_extended
205// Fchmod_extended
206// Access_extended
207// Settid
208// Gettid
209// Setsgroups
210// Getsgroups
211// Setwgroups
212// Getwgroups
213// Mkfifo_extended
214// Mkdir_extended
215// Identitysvc
216// Shared_region_check_np
217// Shared_region_map_np
218// __pthread_mutex_destroy
219// __pthread_mutex_init
220// __pthread_mutex_lock
221// __pthread_mutex_trylock
222// __pthread_mutex_unlock
223// __pthread_cond_init
224// __pthread_cond_destroy
225// __pthread_cond_broadcast
226// __pthread_cond_signal
227// Setsid_with_pid
228// __pthread_cond_timedwait
229// Aio_fsync
230// Aio_return
231// Aio_suspend
232// Aio_cancel
233// Aio_error
234// Aio_read
235// Aio_write
236// Lio_listio
237// __pthread_cond_wait
238// Iopolicysys
239// Mlockall
240// Munlockall
241// __pthread_kill
242// __pthread_sigmask
243// __sigwait
244// __disable_threadsignal
245// __pthread_markcancel
246// __pthread_canceled
247// __semwait_signal
248// Proc_info
249// Sendfile
250// Stat64_extended
251// Lstat64_extended
252// Fstat64_extended
253// __pthread_chdir
254// __pthread_fchdir
255// Audit
256// Auditon
257// Getauid
258// Setauid
259// Getaudit
260// Setaudit
261// Getaudit_addr
262// Setaudit_addr
263// Auditctl
264// Bsdthread_create
265// Bsdthread_terminate
266// Stack_snapshot
267// Bsdthread_register
268// Workq_open
269// Workq_ops
270// __mac_execve
271// __mac_syscall
272// __mac_get_file
273// __mac_set_file
274// __mac_get_link
275// __mac_set_link
276// __mac_get_proc
277// __mac_set_proc
278// __mac_get_fd
279// __mac_set_fd
280// __mac_get_pid
281// __mac_get_lcid
282// __mac_get_lctx
283// __mac_set_lctx
284// Setlcid
285// Read_nocancel
286// Write_nocancel
287// Open_nocancel
288// Close_nocancel
289// Wait4_nocancel
290// Recvmsg_nocancel
291// Sendmsg_nocancel
292// Recvfrom_nocancel
293// Accept_nocancel
294// Msync_nocancel
295// Fcntl_nocancel
296// Select_nocancel
297// Fsync_nocancel
298// Connect_nocancel
299// Sigsuspend_nocancel
300// Readv_nocancel
301// Writev_nocancel
302// Sendto_nocancel
303// Pread_nocancel
304// Pwrite_nocancel
305// Waitid_nocancel
306// Poll_nocancel
307// Msgsnd_nocancel
308// Msgrcv_nocancel
309// Sem_wait_nocancel
310// Aio_suspend_nocancel
311// __sigwait_nocancel
312// __semwait_signal_nocancel
313// __mac_mount
314// __mac_get_mount
315// __mac_getfsstat