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