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