1
2/*--------------------------------------------------------------------*/
3/*--- System call numbers for Solaris.        vki-scnums-solaris.h ---*/
4/*--------------------------------------------------------------------*/
5
6/*
7   This file is part of Valgrind, a dynamic binary instrumentation
8   framework.
9
10   Copyright (C) 2011-2015 Petr Pavlu
11      setup@dagobah.cz
12
13   This program is free software; you can redistribute it and/or
14   modify it under the terms of the GNU General Public License as
15   published by the Free Software Foundation; either version 2 of the
16   License, or (at your option) any later version.
17
18   This program is distributed in the hope that it will be useful, but
19   WITHOUT ANY WARRANTY; without even the implied warranty of
20   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21   General Public License for more details.
22
23   You should have received a copy of the GNU General Public License
24   along with this program; if not, write to the Free Software
25   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26   02111-1307, USA.
27
28   The GNU General Public License is contained in the file COPYING.
29*/
30
31/* Copyright 2013-2015, Ivo Raisr <ivosh@ivosh.net>. */
32
33/* Copyright 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
34
35#ifndef __VKI_SCNUMS_SOLARIS_H
36#define __VKI_SCNUMS_SOLARIS_H
37
38/* Note: Basic information about Solaris syscalls can be found in the kernel
39   source file uts/common/os/sysent.c.
40 */
41
42/* Include sys/syscall.h to get SYS_* constants (and sys/trap.h to get T_*) to
43   avoid any copyright issues connected with their potential copying out of
44   the header file.
45 */
46#include <sys/syscall.h>
47#include <sys/trap.h>
48
49/* normal syscall (int $0x91) */
50#define VG_SOLARIS_SYSCALL_CLASS_CLASSIC        0
51/* fasttrap syscall (int $0xD2) */
52#define VG_SOLARIS_SYSCALL_CLASS_FASTTRAP       1
53
54#define VG_SOLARIS_SYSCALL_CLASS_SHIFT 24
55#define VG_SOLARIS_SYSCALL_NUMBER_MASK 0x00FFFFFF
56
57#define VG_SOLARIS_SYSCALL_CONSTRUCT_FASTTRAP(sysno) \
58   ((VG_SOLARIS_SYSCALL_CLASS_FASTTRAP << VG_SOLARIS_SYSCALL_CLASS_SHIFT) \
59    | (sysno))
60#define VG_SOLARIS_SYSNO_CLASS(sysno) \
61   ((sysno) >> VG_SOLARIS_SYSCALL_CLASS_SHIFT)
62#define VG_SOLARIS_SYSNO_INDEX(sysno) \
63   ((sysno) & VG_SOLARIS_SYSCALL_NUMBER_MASK)
64
65#define __NR_exit                       SYS_exit
66#if defined(SOLARIS_SPAWN_SYSCALL)
67#define __NR_spawn                      SYS_spawn
68#endif /* SOLARIS_SPAWN_SYSCALL */
69#define __NR_read                       SYS_read
70#define __NR_write                      SYS_write
71#define __NR_close                      SYS_close
72#define __NR_linkat                     SYS_linkat
73#define __NR_symlinkat                  SYS_symlinkat
74#define __NR_chdir                      SYS_chdir
75#define __NR_time                       SYS_time
76#define __NR_brk                        SYS_brk
77#define __NR_lseek                      SYS_lseek
78#define __NR_getpid                     SYS_getpid
79#define __NR_mount                      SYS_mount
80#define __NR_readlinkat                 SYS_readlinkat
81#define __NR_setuid                     SYS_setuid
82#define __NR_getuid                     SYS_getuid
83#define __NR_stime                      SYS_stime
84//#define __NR_pcsample                   SYS_pcsample
85#define __NR_alarm                      SYS_alarm
86#define __NR_pause                      SYS_pause
87#if defined(SOLARIS_FREALPATHAT_SYSCALL)
88#define __NR_frealpathat                SYS_frealpathat
89#endif /* SOLARIS_FREALPATHAT_SYSCALL */
90#define __NR_stty                       SYS_stty
91#define __NR_gtty                       SYS_gtty
92//#define __NR_nice                       SYS_nice
93//#define __NR_statfs                     SYS_statfs
94//#define __NR_sync                       SYS_sync
95#define __NR_kill                       SYS_kill
96//#define __NR_fstatfs                    SYS_fstatfs
97#define __NR_pgrpsys                    SYS_pgrpsys
98//#define __NR_uucopystr                  SYS_uucopystr
99#define __NR_pipe                       SYS_pipe
100#define __NR_times                      SYS_times
101//#define __NR_profil                     SYS_profil
102#define __NR_faccessat                  SYS_faccessat
103#define __NR_setgid                     SYS_setgid
104#define __NR_getgid                     SYS_getgid
105#define __NR_mknodat                    SYS_mknodat
106//#define __NR_msgsys                     SYS_msgsys
107#define __NR_sysi86                     SYS_sysi86
108//#define __NR_acct                       SYS_acct
109#define __NR_shmsys                     SYS_shmsys
110#define __NR_semsys                     SYS_semsys
111#define __NR_ioctl                      SYS_ioctl
112//#define __NR_uadmin                     SYS_uadmin
113#define __NR_fchownat                   SYS_fchownat
114//#define __NR_utssys                     SYS_utssys
115#define __NR_fdsync                     SYS_fdsync
116#define __NR_execve                     SYS_execve
117#define __NR_umask                      SYS_umask
118#define __NR_chroot                     SYS_chroot
119#define __NR_fcntl                      SYS_fcntl
120//#define __NR_ulimit                     SYS_ulimit
121#define __NR_renameat                   SYS_renameat
122#define __NR_unlinkat                   SYS_unlinkat
123#define __NR_fstatat                    SYS_fstatat
124#define __NR_fstatat64                  SYS_fstatat64
125#define __NR_openat                     SYS_openat
126#define __NR_openat64                   SYS_openat64
127#define __NR_tasksys                    SYS_tasksys
128//#define __NR_acctctl                    SYS_acctctl
129//#define __NR_exacctsys                  SYS_exacctsys
130#define __NR_getpagesizes               SYS_getpagesizes
131//#define __NR_rctlsys                    SYS_rctlsys
132//#define __NR_sidsys                     SYS_sidsys
133#define __NR_lwp_park                   SYS_lwp_park
134#define __NR_sendfilev                  SYS_sendfilev
135#if defined(SOLARIS_LWP_NAME_SYSCALL)
136#define __NR_lwp_name                   SYS_lwp_name
137#endif /* SOLARIS_LWP_NAME_SYSCALL */
138#define __NR_getdents                   SYS_getdents
139#define __NR_privsys                    SYS_privsys
140#define __NR_ucredsys                   SYS_ucredsys
141//#define __NR_sysfs                      SYS_sysfs
142#define __NR_getmsg                     SYS_getmsg
143#define __NR_putmsg                     SYS_putmsg
144#define __NR_setgroups                  SYS_setgroups
145#define __NR_getgroups                  SYS_getgroups
146#define __NR_sigprocmask                SYS_sigprocmask
147//#define __NR_sigsuspend                 SYS_sigsuspend
148#define __NR_sigaltstack                SYS_sigaltstack
149#define __NR_sigaction                  SYS_sigaction
150#define __NR_sigpending                 SYS_sigpending
151#define __NR_context                    SYS_context
152#define __NR_fchmodat                   SYS_fchmodat
153#define __NR_mkdirat                    SYS_mkdirat
154#define __NR_statvfs                    SYS_statvfs
155#define __NR_fstatvfs                   SYS_fstatvfs
156//#define __NR_getloadavg                 SYS_getloadavg
157#define __NR_nfssys                     SYS_nfssys
158#define __NR_waitid                     SYS_waitid
159#define __NR_waitsys                    SYS_waitsys /* = SYS_waitid (historical) */
160//#define __NR_sigsendsys                 SYS_sigsendsys
161//#define __NR_hrtsys                     SYS_hrtsys
162#if defined(SOLARIS_UTIMESYS_SYSCALL)
163#define __NR_utimesys                   SYS_utimesys
164#endif /* SOLARIS_UTIMESYS_SYSCALL */
165#if defined(SOLARIS_UTIMENSAT_SYSCALL)
166#define __NR_utimensat                  SYS_utimensat
167#endif /* SOLARIS_UTIMENSAT_SYSCALL */
168#define __NR_sigresend                  SYS_sigresend
169#define __NR_priocntlsys                SYS_priocntlsys
170#define __NR_pathconf                   SYS_pathconf
171//#define __NR_mincore                    SYS_mincore
172#define __NR_mmap                       SYS_mmap
173#define __NR_mprotect                   SYS_mprotect
174#define __NR_munmap                     SYS_munmap
175//#define __NR_fpathconf                  SYS_fpathconf
176//#define __NR_vfork                      SYS_vfork
177#define __NR_fchdir                     SYS_fchdir
178#define __NR_readv                      SYS_readv
179#define __NR_writev                     SYS_writev
180#if defined(SOLARIS_UUIDSYS_SYSCALL)
181#define __NR_uuidsys                    SYS_uuidsys
182#endif /* SOLARIS_UUIDSYS_SYSCALL */
183#define __NR_mmapobj                    SYS_mmapobj
184#define __NR_setrlimit                  SYS_setrlimit
185#define __NR_getrlimit                  SYS_getrlimit
186#define __NR_memcntl                    SYS_memcntl
187#define __NR_getpmsg                    SYS_getpmsg
188#define __NR_putpmsg                    SYS_putpmsg
189#define __NR_uname                      SYS_uname
190#define __NR_setegid                    SYS_setegid
191#define __NR_sysconfig                  SYS_sysconfig
192//#define __NR_adjtime                    SYS_adjtime
193#define __NR_systeminfo                 SYS_systeminfo
194//#define __NR_sharefs                    SYS_sharefs
195#define __NR_seteuid                    SYS_seteuid
196#define __NR_forksys                    SYS_forksys
197#define __NR_sigtimedwait               SYS_sigtimedwait
198//#define __NR_lwp_info                   SYS_lwp_info
199#define __NR_yield                      SYS_yield
200#define __NR_lwp_sema_post              SYS_lwp_sema_post
201#define __NR_lwp_sema_trywait           SYS_lwp_sema_trywait
202#define __NR_lwp_detach                 SYS_lwp_detach
203//#define __NR_corectl                    SYS_corectl
204//#define __NR_modctl                     SYS_modctl
205#define __NR_fchroot                    SYS_fchroot
206#if defined(SOLARIS_SYSTEM_STATS_SYSCALL)
207#define __NR_system_stats               SYS_system_stats
208#endif /* SOLARIS_SYSTEM_STATS_SYSCALL */
209//#define __NR_vhangup                    SYS_vhangup
210#define __NR_gettimeofday               SYS_gettimeofday
211#define __NR_getitimer                  SYS_getitimer
212#define __NR_setitimer                  SYS_setitimer
213#define __NR_lwp_create                 SYS_lwp_create
214#define __NR_lwp_exit                   SYS_lwp_exit
215#define __NR_lwp_suspend                SYS_lwp_suspend
216#define __NR_lwp_continue               SYS_lwp_continue
217#if defined(SOLARIS_LWP_SIGQUEUE_SYSCALL)
218#define __NR_lwp_sigqueue               SYS_lwp_sigqueue
219#else
220#define __NR_lwp_kill                   SYS_lwp_kill
221#endif /* SOLARIS_LWP_SIGQUEUE_SYSCALL */
222#define __NR_lwp_self                   SYS_lwp_self
223#define __NR_lwp_sigmask                SYS_lwp_sigmask
224#define __NR_lwp_private                SYS_lwp_private
225#define __NR_lwp_wait                   SYS_lwp_wait
226#define __NR_lwp_mutex_wakeup           SYS_lwp_mutex_wakeup
227#define __NR_lwp_cond_wait              SYS_lwp_cond_wait
228//#define __NR_lwp_cond_signal            SYS_lwp_cond_signal
229#define __NR_lwp_cond_broadcast         SYS_lwp_cond_broadcast
230#define __NR_pread                      SYS_pread
231#define __NR_pwrite                     SYS_pwrite
232#define __NR_llseek                     SYS_llseek
233//#define __NR_inst_sync                  SYS_inst_sync
234//#define __NR_brand                      SYS_brand
235//#define __NR_kaio                       SYS_kaio
236//#define __NR_cpc                        SYS_cpc
237//#define __NR_lgrpsys                    SYS_lgrpsys
238//#define __NR_meminfosys                 SYS_meminfosys /* = SYS_lgrpsys */
239#define __NR_rusagesys                  SYS_rusagesys
240#define __NR_port                       SYS_port
241#define __NR_pollsys                    SYS_pollsys
242#define __NR_labelsys                   SYS_labelsys
243#define __NR_acl                        SYS_acl
244#define __NR_auditsys                   SYS_auditsys
245//#define __NR_processor_bind             SYS_processor_bind
246//#define __NR_processor_info             SYS_processor_info
247#define __NR_p_online                   SYS_p_online
248#define __NR_sigqueue                   SYS_sigqueue
249#define __NR_clock_gettime              SYS_clock_gettime
250#define __NR_clock_settime              SYS_clock_settime
251#define __NR_clock_getres               SYS_clock_getres
252#define __NR_timer_create               SYS_timer_create
253#define __NR_timer_delete               SYS_timer_delete
254#define __NR_timer_settime              SYS_timer_settime
255#define __NR_timer_gettime              SYS_timer_gettime
256#define __NR_timer_getoverrun           SYS_timer_getoverrun
257#define __NR_nanosleep                  SYS_nanosleep
258#define __NR_facl                       SYS_facl
259#define __NR_door                       SYS_door
260#define __NR_setreuid                   SYS_setreuid
261#define __NR_setregid                   SYS_setregid
262//#define __NR_install_utrap              SYS_install_utrap
263//#define __NR_signotify                  SYS_signotify
264#define __NR_schedctl                   SYS_schedctl
265#define __NR_pset                       SYS_pset
266//#define SYS_sparc_utrap_install
267#define __NR_resolvepath                SYS_resolvepath
268#define __NR_lwp_mutex_timedlock        SYS_lwp_mutex_timedlock
269#define __NR_lwp_sema_timedwait         SYS_lwp_sema_timedwait
270#define __NR_lwp_rwlock_sys             SYS_lwp_rwlock_sys
271#define __NR_getdents64                 SYS_getdents64
272#define __NR_mmap64                     SYS_mmap64
273#define __NR_statvfs64                  SYS_statvfs64
274#define __NR_fstatvfs64                 SYS_fstatvfs64
275#define __NR_setrlimit64                SYS_setrlimit64
276#define __NR_getrlimit64                SYS_getrlimit64
277#define __NR_pread64                    SYS_pread64
278#define __NR_pwrite64                   SYS_pwrite64
279//#define __NR_rpcsys                     SYS_rpcsys
280#define __NR_zone                       SYS_zone
281//#define __NR_autofssys                  SYS_autofssys
282#define __NR_getcwd                     SYS_getcwd
283#define __NR_so_socket                  SYS_so_socket
284#define __NR_so_socketpair              SYS_so_socketpair
285#define __NR_bind                       SYS_bind
286#define __NR_listen                     SYS_listen
287#define __NR_accept                     SYS_accept
288#define __NR_connect                    SYS_connect
289#define __NR_shutdown                   SYS_shutdown
290#define __NR_recv                       SYS_recv
291#define __NR_recvfrom                   SYS_recvfrom
292#define __NR_recvmsg                    SYS_recvmsg
293#define __NR_send                       SYS_send
294#define __NR_sendmsg                    SYS_sendmsg
295#define __NR_sendto                     SYS_sendto
296#define __NR_getpeername                SYS_getpeername
297#define __NR_getsockname                SYS_getsockname
298#define __NR_getsockopt                 SYS_getsockopt
299#define __NR_setsockopt                 SYS_setsockopt
300//#define __NR_sockconfig                 SYS_sockconfig
301//#define __NR_ntp_gettime                SYS_ntp_gettime
302//#define __NR_ntp_adjtime                SYS_ntp_adjtime
303//#define __NR_lwp_mutex_unlock           SYS_lwp_mutex_unlock
304//#define __NR_lwp_mutex_trylock          SYS_lwp_mutex_trylock
305#define __NR_lwp_mutex_register         SYS_lwp_mutex_register
306//#define __NR_cladm                      SYS_cladm
307#define __NR_uucopy                     SYS_uucopy
308#define __NR_umount2                    SYS_umount2
309
310/* The following syscalls were removed in Solaris 11 (see
311   https://wikis.oracle.com/display/DTrace/syscall+Provider). Valgrind's core
312   cannot use these syscalls but wrappers have to be provided for them because
313   they are still in use on illumos.
314*/
315#if defined(SOLARIS_OLD_SYSCALLS)
316#define __NR_open                       SYS_open
317#define __NR_link                       SYS_link
318#define __NR_unlink                     SYS_unlink
319#define __NR_mknod                      SYS_mknod
320#define __NR_chmod                      SYS_chmod
321#define __NR_chown                      SYS_chown
322#define __NR_stat                       SYS_stat
323#define __NR_fstat                      SYS_fstat
324#define __NR_access                     SYS_access
325#define __NR_rmdir                      SYS_rmdir
326#define __NR_mkdir                      SYS_mkdir
327#define __NR_lstat                      SYS_lstat
328#define __NR_symlink                    SYS_symlink
329#define __NR_readlink                   SYS_readlink
330#define __NR_fchmod                     SYS_fchmod
331#define __NR_fchown                     SYS_fchown
332#define __NR_lchown                     SYS_lchown
333#define __NR_rename                     SYS_rename
334#define __NR_stat64                     SYS_stat64
335#define __NR_lstat64                    SYS_lstat64
336#define __NR_fstat64                    SYS_fstat64
337#define __NR_open64                     SYS_open64
338#endif /* SOLARIS_OLD_SYSCALLS */
339
340/*
341#define __NR_null \
342   VG_SOLARIS_SYSCALL_CONSTRUCT_FASTTRAP(T_FNULL)
343#define __NR_fgetfp \
344   VG_SOLARIS_SYSCALL_CONSTRUCT_FASTTRAP(T_FGETFP)
345#define __NR_fsetfp \
346   VG_SOLARIS_SYSCALL_CONSTRUCT_FASTTRAP(T_FSETFP)
347*/
348#define __NR_gethrtime \
349   VG_SOLARIS_SYSCALL_CONSTRUCT_FASTTRAP(T_GETHRTIME)
350#define __NR_gethrvtime \
351   VG_SOLARIS_SYSCALL_CONSTRUCT_FASTTRAP(T_GETHRVTIME)
352#define __NR_gethrestime \
353   VG_SOLARIS_SYSCALL_CONSTRUCT_FASTTRAP(T_GETHRESTIME)
354/*
355#define __NR_getlgrp \
356   VG_SOLARIS_SYSCALL_CONSTRUCT_FASTTRAP(T_GETLGRP)
357*/
358#if defined(SOLARIS_GETHRT_FASTTRAP)
359#define __NR_gethrt \
360   VG_SOLARIS_SYSCALL_CONSTRUCT_FASTTRAP(T_GETHRT)
361#endif /* SOLARIS_GETHRT_FASTTRAP */
362#if defined(SOLARIS_GETZONEOFFSET_FASTTRAP)
363#define __NR_getzoneoffset \
364   VG_SOLARIS_SYSCALL_CONSTRUCT_FASTTRAP(T_GETZONEOFFSET)
365#endif /* SOLARIS_GETZONEOFFSET_FASTTRAP */
366
367#endif /* __VKI_SCNUMS_SOLARIS_H */
368
369/*--------------------------------------------------------------------*/
370/*--- end                                                          ---*/
371/*--------------------------------------------------------------------*/
372