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