vki-solaris.h 51 KB

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