Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 09:14:24

0001 
0002 /*--------------------------------------------------------------------*/
0003 /*--- Solaris-specific kernel interface.             vki-solaris.h ---*/
0004 /*--------------------------------------------------------------------*/
0005 
0006 /*
0007    This file is part of Valgrind, a dynamic binary instrumentation
0008    framework.
0009 
0010    Copyright (C) 2011-2017 Petr Pavlu
0011       setup@dagobah.cz
0012 
0013    This program is free software; you can redistribute it and/or
0014    modify it under the terms of the GNU General Public License as
0015    published by the Free Software Foundation; either version 2 of the
0016    License, or (at your option) any later version.
0017 
0018    This program is distributed in the hope that it will be useful, but
0019    WITHOUT ANY WARRANTY; without even the implied warranty of
0020    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0021    General Public License for more details.
0022 
0023    You should have received a copy of the GNU General Public License
0024    along with this program; if not, see <http://www.gnu.org/licenses/>.
0025 
0026    The GNU General Public License is contained in the file COPYING.
0027 */
0028 
0029 /* Copyright 2013-2017, Ivo Raisr <ivosh@ivosh.net> */
0030 
0031 /* Copyright 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
0032 
0033 /* The purpose of this file is described in vki-linux.h.
0034 
0035    To avoid any copyright issues, vki-solaris.h follows the same approach as
0036    vki-darwin.h (not copying anything from kernel header files but instead
0037    just including them).
0038  */
0039 
0040 #ifndef __VKI_SOLARIS_H
0041 #define __VKI_SOLARIS_H
0042 
0043 #include "config.h"
0044 
0045 /* _XOPEN_SOURCE equal to at least '500' is required so that various system
0046    structures have all necessary attributes (for example struct msghdr). */
0047 #if !defined(_XOPEN_SOURCE)
0048 /* Compiler versions c99 and higher require _XOPEN_SOURCE at least '600'. */
0049 #   if (__STDC_VERSION__ - 0 >= 199901L)
0050 #      define _XOPEN_SOURCE 600
0051 #   else
0052 #      define _XOPEN_SOURCE 500
0053 #   endif
0054 #elif (_XOPEN_SOURCE - 0 != 500) && (_XOPEN_SOURCE - 0 != 600) && (_XOPEN_SOURCE - 0 != 700)
0055 #   error "Compiler or options invalid for including this header file."
0056 #endif /* _XOPEN_SOURCE */
0057 
0058 #define __EXTENSIONS__ 1
0059 /* assert _FILE_OFFSET_BITS == 32 */
0060 
0061 #define VKI_PAGE_SHIFT 12
0062 #define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
0063 #define VKI_PAGEMASK (~VKI_PAGEOFFSET)
0064 #define VKI_PAGEOFFSET (VKI_PAGE_SIZE - 1)
0065 #define VKI_MAX_PAGE_SHIFT VKI_PAGE_SHIFT
0066 #define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
0067 
0068 
0069 #include <sys/types.h>
0070 #define VKI_UINT_MAX UINT_MAX
0071 #define VKI_UINTPTR_MAX UINTPTR_MAX
0072 #define vki_boolean_t boolean_t
0073 #define vki_datalink_id_t datalink_id_t
0074 #define vki_uint_t uint_t
0075 #define vki_uint32_t uint32_t
0076 #define vki_uint64_t uint64_t
0077 #define vki_ulong_t ulong_t
0078 #define vki_caddr_t caddr_t
0079 #define vki_dev_t dev_t
0080 #define vki_off_t off_t
0081 #define vki_id_t id_t
0082 #define vki_key_t key_t
0083 #define vki_mode_t mode_t
0084 #define vki_o_dev_t o_dev_t
0085 #define vki_projid_t projid_t
0086 #define vki_uid_t uid_t
0087 #define vki_gid_t gid_t
0088 #define vki_pid_t pid_t
0089 #define vki_size_t size_t
0090 #define vki_time_t time_t
0091 #define vki_timer_t timer_t
0092 #define vki_uchar_t uchar_t
0093 
0094 typedef uint32_t vki_u32;
0095 
0096 
0097 #include <sys/types32.h>
0098 #define vki_size32_t size32_t
0099 
0100 
0101 #include <fcntl.h>
0102 #define VKI_SEEK_SET SEEK_SET
0103 
0104 
0105 #include <limits.h>
0106 #define VKI_NGROUPS_MAX NGROUPS_MAX
0107 #define VKI_PATH_MAX PATH_MAX
0108 /* Used in launcher-linux.c which we share with Linux port. */
0109 #define VKI_BINPRM_BUF_SIZE VKI_PATH_MAX
0110 
0111 
0112 #include <ucred.h>
0113 #define vki_ucred_t ucred_t
0114 
0115 
0116 #include <unistd.h>
0117 #define VKI_R_OK R_OK
0118 #define VKI_W_OK W_OK
0119 #define VKI_X_OK X_OK
0120 
0121 
0122 #include <bsm/audit.h>
0123 #define VKI_A_GETAMASK A_GETAMASK
0124 #define VKI_A_GETCAR A_GETCAR
0125 #define VKI_A_GETCLASS A_GETCLASS
0126 #define VKI_A_GETCOND A_GETCOND
0127 #define VKI_A_GETCWD A_GETCWD
0128 #define VKI_A_GETKAUDIT A_GETKAUDIT
0129 #define VKI_A_GETKMASK A_GETKMASK
0130 #define VKI_A_GETPINFO A_GETPINFO
0131 #define VKI_A_GETPINFO_ADDR A_GETPINFO_ADDR
0132 #define VKI_A_GETPOLICY A_GETPOLICY
0133 #define VKI_A_GETQCTRL A_GETQCTRL
0134 #if defined(SOLARIS_AUDITON_STAT)
0135 #define VKI_A_GETSTAT A_GETSTAT
0136 #define VKI_A_SETSTAT A_SETSTAT
0137 #endif /* SOLARIS_AUDITON_STAT */
0138 #define VKI_A_SETAMASK A_SETAMASK
0139 #define VKI_A_SETCLASS A_SETCLASS
0140 #define VKI_A_SETCOND A_SETCOND
0141 #define VKI_A_SETKAUDIT A_SETKAUDIT
0142 #define VKI_A_SETKMASK A_SETKMASK
0143 #define VKI_A_SETPMASK A_SETPMASK
0144 #define VKI_A_SETPOLICY A_SETPOLICY
0145 #define VKI_A_SETQCTRL A_SETQCTRL
0146 #define VKI_A_SETSMASK A_SETSMASK
0147 #define VKI_A_SETUMASK A_SETUMASK
0148 #define VKI_BSM_AUDIT BSM_AUDIT
0149 #define VKI_BSM_AUDITCTL BSM_AUDITCTL
0150 #define VKI_BSM_AUDITDOOR BSM_AUDITDOOR
0151 #define VKI_BSM_GETAUDIT BSM_GETAUDIT
0152 #define VKI_BSM_GETAUDIT_ADDR BSM_GETAUDIT_ADDR
0153 #define VKI_BSM_GETAUID BSM_GETAUID
0154 #define VKI_BSM_SETAUDIT BSM_SETAUDIT
0155 #define VKI_BSM_SETAUDIT_ADDR BSM_SETAUDIT_ADDR
0156 #define VKI_BSM_SETAUID BSM_SETAUID
0157 #define vki_au_evclass_map_t au_evclass_map_t
0158 #define vki_au_id_t au_id_t
0159 #define vki_au_mask_t au_mask_t
0160 #define vki_au_qctrl au_qctrl
0161 #define vki_auditinfo_t auditinfo_t
0162 #define vki_auditinfo_addr_t auditinfo_addr_t
0163 #define vki_auditpinfo auditpinfo
0164 #define vki_auditpinfo_addr auditpinfo_addr
0165 #if defined(SOLARIS_AUDITON_STAT)
0166 #define vki_au_stat_t au_stat_t
0167 #endif /* SOLARIS_AUDITON_STAT */
0168 
0169 
0170 #include <sys/psw.h>
0171 #define VKI_PSL_USER PSL_USER
0172 
0173 
0174 #include <ia32/sys/trap.h>
0175 #define VKI_T_BPTFLT T_BPTFLT
0176 
0177 
0178 /* From <libc/inc/libc_int.h> which is consolidation private. */
0179 #define VKI_CI_BIND_GUARD 4
0180 #define VKI_CI_BIND_CLEAR 5
0181 #define VKI_THR_FLG_RTLD 0x01
0182 
0183 typedef struct {
0184    int ci_tag;
0185    union {
0186       int (*ci_func)(int);
0187       long ci_val;
0188       char *ci_ptr;
0189    } vki_ci_un;
0190 } vki_Lc_interface;
0191 
0192 
0193 /* From <libc/port/gen/getxby_door.h> which is consolidation private. */
0194 #if defined(SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE)
0195 #define VKI_NAME_SERVICE_DOOR "/system/volatile/name_service_door"
0196 #else
0197 #define VKI_NAME_SERVICE_DOOR "/var/run/name_service_door"
0198 #endif /* SOLARIS_NSCD_DOOR_SYSTEM_VOLATILE */
0199 
0200 
0201 #include <nfs/nfs.h>
0202 #include <nfs/nfssys.h>
0203 #define VKI_NFS_REVAUTH NFS_REVAUTH
0204 #define vki_nfs_revauth_args nfs_revauth_args
0205 
0206 
0207 #include <net/if.h>
0208 #define vki_ifconf ifconf
0209 #define vki_ifreq ifreq
0210 #define vki_lifconf lifconf
0211 #define vki_lifnum lifnum
0212 #define vki_lifreq lifreq
0213 
0214 
0215 #include <netinet/in.h>
0216 #define VKI_IPPROTO_TCP IPPROTO_TCP
0217 #define vki_in_addr in_addr
0218 #define vki_sockaddr_in sockaddr_in
0219 #define vki_sockaddr_in6 sockaddr_in6
0220 
0221 #include <netinet/tcp.h>
0222 #define VKI_TCP_NODELAY TCP_NODELAY
0223 
0224 
0225 /* Do not include nss_dbdefs.h if a C++ compiler is used to build a file
0226    which includes vki-solaris.h. This cannot be done because the nss_dbdefs.h
0227    header file uses 'delete' keyword as a method name. */
0228 #if !defined(__cplusplus)
0229 #include <nss_dbdefs.h>
0230 #define VKI_NSCD_CALLCAT_APP NSCD_CALLCAT_APP
0231 #define VKI_NSCDV2CATMASK NSCDV2CATMASK
0232 #define vki_nss_dbd_t nss_dbd_t
0233 #define vki_nss_pheader_t nss_pheader_t
0234 #endif /* !__cplusplus */
0235 
0236 
0237 /* From <repcache_protocol.h> which is consolidation private. */
0238 #include "vki-solaris-repcache.h"
0239 
0240 #include <sys/acl.h>
0241 #define vki_aclent_t aclent_t
0242 #define vki_ace_t ace_t
0243 #define VKI_GETACL GETACL
0244 #define VKI_SETACL SETACL
0245 #define VKI_GETACLCNT GETACLCNT
0246 #define VKI_ACE_GETACL ACE_GETACL
0247 #define VKI_ACE_SETACL ACE_SETACL
0248 #define VKI_ACE_GETACLCNT ACE_GETACLCNT
0249 
0250 
0251 #include <sys/auxv.h>
0252 #define vki_auxv_t auxv_t
0253 #define VKI_AT_NULL AT_NULL
0254 #define VKI_AT_PHDR AT_PHDR
0255 #define VKI_AT_PAGESZ AT_PAGESZ
0256 #define VKI_AT_BASE AT_BASE
0257 #define VKI_AT_FLAGS AT_FLAGS
0258 #define VKI_AT_ENTRY AT_ENTRY
0259 #define VKI_AT_SUN_PLATFORM AT_SUN_PLATFORM
0260 #define VKI_AT_SUN_HWCAP AT_SUN_HWCAP
0261 #define VKI_AT_SUN_EXECNAME AT_SUN_EXECNAME
0262 #define VKI_AT_SUN_AUXFLAGS AT_SUN_AUXFLAGS
0263 #if defined(SOLARIS_RESERVE_SYSSTAT_ADDR)
0264 #define VKI_AT_SUN_SYSSTAT_ADDR AT_SUN_SYSSTAT_ADDR
0265 #endif
0266 #if defined(SOLARIS_RESERVE_SYSSTAT_ZONE_ADDR)
0267 #define VKI_AT_SUN_SYSSTAT_ZONE_ADDR AT_SUN_SYSSTAT_ZONE_ADDR
0268 #endif
0269 
0270 #define VKI_AF_SUN_HWCAPVERIFY AF_SUN_HWCAPVERIFY
0271 
0272 
0273 #include <sys/auxv_386.h>
0274 #define VKI_AV_386_FPU AV_386_FPU
0275 #define VKI_AV_386_TSC AV_386_TSC
0276 #define VKI_AV_386_CX8 AV_386_CX8
0277 #define VKI_AV_386_SEP AV_386_SEP
0278 #define VKI_AV_386_AMD_SYSC AV_386_AMD_SYSC
0279 #define VKI_AV_386_CMOV AV_386_CMOV
0280 #define VKI_AV_386_MMX AV_386_MMX
0281 #define VKI_AV_386_FXSR AV_386_FXSR
0282 #define VKI_AV_386_SSE AV_386_SSE
0283 #define VKI_AV_386_SSE2 AV_386_SSE2
0284 #define VKI_AV_386_SSE3 AV_386_SSE3
0285 #define VKI_AV_386_CX16 AV_386_CX16
0286 #define VKI_AV_386_AHF AV_386_AHF
0287 #define VKI_AV_386_TSCP AV_386_TSCP
0288 #define VKI_AV_386_POPCNT AV_386_POPCNT
0289 #define VKI_AV_386_AMD_LZCNT AV_386_AMD_LZCNT
0290 #define VKI_AV_386_SSSE3 AV_386_SSSE3
0291 #define VKI_AV_386_SSE4_1 AV_386_SSE4_1
0292 #define VKI_AV_386_SSE4_2 AV_386_SSE4_2
0293 #define VKI_AV_386_AES AV_386_AES
0294 #define VKI_AV_386_PCLMULQDQ AV_386_PCLMULQDQ
0295 #define VKI_AV_386_XSAVE AV_386_XSAVE
0296 
0297 
0298 #include <sys/corectl.h>
0299 #define VKI_CC_CONTENT_ANON CC_CONTENT_ANON
0300 #define VKI_CC_CONTENT_DATA CC_CONTENT_DATA
0301 #define VKI_CC_CONTENT_DISM CC_CONTENT_DISM
0302 #define VKI_CC_CONTENT_HEAP CC_CONTENT_HEAP
0303 #define VKI_CC_CONTENT_ISM CC_CONTENT_ISM
0304 #define VKI_CC_CONTENT_RODATA CC_CONTENT_RODATA
0305 #define VKI_CC_CONTENT_SHANON CC_CONTENT_SHANON
0306 #define VKI_CC_CONTENT_SHM CC_CONTENT_SHM
0307 #define VKI_CC_CONTENT_STACK CC_CONTENT_STACK
0308 #define VKI_CC_CONTENT_TEXT CC_CONTENT_TEXT
0309 #define vki_core_content_t core_content_t
0310 
0311 
0312 /* From <sys/crypto/elfsign.h> which is consolidation private. */
0313 #define VKI__PATH_KCFD_DOOR "/system/volatile/kcfd_door"
0314 typedef enum vki_ELFsign_status_e {
0315    VKI_ELFSIGN_UNKNOWN,
0316    VKI_ELFSIGN_SUCCESS,
0317    VKI_ELFSIGN_FAILED,
0318    VKI_ELFSIGN_NOTSIGNED,
0319    VKI_ELFSIGN_INVALID_CERTPATH,
0320    VKI_ELFSIGN_INVALID_ELFOBJ,
0321    VKI_ELFSIGN_UNAVAILABLE
0322 } vki_ELFsign_status_t;
0323 typedef struct vki_kcf_door_arg_s {
0324    short         da_version;
0325    vki_boolean_t da_iskernel;
0326    union {
0327       char filename[MAXPATHLEN];    /* For request */
0328 
0329       struct vki_kcf_door_result_s {    /* For response */
0330          vki_ELFsign_status_t status;
0331          vki_uint32_t         siglen;
0332          vki_uchar_t          signature[1];
0333       } result;
0334    } vki_da_u;
0335 } vki_kcf_door_arg_t;
0336 
0337 
0338 #include <sys/crypto/ioctl.h>
0339 #define VKI_CRYPTO_SUCCESS CRYPTO_SUCCESS
0340 #define VKI_CRYPTO_GET_PROVIDER_LIST CRYPTO_GET_PROVIDER_LIST
0341 #define vki_crypto_provider_id_t crypto_provider_id_t
0342 #define vki_crypto_provider_entry_t crypto_provider_entry_t
0343 #define vki_crypto_get_provider_list_t crypto_get_provider_list_t
0344 
0345 
0346 #include <sys/dditypes.h>
0347 #include <sys/devinfo_impl.h>
0348 #define VKI_DINFOUSRLD DINFOUSRLD
0349 #define VKI_DINFOIDENT DINFOIDENT
0350 
0351 
0352 #include <sys/dirent.h>
0353 #define VKI_MAXGETDENTS_SIZE MAXGETDENTS_SIZE
0354 #define vki_dirent dirent
0355 #define vki_dirent64 dirent64
0356 
0357 
0358 #include <sys/door.h>
0359 #define vki_door_desc_t door_desc_t
0360 #define vki_door_info_t door_info_t
0361 #define vki_door_arg_t door_arg_t
0362 #define vki_door_results door_results
0363 #define vki_door_return_desc_t door_return_desc_t
0364 
0365 #define VKI_DOOR_CREATE DOOR_CREATE
0366 #define VKI_DOOR_REVOKE DOOR_REVOKE
0367 #define VKI_DOOR_INFO DOOR_INFO
0368 #define VKI_DOOR_CALL DOOR_CALL
0369 #define VKI_DOOR_BIND DOOR_BIND
0370 #define VKI_DOOR_UNBIND DOOR_UNBIND
0371 #define VKI_DOOR_UNREFSYS DOOR_UNREFSYS
0372 #define VKI_DOOR_UCRED DOOR_UCRED
0373 #define VKI_DOOR_RETURN DOOR_RETURN
0374 #define VKI_DOOR_GETPARAM DOOR_GETPARAM
0375 #define VKI_DOOR_SETPARAM DOOR_SETPARAM
0376 
0377 
0378 #include <sys/dtrace.h>
0379 #define VKI_DTRACEHIOC_REMOVE DTRACEHIOC_REMOVE
0380 #define VKI_DTRACEHIOC_ADDDOF DTRACEHIOC_ADDDOF
0381 #define vki_dof_helper_t dof_helper_t
0382 
0383 
0384 #include <sys/elf.h>
0385 #define VKI_EI_CLASS EI_CLASS
0386 #define VKI_EI_DATA EI_DATA
0387 #define VKI_EI_MAG0 EI_MAG0
0388 #define VKI_EI_MAG1 EI_MAG1
0389 #define VKI_EI_MAG2 EI_MAG2
0390 #define VKI_EI_MAG3 EI_MAG3
0391 #define VKI_EI_VERSION EI_VERSION
0392 #define VKI_ELFMAG ELFMAG
0393 #define VKI_ELFMAG ELFMAG
0394 #define VKI_ELFMAG0 ELFMAG0
0395 #define VKI_ELFMAG1 ELFMAG1
0396 #define VKI_ELFMAG2 ELFMAG2
0397 #define VKI_ELFMAG3 ELFMAG3
0398 #define VKI_ET_CORE ET_CORE
0399 #define VKI_ET_DYN ET_DYN
0400 #define VKI_ET_EXEC ET_EXEC
0401 #define VKI_EV_CURRENT EV_CURRENT
0402 #define VKI_NT_AUXV NT_AUXV
0403 #define VKI_NT_CONTENT NT_CONTENT
0404 #define VKI_NT_LWPSINFO NT_LWPSINFO
0405 #define VKI_NT_LWPSTATUS NT_LWPSTATUS
0406 #define VKI_NT_PLATFORM NT_PLATFORM
0407 #define VKI_NT_PRCRED NT_PRCRED
0408 #define VKI_NT_PRFPREG NT_PRFPREG
0409 #define VKI_NT_PRPRIV NT_PRPRIV
0410 #define VKI_NT_PRPRIVINFO NT_PRPRIVINFO
0411 #define VKI_NT_PRPSINFO NT_PRPSINFO
0412 #define VKI_NT_PRSTATUS NT_PRSTATUS
0413 #define VKI_NT_PRXREG NT_PRXREG
0414 #define VKI_NT_PSINFO NT_PSINFO
0415 #define VKI_NT_PSTATUS NT_PSTATUS
0416 #define VKI_NT_UTSNAME NT_UTSNAME
0417 #define VKI_NT_ZONENAME NT_ZONENAME
0418 #define VKI_PF_R PF_R
0419 #define VKI_PF_W PF_W
0420 #define VKI_PF_X PF_X
0421 #define VKI_PN_XNUM PN_XNUM
0422 #define VKI_PT_LOAD PT_LOAD
0423 #define VKI_PT_SUNWBSS PT_SUNWBSS
0424 #define VKI_SELFMAG SELFMAG
0425 
0426 #if VG_WORDSIZE == 8
0427 #define VKI_ESZ(x) Elf64_##x
0428 #elif   VG_WORDSIZE == 4
0429 #define VKI_ESZ(x) Elf32_##x
0430 #else
0431 #error VG_WORDSIZE needs to ==4 or ==8
0432 #endif
0433 
0434 
0435 #include <sys/errno.h>
0436 #define VKI_EPERM EPERM
0437 #define VKI_ENOENT ENOENT
0438 #define VKI_ESRCH ESRCH
0439 #define VKI_EINTR EINTR
0440 #define VKI_EIO EIO
0441 #define VKI_ENXIO ENXIO
0442 #define VKI_E2BIG E2BIG
0443 #define VKI_EBADF EBADF
0444 #define VKI_ECHILD ECHILD
0445 #define VKI_ENOEXEC ENOEXEC
0446 #define VKI_EAGAIN EAGAIN
0447 #define VKI_ENOMEM ENOMEM
0448 #define VKI_EACCES EACCES
0449 #define VKI_EFAULT EFAULT
0450 #define VKI_ENOTBLK ENOTBLK
0451 #define VKI_EBUSY EBUSY
0452 #define VKI_EEXIST EEXIST
0453 #define VKI_EXDEV EXDEV
0454 #define VKI_ENODEV ENODEV
0455 #define VKI_ENOTDIR ENOTDIR
0456 #define VKI_EISDIR EISDIR
0457 #define VKI_EINVAL EINVAL
0458 #define VKI_ENFILE ENFILE
0459 #define VKI_EMFILE EMFILE
0460 #define VKI_ENOTTY ENOTTY
0461 #define VKI_ETXTBSY ETXTBSY
0462 #define VKI_EFBIG EFBIG
0463 #define VKI_ENOSPC ENOSPC
0464 #define VKI_ESPIPE ESPIPE
0465 #define VKI_EROFS EROFS
0466 #define VKI_EMLINK EMLINK
0467 #define VKI_EPIPE EPIPE
0468 #define VKI_EDOM EDOM
0469 #define VKI_ERANGE ERANGE
0470 #define VKI_ENOTSUP ENOTSUP
0471 #define VKI_ENODATA ENODATA
0472 #define VKI_EOVERFLOW EOVERFLOW
0473 #define VKI_ENOSYS ENOSYS
0474 #define VKI_ERESTART ERESTART
0475 #define VKI_EADDRINUSE EADDRINUSE
0476 
0477 
0478 #if defined(SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS)
0479 #include <sys/execx.h>
0480 #define VKI_EXEC_DESCRIPTOR EXEC_DESCRIPTOR
0481 #endif /* SOLARIS_EXECVE_SYSCALL_TAKES_FLAGS */
0482 
0483 
0484 #include <sys/fasttrap.h>
0485 #define VKI_PT_SUNWDTRACE_SIZE PT_SUNWDTRACE_SIZE
0486 
0487 
0488 #include <sys/fcntl.h>
0489 #define VKI_O_RDONLY O_RDONLY
0490 #define VKI_O_WRONLY O_WRONLY
0491 #define VKI_O_RDWR O_RDWR
0492 #define VKI_O_APPEND O_APPEND
0493 #define VKI_O_NONBLOCK O_NONBLOCK
0494 
0495 #define VKI_O_CREAT O_CREAT
0496 #define VKI_O_TRUNC O_TRUNC
0497 #define VKI_O_EXCL O_EXCL
0498 #define VKI_O_LARGEFILE O_LARGEFILE
0499 
0500 #define VKI_F_DUPFD F_DUPFD
0501 #define VKI_F_DUPFD_CLOEXEC F_DUPFD_CLOEXEC
0502 #define VKI_F_GETFD F_GETFD
0503 #define VKI_F_SETFD F_SETFD
0504 #define VKI_F_GETFL F_GETFL
0505 #define VKI_F_GETXFL F_GETXFL
0506 #define VKI_F_SETFL F_SETFL
0507 
0508 /* SVR3 rfs compatibility const, declared only if _KERNEL or _KMEMUSER is
0509    defined. */
0510 #if 0
0511 #define VKI_F_O_GETLK F_O_GETLK
0512 #endif // 0
0513 
0514 #define VKI_F_DUP2FD F_DUP2FD
0515 
0516 /* Mostly unused and kernel-unimplemented commands. In case of F_GETOWN and
0517    F_GETOWN, they are translated by libc in __fcntl() into other syscalls,
0518    that means these two values are never passed to the fcntl handler in the
0519    kernel. F_HASREMOTELOCKS is also special, the fcntl kernel handler doesn't
0520    know about it but it's used inside the kernel. */
0521 #if 0
0522 #define VKI_F_ISSTREAM F_ISSTREAM
0523 #define VKI_F_PRIV F_PRIV
0524 #define VKI_F_NPRIV F_NPRIV
0525 #define VKI_F_QUATACTL F_QUOTACTL
0526 #define VKI_F_BLOCKS F_BLOCKS
0527 #define VKI_F_BLKSIZE F_BLKSIZE
0528 #define VKI_F_GETOWN F_GETOWN
0529 #define VKI_F_SETOWN F_SETOWN
0530 #define VKI_F_REVOKE F_REVOKE
0531 #define VKI_F_HASREMOTELOCKS F_HASREMOTELOCKS
0532 #endif // 0
0533 
0534 #define VKI_F_SETLK F_SETLK
0535 #define VKI_F_SETLKW F_SETLKW
0536 #define VKI_F_ALLOCSP F_ALLOCSP
0537 #define VKI_F_FREESP F_FREESP
0538 #define VKI_F_GETLK F_GETLK
0539 #define VKI_F_SETLK_NBMAND F_SETLK_NBMAND
0540 #if defined(VGP_x86_solaris)
0541 #define VKI_F_SETLK64 F_SETLK64
0542 #define VKI_F_SETLKW64 F_SETLKW64
0543 #define VKI_F_ALLOCSP64 F_ALLOCSP64
0544 #define VKI_F_FREESP64 F_FREESP64
0545 #define VKI_F_GETLK64 F_GETLK64
0546 #define VKI_F_SETLK64_NBMAND F_SETLK64_NBMAND
0547 #endif // defined(VGP_x86_solaris)
0548 
0549 #define VKI_F_SHARE F_SHARE
0550 #define VKI_F_UNSHARE F_UNSHARE
0551 #define VKI_F_SHARE_NBMAND F_SHARE_NBMAND
0552 
0553 #define VKI_F_BADFD F_BADFD
0554 
0555 #define vki_flock flock
0556 #if defined(VGP_x86_solaris)
0557 #define vki_flock64 flock64
0558 #endif // defined(VGP_x86_solaris)
0559 
0560 #define VKI_FD_CLOEXEC FD_CLOEXEC
0561 
0562 #define vki_fshare fshare
0563 
0564 #define VKI_AT_FDCWD AT_FDCWD
0565 
0566 
0567 #include <sys/filio.h>
0568 #define VKI_FIOSETOWN FIOSETOWN
0569 #define VKI_FIOGETOWN FIOGETOWN
0570 
0571 
0572 #include <sys/fs/namenode.h>
0573 #define vki_namefd namefd
0574 
0575 
0576 #include <sys/fstyp.h>
0577 #define VKI_FSTYPSZ FSTYPSZ
0578 #define VKI_GETFSIND GETFSIND
0579 #define VKI_GETFSTYP GETFSTYP
0580 #define VKI_GETNFSTYP GETNFSTYP
0581 
0582 
0583 #include <sys/ioccom.h>
0584 #define _VKI_IOC_DIR(x) ((x) & (IOC_VOID | IOC_OUT | IOC_IN))
0585 #define _VKI_IOC_SIZE(x) (((x) >> 16) & IOCPARM_MASK)
0586 #define _VKI_IOC_NONE 0
0587 #define _VKI_IOC_READ IOC_OUT
0588 #define _VKI_IOC_WRITE IOC_IN
0589 
0590 
0591 #include <sys/ipc.h>
0592 #include <sys/ipc_impl.h>
0593 #define VKI_IPC_RMID IPC_RMID
0594 #define VKI_IPC_SET IPC_SET
0595 #define VKI_IPC_SET64 IPC_SET64
0596 #define VKI_IPC_STAT IPC_STAT
0597 #define VKI_IPC_STAT64 IPC_STAT64
0598 #if defined(SOLARIS_SHM_NEW)
0599 #define VKI_IPC_XSTAT64 IPC_XSTAT64
0600 #endif /* SOLARIS_SHM_NEW */
0601 
0602 #define vki_semid64_ds semid_ds64
0603 
0604 
0605 #include <sys/lgrp_user.h>
0606 #if defined(HAVE_SYS_LGRP_USER_IMPL_H)
0607 /* Include implementation specific header file on newer Solaris. */
0608 #include <sys/lgrp_user_impl.h>
0609 #endif /* HAVE_SYS_LGRP_USER_IMPL_H */
0610 #define VKI_LGRP_SYS_MEMINFO LGRP_SYS_MEMINFO
0611 #define VKI_LGRP_SYS_GENERATION LGRP_SYS_GENERATION
0612 #define VKI_LGRP_SYS_VERSION LGRP_SYS_VERSION
0613 #define VKI_LGRP_SYS_SNAPSHOT LGRP_SYS_SNAPSHOT
0614 #define VKI_LGRP_SYS_AFFINITY_GET LGRP_SYS_AFFINITY_GET
0615 #define VKI_LGRP_SYS_AFFINITY_SET LGRP_SYS_AFFINITY_SET
0616 #define VKI_LGRP_SYS_LATENCY LGRP_SYS_LATENCY
0617 #define VKI_LGRP_SYS_HOME LGRP_SYS_HOME
0618 #define VKI_LGRP_SYS_AFF_INHERIT_GET LGRP_SYS_AFF_INHERIT_GET
0619 #define VKI_LGRP_SYS_AFF_INHERIT_SET LGRP_SYS_AFF_INHERIT_SET
0620 #define VKI_LGRP_SYS_DEVICE_LGRPS LGRP_SYS_DEVICE_LGRPS
0621 #define VKI_LGRP_SYS_MAXSOCKETS_GET LGRP_SYS_MAXSOCKETS_GET
0622 #define vki_lgrp_view_t lgrp_view_t
0623 
0624 
0625 #include <sys/loadavg.h>
0626 #define VKI_LOADAVG_NSTATS LOADAVG_NSTATS
0627 
0628 
0629 #include <sys/lwp.h>
0630 #define VKI_LWP_DAEMON LWP_DAEMON
0631 #define VKI_LWP_FSBASE _LWP_FSBASE
0632 #define VKI_LWP_GSBASE _LWP_GSBASE
0633 #define VKI_LWP_SETPRIVATE _LWP_SETPRIVATE
0634 #define VKI_LWP_GETPRIVATE _LWP_GETPRIVATE
0635 
0636 
0637 #include <sys/mman.h>
0638 #define VKI_PROT_READ PROT_READ
0639 #define VKI_PROT_WRITE PROT_WRITE
0640 #define VKI_PROT_EXEC PROT_EXEC
0641 #define VKI_PROT_NONE PROT_NONE
0642 
0643 #define VKI_MAP_SHARED MAP_SHARED
0644 #define VKI_MAP_PRIVATE MAP_PRIVATE
0645 #define VKI_MAP_FIXED MAP_FIXED
0646 #define VKI_MAP_ANONYMOUS MAP_ANONYMOUS
0647 #define VKI_MAP_ALIGN MAP_ALIGN
0648 #define VKI_MAP_TEXT MAP_TEXT
0649 #define VKI_MAP_INITDATA MAP_INITDATA
0650 
0651 #define VKI_MMOBJ_ALL_FLAGS MMOBJ_ALL_FLAGS
0652 #define VKI_MMOBJ_INTERPRET MMOBJ_INTERPRET
0653 #define VKI_MMOBJ_PADDING MMOBJ_PADDING
0654 #define VKI_MR_PADDING MR_PADDING
0655 #define VKI_MR_HDR_ELF MR_HDR_ELF
0656 #define VKI_MR_GET_TYPE(val) MR_GET_TYPE(val)
0657 #define vki_mmapobj_result_t mmapobj_result_t
0658 
0659 #define vki_memcntl_mha memcntl_mha
0660 #define VKI_MC_LOCKAS MC_LOCKAS
0661 #define VKI_MC_UNLOCKAS MC_UNLOCKAS
0662 #define VKI_MC_HAT_ADVISE MC_HAT_ADVISE
0663 
0664 #define vki_meminfo_t meminfo_t
0665 
0666 #if defined(HAVE_MREMAP)
0667 #define VKI_MREMAP_FIXED MREMAP_FIXED
0668 #define VKI_MREMAP_MAYMOVE MREMAP_MAYMOVE
0669 #endif /* HAVE_MREMAP */
0670 
0671 
0672 #include <sys/mntio.h>
0673 #define VKI_MNTIOC_GETEXTMNTENT MNTIOC_GETEXTMNTENT
0674 #define VKI_MNTIOC_GETMNTANY MNTIOC_GETMNTANY
0675 
0676 
0677 #include <sys/mnttab.h>
0678 #define vki_extmnttab extmnttab
0679 #define vki_mntentbuf mntentbuf
0680 #define vki_mnttab mnttab
0681 
0682 
0683 #include <sys/modctl.h>
0684 #define VKI_MODLOAD MODLOAD
0685 #define VKI_MODUNLOAD MODUNLOAD
0686 #define VKI_MODINFO MODINFO
0687 
0688 #if defined(SOLARIS_MODCTL_MODNVL)
0689 #define VKI_MODNVL_DEVLINKSYNC MODNVL_DEVLINKSYNC
0690 #define VKI_MODDEVINFO_CACHE_TS MODDEVINFO_CACHE_TS
0691 #if !defined(HAVE_SYS_SYSNVL_H)
0692 #define VKI_MODCTL_NVL_OP_GET MODCTL_NVL_OP_GET
0693 #define VKI_MODCTL_NVL_OP_UPDATE MODCTL_NVL_OP_UPDATE
0694 #endif /* !HAVE_SYS_SYSNVL_H */
0695 #endif /* SOLARIS_MODCTL_MODNVL */
0696 
0697 #define vki_modid_t int
0698 #define vki_modinfo modinfo
0699 
0700 
0701 #include <sys/mount.h>
0702 #define VKI_MS_DATA MS_DATA
0703 #define VKI_MS_OPTIONSTR MS_OPTIONSTR
0704 
0705 
0706 #include <sys/poll.h>
0707 #define vki_pollfd pollfd
0708 #define vki_pollfd_t pollfd_t
0709 #define vki_nfds_t nfds_t
0710 
0711 
0712 #include <sys/pool_impl.h>
0713 #define VKI_POOL_STATUSQ POOL_STATUSQ
0714 #define vki_pool_status_t pool_status_t
0715 
0716 
0717 #include <sys/port.h>
0718 #include <sys/port_impl.h>
0719 #define VKI_PORT_SOURCE_FD PORT_SOURCE_FD
0720 #define VKI_PORT_SOURCE_FILE PORT_SOURCE_FILE
0721 
0722 #define vki_port_event_t port_event_t
0723 #define vki_port_notify_t port_notify_t
0724 #define vki_file_obj file_obj
0725 
0726 #define VKI_PORT_CREATE PORT_CREATE
0727 #define VKI_PORT_ASSOCIATE PORT_ASSOCIATE
0728 #define VKI_PORT_DISSOCIATE PORT_DISSOCIATE
0729 #define VKI_PORT_SEND PORT_SEND
0730 #define VKI_PORT_SENDN PORT_SENDN
0731 #define VKI_PORT_GET PORT_GET
0732 #define VKI_PORT_GETN PORT_GETN
0733 #define VKI_PORT_ALERT PORT_ALERT
0734 #define VKI_PORT_DISPATCH PORT_DISPATCH
0735 
0736 #define VKI_PORT_SYS_NOPORT PORT_SYS_NOPORT
0737 #define VKI_PORT_CODE_MASK PORT_CODE_MASK
0738 
0739 
0740 #include <sys/priocntl.h>
0741 #include <sys/rtpriocntl.h>
0742 #include <sys/tspriocntl.h>
0743 #include <sys/iapriocntl.h>
0744 #include <sys/fsspriocntl.h>
0745 #include <sys/fxpriocntl.h>
0746 #define VKI_PC_GETCID PC_GETCID
0747 #define VKI_PC_GETCLINFO PC_GETCLINFO
0748 #define VKI_PC_SETPARMS PC_SETPARMS
0749 #define VKI_PC_GETPARMS PC_GETPARMS
0750 #define VKI_PC_ADMIN PC_ADMIN
0751 #define VKI_PC_GETPRIRANGE PC_GETPRIRANGE
0752 #define VKI_PC_DONICE PC_DONICE
0753 #define VKI_PC_SETXPARMS PC_SETXPARMS
0754 #define VKI_PC_GETXPARMS PC_GETXPARMS
0755 #define VKI_PC_SETDFLCL PC_SETDFLCL
0756 #define VKI_PC_GETDFLCL PC_GETDFLCL
0757 #define VKI_PC_DOPRIO PC_DOPRIO
0758 
0759 #define VKI_PC_CLNMSZ PC_CLNMSZ
0760 
0761 #define VKI_PC_GETNICE PC_GETNICE
0762 #define VKI_PC_SETNICE PC_SETNICE
0763 
0764 #define VKI_PC_GETPRIO PC_GETPRIO
0765 #define VKI_PC_SETPRIO PC_SETPRIO
0766 
0767 #define vki_pcinfo_t pcinfo_t
0768 #define vki_rtinfo_t rtinfo_t
0769 #define vki_tsinfo_t tsinfo_t
0770 #define vki_iainfo_t iainfo_t
0771 #define vki_fssinfo_t fssinfo_t
0772 #define vki_fxinfo_t fxinfo_t
0773 
0774 #define vki_pcparms_t pcparms_t
0775 #define vki_pcnice_t pcnice_t
0776 #define vki_pcprio_t pcprio_t
0777 #define vki_pc_vaparm_t pc_vaparm_t
0778 #define vki_pc_vaparms_t pc_vaparms_t
0779 #define vki_pcpri_t pcpri_t
0780 
0781 #define VKI_PC_KY_CLNAME PC_KY_CLNAME
0782 #define VKI_RT_KY_PRI RT_KY_PRI
0783 #define VKI_RT_KY_TQSECS RT_KY_TQSECS
0784 #define VKI_RT_KY_TQNSECS RT_KY_TQNSECS
0785 #define VKI_RT_KY_TQSIG RT_KY_TQSIG
0786 #define VKI_TS_KY_UPRILIM TS_KY_UPRILIM
0787 #define VKI_TS_KY_UPRI TS_KY_UPRI
0788 #define VKI_IA_KY_UPRILIM IA_KY_UPRILIM
0789 #define VKI_IA_KY_UPRI IA_KY_UPRI
0790 #define VKI_IA_KY_MODE IA_KY_MODE
0791 #define VKI_FSS_KY_UPRILIM FSS_KY_UPRILIM
0792 #define VKI_FSS_KY_UPRI FSS_KY_UPRI
0793 #define VKI_FX_KY_UPRILIM FX_KY_UPRILIM
0794 #define VKI_FX_KY_UPRI FX_KY_UPRI
0795 #define VKI_FX_KY_TQSECS FX_KY_TQSECS
0796 #define VKI_FX_KY_TQNSECS FX_KY_TQNSECS
0797 
0798 
0799 #include <sys/priv.h>
0800 #define vki_priv_impl_info_t priv_impl_info_t
0801 
0802 
0803 #include <sys/proc.h>
0804 #define VKI_SRUN SRUN
0805 #define VKI_SSLEEP SSLEEP
0806 #define VKI_SZOMB SZOMB
0807 
0808 
0809 #include <sys/processor.h>
0810 #define vki_processorid_t processorid_t
0811 
0812 
0813 /* We want the new /proc definitions. */
0814 #define _STRUCTURED_PROC 1
0815 #include <sys/procfs.h>
0816 #define VKI_MA_READ MA_READ
0817 #define VKI_MA_WRITE MA_WRITE
0818 #define VKI_MA_EXEC MA_EXEC
0819 #define VKI_PRNODEV PRNODEV
0820 #define VKI_PR_PCINVAL PR_PCINVAL
0821 #define vki_lwpsinfo_t lwpsinfo_t
0822 #define vki_lwpstatus_t lwpstatus_t
0823 #define vki_prcred_t prcred_t
0824 #define vki_prmap_t prmap_t
0825 #define vki_prpriv_t prpriv_t
0826 #define vki_prxmap_t prxmap_t
0827 #define vki_pstatus_t pstatus_t
0828 #define vki_psinfo_t psinfo_t
0829 
0830 
0831 #include <sys/procfs_isa.h>
0832 #if defined(SOLARIS_PRXREGSET_T)
0833 #define vki_prxregset_t prxregset_t
0834 #endif /* SOLARIS_PRXREGSET_T */
0835 
0836 
0837 #include <sys/procset.h>
0838 #define vki_idtype_t idtype_t
0839 #define VKI_P_PID P_PID
0840 #define VKI_P_PGID P_PGID
0841 #define VKI_P_ALL P_ALL
0842 #define VKI_POP_AND POP_AND
0843 #define vki_procset_t procset_t
0844 
0845 
0846 #include <sys/pset.h>
0847 #define VKI_PSET_CREATE PSET_CREATE
0848 #define VKI_PSET_DESTROY PSET_DESTROY
0849 #define VKI_PSET_ASSIGN PSET_ASSIGN
0850 #define VKI_PSET_INFO PSET_INFO
0851 #define VKI_PSET_BIND PSET_BIND
0852 #define VKI_PSET_GETLOADAVG PSET_GETLOADAVG
0853 #define VKI_PSET_LIST PSET_LIST
0854 #define VKI_PSET_SETATTR PSET_SETATTR
0855 #define VKI_PSET_GETATTR PSET_GETATTR
0856 #define VKI_PSET_ASSIGN_FORCED PSET_ASSIGN_FORCED
0857 #define VKI_PSET_BIND_LWP PSET_BIND_LWP
0858 #if defined(SOLARIS_PSET_GET_NAME)
0859 #define VKI_PSET_GET_NAME PSET_GET_NAME
0860 #endif /* SOLARIS_PSET_GET_NAME */
0861 #define vki_psetid_t psetid_t
0862 
0863 
0864 #include <sys/regset.h>
0865 #define vki_prgregset_t prgregset_t
0866 
0867 
0868 #include <sys/resource.h>
0869 #define VKI_RLIMIT_DATA RLIMIT_DATA
0870 #define VKI_RLIMIT_STACK RLIMIT_STACK
0871 #define VKI_RLIMIT_CORE RLIMIT_CORE
0872 #define VKI_RLIMIT_NOFILE RLIMIT_NOFILE
0873 #define VKI__RUSAGESYS_GETRUSAGE _RUSAGESYS_GETRUSAGE
0874 #define VKI__RUSAGESYS_GETRUSAGE_CHLD _RUSAGESYS_GETRUSAGE_CHLD
0875 #define VKI__RUSAGESYS_GETRUSAGE_LWP _RUSAGESYS_GETRUSAGE_LWP
0876 #define VKI__RUSAGESYS_GETVMUSAGE _RUSAGESYS_GETVMUSAGE
0877 #define vki_rlimit rlimit
0878 #define vki_rlimit64 rlimit64
0879 #define vki_rusage rusage
0880 
0881 
0882 #include <sys/schedctl.h>
0883 #define vki_sc_shared sc_shared
0884 
0885 
0886 #include <sys/segments.h>
0887 #define VKI_GDT_LWPGS GDT_LWPGS
0888 #if defined(VGP_amd64_solaris)
0889 /* Values VKI_UCS_SEL/VKI_UDS_SEL can be used only on amd64. On x86, correct
0890    %cs/%ds values for a client need to be obtained from the host registers
0891    because they are different depending on the running kernel (x86 or amd64).
0892  */
0893 #define VKI_UCS_SEL UCS_SEL
0894 #define VKI_UDS_SEL UDS_SEL
0895 #endif
0896 #define VKI_LWPGS_SEL LWPGS_SEL
0897 
0898 
0899 #include <sys/select.h>
0900 #define vki_fd_set fd_set
0901 
0902 
0903 #include <sys/priv.h>
0904 /* Define _KMEMUSER so priv_set is pulled in. */
0905 #define _KMEMUSER
0906 #include <sys/priv_impl.h>
0907 #undef _KMEMUSER
0908 #define vki_priv_set_t priv_set_t
0909 #define vki_priv_ptype_t priv_ptype_t
0910 #define vki_priv_op_t priv_op_t
0911 
0912 #define VKI_PRIVSYS_SETPPRIV PRIVSYS_SETPPRIV
0913 #define VKI_PRIVSYS_GETPPRIV PRIVSYS_GETPPRIV
0914 #define VKI_PRIVSYS_GETIMPLINFO PRIVSYS_GETIMPLINFO
0915 #define VKI_PRIVSYS_SETPFLAGS PRIVSYS_SETPFLAGS
0916 #define VKI_PRIVSYS_GETPFLAGS PRIVSYS_GETPFLAGS
0917 #define VKI_PRIVSYS_ISSETUGID PRIVSYS_ISSETUGID
0918 #define VKI_PRIVSYS_PFEXEC_REG PRIVSYS_PFEXEC_REG
0919 #define VKI_PRIVSYS_PFEXEC_UNREG PRIVSYS_PFEXEC_UNREG
0920 
0921 #define vki_priv_impl_info_t priv_impl_info_t
0922 
0923 
0924 #include <sys/sem.h>
0925 #include <sys/sem_impl.h>
0926 #define VKI_GETALL GETALL
0927 #define VKI_GETPID GETPID
0928 #define VKI_GETNCNT GETNCNT
0929 #define VKI_GETZCNT GETZCNT
0930 #define VKI_GETVAL GETVAL
0931 #define VKI_SEMCTL SEMCTL
0932 #define VKI_SEMGET SEMGET
0933 #define VKI_SEMIDS SEMIDS
0934 #define VKI_SEMOP SEMOP
0935 #define VKI_SEMTIMEDOP SEMTIMEDOP
0936 #define VKI_SETALL SETALL
0937 #define VKI_SETVAL SETVAL
0938 
0939 #define vki_semid_ds semid_ds
0940 #define vki_sembuf sembuf
0941 
0942 /* The semun union has to be explicitly declared by the application program
0943    (see semctl(2)). */
0944 union vki_semun {
0945    int val;
0946    struct semid_ds *buf;
0947    ushort_t *array;
0948 };
0949 
0950 
0951 #include <sys/sendfile.h>
0952 #define VKI_SENDFILEV SENDFILEV
0953 #define VKI_SENDFILEV64 SENDFILEV64
0954 #define VKI_SFV_FD_SELF SFV_FD_SELF
0955 #define vki_sendfilevec sendfilevec
0956 #define vki_sendfilevec64 sendfilevec64
0957 
0958 
0959 #include <sys/shm.h>
0960 #include <sys/shm_impl.h>
0961 #define VKI_SHMAT SHMAT
0962 #define VKI_SHMCTL SHMCTL
0963 #define VKI_SHMDT SHMDT
0964 #define VKI_SHMGET SHMGET
0965 #define VKI_SHMIDS SHMIDS
0966 #if defined(SOLARIS_SHM_NEW)
0967 #define VKI_SHMADV SHMADV
0968 #define VKI_SHMGET_OSM SHMGET_OSM
0969 #define VKI_SHM_ADV_GET SHM_ADV_GET
0970 #define VKI_SHM_ADV_SET SHM_ADV_SET
0971 #endif /* SOLARIS_SHM_NEW */
0972 #define VKI_SHM_LOCK SHM_LOCK
0973 #define VKI_SHM_RDONLY SHM_RDONLY
0974 #define VKI_SHM_UNLOCK SHM_UNLOCK
0975 /* Should be correct, but not really neat. */
0976 #define VKI_SHMLBA VKI_PAGE_SIZE
0977 
0978 #define vki_shmid_ds shmid_ds
0979 #define vki_shmid_ds64 shmid_ds64
0980 #define vki_shmid_xds64 shmid_xds64
0981 
0982 
0983 #include <sys/siginfo.h>
0984 /* This section also contains items defined in sys/machsig.h, this file
0985    is directly included in sys/siginfo.h. */
0986 #define vki_sigevent sigevent
0987 #define vki_siginfo_t siginfo_t
0988 
0989 #define VKI_SI_LWP SI_LWP
0990 #define VKI_SI_USER SI_USER
0991 #define VKI_SIGEV_PORT SIGEV_PORT
0992 #define VKI_SIGEV_THREAD SIGEV_THREAD
0993 
0994 /* SIGTRAP signal codes */
0995 #define VKI_TRAP_BRKPT TRAP_BRKPT
0996 
0997 /* SIGCLD signal codes */
0998 #define VKI_CLD_EXITED CLD_EXITED
0999 #define VKI_CLD_KILLED CLD_KILLED
1000 #define VKI_CLD_DUMPED CLD_DUMPED
1001 #define VKI_CLD_TRAPPED CLD_TRAPPED
1002 #define VKI_CLD_STOPPED CLD_STOPPED
1003 #define VKI_CLD_CONTINUED CLD_CONTINUED
1004 
1005 /* SIGILL signal codes */
1006 #define VKI_ILL_ILLOPC ILL_ILLOPC
1007 #define VKI_ILL_ILLOPN ILL_ILLOPN
1008 #define VKI_ILL_ILLADR ILL_ILLADR
1009 #define VKI_ILL_ILLTRP ILL_ILLTRP
1010 #define VKI_ILL_PRVOPC ILL_PRVOPC
1011 #define VKI_ILL_PRVREG ILL_PRVREG
1012 #define VKI_ILL_COPROC ILL_COPROC
1013 #define VKI_ILL_BADSTK ILL_BADSTK
1014 
1015 /* SIGFPE signal codes */
1016 #define VKI_FPE_INTDIV FPE_INTDIV
1017 #define VKI_FPE_INTOVF FPE_INTOVF
1018 #define VKI_FPE_FLTDIV FPE_FLTDIV
1019 #define VKI_FPE_FLTOVF FPE_FLTOVF
1020 #define VKI_FPE_FLTUND FPE_FLTUND
1021 #define VKI_FPE_FLTRES FPE_FLTRES
1022 #define VKI_FPE_FLTINV FPE_FLTINV
1023 #define VKI_FPE_FLTSUB FPE_FLTSUB
1024 #define VKI_FPE_FLTDEN FPE_FLTDEN
1025 
1026 /* SIGSEV signal codes */
1027 #define VKI_SEGV_MAPERR SEGV_MAPERR
1028 #define VKI_SEGV_ACCERR SEGV_ACCERR
1029 
1030 /* SIGBUS signal codes */
1031 #define VKI_BUS_ADRALN BUS_ADRALN
1032 #define VKI_BUS_ADRERR BUS_ADRERR
1033 #define VKI_BUS_OBJERR BUS_OBJERR
1034 
1035 
1036 #include <sys/signal.h>
1037 /* This section also contains items defined in sys/iso/signal_iso.h, this file
1038    is directly included in sys/signal.h. */
1039 
1040 /* Next three constants describe the internal representation of sigset_t,
1041    there are checks in coregrind/m_vki.c to make sure they are correct. */
1042 #define _VKI_NSIG 128
1043 #define _VKI_MAXSIG MAXSIG
1044 #define _VKI_NSIG_BPW 32
1045 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
1046 #define vki_sigset_t sigset_t
1047 #define vki_sigaltstack sigaltstack
1048 /* sigset_t accessor */
1049 #define sig __sigbits
1050 
1051 /* On Solaris we use the same type for passing sigactions to
1052    and from the kernel. Hence: */
1053 typedef struct sigaction vki_sigaction_toK_t;
1054 typedef struct sigaction vki_sigaction_fromK_t;
1055 /* sigaction_t accessor */
1056 #define ksa_handler sa_handler
1057 
1058 #define VKI_SA_ONSTACK SA_ONSTACK
1059 #define VKI_SA_ONESHOT SA_RESETHAND
1060 #define VKI_SA_NOMASK SA_NODEFER
1061 
1062 #define VKI_MINSIGSTKSZ MINSIGSTKSZ
1063 
1064 #define VKI_SS_ONSTACK SS_ONSTACK
1065 #define VKI_SS_DISABLE SS_DISABLE
1066 
1067 #define vki_stack_t stack_t
1068 
1069 #define VKI_SA_NOCLDSTOP SA_NOCLDSTOP
1070 #define VKI_SA_RESTART SA_RESTART
1071 #define VKI_SA_SIGINFO SA_SIGINFO
1072 #define VKI_SA_NOCLDWAIT SA_NOCLDWAIT
1073 #define VKI_SA_RESTORER 0 /* Solaris doesn't have this */
1074 
1075 #define VKI_SIGHUP SIGHUP               /*  1 */
1076 #define VKI_SIGINT SIGINT               /*  2 */
1077 #define VKI_SIGQUIT SIGQUIT             /*  3 */
1078 #define VKI_SIGILL SIGILL               /*  4 */
1079 #define VKI_SIGTRAP SIGTRAP             /*  5 */
1080 #define VKI_SIGABRT SIGABRT             /*  6 */
1081 #define VKI_SIGEMT SIGEMT               /*  7 */
1082 #define VKI_SIGFPE SIGFPE               /*  8 */
1083 #define VKI_SIGKILL SIGKILL             /*  9 */
1084 #define VKI_SIGBUS SIGBUS               /* 10 */
1085 #define VKI_SIGSEGV SIGSEGV             /* 11 */
1086 #define VKI_SIGSYS SIGSYS               /* 12 */
1087 #define VKI_SIGPIPE SIGPIPE             /* 13 */
1088 #define VKI_SIGALRM SIGALRM             /* 14 */
1089 #define VKI_SIGTERM SIGTERM             /* 15 */
1090 #define VKI_SIGUSR1 SIGUSR1             /* 16 */
1091 #define VKI_SIGUSR2 SIGUSR2             /* 17 */
1092 #define VKI_SIGCHLD SIGCHLD             /* 18 */
1093 #define VKI_SIGPWR SIGPWR               /* 19 */
1094 #define VKI_SIGWINCH SIGWINCH           /* 20 */
1095 #define VKI_SIGURG SIGURG               /* 21 */
1096 #define VKI_SIGIO SIGIO                 /* 22 */
1097 #define VKI_SIGSTOP SIGSTOP             /* 23 */
1098 #define VKI_SIGTSTP SIGTSTP             /* 24 */
1099 #define VKI_SIGCONT SIGCONT             /* 25 */
1100 #define VKI_SIGTTIN SIGTTIN             /* 26 */
1101 #define VKI_SIGTTOU SIGTTOU             /* 27 */
1102 #define VKI_SIGVTALRM SIGVTALRM         /* 28 */
1103 #define VKI_SIGPROF SIGPROF             /* 29 */
1104 #define VKI_SIGXCPU SIGXCPU             /* 30 */
1105 #define VKI_SIGXFSZ SIGXFSZ             /* 31 */
1106 #define VKI_SIGWAITING SIGWAITING       /* 32 */
1107 #define VKI_SIGLWP SIGLWP               /* 33 */
1108 #define VKI_SIGFREEZE SIGFREEZE         /* 34 */
1109 #define VKI_SIGTHAW SIGTHAW             /* 35 */
1110 #define VKI_SIGCANCEL SIGCANCEL         /* 36 */
1111 #define VKI_SIGLOST SIGLOST             /* 37 */
1112 #define VKI_SIGXRES SIGXRES             /* 38 */
1113 #define VKI_SIGJVM1 SIGJVM1             /* 39 */
1114 #define VKI_SIGJVM2 SIGJVM2             /* 40 */
1115 /* Note that SIGRTMIN and SIGRTMAX are actually macros calling into
1116    libc's sysconf() which in turn calls into kernel. And it returns
1117    these _SIGRTM* values. So we are safe until someone rebuilds Solaris
1118    kernel with different values... */
1119 #define VKI_SIGRTMIN _SIGRTMIN          /* 41 */
1120 #define VKI_SIGRTMAX _SIGRTMAX          /* 72 */
1121 
1122 #define VKI_SIG_DFL SIG_DFL
1123 #define VKI_SIG_IGN SIG_IGN
1124 
1125 #define VKI_SIG_BLOCK SIG_BLOCK
1126 #define VKI_SIG_UNBLOCK SIG_UNBLOCK
1127 #define VKI_SIG_SETMASK SIG_SETMASK
1128 
1129 
1130 #include <sys/socket.h>
1131 #define vki_sa_family_t sa_family_t
1132 #define vki_sockaddr sockaddr
1133 
1134 #define vki_socklen_t socklen_t
1135 
1136 #define VKI_SOCK_STREAM SOCK_STREAM
1137 
1138 #define VKI_SO_TYPE SO_TYPE
1139 #define VKI_SCM_RIGHTS SCM_RIGHTS
1140 #define VKI_SOL_SOCKET SOL_SOCKET
1141 
1142 #define VKI_AF_UNIX AF_UNIX
1143 #define VKI_AF_INET AF_INET
1144 #define VKI_AF_INET6 AF_INET6
1145 
1146 #define vki_msghdr msghdr
1147 #define vki_cmsghdr cmsghdr
1148 
1149 #define VKI_CMSG_ALIGN(a) _CMSG_DATA_ALIGN(a)
1150 #define VKI_CMSG_DATA(cmsg) CMSG_DATA(cmsg)
1151 #define VKI_CMSG_FIRSTHDR(mhdr) CMSG_FIRSTHDR(mhdr)
1152 #define VKI_CMSG_NXTHDR(mhdr, cmsg) CMSG_NXTHDR(mhdr, cmsg)
1153 
1154 
1155 #include <sys/socketvar.h>
1156 #define VKI_SOV_DEFAULT SOV_DEFAULT
1157 
1158 
1159 #include <sys/sockio.h>
1160 #define VKI_SIOCGIFCONF SIOCGIFCONF
1161 #define VKI_SIOCGIFFLAGS SIOCGIFFLAGS
1162 #define VKI_SIOCGIFNETMASK SIOCGIFNETMASK
1163 #define VKI_SIOCGIFNUM SIOCGIFNUM
1164 #define VKI_SIOCGLIFBRDADDR SIOCGLIFBRDADDR
1165 #define VKI_SIOCGLIFCONF SIOCGLIFCONF
1166 #define VKI_SIOCGLIFFLAGS SIOCGLIFFLAGS
1167 #define VKI_SIOCGLIFNETMASK SIOCGLIFNETMASK
1168 #define VKI_SIOCGLIFNUM SIOCGLIFNUM
1169 
1170 
1171 #if defined(SOLARIS_SPAWN_SYSCALL)
1172 #include <sys/spawn_impl.h>
1173 #define VKI_FA_CHDIR FA_CHDIR
1174 #define VKI_FA_CLOSE FA_CLOSE
1175 #define VKI_FA_CLOSEFROM FA_CLOSEFROM
1176 #define VKI_FA_DUP2 FA_DUP2
1177 #define VKI_FA_OPEN FA_OPEN
1178 #define VKI_POSIX_SPAWN_NOEXECERR_NP POSIX_SPAWN_NOEXECERR_NP
1179 #define VKI_POSIX_SPAWN_NOSIGCHLD_NP POSIX_SPAWN_NOSIGCHLD_NP
1180 #define VKI_POSIX_SPAWN_RESETIDS POSIX_SPAWN_RESETIDS
1181 #define VKI_POSIX_SPAWN_SETPGROUP POSIX_SPAWN_SETPGROUP
1182 #define VKI_POSIX_SPAWN_SETSCHEDPARAM POSIX_SPAWN_SETSCHEDPARAM
1183 #define VKI_POSIX_SPAWN_SETSCHEDULER POSIX_SPAWN_SETSCHEDULER
1184 #define VKI_POSIX_SPAWN_SETSID_NP POSIX_SPAWN_SETSID_NP
1185 #define VKI_POSIX_SPAWN_SETSIGDEF POSIX_SPAWN_SETSIGDEF
1186 #define VKI_POSIX_SPAWN_SETSIGIGN_NP POSIX_SPAWN_SETSIGIGN_NP
1187 #define VKI_POSIX_SPAWN_SETSIGMASK POSIX_SPAWN_SETSIGMASK
1188 #define VKI_POSIX_SPAWN_SETVAMASK_NP POSIX_SPAWN_SETVAMASK_NP
1189 #define VKI_POSIX_SPAWN_WAITPID_NP POSIX_SPAWN_WAITPID_NP
1190 #define VKI_SPAWN_VERSION SPAWN_VERSION
1191 #define vki_kfile_attr_t kfile_attr_t
1192 #define vki_kspawn_attr_t kspawn_attr_t
1193 #define vki_spawn_attr_t spawn_attr_t
1194 #endif /* SOLARIS_SPAWN_SYSCALL */
1195 
1196 
1197 #include <sys/stat.h>
1198 #define vki_stat stat
1199 #define vki_stat64 stat64
1200 
1201 #define st_atime_nsec st_atim.tv_nsec
1202 #define st_mtime_nsec st_mtim.tv_nsec
1203 #define st_ctime_nsec st_ctim.tv_nsec
1204 
1205 #define VKI_S_IFIFO S_IFIFO
1206 #define VKI_S_ISUID S_ISUID
1207 #define VKI_S_ISGID S_ISGID
1208 
1209 #define VKI_S_IRUSR S_IRUSR
1210 #define VKI_S_IWUSR S_IWUSR
1211 #define VKI_S_IXUSR S_IXUSR
1212 #define VKI_S_IRGRP S_IRGRP
1213 #define VKI_S_IWGRP S_IWGRP
1214 #define VKI_S_IXGRP S_IXGRP
1215 #define VKI_S_IROTH S_IROTH
1216 #define VKI_S_IWOTH S_IWOTH
1217 #define VKI_S_IXOTH S_IXOTH
1218 
1219 #define VKI_S_ISCHR S_ISCHR
1220 #define VKI_S_ISDIR S_ISDIR
1221 #define VKI_S_ISBLK S_ISBLK
1222 #define VKI_S_ISREG S_ISREG
1223 #define VKI_S_ISLNK S_ISLNK
1224 
1225 
1226 #include <sys/statfs.h>
1227 #define vki_statfs statfs
1228 
1229 
1230 #include <sys/statvfs.h>
1231 #define vki_statvfs statvfs
1232 #define vki_statvfs64 statvfs64
1233 
1234 
1235 #include <sys/stropts.h>
1236 #define VKI_I_CANPUT I_CANPUT
1237 #define VKI_I_FIND I_FIND
1238 #define VKI_I_FLUSH I_FLUSH
1239 #define VKI_I_PEEK I_PEEK
1240 #define VKI_I_PUSH I_PUSH
1241 #define VKI_I_STR I_STR
1242 #define vki_strbuf strbuf
1243 #define vki_strioctl strioctl
1244 #define vki_strpeek strpeek
1245 
1246 
1247 #include <sys/synch.h>
1248 #define vki_lwp_mutex_t lwp_mutex_t
1249 #define vki_lwp_cond_t lwp_cond_t
1250 #define vki_lwp_sema_t lwp_sema_t
1251 #define vki_lwp_rwlock_t lwp_rwlock_t
1252 
1253 /* Defines from the private sys/synch32.h header. */
1254 #define vki_mutex_flag flags.flag1
1255 #define vki_mutex_type flags.mbcp_type_un.mtype_rcount.count_type1
1256 #define vki_mutex_rcount flags.mbcp_type_un.mtype_rcount.count_type2
1257 #define vki_mutex_owner data
1258 #define vki_mutex_lockw lock.lock64.pad[7]
1259 #define vki_mutex_waiters lock.lock64.pad[6]
1260 #define vki_mutex_ownerpid lock.lock32.ownerpid
1261 
1262 #define vki_cond_type flags.type
1263 #define vki_cond_waiters_kernel flags.flag[3]
1264 
1265 #define vki_sema_count count
1266 #define vki_sema_type type
1267 #define vki_sema_waiters flags[7]
1268 
1269 #define vki_rwlock_readers readers
1270 #define vki_rwlock_type type
1271 #define vki_rwlock_owner readercv.data
1272 #define vki_rwlock_ownerpid writercv.data
1273 
1274 
1275 #include <sys/sysconfig.h>
1276 #define VKI_CONFIG_OPEN_FILES _CONFIG_OPEN_FILES
1277 
1278 
1279 #include <sys/sysi86.h>
1280 #define VKI_SI86FPSTART SI86FPSTART
1281 
1282 
1283 #if defined(HAVE_SYS_SYSNVL_H)
1284 #include <sys/sysnvl.h>
1285 #define VKI_SYSNVL_OP_GET SYSNVL_OP_GET
1286 #define VKI_SYSNVL_OP_UPDATE SYSNVL_OP_UPDATE
1287 #endif /* HAVE_SYS_SYSNVL_H */
1288 
1289 
1290 #include <sys/systeminfo.h>
1291 #define VKI_SI_SYSNAME SI_SYSNAME
1292 #define VKI_SI_HOSTNAME SI_HOSTNAME
1293 #define VKI_SI_RELEASE SI_RELEASE
1294 #define VKI_SI_VERSION SI_VERSION
1295 #define VKI_SI_MACHINE SI_MACHINE
1296 #define VKI_SI_ARCHITECTURE SI_ARCHITECTURE
1297 #define VKI_SI_HW_SERIAL SI_HW_SERIAL
1298 #define VKI_SI_HW_PROVIDER SI_HW_PROVIDER
1299 #define VKI_SI_SRPC_DOMAIN SI_SRPC_DOMAIN
1300 
1301 #define VKI_SI_SET_HOSTNAME SI_SET_HOSTNAME
1302 #define VKI_SI_SET_SRCP_DOMAIN SI_SET_SRPC_DOMAIN
1303 
1304 #define VKI_SI_PLATFORM SI_PLATFORM
1305 #define VKI_SI_ISALIST SI_ISALIST
1306 #define VKI_SI_DHCP_CACHE SI_DHCP_CACHE
1307 #define VKI_SI_ARCHITECTURE_32 SI_ARCHITECTURE_32
1308 #define VKI_SI_ARCHITECTURE_64 SI_ARCHITECTURE_64
1309 #define VKI_SI_ARCHITECTURE_K SI_ARCHITECTURE_K
1310 #define VKI_SI_ARCHITECTURE_NATIVE SI_ARCHITECTURE_NATIVE
1311 
1312 
1313 #include <sys/termio.h>
1314 #define vki_termio termio
1315 
1316 
1317 #include <sys/termios.h>
1318 #define vki_termios termios
1319 #define VKI_TCGETA TCGETA
1320 #define VKI_TCGETS TCGETS
1321 #define VKI_TCSETS TCSETS
1322 #define VKI_TCSETSF TCSETSF
1323 #define VKI_TCSETSW TCSETSW
1324 #define VKI_TIOCGPGRP TIOCGPGRP
1325 #define VKI_TIOCGSID TIOCGSID
1326 #define VKI_TIOCGWINSZ TIOCGWINSZ
1327 #define VKI_TIOCNOTTY TIOCNOTTY
1328 #define VKI_TIOCSCTTY TIOCSCTTY
1329 #define VKI_TIOCSPGRP TIOCSPGRP
1330 #define VKI_TIOCSWINSZ TIOCSWINSZ
1331 #define vki_winsize winsize
1332 
1333 
1334 #include <sys/time.h>
1335 #define VKI_CLOCK_MONOTONIC CLOCK_MONOTONIC
1336 #define VKI_CLOCK_THREAD_CPUTIME_ID CLOCK_THREAD_CPUTIME_ID
1337 
1338 #define vki_clockid_t clockid_t
1339 #define vki_timespec timespec
1340 #define vki_timespec_t timespec_t
1341 #define vki_timeval timeval
1342 #define vki_timezone timezone
1343 #define vki_itimerspec itimerspec
1344 #define vki_itimerval itimerval
1345 
1346 
1347 #include <sys/times.h>
1348 #define vki_tms tms
1349 
1350 
1351 #include <sys/tsol/label_macro.h>
1352 #define vki_bslabel_t bslabel_t
1353 
1354 
1355 /* Do not include sys/tsol/tndb.h if a C++ compiler is used to build a file
1356    which includes vki-solaris.h.  This cannot be done because the tndb.h
1357    header file uses the template keyword as a member name (on illumos). */
1358 #if !defined(__cplusplus)
1359 #include <sys/tsol/tndb.h>
1360 #define VKI_TNDB_DELETE TNDB_DELETE
1361 #define VKI_TNDB_FLUSH TNDB_FLUSH
1362 #define VKI_TNDB_GET TNDB_GET
1363 #if defined(SOLARIS_TNDB_GET_TNIP)
1364 #define VKI_TNDB_GET_TNIP TNDB_GET_TNIP
1365 #endif /* SOLARIS_TNDB_GET_TNIP */
1366 #define VKI_TNDB_LOAD TNDB_LOAD
1367 #define vki_tsol_mlpent_t tsol_mlpent_t
1368 #define vki_tsol_rhent_t tsol_rhent_t
1369 #define vki_tsol_tpent_t tsol_tpent_t
1370 #endif /* !__cplusplus */
1371 
1372 
1373 #include <sys/tsol/tsyscall.h>
1374 #define VKI_TSOL_FGETLABEL TSOL_FGETLABEL
1375 #define VKI_TSOL_GETLABEL TSOL_GETLABEL
1376 #define VKI_TSOL_TNMLP TSOL_TNMLP
1377 #define VKI_TSOL_TNRH TSOL_TNRH
1378 #define VKI_TSOL_TNRHTP TSOL_TNRHTP
1379 #define VKI_TSOL_SYSLABELING TSOL_SYSLABELING
1380 #if defined(SOLARIS_TSOL_CLEARANCE)
1381 #define VKI_TSOL_GETCLEARANCE TSOL_GETCLEARANCE
1382 #define VKI_TSOL_SETCLEARANCE TSOL_SETCLEARANCE
1383 #endif /* SOLARIS_TSOL_CLEARANCE */
1384 
1385 
1386 #include <sys/ttold.h>
1387 #define vki_sgttyb sgttyb
1388 
1389 
1390 #include <ucontext.h>
1391 /* This section also contains items defined in sys/regset.h, this file
1392    is directly included in ucontext.h. */
1393 #if defined(VGP_x86_solaris)
1394 #define VKI_SS SS
1395 #define VKI_UESP UESP
1396 #define VKI_EFL EFL
1397 #define VKI_CS CS
1398 #define VKI_EIP EIP
1399 #define VKI_ERR 13 /* ERR */
1400 #define VKI_TRAPNO TRAPNO
1401 #define VKI_EAX EAX
1402 #define VKI_ECX ECX
1403 #define VKI_EDX EDX
1404 #define VKI_EBX EBX
1405 #define VKI_ESP ESP
1406 #define VKI_EBP EBP
1407 #define VKI_ESI ESI
1408 #define VKI_EDI EDI
1409 #define VKI_DS DS
1410 #define VKI_ES ES
1411 #define VKI_FS FS
1412 #define VKI_GS GS
1413 
1414 /* Definitions for compatibility with amd64-solaris. */
1415 #define VKI_REG_ERR VKI_ERR
1416 #define VKI_REG_TRAPNO VKI_TRAPNO
1417 
1418 #define VKI_EFLAGS_ID_BIT (1 << 21)
1419 
1420 #elif defined(VGP_amd64_solaris)
1421 #define VKI_REG_GSBASE REG_GSBASE
1422 #define VKI_REG_FSBASE REG_FSBASE
1423 #define VKI_REG_DS REG_DS
1424 #define VKI_REG_ES REG_ES
1425 #define VKI_REG_GS REG_GS
1426 #define VKI_REG_FS REG_FS
1427 #define VKI_REG_SS REG_SS
1428 #define VKI_REG_RSP REG_RSP
1429 #define VKI_REG_RFL REG_RFL
1430 #define VKI_REG_CS REG_CS
1431 #define VKI_REG_RIP REG_RIP
1432 #define VKI_REG_ERR REG_ERR
1433 #define VKI_REG_TRAPNO REG_TRAPNO
1434 #define VKI_REG_RAX REG_RAX
1435 #define VKI_REG_RCX REG_RCX
1436 #define VKI_REG_RDX REG_RDX
1437 #define VKI_REG_RBX REG_RBX
1438 #define VKI_REG_RBP REG_RBP
1439 #define VKI_REG_RSI REG_RSI
1440 #define VKI_REG_RDI REG_RDI
1441 #define VKI_REG_R8 REG_R8
1442 #define VKI_REG_R9 REG_R9
1443 #define VKI_REG_R10 REG_R10
1444 #define VKI_REG_R11 REG_R11
1445 #define VKI_REG_R12 REG_R12
1446 #define VKI_REG_R13 REG_R13
1447 #define VKI_REG_R14 REG_R14
1448 #define VKI_REG_R15 REG_R15
1449 
1450 #define VKI_RFLAGS_ID_BIT (1 << 21)
1451 
1452 #else
1453 #error "Unknown platform"
1454 #endif
1455 
1456 #define vki_fpregset_t fpregset_t
1457 
1458 /* Don't polute global namespace so much. */
1459 #undef r_r0
1460 #undef r_r1
1461 #undef r_fp
1462 #undef r_sp
1463 #undef r_pc
1464 #undef r_ps
1465 #undef ERR
1466 
1467 #if defined(VGP_x86_solaris)
1468 /* The ucontext structure as defined in the SYSV ABI for Intel386. Illumos
1469    contains exactly this definition. Solaris 11 utilizes two uc_filler values
1470    -> "xrs_t uc_xrs; long uc_filler[3];". The xrs_t structure is used for the
1471    AVX support. We define our own ucontext structure because all five
1472    uc_filler values need to be available in VG_(save_context). Note that
1473    Valgrind doesn't support AVX on the x86 platform. */
1474 typedef struct sysv_ucontext sysv_ucontext_t;
1475 struct sysv_ucontext {
1476    unsigned long uc_flags;
1477    sysv_ucontext_t *uc_link;
1478    sigset_t uc_sigmask;
1479    stack_t uc_stack;
1480    mcontext_t uc_mcontext;
1481    long uc_filler[5];
1482 };
1483 #define VKI_UC_GUEST_CC_OP(uc) (*(UWord*)&(uc)->uc_filler[0])
1484 #define VKI_UC_GUEST_CC_NDEP(uc) (*(UWord*)&(uc)->uc_filler[1])
1485 #define VKI_UC_GUEST_CC_DEP1(uc) (*(UWord*)&(uc)->uc_filler[2])
1486 #define VKI_UC_GUEST_CC_DEP2(uc) (*(UWord*)&(uc)->uc_filler[3])
1487 #define VKI_UC_GUEST_EFLAGS_NEG(uc) \
1488    (*(UWord*)&(uc)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.__pad[0])
1489 #define VKI_UC_GUEST_EFLAGS_CHECKSUM(uc) \
1490    (*(UWord*)&(uc)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.__pad[1])
1491 #define VKI_UC_SIGNO(uc) (*(UWord*)&(uc)->uc_filler[4])
1492 #define VKI_UC_SIGNO_CONST(uc) (*(const UWord*)&(uc)->uc_filler[4])
1493 
1494 #define vki_ucontext_t sysv_ucontext_t
1495 #define vki_ucontext sysv_ucontext
1496 
1497 #elif defined(VGP_amd64_solaris)
1498 /* The ucontext structure on Solaris has only 3 elements available in uc_filler
1499    which is not enough to store all required information. Therefore padding
1500    area in mcontext's FPU regset is used. */
1501 #define vki_ucontext ucontext
1502 #define vki_ucontext_t ucontext_t
1503 #define VKI_UC_MC_FP_FX_IGN2(uc) \
1504     (uc)->uc_mcontext.fpregs.fp_reg_set.fpchip_state.__fx_ign2
1505 #define VKI_UC_GUEST_CC_OP(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[0])
1506 #define VKI_UC_GUEST_CC_NDEP(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[1])
1507 #define VKI_UC_GUEST_CC_DEP1(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[2])
1508 #define VKI_UC_GUEST_CC_DEP2(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[3])
1509 #define VKI_UC_GUEST_RFLAGS_NEG(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[4])
1510 #define VKI_UC_GUEST_RFLAGS_CHECKSUM(uc) \
1511    (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[5])
1512 #define VKI_UC_SIGNO(uc) (*(UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[6])
1513 #define VKI_UC_SIGNO_CONST(uc) (*(const UWord *) &VKI_UC_MC_FP_FX_IGN2(uc)[6])
1514 
1515 #else
1516 #error "Unknown platform"
1517 #endif
1518 
1519 #if defined(SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE)
1520 #define vki_fpchip_state _fpchip_state
1521 #else
1522 #define vki_fpchip_state fpchip_state
1523 #endif /* SOLARIS_FPCHIP_STATE_TAKES_UNDERSCORE */
1524 
1525 #define VKI_GETCONTEXT GETCONTEXT
1526 #define VKI_SETCONTEXT SETCONTEXT
1527 #define VKI_GETUSTACK GETUSTACK
1528 #define VKI_SETUSTACK SETUSTACK
1529 
1530 #define VKI_UC_SIGMASK UC_SIGMASK
1531 #define VKI_UC_STACK UC_STACK
1532 #define VKI_UC_CPU UC_CPU
1533 #define VKI_UC_FPU UC_FPU
1534 #define VKI_UC_ALL UC_ALL
1535 
1536 #include <sys/uio.h>
1537 #define vki_iovec iovec
1538 
1539 
1540 #include <sys/un.h>
1541 #define vki_sockaddr_un sockaddr_un
1542 
1543 
1544 #if defined(SOLARIS_UUIDSYS_SYSCALL)
1545 #include <sys/uuid.h>
1546 #define vki_uuid uuid
1547 #endif /* SOLARIS_UUIDSYS_SYSCALL */
1548 
1549 
1550 #include <sys/utsname.h>
1551 #define vki_utsname utsname
1552 /* Add another alias for utsname, used in syswrap-generic.c. */
1553 #define vki_new_utsname utsname
1554 
1555 
1556 #include <sys/vm_usage.h>
1557 #define vki_vmusage_t vmusage_t
1558 
1559 
1560 #include <sys/wait.h>
1561 #define VKI_WEXITED WEXITED
1562 #define VKI_WTRAPPED WTRAPPED
1563 
1564 #define VKI_WSTOPFLG WSTOPFLG
1565 #define VKI_WCONTFLG WCONTFLG
1566 #define VKI_WCOREFLG WCOREFLG
1567 
1568 
1569 #include <sys/zone.h>
1570 #define VKI_ZONE_ADD_DATALINK ZONE_ADD_DATALINK
1571 #define VKI_ZONE_ATTR_NAME ZONE_ATTR_NAME
1572 #define VKI_ZONE_BOOT ZONE_BOOT
1573 #define VKI_ZONE_CHECK_DATALINK ZONE_CHECK_DATALINK
1574 #define VKI_ZONE_CREATE ZONE_CREATE
1575 #define VKI_ZONE_DEL_DATALINK ZONE_DEL_DATALINK
1576 #define VKI_ZONE_DESTROY ZONE_DESTROY
1577 #define VKI_ZONE_ENTER ZONE_ENTER
1578 #define VKI_ZONE_GETATTR ZONE_GETATTR
1579 #define VKI_ZONE_LIST ZONE_LIST
1580 #define VKI_ZONE_LIST_DATALINK ZONE_LIST_DATALINK
1581 #define VKI_ZONE_LOOKUP ZONE_LOOKUP
1582 #define VKI_ZONE_SETATTR ZONE_SETATTR
1583 #define VKI_ZONE_SHUTDOWN ZONE_SHUTDOWN
1584 #if defined(SOLARIS_ZONE_DEFUNCT)
1585 #define VKI_ZONE_GETATTR_DEFUNCT ZONE_GETATTR_DEFUNCT
1586 #define VKI_ZONE_LIST_DEFUNCT ZONE_LIST_DEFUNCT
1587 #endif /* SOLARIS_ZONE_DEFUNCT */
1588 #define VKI_ZONENAME_MAX ZONENAME_MAX
1589 #define vki_zone_def zone_def
1590 #define vki_zoneid_t zoneid_t
1591 
1592 
1593 /* from <sys/ucred.h> which is consolidation private */
1594 #define VKI_UCREDSYS_UCREDGET 0
1595 #define VKI_UCREDSYS_GETPEERUCRED 1
1596 struct ucred_s {
1597    vki_uint32_t uc_size;     /* Size of the full structure */
1598    vki_uint32_t uc_credoff;  /* Credential offset */
1599    vki_uint32_t uc_privoff;  /* Privilege offset */
1600    vki_pid_t    uc_pid;      /* Process id */
1601    vki_uint32_t uc_audoff;   /* Audit info offset */
1602    vki_zoneid_t uc_zoneid;   /* Zone id */
1603    vki_projid_t uc_projid;   /* Project id */
1604    vki_uint32_t uc_labeloff; /* label offset */
1605 };
1606 
1607 
1608 /* from sys/old_procfs.h which clashes with sys/procfs.h */
1609 
1610 #define VKI_ELF_OLD_PR_PCINVAL 0x0080
1611 
1612 typedef struct vki_elf_prpsinfo {
1613    char     pr_state;   /* numeric process state (see pr_sname) */
1614    char     pr_sname;   /* printable character representing pr_state */
1615    char     pr_zomb;    /* !=0: process terminated but not waited for */
1616    char     pr_nice;    /* nice for cpu usage */
1617    vki_uint_t   pr_flag;    /* process flags */
1618    vki_uid_t    pr_uid;     /* real user id */
1619    vki_gid_t    pr_gid;     /* real group id */
1620    vki_pid_t    pr_pid;     /* unique process id */
1621    vki_pid_t    pr_ppid;    /* process id of parent */
1622    vki_pid_t    pr_pgrp;    /* pid of process group leader */
1623    vki_pid_t    pr_sid;     /* session id */
1624    vki_caddr_t  pr_addr;    /* physical address of process */
1625    vki_size_t   pr_size;    /* size of process image in pages */
1626    vki_size_t   pr_rssize;  /* resident set size in pages */
1627    vki_caddr_t  pr_wchan;   /* wait addr for sleeping process */
1628    vki_timespec_t pr_start; /* process start time, sec+nsec since epoch */
1629    vki_timespec_t pr_time;  /* usr+sys cpu time for this process */
1630    int      pr_pri;     /* priority, high value is high priority */
1631    char     pr_oldpri;  /* pre-SVR4, low value is high priority */
1632    char     pr_cpu;     /* pre-SVR4, cpu usage for scheduling */
1633    vki_o_dev_t  pr_ottydev; /* short tty device number */
1634    vki_dev_t    pr_lttydev; /* controlling tty device (PRNODEV if none) */
1635    char     pr_clname[8];   /* scheduling class name */
1636    char     pr_fname[16];   /* last component of execed pathname */
1637    char     pr_psargs[80];  /* initial characters of arg list */
1638    short    pr_syscall; /* system call number (if in syscall) */
1639    short    pr_fill;
1640    vki_timespec_t pr_ctime; /* usr+sys cpu time for reaped children */
1641    vki_size_t   pr_bysize;  /* size of process image in bytes */
1642    vki_size_t   pr_byrssize;    /* resident set size in bytes */
1643    int      pr_argc;    /* initial argument count */
1644    char     **pr_argv;  /* initial argument vector */
1645    char     **pr_envp;  /* initial environment vector */
1646    int      pr_wstat;   /* if zombie, the wait() status */
1647                             /* The following percent numbers are 16-bit binary */
1648                             /* fractions [0 .. 1] with the binary point to the */
1649                             /* right of the high-order bit (one == 0x8000) */
1650    ushort_t     pr_pctcpu;  /* % of recent cpu time, one or all lwps */
1651    ushort_t     pr_pctmem;  /* % of of system memory used by the process */
1652    vki_uid_t    pr_euid;    /* effective user id */
1653    vki_gid_t    pr_egid;    /* effective group id */
1654    vki_id_t pr_aslwpid; /* historical; now always zero */
1655    char     pr_dmodel;  /* data model of the process */
1656    char     pr_pad[3];
1657    int      pr_filler[6];   /* for future expansion */
1658 } vki_elf_prpsinfo_t;
1659 
1660 typedef struct vki_elf_prstatus {
1661    int      pr_flags;   /* Flags (see below) */
1662    short    pr_why;     /* Reason for process stop (if stopped) */
1663    short    pr_what;    /* More detailed reason */
1664    vki_siginfo_t pr_info;   /* Info associated with signal or fault */
1665    short    pr_cursig;  /* Current signal */
1666    ushort_t     pr_nlwp;    /* Number of lwps in the process */
1667    vki_sigset_t pr_sigpend; /* Set of signals pending to the process */
1668    vki_sigset_t pr_sighold; /* Set of signals held (blocked) by the lwp */
1669    struct vki_sigaltstack pr_altstack; /* Alternate signal stack info */
1670    struct sigaction pr_action;  /* Signal action for current signal */
1671    vki_pid_t    pr_pid;     /* Process id */
1672    vki_pid_t    pr_ppid;    /* Parent process id */
1673    vki_pid_t    pr_pgrp;    /* Process group id */
1674    vki_pid_t    pr_sid;     /* Session id */
1675    vki_timespec_t pr_utime; /* Process user cpu time */
1676    vki_timespec_t pr_stime; /* Process system cpu time */
1677    vki_timespec_t pr_cutime;    /* Sum of children's user times */
1678    vki_timespec_t pr_cstime;    /* Sum of children's system times */
1679    char pr_clname[PRCLSZ];  /* Scheduling class name */
1680    short    pr_syscall; /* System call number (if in syscall) */
1681    short    pr_nsysarg; /* Number of arguments to this syscall */
1682    long pr_sysarg[PRSYSARGS];   /* Arguments to this syscall */
1683    vki_id_t pr_who;     /* Specific lwp identifier */
1684    vki_sigset_t pr_lwppend; /* Set of signals pending to the lwp */
1685    struct vki_ucontext *pr_oldcontext; /* Address of previous ucontext */
1686    vki_caddr_t  pr_brkbase; /* Address of the process heap */
1687    vki_size_t   pr_brksize; /* Size of the process heap, in bytes */
1688    vki_caddr_t  pr_stkbase; /* Address of the process stack */
1689    vki_size_t   pr_stksize; /* Size of the process stack, in bytes */
1690    short    pr_processor;   /* processor which last ran this LWP */
1691    short    pr_bind;    /* processor LWP bound to or PBIND_NONE */
1692    long     pr_instr;   /* Current instruction */
1693    vki_prgregset_t pr_reg;  /* General registers */
1694 } vki_elf_prstatus_t;
1695 
1696 
1697 /* Signal frames. */
1698 #if defined(VGP_x86_solaris)
1699 struct vki_sigframe {
1700    /* First four words look like a call to a 3-arg x86 function. */
1701    void *return_addr;
1702    int a1_signo;
1703    vki_siginfo_t *a2_siginfo;
1704    vki_ucontext_t *a3_ucontext;
1705    /* Saved ucontext and siginfo. */
1706    vki_ucontext_t ucontext;
1707    vki_siginfo_t siginfo;
1708 };
1709 
1710 #elif defined(VGP_amd64_solaris)
1711 struct vki_sigframe {
1712    void *return_addr;
1713    long a1_signo;
1714    vki_siginfo_t *a2_siginfo;
1715    /* Saved ucontext and siginfo. */
1716    vki_ucontext_t ucontext;
1717    vki_siginfo_t siginfo;
1718 };
1719 
1720 #else
1721 #error "Unknown platform"
1722 #endif
1723 typedef struct vki_sigframe vki_sigframe_t;
1724 
1725 #endif // __VKI_SOLARIS_H
1726 
1727 /*--------------------------------------------------------------------*/
1728 /*--- end                                                          ---*/
1729 /*--------------------------------------------------------------------*/