xref: /titanic_52/usr/src/uts/common/sys/syscall.h (revision 06e46062ef4f5f4b687cbafb4518fb123fe23920)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 
31 #ifndef	_SYS_SYSCALL_H
32 #define	_SYS_SYSCALL_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  *	system call numbers
42  *		syscall(SYS_xxxx, ...)
43  */
44 
45 	/* syscall enumeration MUST begin with 1 */
46 
47 	/*
48 	 * SunOS/SPARC uses 0 for the indirect system call SYS_syscall
49 	 * but this doesn't count because it is just another way
50 	 * to specify the real system call number.
51 	 */
52 
53 #define	SYS_syscall	0
54 #define	SYS_exit	1
55 #define	SYS_forkall	2
56 #define	SYS_fork	SYS_forkall	/* historical */
57 #define	SYS_read	3
58 #define	SYS_write	4
59 #define	SYS_open	5
60 #define	SYS_close	6
61 #define	SYS_wait	7
62 #define	SYS_creat	8
63 #define	SYS_link	9
64 #define	SYS_unlink	10
65 #define	SYS_exec	11
66 #define	SYS_chdir	12
67 #define	SYS_time	13
68 #define	SYS_mknod	14
69 #define	SYS_chmod	15
70 #define	SYS_chown	16
71 #define	SYS_brk		17
72 #define	SYS_stat	18
73 #define	SYS_lseek	19
74 #define	SYS_getpid	20
75 #define	SYS_mount	21
76 #define	SYS_umount	22
77 #define	SYS_setuid	23
78 #define	SYS_getuid	24
79 #define	SYS_stime	25
80 #define	SYS_pcsample	26
81 #define	SYS_alarm	27
82 #define	SYS_fstat	28
83 #define	SYS_pause	29
84 #define	SYS_utime	30
85 #define	SYS_stty	31
86 #define	SYS_gtty	32
87 #define	SYS_access	33
88 #define	SYS_nice	34
89 #define	SYS_statfs	35
90 #define	SYS_sync	36
91 #define	SYS_kill	37
92 #define	SYS_fstatfs	38
93 #define	SYS_pgrpsys	39
94 	/*
95 	 * subcodes:
96 	 *	getpgrp()	  :: syscall(39,0)
97 	 *	setpgrp()	  :: syscall(39,1)
98 	 *	getsid(pid)	  :: syscall(39,2,pid)
99 	 *	setsid()	  :: syscall(39,3)
100 	 *	getpgid(pid)	  :: syscall(39,4,pid)
101 	 *	setpgid(pid,pgid) :: syscall(39,5,pid,pgid)
102 	 */
103 #define	SYS_reserved_40	40	/* 40 not used, was xenix */
104 #define	SYS_dup		41
105 #define	SYS_pipe	42
106 #define	SYS_times	43
107 #define	SYS_profil	44
108 #define	SYS_plock	45
109 #define	SYS_setgid	46
110 #define	SYS_getgid	47
111 #define	SYS_signal	48
112 	/*
113 	 * subcodes:
114 	 *	signal(sig, f) :: signal(sig, f)    ((sig&SIGNO_MASK) == sig)
115 	 *	sigset(sig, f) :: signal(sig|SIGDEFER, f)
116 	 *	sighold(sig)   :: signal(sig|SIGHOLD)
117 	 *	sigrelse(sig)  :: signal(sig|SIGRELSE)
118 	 *	sigignore(sig) :: signal(sig|SIGIGNORE)
119 	 *	sigpause(sig)  :: signal(sig|SIGPAUSE)
120 	 *	see <sys/signal.h>
121 	 */
122 #define	SYS_msgsys	49
123 	/*
124 	 * subcodes:
125 	 *	msgget(...)  :: msgsys(0, ...)
126 	 *	msgctl(...)  :: msgsys(1, ...)
127 	 *	msgrcv(...)  :: msgsys(2, ...)
128 	 *	msgsnd(...)  :: msgsys(3, ...)
129 	 *	msgids(...)  :: msgsys(4, ...)
130 	 *	msgsnap(...) :: msgsys(5, ...)
131 	 *	see <sys/msg.h>
132 	 */
133 #define	SYS_syssun	50
134 #define	SYS_sysi86	50
135 	/*
136 	 * subcodes:
137 	 *	syssun(code, ...)
138 	 *	see <sys/sys3b.h>
139 	 */
140 #define	SYS_acct	51
141 #define	SYS_shmsys	52
142 	/*
143 	 * subcodes:
144 	 *	shmat (...) :: shmsys(0, ...)
145 	 *	shmctl(...) :: shmsys(1, ...)
146 	 *	shmdt (...) :: shmsys(2, ...)
147 	 *	shmget(...) :: shmsys(3, ...)
148 	 *	shmids(...) :: shmsys(4, ...)
149 	 *	see <sys/shm.h>
150 	 */
151 #define	SYS_semsys	53
152 	/*
153 	 * subcodes:
154 	 *	semctl(...) :: semsys(0, ...)
155 	 *	semget(...) :: semsys(1, ...)
156 	 *	semop (...) :: semsys(2, ...)
157 	 *	semids(...) :: semsys(3, ...)
158 	 *	semtimedop(...) :: semsys(4, ...)
159 	 *	see <sys/sem.h>
160 	 */
161 #define	SYS_ioctl	54
162 #define	SYS_uadmin	55
163 #define	SYS_utssys	57
164 	/*
165 	 * subcodes (third argument):
166 	 *	uname(obuf)  (obsolete)   :: syscall(57, obuf, ign, 0)
167 	 *					subcode 1 unused
168 	 *	ustat(dev, obuf)	  :: syscall(57, obuf, dev, 2)
169 	 *	fusers(path, flags, obuf) :: syscall(57, path, flags, 3, obuf)
170 	 *	see <sys/utssys.h>
171 	 */
172 #define	SYS_fdsync	58
173 #define	SYS_execve	59
174 #define	SYS_umask	60
175 #define	SYS_chroot	61
176 #define	SYS_fcntl	62
177 #define	SYS_ulimit	63
178 #define	SYS_reserved_64	64	/* 64 reserved */
179 #define	SYS_reserved_65	65	/* 65 reserved */
180 #define	SYS_reserved_66	66	/* 66 reserved */
181 #define	SYS_reserved_67	67	/* 67 reserved */
182 #define	SYS_reserved_68	68	/* 68 reserved */
183 #define	SYS_reserved_69	69	/* 69 reserved */
184 #define	SYS_tasksys	70
185 	/*
186 	 * subcodes:
187 	 * 	settaskid(...) :: tasksys(0, ...)
188 	 * 	gettaskid(...) :: tasksys(1, ...)
189 	 * 	getprojid(...) :: tasksys(2, ...)
190 	 */
191 #define	SYS_acctctl	71
192 #define	SYS_exacctsys	72
193 	/*
194 	 * subcodes:
195 	 * 	getacct(...) :: exacct(0, ...)
196 	 * 	putacct(...) :: exacct(1, ...)
197 	 * 	wracct(...) :: exacct(2, ...)
198 	 */
199 #define	SYS_getpagesizes	73
200 #define	SYS_rctlsys	74
201 	/*
202 	 * subcodes:
203 	 * 	getrctl(...) :: rctlsys(0, ...)
204 	 * 	setrctl(...) :: rctlsys(1, ...)
205 	 * 	rctllist(...) :: rctlsys(2, ...)
206 	 * 	rctlctl(...) :: rctlsys(3, ...)
207 	 */
208 #define	SYS_issetugid	75
209 #define	SYS_fsat	76
210 	/*
211 	 * subcodes:
212 	 *	openat(...)	:: fsat(0, ...)
213 	 *	openat64(...)	:: fsat(1, ...)
214 	 *	fstatat64(...)	:: fsat(2, ...)
215 	 *	fstatat(...)	:: fsat(3, ...)
216 	 *	renameat(...)	:: fsat(4, ...)
217 	 *	fchownat(...)	:: fsat(5, ...)
218 	 *	unlinkat(...)	:: fsat(6, ...)
219 	 *	futimesat(...)	:: fsat(7, ...)
220 	 */
221 #define	SYS_lwp_park	77
222 	/*
223 	 * subcodes:
224 	 * 	_lwp_park(timespec_t *, lwpid_t) :: syslwp_park(0, ...)
225 	 * 	_lwp_unpark(lwpid_t, int)	 :: syslwp_park(1, ...)
226 	 * 	_lwp_unpark_all(lwpid_t *, int)  :: syslwp_park(2, ...)
227 	 */
228 #define	SYS_sendfilev	78
229 	/*
230 	 * subcodes :
231 	 * 	sendfilev()   :: sendfilev(0, ...)
232 	 * 	sendfilev64() :: sendfilev(1, ...)
233 	 */
234 #define	SYS_rmdir	79
235 #define	SYS_mkdir	80
236 #define	SYS_getdents	81
237 #define	SYS_privsys	82
238 	/*
239 	 * subcodes:
240 	 * 	setppriv(...)		:: privsys(0, ...)
241 	 * 	getppriv(...)		:: privsys(1, ...)
242 	 * 	getimplinfo(...)	:: privsys(2, ...)
243 	 * 	setpflags(...) 		:: privsys(3, ...)
244 	 * 	getpflags(...) 		:: privsys(4, ...)
245 	 */
246 #define	SYS_ucredsys	83
247 	/*
248 	 * subcodes:
249 	 *	ucred_get(...)		:: ucredsys(0, ...)
250 	 *	getpeerucred(...)	:: ucredsys(1, ...)
251 	 */
252 #define	SYS_sysfs	84
253 	/*
254 	 * subcodes:
255 	 *	sysfs(code, ...)
256 	 *	see <sys/fstyp.h>
257 	 */
258 #define	SYS_getmsg	85
259 #define	SYS_putmsg	86
260 #define	SYS_poll	87
261 
262 #define	SYS_lstat	88
263 #define	SYS_symlink	89
264 #define	SYS_readlink	90
265 #define	SYS_setgroups	91
266 #define	SYS_getgroups	92
267 #define	SYS_fchmod	93
268 #define	SYS_fchown	94
269 #define	SYS_sigprocmask	95
270 #define	SYS_sigsuspend	96
271 #define	SYS_sigaltstack	97
272 #define	SYS_sigaction	98
273 #define	SYS_sigpending	99
274 	/*
275 	 * subcodes:
276 	 *			subcode 0 unused
277 	 *	sigpending(...) :: syscall(99, 1, ...)
278 	 *	sigfillset(...) :: syscall(99, 2, ...)
279 	 */
280 #define	SYS_context	100
281 	/*
282 	 * subcodes:
283 	 *	getcontext(...) :: syscall(100, 0, ...)
284 	 *	setcontext(...) :: syscall(100, 1, ...)
285 	 */
286 #define	SYS_evsys	101
287 #define	SYS_evtrapret	102
288 #define	SYS_statvfs	103
289 #define	SYS_fstatvfs	104
290 #define	SYS_getloadavg	105
291 #define	SYS_nfssys	106
292 #define	SYS_waitsys	107
293 #define	SYS_sigsendsys	108
294 #define	SYS_hrtsys	109
295 #define	SYS_acancel	110
296 #define	SYS_async	111
297 #define	SYS_priocntlsys	112
298 #define	SYS_pathconf	113
299 #define	SYS_mincore	114
300 #define	SYS_mmap	115
301 #define	SYS_mprotect	116
302 #define	SYS_munmap	117
303 #define	SYS_fpathconf	118
304 #define	SYS_vfork	119
305 #define	SYS_fchdir	120
306 #define	SYS_readv	121
307 #define	SYS_writev	122
308 #define	SYS_xstat	123
309 #define	SYS_lxstat	124
310 #define	SYS_fxstat	125
311 #define	SYS_xmknod	126
312 #define	SYS_setrlimit	128
313 #define	SYS_getrlimit	129
314 #define	SYS_lchown	130
315 #define	SYS_memcntl	131
316 #define	SYS_getpmsg	132
317 #define	SYS_putpmsg	133
318 #define	SYS_rename	134
319 #define	SYS_uname	135
320 #define	SYS_setegid	136
321 #define	SYS_sysconfig	137
322 #define	SYS_adjtime	138
323 #define	SYS_systeminfo	139
324 #define	SYS_seteuid	141
325 #define	SYS_fork1	143
326 #define	SYS_sigtimedwait	144
327 #define	SYS_lwp_info	145
328 #define	SYS_yield	146
329 #define	SYS_lwp_sema_wait	147
330 #define	SYS_lwp_sema_post	148
331 #define	SYS_lwp_sema_trywait	149
332 #define	SYS_lwp_detach	150
333 #define	SYS_corectl	151
334 #define	SYS_modctl	152
335 #define	SYS_fchroot	153
336 #define	SYS_utimes	154
337 #define	SYS_vhangup	155
338 #define	SYS_gettimeofday	156
339 #define	SYS_getitimer		157
340 #define	SYS_setitimer		158
341 #define	SYS_lwp_create		159
342 #define	SYS_lwp_exit		160
343 #define	SYS_lwp_suspend		161
344 #define	SYS_lwp_continue	162
345 #define	SYS_lwp_kill		163
346 #define	SYS_lwp_self		164
347 #define	SYS_lwp_sigmask		165
348 #define	SYS_lwp_private		166
349 #define	SYS_lwp_wait		167
350 #define	SYS_lwp_mutex_wakeup	168
351 #define	SYS_lwp_mutex_lock	169
352 #define	SYS_lwp_cond_wait	170
353 #define	SYS_lwp_cond_signal	171
354 #define	SYS_lwp_cond_broadcast	172
355 #define	SYS_pread		173
356 #define	SYS_pwrite		174
357 #define	SYS_llseek		175
358 #define	SYS_inst_sync		176
359 #define	SYS_reserved_177	177	/* 177 reserved */
360 #define	SYS_kaio		178
361 	/*
362 	 * subcodes:
363 	 *	aioread(...)	:: kaio(AIOREAD, ...)
364 	 *	aiowrite(...)	:: kaio(AIOWRITE, ...)
365 	 *	aiowait(...)	:: kaio(AIOWAIT, ...)
366 	 *	aiocancel(...)	:: kaio(AIOCANCEL, ...)
367 	 *	aionotify()	:: kaio(AIONOTIFY)
368 	 *	aioinit()	:: kaio(AIOINIT)
369 	 *	aiostart()	:: kaio(AIOSTART)
370 	 *	see <sys/aio.h>
371 	 */
372 #define	SYS_cpc			179
373 #define	SYS_lgrpsys		180
374 #define	SYS_meminfosys		SYS_lgrpsys
375 	/*
376 	 * subcodes:
377 	 * 	meminfo(...) :: meminfosys(MISYS_MEMINFO, ...)
378 	 */
379 #define	SYS_rusagesys		181
380 	/*
381 	 * subcodes:
382 	 *	getrusage(...) :: rusagesys(RUSAGESYS_GETRUSAGE,...)
383 	 */
384 #define	SYS_port		182
385 	/*
386 	 * subcodes:
387 	 *	port_create(...) :: portfs(PORT_CREATE, ...)
388 	 *	port_associate(...) :: portfs(PORT_ASSOCIATE, ...)
389 	 *	port_dissociate(...) :: portfs(PORT_DISSOCIATE, ...)
390 	 *	port_send(...) :: portfs(PORT_SEND, ...)
391 	 *	port_sendn(...) :: portfs(PORT_SENDN, ...)
392 	 *	port_get(...) :: portfs(PORT_GET, ...)
393 	 *	port_getn(...) :: portfs(PORT_GETN, ...)
394 	 *	port_alert(...) :: portfs(PORT_ALERT, ...)
395 	 *	port_dispatch(...) :: portfs(PORT_DISPATCH, ...)
396 	 */
397 #define	SYS_pollsys		183
398 #define	SYS_tsolsys		184
399 #define	SYS_acl			185
400 #define	SYS_auditsys		186
401 #define	SYS_processor_bind	187
402 #define	SYS_processor_info	188
403 #define	SYS_p_online		189
404 #define	SYS_sigqueue		190
405 #define	SYS_clock_gettime	191
406 #define	SYS_clock_settime	192
407 #define	SYS_clock_getres	193
408 #define	SYS_timer_create	194
409 #define	SYS_timer_delete	195
410 #define	SYS_timer_settime	196
411 #define	SYS_timer_gettime	197
412 #define	SYS_timer_getoverrun	198
413 #define	SYS_nanosleep		199
414 #define	SYS_facl		200
415 #define	SYS_door		201
416 	/*
417 	 * Door Subcodes:
418 	 *	0	door_create
419 	 *	1	door_revoke
420 	 *	2	door_info
421 	 *	3	door_call
422 	 *	4	door_return
423 	 */
424 #define	SYS_setreuid		202
425 #define	SYS_setregid		203
426 #define	SYS_install_utrap	204
427 #define	SYS_signotify		205
428 #define	SYS_schedctl		206
429 #define	SYS_pset		207
430 #define	SYS_sparc_utrap_install	208
431 #define	SYS_resolvepath		209
432 #define	SYS_lwp_mutex_timedlock	210
433 #define	SYS_lwp_sema_timedwait	211
434 #define	SYS_lwp_rwlock_sys	212
435 	/*
436 	 * subcodes:
437 	 *	lwp_rwlock_rdlock(...)    :: syscall(212, 0, ...)
438 	 *	lwp_rwlock_wrlock(...)    :: syscall(212, 1, ...)
439 	 *	lwp_rwlock_tryrdlock(...) :: syscall(212, 2, ...)
440 	 *	lwp_rwlock_trywrlock(...) :: syscall(212, 3, ...)
441 	 *	lwp_rwlock_unlock(...)    :: syscall(212, 4, ...)
442 	 */
443 /* system calls for large file ( > 2 gigabyte) support */
444 #define	SYS_getdents64		213
445 #define	SYS_mmap64		214
446 #define	SYS_stat64		215
447 #define	SYS_lstat64		216
448 #define	SYS_fstat64		217
449 #define	SYS_statvfs64		218
450 #define	SYS_fstatvfs64		219
451 #define	SYS_setrlimit64		220
452 #define	SYS_getrlimit64		221
453 #define	SYS_pread64		222
454 #define	SYS_pwrite64		223
455 #define	SYS_creat64		224
456 #define	SYS_open64		225
457 #define	SYS_rpcsys		226
458 #define	SYS_zone		227
459 	/*
460 	 * subcodes:
461 	 *	zone_create(...) :: zone(ZONE_CREATE, ...)
462 	 *	zone_destroy(...) :: zone(ZONE_DESTROY, ...)
463 	 *	zone_getattr(...) :: zone(ZONE_GETATTR, ...)
464 	 *	zone_enter(...) :: zone(ZONE_ENTER, ...)
465 	 *	zone_list(...) :: zone(ZONE_LIST, ...)
466 	 *	zone_shutdown(...) :: zone(ZONE_SHUTDOWN, ...)
467 	 *	zone_lookup(...) :: zone(ZONE_LOOKUP, ...)
468 	 */
469 #define	SYS_autofssys		228
470 #define	SYS_getcwd		229
471 #define	SYS_so_socket		230
472 #define	SYS_so_socketpair	231
473 #define	SYS_bind		232
474 #define	SYS_listen		233
475 #define	SYS_accept		234
476 #define	SYS_connect		235
477 #define	SYS_shutdown		236
478 #define	SYS_recv		237
479 #define	SYS_recvfrom		238
480 #define	SYS_recvmsg		239
481 #define	SYS_send		240
482 #define	SYS_sendmsg		241
483 #define	SYS_sendto		242
484 #define	SYS_getpeername		243
485 #define	SYS_getsockname		244
486 #define	SYS_getsockopt		245
487 #define	SYS_setsockopt		246
488 #define	SYS_sockconfig		247
489 	/*
490 	 * NTP codes
491 	 */
492 #define	SYS_ntp_gettime		248
493 #define	SYS_ntp_adjtime		249
494 #define	SYS_lwp_mutex_unlock	250
495 #define	SYS_lwp_mutex_trylock	251
496 #define	SYS_lwp_mutex_init	252
497 #define	SYS_cladm		253
498 #define	SYS_reserved_254	254	/* 254 reserved */
499 #define	SYS_umount2		255
500 
501 
502 #ifndef	_ASM
503 
504 typedef struct {		/* syscall set type */
505 	unsigned int	word[16];
506 } sysset_t;
507 
508 #if !defined(_KERNEL)
509 
510 typedef struct {	/* return values from system call */
511 	long	sys_rval1;	/* primary return value from system call */
512 	long	sys_rval2;	/* second return value from system call */
513 } sysret_t;
514 
515 #if defined(__STDC__)
516 extern int	syscall(int, ...);
517 extern int	__systemcall(sysret_t *, int, ...);
518 extern int	__set_errno(int);
519 #else
520 extern int	syscall();
521 extern int	__systemcall();
522 extern int	__set_errno();
523 #endif
524 
525 #endif	/* _KERNEL */
526 
527 #endif	/* _ASM */
528 
529 #ifdef	__cplusplus
530 }
531 #endif
532 
533 #endif	/* _SYS_SYSCALL_H */
534