blob: ba2631efa75ea010e5a752e373b2ceb21c3dc531 [file] [log] [blame]
sewardj8eb8bab2015-07-21 14:44:28 +00001
2/*--------------------------------------------------------------------*/
3/*--- Solaris-specific kernel interface. vki-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/* The purpose of this file is described in vki-linux.h.
36
37 To avoid any copyright issues, vki-solaris.h follows the same approach as
38 vki-darwin.h (not copying anything from kernel header files but instead
39 just including them).
40 */
41
42#ifndef __VKI_SOLARIS_H
43#define __VKI_SOLARIS_H
44
45#include "../../config.h"
46
47/* _XOPEN_SOURCE equal to at least '500' is required so that various system
48 structures have all necessary attributes (for example struct msghdr). */
49#if !defined(_XOPEN_SOURCE)
50/* Compiler versions c99 and higher require _XOPEN_SOURCE at least '600'. */
51# if (__STDC_VERSION__ - 0 >= 199901L)
52# define _XOPEN_SOURCE 600
53# else
54# define _XOPEN_SOURCE 500
55# endif
56#elif (_XOPEN_SOURCE - 0 != 500) && (_XOPEN_SOURCE - 0 != 600) && (_XOPEN_SOURCE - 0 != 700)
57# error "Compiler or options invalid for including this header file."
58#endif /* _XOPEN_SOURCE */
59
60#define __EXTENSIONS__ 1
61/* assert _FILE_OFFSET_BITS == 32 */
62
63/* XXX These two PTRACE defines are currently used only in m_debugger.c for
64 legacy 'attach debugger' functionality. This is going to be removed
65 in future Valgrind version and so can these two as well. */
66#define VKI_PTRACE_TRACEME 0
67#define VKI_PTRACE_DETACH -1
68
69#define VKI_PAGE_SHIFT 12
70#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
71#define VKI_PAGEMASK (~VKI_PAGEOFFSET)
72#define VKI_PAGEOFFSET (VKI_PAGE_SIZE - 1)
73#define VKI_MAX_PAGE_SHIFT VKI_PAGE_SHIFT
74#define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
75
76
77#include <sys/types.h>
78#define VKI_UINT_MAX UINT_MAX
79#define vki_boolean_t boolean_t
80#define vki_datalink_id_t datalink_id_t
81#define vki_uint_t uint_t
82#define vki_uint32_t uint32_t
83#define vki_uint64_t uint64_t
84#define vki_ulong_t ulong_t
85#define vki_caddr_t caddr_t
86#define vki_dev_t dev_t
87#define vki_off_t off_t
88#define vki_id_t id_t
89#define vki_key_t key_t
90#define vki_mode_t mode_t
91#define vki_o_dev_t o_dev_t
92#define vki_projid_t projid_t
93#define vki_uid_t uid_t
94#define vki_gid_t gid_t
95#define vki_pid_t pid_t
96#define vki_size_t size_t
97#define vki_time_t time_t
98#define vki_timer_t timer_t
99#define vki_uchar_t uchar_t
100
101typedef uint32_t vki_u32;
102
103
104#include <sys/types32.h>
105#define vki_size32_t size32_t
106
107
108#include <fcntl.h>
109#define VKI_SEEK_SET SEEK_SET
110
111
112#include <limits.h>
113#define VKI_NGROUPS_MAX NGROUPS_MAX
114#define VKI_PATH_MAX PATH_MAX
115/* Used in launcher-linux.c which we share with Linux port. */
116#define VKI_BINPRM_BUF_SIZE VKI_PATH_MAX
117
118
119#include <ucred.h>
120#define vki_ucred_t ucred_t
121
122
123#include <unistd.h>
124#define VKI_R_OK R_OK
125#define VKI_W_OK W_OK
126#define VKI_X_OK X_OK
127
128
129#include <bsm/audit.h>
130#define VKI_A_GETAMASK A_GETAMASK
131#define VKI_A_GETCAR A_GETCAR
132#define VKI_A_GETCLASS A_GETCLASS
133#define VKI_A_GETCOND A_GETCOND
134#define VKI_A_GETCWD A_GETCWD
135#define VKI_A_GETKAUDIT A_GETKAUDIT
136#define VKI_A_GETKMASK A_GETKMASK
137#define VKI_A_GETPINFO A_GETPINFO
138#define VKI_A_GETPINFO_ADDR A_GETPINFO_ADDR
139#define VKI_A_GETPOLICY A_GETPOLICY
140#define VKI_A_GETQCTRL A_GETQCTRL
141#define VKI_A_GETSTAT A_GETSTAT
142#define VKI_A_SETAMASK A_SETAMASK
143#define VKI_A_SETCLASS A_SETCLASS
144#define VKI_A_SETCOND A_SETCOND
145#define VKI_A_SETKAUDIT A_SETKAUDIT
146#define VKI_A_SETKMASK A_SETKMASK
147#define VKI_A_SETPMASK A_SETPMASK
148#define VKI_A_SETPOLICY A_SETPOLICY
149#define VKI_A_SETQCTRL A_SETQCTRL
150#define VKI_A_SETSMASK A_SETSMASK
151#define VKI_A_SETSTAT A_SETSTAT
152#define VKI_A_SETUMASK A_SETUMASK
153#define VKI_BSM_AUDIT BSM_AUDIT
154#define VKI_BSM_AUDITCTL BSM_AUDITCTL
155#define VKI_BSM_AUDITDOOR BSM_AUDITDOOR
156#define VKI_BSM_GETAUDIT BSM_GETAUDIT
157#define VKI_BSM_GETAUDIT_ADDR BSM_GETAUDIT_ADDR
158#define VKI_BSM_GETAUID BSM_GETAUID
159#define VKI_BSM_SETAUDIT BSM_SETAUDIT
160#define VKI_BSM_SETAUDIT_ADDR BSM_SETAUDIT_ADDR
161#define VKI_BSM_SETAUID BSM_SETAUID
162#define vki_au_evclass_map_t au_evclass_map_t
163#define vki_au_id_t au_id_t
164#define vki_au_mask_t au_mask_t
165#define vki_au_qctrl au_qctrl
166#define vki_au_stat_t au_stat_t
167#define vki_auditinfo_t auditinfo_t
168#define vki_auditinfo_addr_t auditinfo_addr_t
169#define vki_auditpinfo auditpinfo
170#define vki_auditpinfo_addr auditpinfo_addr
171
172
173#include <sys/psw.h>
174#define VKI_PSL_USER PSL_USER
175
176
177#include <ia32/sys/trap.h>
178#define VKI_T_BPTFLT T_BPTFLT
179
180
181/* From <libc/inc/libc_int.h> which is consolidation private. */
182#define VKI_CI_BIND_GUARD 4
183#define VKI_CI_BIND_CLEAR 5
184#define VKI_THR_FLG_RTLD 0x01
185
186typedef struct {
187 int ci_tag;
188 union {
189 int (*ci_func)(int);
190 long ci_val;
191 char *ci_ptr;
192 } vki_ci_un;
193} vki_Lc_interface;
194
195
196/* From <libc/port/gen/getxby_door.h> which is consolidation private. */
197#if defined(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE)
198#define VKI_NAME_SERVICE_DOOR "/system/volatile/name_service_door"
199#else
200#define VKI_NAME_SERVICE_DOOR "/var/run/name_service_door"
201#endif /* SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE */
202
203
204#include <nfs/nfs.h>
205#include <nfs/nfssys.h>
206#define VKI_NFS_REVAUTH NFS_REVAUTH
207#define vki_nfs_revauth_args nfs_revauth_args
208
209
210#include <net/if.h>
211#define vki_lifnum lifnum
212
213
214#include <netinet/in.h>
215#define VKI_IPPROTO_TCP IPPROTO_TCP
216#define vki_in_addr in_addr
217#define vki_sockaddr_in sockaddr_in
218#define vki_sockaddr_in6 sockaddr_in6
219
220#include <netinet/tcp.h>
221#define VKI_TCP_NODELAY TCP_NODELAY
222
223
224/* Do not include nss_dbdefs.h if a C++ compiler is used to build a file
225 which includes vki-solaris.h. This cannot be done because the nss_dbdefs.h
226 header file uses 'delete' keyword as a method name. */
227#if !defined(__cplusplus)
228#include <nss_dbdefs.h>
229#define VKI_NSCD_CALLCAT_APP NSCD_CALLCAT_APP
230#define VKI_NSCDV2CATMASK NSCDV2CATMASK
231#define vki_nss_dbd_t nss_dbd_t
232#define vki_nss_pheader_t nss_pheader_t
233#endif /* !__cplusplus */
234
235
236/* From <repcache_protocol.h> which is consolidation private. */
237#include "vki-solaris-repcache.h"
238
239#include <sys/acl.h>
240#define vki_aclent_t aclent_t
241#define vki_ace_t ace_t
242#define VKI_GETACL GETACL
243#define VKI_SETACL SETACL
244#define VKI_GETACLCNT GETACLCNT
245#define VKI_ACE_GETACL ACE_GETACL
246#define VKI_ACE_SETACL ACE_SETACL
247#define VKI_ACE_GETACLCNT ACE_GETACLCNT
248
249
250#include <sys/auxv.h>
251#define vki_auxv_t auxv_t
252#define VKI_AT_NULL AT_NULL
253#define VKI_AT_PHDR AT_PHDR
254#define VKI_AT_PAGESZ AT_PAGESZ
255#define VKI_AT_BASE AT_BASE
256#define VKI_AT_FLAGS AT_FLAGS
257#define VKI_AT_SUN_PLATFORM AT_SUN_PLATFORM
258#define VKI_AT_SUN_HWCAP AT_SUN_HWCAP
259#define VKI_AT_SUN_EXECNAME AT_SUN_EXECNAME
260#define VKI_AT_SUN_AUXFLAGS AT_SUN_AUXFLAGS
261
262#define VKI_AF_SUN_HWCAPVERIFY AF_SUN_HWCAPVERIFY
263
264
265#include <sys/auxv_386.h>
266#define VKI_AV_386_FPU AV_386_FPU
267#define VKI_AV_386_TSC AV_386_TSC
268#define VKI_AV_386_CX8 AV_386_CX8
269#define VKI_AV_386_SEP AV_386_SEP
270#define VKI_AV_386_AMD_SYSC AV_386_AMD_SYSC
271#define VKI_AV_386_CMOV AV_386_CMOV
272#define VKI_AV_386_MMX AV_386_MMX
273#define VKI_AV_386_FXSR AV_386_FXSR
274#define VKI_AV_386_SSE AV_386_SSE
275#define VKI_AV_386_SSE2 AV_386_SSE2
276#define VKI_AV_386_SSE3 AV_386_SSE3
277#define VKI_AV_386_CX16 AV_386_CX16
278#define VKI_AV_386_AHF AV_386_AHF
279#define VKI_AV_386_TSCP AV_386_TSCP
280#define VKI_AV_386_POPCNT AV_386_POPCNT
281#define VKI_AV_386_AMD_LZCNT AV_386_AMD_LZCNT
282#define VKI_AV_386_SSSE3 AV_386_SSSE3
283#define VKI_AV_386_SSE4_1 AV_386_SSE4_1
284#define VKI_AV_386_SSE4_2 AV_386_SSE4_2
285#define VKI_AV_386_AES AV_386_AES
286#define VKI_AV_386_PCLMULQDQ AV_386_PCLMULQDQ
287#define VKI_AV_386_XSAVE AV_386_XSAVE
288
289
290#include <sys/corectl.h>
291#define VKI_CC_CONTENT_ANON CC_CONTENT_ANON
292#define VKI_CC_CONTENT_DATA CC_CONTENT_DATA
293#define VKI_CC_CONTENT_DISM CC_CONTENT_DISM
294#define VKI_CC_CONTENT_HEAP CC_CONTENT_HEAP
295#define VKI_CC_CONTENT_ISM CC_CONTENT_ISM
296#define VKI_CC_CONTENT_RODATA CC_CONTENT_RODATA
297#define VKI_CC_CONTENT_SHANON CC_CONTENT_SHANON
298#define VKI_CC_CONTENT_SHM CC_CONTENT_SHM
299#define VKI_CC_CONTENT_STACK CC_CONTENT_STACK
300#define VKI_CC_CONTENT_TEXT CC_CONTENT_TEXT
301#define vki_core_content_t core_content_t
302
303
304/* From <sys/crypto/elfsign.h> which is consolidation private. */
305#define VKI__PATH_KCFD_DOOR "/system/volatile/kcfd_door"
306typedef enum vki_ELFsign_status_e {
307 VKI_ELFSIGN_UNKNOWN,
308 VKI_ELFSIGN_SUCCESS,
309 VKI_ELFSIGN_FAILED,
310 VKI_ELFSIGN_NOTSIGNED,
311 VKI_ELFSIGN_INVALID_CERTPATH,
312 VKI_ELFSIGN_INVALID_ELFOBJ,
313 VKI_ELFSIGN_UNAVAILABLE
314} vki_ELFsign_status_t;
315typedef struct vki_kcf_door_arg_s {
316 short da_version;
317 vki_boolean_t da_iskernel;
318 union {
319 char filename[MAXPATHLEN]; /* For request */
320
321 struct vki_kcf_door_result_s { /* For response */
322 vki_ELFsign_status_t status;
323 vki_uint32_t siglen;
324 vki_uchar_t signature[1];
325 } result;
326 } vki_da_u;
327} vki_kcf_door_arg_t;
328
329
330#include <sys/crypto/ioctl.h>
331#define VKI_CRYPTO_SUCCESS CRYPTO_SUCCESS
332#define VKI_CRYPTO_GET_PROVIDER_LIST CRYPTO_GET_PROVIDER_LIST
333#define vki_crypto_provider_id_t crypto_provider_id_t
334#define vki_crypto_provider_entry_t crypto_provider_entry_t
335#define vki_crypto_get_provider_list_t crypto_get_provider_list_t
336
337
338#include <sys/dirent.h>
339#define VKI_MAXGETDENTS_SIZE MAXGETDENTS_SIZE
340#define vki_dirent dirent
341#define vki_dirent64 dirent64
342
343
344#include <sys/door.h>
345#define vki_door_desc_t door_desc_t
346#define vki_door_info_t door_info_t
347#define vki_door_arg_t door_arg_t
348#define vki_door_results door_results
349#define vki_door_return_desc_t door_return_desc_t
350
351#define VKI_DOOR_CREATE DOOR_CREATE
352#define VKI_DOOR_REVOKE DOOR_REVOKE
353#define VKI_DOOR_INFO DOOR_INFO
354#define VKI_DOOR_CALL DOOR_CALL
355#define VKI_DOOR_BIND DOOR_BIND
356#define VKI_DOOR_UNBIND DOOR_UNBIND
357#define VKI_DOOR_UNREFSYS DOOR_UNREFSYS
358#define VKI_DOOR_UCRED DOOR_UCRED
359#define VKI_DOOR_RETURN DOOR_RETURN
360#define VKI_DOOR_GETPARAM DOOR_GETPARAM
361#define VKI_DOOR_SETPARAM DOOR_SETPARAM
362
363
364#include <sys/dtrace.h>
365#define VKI_DTRACEHIOC_REMOVE DTRACEHIOC_REMOVE
366#define VKI_DTRACEHIOC_ADDDOF DTRACEHIOC_ADDDOF
367#define vki_dof_helper_t dof_helper_t
368
369
370#include <sys/elf.h>
371#define VKI_EI_CLASS EI_CLASS
372#define VKI_EI_DATA EI_DATA
373#define VKI_EI_MAG0 EI_MAG0
374#define VKI_EI_MAG1 EI_MAG1
375#define VKI_EI_MAG2 EI_MAG2
376#define VKI_EI_MAG3 EI_MAG3
377#define VKI_EI_VERSION EI_VERSION
378#define VKI_ELFMAG ELFMAG
379#define VKI_ELFMAG ELFMAG
380#define VKI_ELFMAG0 ELFMAG0
381#define VKI_ELFMAG1 ELFMAG1
382#define VKI_ELFMAG2 ELFMAG2
383#define VKI_ELFMAG3 ELFMAG3
384#define VKI_ET_CORE ET_CORE
385#define VKI_ET_DYN ET_DYN
386#define VKI_ET_EXEC ET_EXEC
387#define VKI_EV_CURRENT EV_CURRENT
388#define VKI_NT_AUXV NT_AUXV
389#define VKI_NT_CONTENT NT_CONTENT
390#define VKI_NT_LWPSINFO NT_LWPSINFO
391#define VKI_NT_LWPSTATUS NT_LWPSTATUS
392#define VKI_NT_PLATFORM NT_PLATFORM
393#define VKI_NT_PRCRED NT_PRCRED
394#define VKI_NT_PRFPREG NT_PRFPREG
395#define VKI_NT_PRPRIV NT_PRPRIV
396#define VKI_NT_PRPRIVINFO NT_PRPRIVINFO
397#define VKI_NT_PRPSINFO NT_PRPSINFO
398#define VKI_NT_PRSTATUS NT_PRSTATUS
399#define VKI_NT_PRXREG NT_PRXREG
400#define VKI_NT_PSINFO NT_PSINFO
401#define VKI_NT_PSTATUS NT_PSTATUS
402#define VKI_NT_UTSNAME NT_UTSNAME
403#define VKI_NT_ZONENAME NT_ZONENAME
404#define VKI_PF_R PF_R
405#define VKI_PF_W PF_W
406#define VKI_PF_X PF_X
407#define VKI_PN_XNUM PN_XNUM
408#define VKI_PT_LOAD PT_LOAD
409#define VKI_PT_SUNWBSS PT_SUNWBSS
410#define VKI_SELFMAG SELFMAG
411
412#if VG_WORDSIZE == 8
413#define VKI_ESZ(x) Elf64_##x
414#elif VG_WORDSIZE == 4
415#define VKI_ESZ(x) Elf32_##x
416#else
417#error VG_WORDSIZE needs to ==4 or ==8
418#endif
419
420
421#include <sys/errno.h>
422#define VKI_EPERM EPERM
423#define VKI_ENOENT ENOENT
424#define VKI_ESRCH ESRCH
425#define VKI_EINTR EINTR
426#define VKI_EIO EIO
427#define VKI_ENXIO ENXIO
428#define VKI_E2BIG E2BIG
429#define VKI_EBADF EBADF
430#define VKI_ECHILD ECHILD
431#define VKI_ENOEXEC ENOEXEC
432#define VKI_EAGAIN EAGAIN
433#define VKI_ENOMEM ENOMEM
434#define VKI_EACCES EACCES
435#define VKI_EFAULT EFAULT
436#define VKI_ENOTBLK ENOTBLK
437#define VKI_EBUSY EBUSY
438#define VKI_EEXIST EEXIST
439#define VKI_EXDEV EXDEV
440#define VKI_ENODEV ENODEV
441#define VKI_ENOTDIR ENOTDIR
442#define VKI_EISDIR EISDIR
443#define VKI_EINVAL EINVAL
444#define VKI_ENFILE ENFILE
445#define VKI_EMFILE EMFILE
446#define VKI_ENOTTY ENOTTY
447#define VKI_ETXTBSY ETXTBSY
448#define VKI_EFBIG EFBIG
449#define VKI_ENOSPC ENOSPC
450#define VKI_ESPIPE ESPIPE
451#define VKI_EROFS EROFS
452#define VKI_EMLINK EMLINK
453#define VKI_EPIPE EPIPE
454#define VKI_EDOM EDOM
455#define VKI_ERANGE ERANGE
456#define VKI_ENOTSUP ENOTSUP
457#define VKI_ENODATA ENODATA
458#define VKI_EOVERFLOW EOVERFLOW
459#define VKI_ENOSYS ENOSYS
460#define VKI_ERESTART ERESTART
461
462
463#if defined(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS)
464#include <sys/execx.h>
465#define VKI_EXEC_DESCRIPTOR EXEC_DESCRIPTOR
466#endif /* SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS */
467
468
469#include <sys/fcntl.h>
470#define VKI_O_RDONLY O_RDONLY
471#define VKI_O_WRONLY O_WRONLY
472#define VKI_O_RDWR O_RDWR
473#define VKI_O_APPEND O_APPEND
474#define VKI_O_NONBLOCK O_NONBLOCK
475
476#define VKI_O_CREAT O_CREAT
477#define VKI_O_TRUNC O_TRUNC
478#define VKI_O_EXCL O_EXCL
479#define VKI_O_LARGEFILE O_LARGEFILE
480
481#define VKI_F_DUPFD F_DUPFD
482#define VKI_F_GETFD F_GETFD
483#define VKI_F_SETFD F_SETFD
484#define VKI_F_GETFL F_GETFL
485#define VKI_F_GETXFL F_GETXFL
486#define VKI_F_SETFL F_SETFL
487
488/* SVR3 rfs compability const, declared only if _KERNEL or _KMEMUSER is
489 defined. */
490#if 0
491#define VKI_F_O_GETLK F_O_GETLK
492#endif // 0
493
494#define VKI_F_DUP2FD F_DUP2FD
495
496/* Mostly unused and kernel-unimplemented commands. In case of F_GETOWN and
497 F_GETOWN, they are translated by libc in __fcntl() into other syscalls,
498 that means these two values are never passed to the fcntl handler in the
499 kernel. F_HASREMOTELOCKS is also special, the fcntl kernel handler doesn't
500 know about it but it's used inside the kernel. */
501#if 0
502#define VKI_F_ISSTREAM F_ISSTREAM
503#define VKI_F_PRIV F_PRIV
504#define VKI_F_NPRIV F_NPRIV
505#define VKI_F_QUATACTL F_QUOTACTL
506#define VKI_F_BLOCKS F_BLOCKS
507#define VKI_F_BLKSIZE F_BLKSIZE
508#define VKI_F_GETOWN F_GETOWN
509#define VKI_F_SETOWN F_SETOWN
510#define VKI_F_REVOKE F_REVOKE
511#define VKI_F_HASREMOTELOCKS F_HASREMOTELOCKS
512#endif // 0
513
514#define VKI_F_SETLK F_SETLK
515#define VKI_F_SETLKW F_SETLKW
516#define VKI_F_ALLOCSP F_ALLOCSP
517#define VKI_F_FREESP F_FREESP
518#define VKI_F_GETLK F_GETLK
519#define VKI_F_SETLK_NBMAND F_SETLK_NBMAND
520#if defined(VGP_x86_solaris)
521#define VKI_F_SETLK64 F_SETLK64
522#define VKI_F_SETLKW64 F_SETLKW64
523#define VKI_F_ALLOCSP64 F_ALLOCSP64
524#define VKI_F_FREESP64 F_FREESP64
525#define VKI_F_GETLK64 F_GETLK64
526#define VKI_F_SETLK64_NBMAND F_SETLK64_NBMAND
527#endif // defined(VGP_x86_solaris)
528
529#define VKI_F_SHARE F_SHARE
530#define VKI_F_UNSHARE F_UNSHARE
531#define VKI_F_SHARE_NBMAND F_SHARE_NBMAND
532
533#define VKI_F_BADFD F_BADFD
534
535#define vki_flock flock
536#if defined(VGP_x86_solaris)
537#define vki_flock64 flock64
538#endif // defined(VGP_x86_solaris)
539
540#define VKI_FD_CLOEXEC FD_CLOEXEC
541
542#define vki_fshare fshare
543
544#define VKI_AT_FDCWD AT_FDCWD
545
546
547#include <sys/filio.h>
548#define VKI_FIOSETOWN FIOSETOWN
549#define VKI_FIOGETOWN FIOGETOWN
550
551
552#include <sys/fs/namenode.h>
553#define vki_namefd namefd
554
555
556#include <sys/ioccom.h>
557#define _VKI_IOC_DIR(x) ((x) & (IOC_VOID | IOC_OUT | IOC_IN))
558#define _VKI_IOC_SIZE(x) (((x) >> 16) & IOCPARM_MASK)
559#define _VKI_IOC_NONE 0
560#define _VKI_IOC_READ IOC_OUT
561#define _VKI_IOC_WRITE IOC_IN
562
563
564#include <sys/ipc.h>
565#include <sys/ipc_impl.h>
566#define VKI_IPC_RMID IPC_RMID
567#define VKI_IPC_SET IPC_SET
568#define VKI_IPC_SET64 IPC_SET64
569#define VKI_IPC_STAT IPC_STAT
570#define VKI_IPC_STAT64 IPC_STAT64
571#if defined(SOLARIS_SHM_NEW)
572#define VKI_IPC_XSTAT64 IPC_XSTAT64
573#endif /* SOLARIS_SHM_NEW */
574
575#define vki_semid64_ds semid_ds64
576
577
578#include <sys/lwp.h>
579#define VKI_LWP_DAEMON LWP_DAEMON
580#define VKI_LWP_FSBASE _LWP_FSBASE
581#define VKI_LWP_GSBASE _LWP_GSBASE
582#define VKI_LWP_SETPRIVATE _LWP_SETPRIVATE
583#define VKI_LWP_GETPRIVATE _LWP_GETPRIVATE
584
585
586#include <sys/mman.h>
587#define VKI_PROT_READ PROT_READ
588#define VKI_PROT_WRITE PROT_WRITE
589#define VKI_PROT_EXEC PROT_EXEC
590#define VKI_PROT_NONE PROT_NONE
591
592#define VKI_MAP_SHARED MAP_SHARED
593#define VKI_MAP_PRIVATE MAP_PRIVATE
594#define VKI_MAP_FIXED MAP_FIXED
595#define VKI_MAP_ANONYMOUS MAP_ANONYMOUS
596#define VKI_MAP_ALIGN MAP_ALIGN
597#define VKI_MAP_TEXT MAP_TEXT
598#define VKI_MAP_INITDATA MAP_INITDATA
599
600#define VKI_MMOBJ_ALL_FLAGS MMOBJ_ALL_FLAGS
601#define VKI_MMOBJ_INTERPRET MMOBJ_INTERPRET
602#define VKI_MMOBJ_PADDING MMOBJ_PADDING
603#define VKI_MR_PADDING MR_PADDING
604#define VKI_MR_HDR_ELF MR_HDR_ELF
605#define VKI_MR_GET_TYPE(val) MR_GET_TYPE(val)
606#define vki_mmapobj_result_t mmapobj_result_t
607
608#define vki_memcntl_mha memcntl_mha
609#define VKI_MC_LOCKAS MC_LOCKAS
610#define VKI_MC_UNLOCKAS MC_UNLOCKAS
611#define VKI_MC_HAT_ADVISE MC_HAT_ADVISE
612
613
614#include <sys/mntio.h>
615#define VKI_MNTIOC_GETMNTANY MNTIOC_GETMNTANY
616
617
618#include <sys/mnttab.h>
619#define vki_mntentbuf mntentbuf
620#define vki_mnttab mnttab
621
622
623#include <sys/mount.h>
624#define VKI_MS_DATA MS_DATA
625#define VKI_MS_OPTIONSTR MS_OPTIONSTR
626
627
628#include <sys/poll.h>
629#define vki_pollfd pollfd
630#define vki_pollfd_t pollfd_t
631#define vki_nfds_t nfds_t
632
633
634#include <sys/pool_impl.h>
635#define VKI_POOL_STATUSQ POOL_STATUSQ
636#define vki_pool_status_t pool_status_t
637
638
639#include <sys/port.h>
640#include <sys/port_impl.h>
641#define VKI_PORT_SOURCE_FD PORT_SOURCE_FD
642#define VKI_PORT_SOURCE_FILE PORT_SOURCE_FILE
643
644#define vki_port_event_t port_event_t
645#define vki_port_notify_t port_notify_t
646#define vki_file_obj file_obj
647
648#define VKI_PORT_CREATE PORT_CREATE
649#define VKI_PORT_ASSOCIATE PORT_ASSOCIATE
650#define VKI_PORT_DISSOCIATE PORT_DISSOCIATE
651#define VKI_PORT_SEND PORT_SEND
652#define VKI_PORT_SENDN PORT_SENDN
653#define VKI_PORT_GET PORT_GET
654#define VKI_PORT_GETN PORT_GETN
655#define VKI_PORT_ALERT PORT_ALERT
656#define VKI_PORT_DISPATCH PORT_DISPATCH
657
658#define VKI_PORT_SYS_NOPORT PORT_SYS_NOPORT
659#define VKI_PORT_CODE_MASK PORT_CODE_MASK
660
661
662#include <sys/priocntl.h>
663#include <sys/rtpriocntl.h>
664#include <sys/tspriocntl.h>
665#include <sys/iapriocntl.h>
666#include <sys/fsspriocntl.h>
667#include <sys/fxpriocntl.h>
668#define VKI_PC_GETCID PC_GETCID
669#define VKI_PC_GETCLINFO PC_GETCLINFO
670#define VKI_PC_SETPARMS PC_SETPARMS
671#define VKI_PC_GETPARMS PC_GETPARMS
672#define VKI_PC_ADMIN PC_ADMIN
673#define VKI_PC_GETPRIRANGE PC_GETPRIRANGE
674#define VKI_PC_DONICE PC_DONICE
675#define VKI_PC_SETXPARMS PC_SETXPARMS
676#define VKI_PC_GETXPARMS PC_GETXPARMS
677#define VKI_PC_SETDFLCL PC_SETDFLCL
678#define VKI_PC_GETDFLCL PC_GETDFLCL
679#define VKI_PC_DOPRIO PC_DOPRIO
680
681#define VKI_PC_CLNMSZ PC_CLNMSZ
682
683#define VKI_PC_GETNICE PC_GETNICE
684#define VKI_PC_SETNICE PC_SETNICE
685
686#define VKI_PC_GETPRIO PC_GETPRIO
687#define VKI_PC_SETPRIO PC_SETPRIO
688
689#define vki_pcinfo_t pcinfo_t
690#define vki_rtinfo_t rtinfo_t
691#define vki_tsinfo_t tsinfo_t
692#define vki_iainfo_t iainfo_t
693#define vki_fssinfo_t fssinfo_t
694#define vki_fxinfo_t fxinfo_t
695
696#define vki_pcparms_t pcparms_t
697#define vki_pcnice_t pcnice_t
698#define vki_pcprio_t pcprio_t
699#define vki_pc_vaparm_t pc_vaparm_t
700#define vki_pc_vaparms_t pc_vaparms_t
701#define vki_pcpri_t pcpri_t
702
703#define VKI_PC_KY_CLNAME PC_KY_CLNAME
704#define VKI_RT_KY_PRI RT_KY_PRI
705#define VKI_RT_KY_TQSECS RT_KY_TQSECS
706#define VKI_RT_KY_TQNSECS RT_KY_TQNSECS
707#define VKI_RT_KY_TQSIG RT_KY_TQSIG
708#define VKI_TS_KY_UPRILIM TS_KY_UPRILIM
709#define VKI_TS_KY_UPRI TS_KY_UPRI
710#define VKI_IA_KY_UPRILIM IA_KY_UPRILIM
711#define VKI_IA_KY_UPRI IA_KY_UPRI
712#define VKI_IA_KY_MODE IA_KY_MODE
713#define VKI_FSS_KY_UPRILIM FSS_KY_UPRILIM
714#define VKI_FSS_KY_UPRI FSS_KY_UPRI
715#define VKI_FX_KY_UPRILIM FX_KY_UPRILIM
716#define VKI_FX_KY_UPRI FX_KY_UPRI
717#define VKI_FX_KY_TQSECS FX_KY_TQSECS
718#define VKI_FX_KY_TQNSECS FX_KY_TQNSECS
719
720
721#include <sys/priv.h>
722#define vki_priv_impl_info_t priv_impl_info_t
723
724
725#include <sys/proc.h>
726#define VKI_SRUN SRUN
727#define VKI_SSLEEP SSLEEP
728#define VKI_SZOMB SZOMB
729
730
731#include <sys/processor.h>
732#define vki_processorid_t processorid_t
733
734
735/* We want the new /proc definitions. */
736#define _STRUCTURED_PROC 1
737#include <sys/procfs.h>
738#define VKI_MA_READ MA_READ
739#define VKI_MA_WRITE MA_WRITE
740#define VKI_MA_EXEC MA_EXEC
741#define VKI_PRNODEV PRNODEV
742#define VKI_PR_PCINVAL PR_PCINVAL
743#define vki_lwpsinfo_t lwpsinfo_t
744#define vki_lwpstatus_t lwpstatus_t
745#define vki_prcred_t prcred_t
746#define vki_prmap_t prmap_t
747#define vki_prpriv_t prpriv_t
748#define vki_prxmap_t prxmap_t
749#define vki_pstatus_t pstatus_t
750#define vki_psinfo_t psinfo_t
751
752
753#include <sys/procfs_isa.h>
754#if defined(SOLARIS_PRXREGSET_T)
755#define vki_prxregset_t prxregset_t
756#endif /* SOLARIS_PRXREGSET_T */
757
758
759#include <sys/procset.h>
760#define vki_idtype_t idtype_t
761#define VKI_P_PID P_PID
762#define VKI_P_PGID P_PGID
763#define VKI_P_ALL P_ALL
764#define vki_procset_t procset_t
765
766
767#include <sys/regset.h>
768#define vki_prgregset_t prgregset_t
769
770
771#include <sys/resource.h>
772#define VKI_RLIMIT_DATA RLIMIT_DATA
773#define VKI_RLIMIT_STACK RLIMIT_STACK
774#define VKI_RLIMIT_CORE RLIMIT_CORE
775#define VKI_RLIMIT_NOFILE RLIMIT_NOFILE
776#define VKI__RUSAGESYS_GETRUSAGE _RUSAGESYS_GETRUSAGE
777#define VKI__RUSAGESYS_GETRUSAGE_CHLD _RUSAGESYS_GETRUSAGE_CHLD
778#define VKI__RUSAGESYS_GETRUSAGE_LWP _RUSAGESYS_GETRUSAGE_LWP
779#define VKI__RUSAGESYS_GETVMUSAGE _RUSAGESYS_GETVMUSAGE
780#define vki_rlimit rlimit
781#define vki_rlimit64 rlimit64
782#define vki_rusage rusage
783
784
785#include <sys/schedctl.h>
786#define vki_sc_shared sc_shared
787
788
789#include <sys/segments.h>
790#define VKI_GDT_LWPGS GDT_LWPGS
791#if defined(VGP_amd64_solaris)
792/* Values VKI_UCS_SEL/VKI_UDS_SEL can be used only on amd64. On x86, correct
793 %cs/%ds values for a client need to be obtained from the host registers
794 because they are different depending on the running kernel (x86 or amd64).
795 */
796#define VKI_UCS_SEL UCS_SEL
797#define VKI_UDS_SEL UDS_SEL
798#endif
799#define VKI_LWPGS_SEL LWPGS_SEL
800
801
802#include <sys/select.h>
803#define vki_fd_set fd_set
804
805
806#include <sys/priv.h>
807/* Define _KMEMUSER so priv_set is pulled in. */
808#define _KMEMUSER
809#include <sys/priv_impl.h>
810#undef _KMEMUSER
811#define vki_priv_set_t priv_set_t
812#define vki_priv_ptype_t priv_ptype_t
813#define vki_priv_op_t priv_op_t
814
815#define VKI_PRIVSYS_SETPPRIV PRIVSYS_SETPPRIV
816#define VKI_PRIVSYS_GETPPRIV PRIVSYS_GETPPRIV
817#define VKI_PRIVSYS_GETIMPLINFO PRIVSYS_GETIMPLINFO
818#define VKI_PRIVSYS_SETPFLAGS PRIVSYS_SETPFLAGS
819#define VKI_PRIVSYS_GETPFLAGS PRIVSYS_GETPFLAGS
820#define VKI_PRIVSYS_ISSETUGID PRIVSYS_ISSETUGID
821#define VKI_PRIVSYS_PFEXEC_REG PRIVSYS_PFEXEC_REG
822#define VKI_PRIVSYS_PFEXEC_UNREG PRIVSYS_PFEXEC_UNREG
823
824#define vki_priv_impl_info_t priv_impl_info_t
825
826
827#include <sys/sem.h>
828#include <sys/sem_impl.h>
829#define VKI_GETALL GETALL
830#define VKI_GETPID GETPID
831#define VKI_GETNCNT GETNCNT
832#define VKI_GETZCNT GETZCNT
833#define VKI_GETVAL GETVAL
834#define VKI_SEMCTL SEMCTL
835#define VKI_SEMGET SEMGET
836#define VKI_SEMIDS SEMIDS
837#define VKI_SEMOP SEMOP
838#define VKI_SEMTIMEDOP SEMTIMEDOP
839#define VKI_SETALL SETALL
840#define VKI_SETVAL SETVAL
841
842#define vki_semid_ds semid_ds
843#define vki_sembuf sembuf
844
845/* The semun union has to be explicitly declared by the application program
846 (see semctl(2)). */
847union vki_semun {
848 int val;
849 struct semid_ds *buf;
850 ushort_t *array;
851};
852
853
854#include <sys/sendfile.h>
855#define VKI_SENDFILEV SENDFILEV
856#define VKI_SENDFILEV64 SENDFILEV64
857#define VKI_SFV_FD_SELF SFV_FD_SELF
858#define vki_sendfilevec sendfilevec
859#define vki_sendfilevec64 sendfilevec64
860
861
862#include <sys/shm.h>
863#include <sys/shm_impl.h>
864#define VKI_SHMAT SHMAT
865#define VKI_SHMCTL SHMCTL
866#define VKI_SHMDT SHMDT
867#define VKI_SHMGET SHMGET
868#define VKI_SHMIDS SHMIDS
869#if defined(SOLARIS_SHM_NEW)
870#define VKI_SHMADV SHMADV
871#define VKI_SHMGET_OSM SHMGET_OSM
872#define VKI_SHM_ADV_GET SHM_ADV_GET
873#define VKI_SHM_ADV_SET SHM_ADV_SET
874#endif /* SOLARIS_SHM_NEW */
875#define VKI_SHM_LOCK SHM_LOCK
876#define VKI_SHM_RDONLY SHM_RDONLY
877#define VKI_SHM_UNLOCK SHM_UNLOCK
878/* Should be correct, but not really neat. */
879#define VKI_SHMLBA VKI_PAGE_SIZE
880
881#define vki_shmid_ds shmid_ds
882#define vki_shmid_ds64 shmid_ds64
883#define vki_shmid_xds64 shmid_xds64
884
885
886#include <sys/siginfo.h>
887/* This section also contains items defined in sys/machsig.h, this file
888 is directly included in sys/siginfo.h. */
889#define vki_sigevent sigevent
890#define vki_siginfo_t siginfo_t
891
892#define VKI_SI_LWP SI_LWP
893#define VKI_SI_USER SI_USER
894#define VKI_SIGEV_PORT SIGEV_PORT
895#define VKI_SIGEV_THREAD SIGEV_THREAD
896
897/* SIGTRAP signal codes */
898#define VKI_TRAP_BRKPT TRAP_BRKPT
899
900/* SIGCLD signal codes */
901#define VKI_CLD_EXITED CLD_EXITED
902#define VKI_CLD_KILLED CLD_KILLED
903#define VKI_CLD_DUMPED CLD_DUMPED
904#define VKI_CLD_TRAPPED CLD_TRAPPED
905#define VKI_CLD_STOPPED CLD_STOPPED
906#define VKI_CLD_CONTINUED CLD_CONTINUED
907
908/* SIGILL signal codes */
909#define VKI_ILL_ILLOPC ILL_ILLOPC
910#define VKI_ILL_ILLOPN ILL_ILLOPN
911#define VKI_ILL_ILLADR ILL_ILLADR
912#define VKI_ILL_ILLTRP ILL_ILLTRP
913#define VKI_ILL_PRVOPC ILL_PRVOPC
914#define VKI_ILL_PRVREG ILL_PRVREG
915#define VKI_ILL_COPROC ILL_COPROC
916#define VKI_ILL_BADSTK ILL_BADSTK
917
918/* SIGFPE signal codes */
919#define VKI_FPE_INTDIV FPE_INTDIV
920#define VKI_FPE_INTOVF FPE_INTOVF
921#define VKI_FPE_FLTDIV FPE_FLTDIV
922#define VKI_FPE_FLTOVF FPE_FLTOVF
923#define VKI_FPE_FLTUND FPE_FLTUND
924#define VKI_FPE_FLTRES FPE_FLTRES
925#define VKI_FPE_FLTINV FPE_FLTINV
926#define VKI_FPE_FLTSUB FPE_FLTSUB
927#define VKI_FPE_FLTDEN FPE_FLTDEN
928
929/* SIGSEV signal codes */
930#define VKI_SEGV_MAPERR SEGV_MAPERR
931#define VKI_SEGV_ACCERR SEGV_ACCERR
932
933/* SIGBUS signal codes */
934#define VKI_BUS_ADRALN BUS_ADRALN
935#define VKI_BUS_ADRERR BUS_ADRERR
936#define VKI_BUS_OBJERR BUS_OBJERR
937
938
939#include <sys/signal.h>
940/* This section also contains items defined in sys/iso/signal_iso.h, this file
941 is directly included in sys/signal.h. */
942
943/* Next three constants describe the internal representation of sigset_t,
944 there are checks in coregrind/m_vki.c to make sure they are correct. */
945#define _VKI_NSIG 128
946#define _VKI_MAXSIG MAXSIG
947#define _VKI_NSIG_BPW 32
948#define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
949#define vki_sigset_t sigset_t
950#define vki_sigaltstack sigaltstack
951/* sigset_t accessor */
952#define sig __sigbits
953
954/* On Solaris we use the same type for passing sigactions to
955 and from the kernel. Hence: */
956typedef struct sigaction vki_sigaction_toK_t;
957typedef struct sigaction vki_sigaction_fromK_t;
958/* sigaction_t accessor */
959#define ksa_handler sa_handler
960
961#define VKI_SA_ONSTACK SA_ONSTACK
962#define VKI_SA_ONESHOT SA_RESETHAND
963#define VKI_SA_NOMASK SA_NODEFER
964
965#define VKI_MINSIGSTKSZ MINSIGSTKSZ
966
967#define VKI_SS_ONSTACK SS_ONSTACK
968#define VKI_SS_DISABLE SS_DISABLE
969
970#define vki_stack_t stack_t
971
972#define VKI_SA_NOCLDSTOP SA_NOCLDSTOP
973#define VKI_SA_RESTART SA_RESTART
974#define VKI_SA_SIGINFO SA_SIGINFO
975#define VKI_SA_NOCLDWAIT SA_NOCLDWAIT
976#define VKI_SA_RESTORER 0 /* Solaris doesn't have this */
977
978#define VKI_SIGHUP SIGHUP /* 1 */
979#define VKI_SIGINT SIGINT /* 2 */
980#define VKI_SIGQUIT SIGQUIT /* 3 */
981#define VKI_SIGILL SIGILL /* 4 */
982#define VKI_SIGTRAP SIGTRAP /* 5 */
983#define VKI_SIGABRT SIGABRT /* 6 */
984#define VKI_SIGEMT SIGEMT /* 7 */
985#define VKI_SIGFPE SIGFPE /* 8 */
986#define VKI_SIGKILL SIGKILL /* 9 */
987#define VKI_SIGBUS SIGBUS /* 10 */
988#define VKI_SIGSEGV SIGSEGV /* 11 */
989#define VKI_SIGSYS SIGSYS /* 12 */
990#define VKI_SIGPIPE SIGPIPE /* 13 */
991#define VKI_SIGALRM SIGALRM /* 14 */
992#define VKI_SIGTERM SIGTERM /* 15 */
993#define VKI_SIGUSR1 SIGUSR1 /* 16 */
994#define VKI_SIGUSR2 SIGUSR2 /* 17 */
995#define VKI_SIGCHLD SIGCHLD /* 18 */
996#define VKI_SIGPWR SIGPWR /* 19 */
997#define VKI_SIGWINCH SIGWINCH /* 20 */
998#define VKI_SIGURG SIGURG /* 21 */
999#define VKI_SIGIO SIGIO /* 22 */
1000#define VKI_SIGSTOP SIGSTOP /* 23 */
1001#define VKI_SIGTSTP SIGTSTP /* 24 */
1002#define VKI_SIGCONT SIGCONT /* 25 */
1003#define VKI_SIGTTIN SIGTTIN /* 26 */
1004#define VKI_SIGTTOU SIGTTOU /* 27 */
1005#define VKI_SIGVTALRM SIGVTALRM /* 28 */
1006#define VKI_SIGPROF SIGPROF /* 29 */
1007#define VKI_SIGXCPU SIGXCPU /* 30 */
1008#define VKI_SIGXFSZ SIGXFSZ /* 31 */
1009#define VKI_SIGWAITING SIGWAITING /* 32 */
1010#define VKI_SIGLWP SIGLWP /* 33 */
1011#define VKI_SIGFREEZE SIGFREEZE /* 34 */
1012#define VKI_SIGTHAW SIGTHAW /* 35 */
1013#define VKI_SIGCANCEL SIGCANCEL /* 36 */
1014#define VKI_SIGLOST SIGLOST /* 37 */
1015#define VKI_SIGXRES SIGXRES /* 38 */
1016#define VKI_SIGJVM1 SIGJVM1 /* 39 */
1017#define VKI_SIGJVM2 SIGJVM2 /* 40 */
1018/* Note that SIGRTMIN and SIGRTMAX are actually macros calling into
1019 libc's sysconf() which in turn calls into kernel. And it returns
1020 these _SIGRTM* values. So we are safe until someone rebuilds Solaris
1021 kernel with different values... */
1022#define VKI_SIGRTMIN _SIGRTMIN /* 41 */
1023#define VKI_SIGRTMAX _SIGRTMAX /* 72 */
1024
1025#define VKI_SIG_DFL SIG_DFL
1026#define VKI_SIG_IGN SIG_IGN
1027
1028#define VKI_SIG_BLOCK SIG_BLOCK
1029#define VKI_SIG_UNBLOCK SIG_UNBLOCK
1030#define VKI_SIG_SETMASK SIG_SETMASK
1031
1032
1033#include <sys/socket.h>
1034#define vki_sa_family_t sa_family_t
1035#define vki_sockaddr sockaddr
1036
1037#define vki_socklen_t socklen_t
1038
1039#define VKI_SOCK_STREAM SOCK_STREAM
1040
1041#define VKI_SO_TYPE SO_TYPE
1042#define VKI_SCM_RIGHTS SCM_RIGHTS
1043#define VKI_SOL_SOCKET SOL_SOCKET
1044
1045#define VKI_AF_UNIX AF_UNIX
1046#define VKI_AF_INET AF_INET
1047#define VKI_AF_INET6 AF_INET6
1048
1049#define vki_msghdr msghdr
1050#define vki_cmsghdr cmsghdr
1051
1052#define VKI_CMSG_ALIGN(a) _CMSG_DATA_ALIGN(a)
1053#define VKI_CMSG_DATA(cmsg) CMSG_DATA(cmsg)
1054#define VKI_CMSG_FIRSTHDR(mhdr) CMSG_FIRSTHDR(mhdr)
1055#define VKI_CMSG_NXTHDR(mhdr, cmsg) CMSG_NXTHDR(mhdr, cmsg)
1056
1057
1058#include <sys/socketvar.h>
1059#define VKI_SOV_DEFAULT SOV_DEFAULT
1060
1061
1062#include <sys/sockio.h>
1063#define VKI_SIOCGLIFNUM SIOCGLIFNUM
1064
1065
1066#if defined(SOLARIS_SPAWN_SYSCALL)
1067#include <sys/spawn_impl.h>
1068#define VKI_FA_CHDIR FA_CHDIR
1069#define VKI_FA_CLOSE FA_CLOSE
1070#define VKI_FA_CLOSEFROM FA_CLOSEFROM
1071#define VKI_FA_DUP2 FA_DUP2
1072#define VKI_FA_OPEN FA_OPEN
1073#define VKI_POSIX_SPAWN_NOEXECERR_NP POSIX_SPAWN_NOEXECERR_NP
1074#define VKI_POSIX_SPAWN_NOSIGCHLD_NP POSIX_SPAWN_NOSIGCHLD_NP
1075#define VKI_POSIX_SPAWN_RESETIDS POSIX_SPAWN_RESETIDS
1076#define VKI_POSIX_SPAWN_SETPGROUP POSIX_SPAWN_SETPGROUP
1077#define VKI_POSIX_SPAWN_SETSCHEDPARAM POSIX_SPAWN_SETSCHEDPARAM
1078#define VKI_POSIX_SPAWN_SETSCHEDULER POSIX_SPAWN_SETSCHEDULER
1079#define VKI_POSIX_SPAWN_SETSID_NP POSIX_SPAWN_SETSID_NP
1080#define VKI_POSIX_SPAWN_SETSIGDEF POSIX_SPAWN_SETSIGDEF
1081#define VKI_POSIX_SPAWN_SETSIGIGN_NP POSIX_SPAWN_SETSIGIGN_NP
1082#define VKI_POSIX_SPAWN_SETSIGMASK POSIX_SPAWN_SETSIGMASK
1083#define VKI_POSIX_SPAWN_SETVAMASK_NP POSIX_SPAWN_SETVAMASK_NP
1084#define VKI_POSIX_SPAWN_WAITPID_NP POSIX_SPAWN_WAITPID_NP
1085#define VKI_SPAWN_VERSION SPAWN_VERSION
1086#define vki_kfile_attr_t kfile_attr_t
1087#define vki_kspawn_attr_t kspawn_attr_t
1088#define vki_spawn_attr_t spawn_attr_t
1089#endif /* SOLARIS_SPAWN_SYSCALL */
1090
1091
1092#include <sys/stat.h>
1093#define vki_stat stat
1094#define vki_stat64 stat64
1095
1096#define st_atime_nsec st_atim.tv_nsec
1097#define st_mtime_nsec st_mtim.tv_nsec
1098#define st_ctime_nsec st_ctim.tv_nsec
1099
1100#define VKI_S_IFIFO S_IFIFO
1101#define VKI_S_ISUID S_ISUID
1102#define VKI_S_ISGID S_ISGID
1103
1104#define VKI_S_IRUSR S_IRUSR
1105#define VKI_S_IWUSR S_IWUSR
1106#define VKI_S_IXUSR S_IXUSR
1107#define VKI_S_IRGRP S_IRGRP
1108#define VKI_S_IWGRP S_IWGRP
1109#define VKI_S_IXGRP S_IXGRP
1110#define VKI_S_IROTH S_IROTH
1111#define VKI_S_IWOTH S_IWOTH
1112#define VKI_S_IXOTH S_IXOTH
1113
1114#define VKI_S_ISCHR S_ISCHR
1115#define VKI_S_ISDIR S_ISDIR
1116#define VKI_S_ISBLK S_ISBLK
1117#define VKI_S_ISREG S_ISREG
1118#define VKI_S_ISLNK S_ISLNK
1119
1120
1121#include <sys/statfs.h>
1122#define vki_statfs statfs
1123
1124
1125#include <sys/statvfs.h>
1126#define vki_statvfs statvfs
1127#define vki_statvfs64 statvfs64
1128
1129
1130#include <sys/stropts.h>
1131#define VKI_I_CANPUT I_CANPUT
1132#define VKI_I_PEEK I_PEEK
1133#define VKI_I_PUSH I_PUSH
1134#define VKI_I_STR I_STR
1135#define vki_strbuf strbuf
1136#define vki_strioctl strioctl
1137#define vki_strpeek strpeek
1138
1139
1140#include <sys/synch.h>
1141#define vki_lwp_mutex_t lwp_mutex_t
1142#define vki_lwp_cond_t lwp_cond_t
1143#define vki_lwp_sema_t lwp_sema_t
1144#define vki_lwp_rwlock_t lwp_rwlock_t
1145
1146/* Defines from the private sys/synch32.h header. */
1147#define vki_mutex_flag flags.flag1
1148#define vki_mutex_type flags.mbcp_type_un.mtype_rcount.count_type1
1149#define vki_mutex_rcount flags.mbcp_type_un.mtype_rcount.count_type2
1150#define vki_mutex_owner data
1151#define vki_mutex_lockw lock.lock64.pad[7]
1152#define vki_mutex_waiters lock.lock64.pad[6]
1153#define vki_mutex_ownerpid lock.lock32.ownerpid
1154
1155#define vki_cond_type flags.type
1156#define vki_cond_waiters_kernel flags.flag[3]
1157
1158#define vki_sema_count count
1159#define vki_sema_type type
1160#define vki_sema_waiters flags[7]
1161
1162#define vki_rwlock_readers readers
1163#define vki_rwlock_type type
1164#define vki_rwlock_owner readercv.data
1165#define vki_rwlock_ownerpid writercv.data
1166
1167
1168#include <sys/sysconfig.h>
1169#define VKI_CONFIG_OPEN_FILES _CONFIG_OPEN_FILES
1170
1171
1172#include <sys/sysi86.h>
1173#define VKI_SI86FPSTART SI86FPSTART
1174
1175
1176#include <sys/systeminfo.h>
1177#define VKI_SI_SYSNAME SI_SYSNAME
1178#define VKI_SI_HOSTNAME SI_HOSTNAME
1179#define VKI_SI_RELEASE SI_RELEASE
1180#define VKI_SI_VERSION SI_VERSION
1181#define VKI_SI_MACHINE SI_MACHINE
1182#define VKI_SI_ARCHITECTURE SI_ARCHITECTURE
1183#define VKI_SI_HW_SERIAL SI_HW_SERIAL
1184#define VKI_SI_HW_PROVIDER SI_HW_PROVIDER
1185#define VKI_SI_SRPC_DOMAIN SI_SRPC_DOMAIN
1186
1187#define VKI_SI_SET_HOSTNAME SI_SET_HOSTNAME
1188#define VKI_SI_SET_SRCP_DOMAIN SI_SET_SRPC_DOMAIN
1189
1190#define VKI_SI_PLATFORM SI_PLATFORM
1191#define VKI_SI_ISALIST SI_ISALIST
1192#define VKI_SI_DHCP_CACHE SI_DHCP_CACHE
1193#define VKI_SI_ARCHITECTURE_32 SI_ARCHITECTURE_32
1194#define VKI_SI_ARCHITECTURE_64 SI_ARCHITECTURE_64
1195#define VKI_SI_ARCHITECTURE_K SI_ARCHITECTURE_K
1196#define VKI_SI_ARCHITECTURE_NATIVE SI_ARCHITECTURE_NATIVE
1197
1198
1199#include <sys/termio.h>
1200#define vki_termio termio
1201
1202
1203#include <sys/termios.h>
1204#define vki_termios termios
1205#define VKI_TCGETA TCGETA
1206#define VKI_TCGETS TCGETS
1207#define VKI_TCSETS TCSETS
1208#define VKI_TCSETSF TCSETSF
1209#define VKI_TCSETSW TCSETSW
1210#define VKI_TIOCGPGRP TIOCGPGRP
1211#define VKI_TIOCGSID TIOCGSID
1212#define VKI_TIOCGWINSZ TIOCGWINSZ
1213#define VKI_TIOCNOTTY TIOCNOTTY
1214#define VKI_TIOCSCTTY TIOCSCTTY
1215#define VKI_TIOCSPGRP TIOCSPGRP
1216#define VKI_TIOCSWINSZ TIOCSWINSZ
1217#define vki_winsize winsize
1218
1219
1220#include <sys/time.h>
1221#define VKI_CLOCK_MONOTONIC CLOCK_MONOTONIC
1222
1223#define vki_clockid_t clockid_t
1224#define vki_timespec timespec
1225#define vki_timespec_t timespec_t
1226#define vki_timeval timeval
1227#define vki_timezone timezone
1228#define vki_itimerspec itimerspec
1229#define vki_itimerval itimerval
1230
1231
1232#include <sys/times.h>
1233#define vki_tms tms
1234
1235
1236#include <sys/tsol/label_macro.h>
1237#define vki_bslabel_t bslabel_t
1238
1239
1240/* Do not include sys/tsol/tndb.h if a C++ compiler is used to build a file
1241 which includes vki-solaris.h. This cannot be done because the tndb.h
1242 header file uses the template keyword as a member name (on illumos). */
1243#if !defined(__cplusplus)
1244#include <sys/tsol/tndb.h>
1245#define VKI_TNDB_DELETE TNDB_DELETE
1246#define VKI_TNDB_FLUSH TNDB_FLUSH
1247#define VKI_TNDB_GET TNDB_GET
1248#if defined(SOLARIS_TNDB_GET_TNIP)
1249#define VKI_TNDB_GET_TNIP TNDB_GET_TNIP
1250#endif /* SOLARIS_TNDB_GET_TNIP */
1251#define VKI_TNDB_LOAD TNDB_LOAD
1252#define vki_tsol_mlpent_t tsol_mlpent_t
1253#define vki_tsol_rhent_t tsol_rhent_t
1254#define vki_tsol_tpent_t tsol_tpent_t
1255#endif /* !__cplusplus */
1256
1257
1258#include <sys/tsol/tsyscall.h>
1259#define VKI_TSOL_FGETLABEL TSOL_FGETLABEL
1260#define VKI_TSOL_GETLABEL TSOL_GETLABEL
1261#define VKI_TSOL_TNMLP TSOL_TNMLP
1262#define VKI_TSOL_TNRH TSOL_TNRH
1263#define VKI_TSOL_TNRHTP TSOL_TNRHTP
1264#define VKI_TSOL_SYSLABELING TSOL_SYSLABELING
1265#if defined(SOLARIS_TSOL_CLEARANCE)
1266#define VKI_TSOL_GETCLEARANCE TSOL_GETCLEARANCE
1267#define VKI_TSOL_SETCLEARANCE TSOL_SETCLEARANCE
1268#endif /* SOLARIS_TSOL_CLEARANCE */
1269
1270
1271#include <sys/ttold.h>
1272#define vki_sgttyb sgttyb
1273
1274
1275#include <sys/ucontext.h>
1276/* This section also contains items defined in sys/regset.h, this file
1277 is directly included in sys/ucontext.h. */
1278#if defined(VGP_x86_solaris)
1279#define VKI_SS SS
1280#define VKI_UESP UESP
1281#define VKI_EFL EFL
1282#define VKI_CS CS
1283#define VKI_EIP EIP
1284#define VKI_ERR 13 /* ERR */
1285#define VKI_TRAPNO TRAPNO
1286#define VKI_EAX EAX
1287#define VKI_ECX ECX
1288#define VKI_EDX EDX
1289#define VKI_EBX EBX
1290#define VKI_ESP ESP
1291#define VKI_EBP EBP
1292#define VKI_ESI ESI
1293#define VKI_EDI EDI
1294#define VKI_DS DS
1295#define VKI_ES ES
1296#define VKI_FS FS
1297#define VKI_GS GS
1298
1299/* Definitions for compatibility with amd64-solaris. */
1300#define VKI_REG_ERR VKI_ERR
1301#define VKI_REG_TRAPNO VKI_TRAPNO
1302
1303#define VKI_EFLAGS_ID_BIT (1 << 21)
1304
1305#elif defined(VGP_amd64_solaris)
1306#define VKI_REG_GSBASE REG_GSBASE
1307#define VKI_REG_FSBASE REG_FSBASE
1308#define VKI_REG_DS REG_DS
1309#define VKI_REG_ES REG_ES
1310#define VKI_REG_GS REG_GS
1311#define VKI_REG_FS REG_FS
1312#define VKI_REG_SS REG_SS
1313#define VKI_REG_RSP REG_RSP
1314#define VKI_REG_RFL REG_RFL
1315#define VKI_REG_CS REG_CS
1316#define VKI_REG_RIP REG_RIP
1317#define VKI_REG_ERR REG_ERR
1318#define VKI_REG_TRAPNO REG_TRAPNO
1319#define VKI_REG_RAX REG_RAX
1320#define VKI_REG_RCX REG_RCX
1321#define VKI_REG_RDX REG_RDX
1322#define VKI_REG_RBX REG_RBX
1323#define VKI_REG_RBP REG_RBP
1324#define VKI_REG_RSI REG_RSI
1325#define VKI_REG_RDI REG_RDI
1326#define VKI_REG_R8 REG_R8
1327#define VKI_REG_R9 REG_R9
1328#define VKI_REG_R10 REG_R10
1329#define VKI_REG_R11 REG_R11
1330#define VKI_REG_R12 REG_R12
1331#define VKI_REG_R13 REG_R13
1332#define VKI_REG_R14 REG_R14
1333#define VKI_REG_R15 REG_R15
1334
1335#define VKI_RFLAGS_ID_BIT (1 << 21)
1336
1337#else
1338#error "Unknown platform"
1339#endif
1340
1341#define vki_fpregset_t fpregset_t
1342
1343/* Don't polute global namespace so much. */
1344#undef r_r0
1345#undef r_r1
1346#undef r_fp
1347#undef r_sp
1348#undef r_pc
1349#undef r_ps
1350#undef ERR
1351
1352#if defined(VGP_x86_solaris)
1353/* The ucontext structure as defined in the SYSV ABI for Intel386. Illumos
1354 contains exactly this definition. Solaris 11 utilizes two uc_filler values
1355 -> "xrs_t uc_xrs; long uc_filler[3];". The xrs_t structure is used for the
1356 AVX support. We define our own ucontext structure because all five
1357 uc_filler values need to be available in VG_(save_context). Note that
1358 Valgrind doesn't support AVX on the x86 platform. */
1359typedef struct sysv_ucontext sysv_ucontext_t;
1360struct sysv_ucontext {
1361 unsigned long uc_flags;
1362 sysv_ucontext_t *uc_link;
1363 sigset_t uc_sigmask;
1364 stack_t uc_stack;
1365 mcontext_t uc_mcontext;
1366 long uc_filler[5];
1367};
1368#define VKI_UC_GUEST_CC_OP(uc) (*(UWord*)&(uc)->uc_filler[0])
1369#define VKI_UC_GUEST_CC_NDEP(uc) (*(UWord*)&(uc)->uc_filler[1])
1370#define VKI_UC_GUEST_CC_DEP1(uc) (*(UWord*)&(uc)->uc_filler[2])
1371#define VKI_UC_GUEST_CC_DEP2(uc) (*(UWord*)&(uc)->uc_filler[3])
1372#define VKI_UC_GUEST_EFLAGS_NEG(uc) \
1373 (*(UWord*)&(uc)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.__pad[0])
1374#define VKI_UC_GUEST_EFLAGS_CHECKSUM(uc) \
1375 (*(UWord*)&(uc)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.__pad[1])
1376#define VKI_UC_SIGNO(uc) (*(UWord*)&(uc)->uc_filler[4])
1377#define VKI_UC_SIGNO_CONST(uc) (*(const UWord*)&(uc)->uc_filler[4])
1378
1379#define vki_ucontext_t sysv_ucontext_t
1380#define vki_ucontext sysv_ucontext
1381
1382#elif defined(VGP_amd64_solaris)
1383/* The ucontext structure on Solaris has only 3 elements available in uc_filler
1384 which is not enough to store all required information. Therefore padding
1385 area in mcontext's FPU regset is used. */
1386#define vki_ucontext ucontext
1387#define vki_ucontext_t ucontext_t
1388#define VKI_UC_MC_FP_FX_IGN2(uc) \
1389 (uc)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.__fx_ign2
1390#define VKI_UC_GUEST_CC_OP(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[0])
1391#define VKI_UC_GUEST_CC_NDEP(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[1])
1392#define VKI_UC_GUEST_CC_DEP1(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[2])
1393#define VKI_UC_GUEST_CC_DEP2(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[3])
1394#define VKI_UC_GUEST_RFLAGS_NEG(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[4])
1395#define VKI_UC_GUEST_RFLAGS_CHECKSUM(uc) \
1396 (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[5])
1397#define VKI_UC_SIGNO(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[6])
1398#define VKI_UC_SIGNO_CONST(uc) (*(const UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[6])
1399
1400#else
1401#error "Unknown platform"
1402#endif
1403
1404#define vki_fpchip_state fpchip_state
1405
1406#define VKI_GETCONTEXT GETCONTEXT
1407#define VKI_SETCONTEXT SETCONTEXT
1408#define VKI_GETUSTACK GETUSTACK
1409#define VKI_SETUSTACK SETUSTACK
1410
1411#define VKI_UC_SIGMASK UC_SIGMASK
1412#define VKI_UC_STACK UC_STACK
1413#define VKI_UC_CPU UC_CPU
1414#define VKI_UC_FPU UC_FPU
1415#define VKI_UC_ALL UC_ALL
1416
1417#include <sys/uio.h>
1418#define vki_iovec iovec
1419
1420
1421#include <sys/un.h>
1422#define vki_sockaddr_un sockaddr_un
1423
1424
1425#if defined(SOLARIS_UUIDSYS_SYSCALL)
1426#include <sys/uuid.h>
1427#define vki_uuid uuid
1428#endif /* SOLARIS_UUIDSYS_SYSCALL */
1429
1430
1431#include <sys/utsname.h>
1432#define vki_utsname utsname
1433/* Add another alias for utsname, used in syswrap-generic.c. */
1434#define vki_new_utsname utsname
1435
1436
1437#include <sys/vm_usage.h>
1438#define vki_vmusage_t vmusage_t
1439
1440
1441#include <sys/wait.h>
1442#define VKI_WEXITED WEXITED
1443#define VKI_WTRAPPED WTRAPPED
1444
1445#define VKI_WSTOPFLG WSTOPFLG
1446#define VKI_WCONTFLG WCONTFLG
1447#define VKI_WCOREFLG WCOREFLG
1448
1449
1450#include <sys/zone.h>
1451#define VKI_ZONE_ADD_DATALINK ZONE_ADD_DATALINK
1452#define VKI_ZONE_ATTR_NAME ZONE_ATTR_NAME
1453#define VKI_ZONE_BOOT ZONE_BOOT
1454#define VKI_ZONE_CHECK_DATALINK ZONE_CHECK_DATALINK
1455#define VKI_ZONE_CREATE ZONE_CREATE
1456#define VKI_ZONE_DEL_DATALINK ZONE_DEL_DATALINK
1457#define VKI_ZONE_DESTROY ZONE_DESTROY
1458#define VKI_ZONE_ENTER ZONE_ENTER
1459#define VKI_ZONE_GETATTR ZONE_GETATTR
1460#define VKI_ZONE_LIST ZONE_LIST
1461#define VKI_ZONE_LIST_DATALINK ZONE_LIST_DATALINK
1462#define VKI_ZONE_LOOKUP ZONE_LOOKUP
1463#define VKI_ZONE_SETATTR ZONE_SETATTR
1464#define VKI_ZONE_SHUTDOWN ZONE_SHUTDOWN
1465#if defined(SOLARIS_ZONE_DEFUNCT)
1466#define VKI_ZONE_GETATTR_DEFUNCT ZONE_GETATTR_DEFUNCT
1467#define VKI_ZONE_LIST_DEFUNCT ZONE_LIST_DEFUNCT
1468#endif /* SOLARIS_ZONE_DEFUNCT */
1469#define VKI_ZONENAME_MAX ZONENAME_MAX
1470#define vki_zone_def zone_def
1471#define vki_zoneid_t zoneid_t
1472
1473
1474/* from <sys/ucred.h> which is consolidation private */
1475#define VKI_UCREDSYS_UCREDGET 0
1476#define VKI_UCREDSYS_GETPEERUCRED 1
1477struct ucred_s {
1478 vki_uint32_t uc_size; /* Size of the full structure */
1479 vki_uint32_t uc_credoff; /* Credential offset */
1480 vki_uint32_t uc_privoff; /* Privilege offset */
1481 vki_pid_t uc_pid; /* Process id */
1482 vki_uint32_t uc_audoff; /* Audit info offset */
1483 vki_zoneid_t uc_zoneid; /* Zone id */
1484 vki_projid_t uc_projid; /* Project id */
1485 vki_uint32_t uc_labeloff; /* label offset */
1486};
1487
1488
1489/* from sys/old_procfs.h which clashes with sys/procfs.h */
1490
1491#define VKI_ELF_OLD_PR_PCINVAL 0x0080
1492
1493typedef struct vki_elf_prpsinfo {
1494 char pr_state; /* numeric process state (see pr_sname) */
1495 char pr_sname; /* printable character representing pr_state */
1496 char pr_zomb; /* !=0: process terminated but not waited for */
1497 char pr_nice; /* nice for cpu usage */
1498 vki_uint_t pr_flag; /* process flags */
1499 vki_uid_t pr_uid; /* real user id */
1500 vki_gid_t pr_gid; /* real group id */
1501 vki_pid_t pr_pid; /* unique process id */
1502 vki_pid_t pr_ppid; /* process id of parent */
1503 vki_pid_t pr_pgrp; /* pid of process group leader */
1504 vki_pid_t pr_sid; /* session id */
1505 vki_caddr_t pr_addr; /* physical address of process */
1506 vki_size_t pr_size; /* size of process image in pages */
1507 vki_size_t pr_rssize; /* resident set size in pages */
1508 vki_caddr_t pr_wchan; /* wait addr for sleeping process */
1509 vki_timespec_t pr_start; /* process start time, sec+nsec since epoch */
1510 vki_timespec_t pr_time; /* usr+sys cpu time for this process */
1511 int pr_pri; /* priority, high value is high priority */
1512 char pr_oldpri; /* pre-SVR4, low value is high priority */
1513 char pr_cpu; /* pre-SVR4, cpu usage for scheduling */
1514 vki_o_dev_t pr_ottydev; /* short tty device number */
1515 vki_dev_t pr_lttydev; /* controlling tty device (PRNODEV if none) */
1516 char pr_clname[8]; /* scheduling class name */
1517 char pr_fname[16]; /* last component of execed pathname */
1518 char pr_psargs[80]; /* initial characters of arg list */
1519 short pr_syscall; /* system call number (if in syscall) */
1520 short pr_fill;
1521 vki_timespec_t pr_ctime; /* usr+sys cpu time for reaped children */
1522 vki_size_t pr_bysize; /* size of process image in bytes */
1523 vki_size_t pr_byrssize; /* resident set size in bytes */
1524 int pr_argc; /* initial argument count */
1525 char **pr_argv; /* initial argument vector */
1526 char **pr_envp; /* initial environment vector */
1527 int pr_wstat; /* if zombie, the wait() status */
1528 /* The following percent numbers are 16-bit binary */
1529 /* fractions [0 .. 1] with the binary point to the */
1530 /* right of the high-order bit (one == 0x8000) */
1531 ushort_t pr_pctcpu; /* % of recent cpu time, one or all lwps */
1532 ushort_t pr_pctmem; /* % of of system memory used by the process */
1533 vki_uid_t pr_euid; /* effective user id */
1534 vki_gid_t pr_egid; /* effective group id */
1535 vki_id_t pr_aslwpid; /* historical; now always zero */
1536 char pr_dmodel; /* data model of the process */
1537 char pr_pad[3];
1538 int pr_filler[6]; /* for future expansion */
1539} vki_elf_prpsinfo_t;
1540
1541typedef struct vki_elf_prstatus {
1542 int pr_flags; /* Flags (see below) */
1543 short pr_why; /* Reason for process stop (if stopped) */
1544 short pr_what; /* More detailed reason */
1545 vki_siginfo_t pr_info; /* Info associated with signal or fault */
1546 short pr_cursig; /* Current signal */
1547 ushort_t pr_nlwp; /* Number of lwps in the process */
1548 vki_sigset_t pr_sigpend; /* Set of signals pending to the process */
1549 vki_sigset_t pr_sighold; /* Set of signals held (blocked) by the lwp */
1550 struct vki_sigaltstack pr_altstack; /* Alternate signal stack info */
1551 struct sigaction pr_action; /* Signal action for current signal */
1552 vki_pid_t pr_pid; /* Process id */
1553 vki_pid_t pr_ppid; /* Parent process id */
1554 vki_pid_t pr_pgrp; /* Process group id */
1555 vki_pid_t pr_sid; /* Session id */
1556 vki_timespec_t pr_utime; /* Process user cpu time */
1557 vki_timespec_t pr_stime; /* Process system cpu time */
1558 vki_timespec_t pr_cutime; /* Sum of children's user times */
1559 vki_timespec_t pr_cstime; /* Sum of children's system times */
1560 char pr_clname[PRCLSZ]; /* Scheduling class name */
1561 short pr_syscall; /* System call number (if in syscall) */
1562 short pr_nsysarg; /* Number of arguments to this syscall */
1563 long pr_sysarg[PRSYSARGS]; /* Arguments to this syscall */
1564 vki_id_t pr_who; /* Specific lwp identifier */
1565 vki_sigset_t pr_lwppend; /* Set of signals pending to the lwp */
1566 struct vki_ucontext *pr_oldcontext; /* Address of previous ucontext */
1567 vki_caddr_t pr_brkbase; /* Address of the process heap */
1568 vki_size_t pr_brksize; /* Size of the process heap, in bytes */
1569 vki_caddr_t pr_stkbase; /* Address of the process stack */
1570 vki_size_t pr_stksize; /* Size of the process stack, in bytes */
1571 short pr_processor; /* processor which last ran this LWP */
1572 short pr_bind; /* processor LWP bound to or PBIND_NONE */
1573 long pr_instr; /* Current instruction */
1574 vki_prgregset_t pr_reg; /* General registers */
1575} vki_elf_prstatus_t;
1576
1577
1578/* Signal frames. */
1579#if defined(VGP_x86_solaris)
1580struct vki_sigframe {
1581 /* First four words look like a call to a 3-arg x86 function. */
1582 void *return_addr;
1583 int a1_signo;
1584 vki_siginfo_t *a2_siginfo;
1585 vki_ucontext_t *a3_ucontext;
1586 /* Saved ucontext and siginfo. */
1587 vki_ucontext_t ucontext;
1588 vki_siginfo_t siginfo;
1589};
1590
1591#elif defined(VGP_amd64_solaris)
1592struct vki_sigframe {
1593 void *return_addr;
1594 long a1_signo;
1595 vki_siginfo_t *a2_siginfo;
1596 /* Saved ucontext and siginfo. */
1597 vki_ucontext_t ucontext;
1598 vki_siginfo_t siginfo;
1599};
1600
1601#else
1602#error "Unknown platform"
1603#endif
1604typedef struct vki_sigframe vki_sigframe_t;
1605
1606#endif // __VKI_SOLARIS_H
1607
1608/*--------------------------------------------------------------------*/
1609/*--- end ---*/
1610/*--------------------------------------------------------------------*/