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