Home | History | Annotate | Download | only in vki
      1 /*--------------------------------------------------------------------*/
      2 /*--- Solaris-specific kernel interface for the repository cache   ---*/
      3 /*--- protocol.                             vki-solaris-repcache.h ---*/
      4 /*--------------------------------------------------------------------*/
      5 
      6 /*
      7    This file is part of Valgrind, a dynamic binary instrumentation
      8    framework.
      9 
     10    Copyright (C) 2015-2015 Ivo Raisr
     11       ivosh (at) ivosh.net
     12 
     13    This program is free software; you can redistribute it and/or
     14    modify it under the terms of the GNU General Public License as
     15    published by the Free Software Foundation; either version 2 of the
     16    License, or (at your option) any later version.
     17 
     18    This program is distributed in the hope that it will be useful, but
     19    WITHOUT ANY WARRANTY; without even the implied warranty of
     20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     21    General Public License for more details.
     22 
     23    You should have received a copy of the GNU General Public License
     24    along with this program; if not, write to the Free Software
     25    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     26    02111-1307, USA.
     27 
     28    The GNU General Public License is contained in the file COPYING.
     29 */
     30 
     31 /* Copyright 2015-2015, Tomas Jedlicka <jedlickat (at) gmail.com>. */
     32 
     33 #ifndef __VKI_SOLARIS_REPCACHE_H
     34 #define __VKI_SOLARIS_REPCACHE_H
     35 
     36 /* From <repcache_protocol.h> which is consolidation private. */
     37 #define VKI_REPOSITORY_DOOR_BASEVER (('R' << 24) | ('e' << 16) | ('p' << 8))
     38 
     39 #if (SOLARIS_REPCACHE_PROTOCOL_VERSION == 21)
     40 #define VKI_REPOSITORY_DOOR_VERSION (21 + VKI_REPOSITORY_DOOR_BASEVER)
     41 enum vki_rep_protocol_requestid {
     42    VKI_REP_PROTOCOL_CLOSE = ('C' << 8),
     43    VKI_REP_PROTOCOL_ENTITY_SETUP,
     44    VKI_REP_PROTOCOL_ENTITY_NAME,
     45    VKI_REP_PROTOCOL_ENTITY_PARENT_TYPE,
     46    VKI_REP_PROTOCOL_ENTITY_GET_CHILD,
     47    VKI_REP_PROTOCOL_ENTITY_GET_PARENT,
     48    VKI_REP_PROTOCOL_ENTITY_GET,
     49    VKI_REP_PROTOCOL_ENTITY_UPDATE,
     50    VKI_REP_PROTOCOL_ENTITY_CREATE_CHILD,
     51    VKI_REP_PROTOCOL_ENTITY_CREATE_PG,
     52    VKI_REP_PROTOCOL_ENTITY_DELETE,
     53    VKI_REP_PROTOCOL_ENTITY_RESET,
     54    VKI_REP_PROTOCOL_ENTITY_TEARDOWN,
     55    VKI_REP_PROTOCOL_ITER_SETUP,
     56    VKI_REP_PROTOCOL_ITER_START,
     57    VKI_REP_PROTOCOL_ITER_READ,
     58    VKI_REP_PROTOCOL_ITER_READ_VALUE,
     59    VKI_REP_PROTOCOL_ITER_RESET,
     60    VKI_REP_PROTOCOL_ITER_TEARDOWN,
     61    VKI_REP_PROTOCOL_NEXT_SNAPLEVEL,
     62    VKI_REP_PROTOCOL_SNAPSHOT_TAKE,
     63    VKI_REP_PROTOCOL_SNAPSHOT_TAKE_NAMED,
     64    VKI_REP_PROTOCOL_SNAPSHOT_ATTACH,
     65    VKI_REP_PROTOCOL_PROPERTY_GET_TYPE,
     66    VKI_REP_PROTOCOL_PROPERTY_GET_VALUE,
     67    VKI_REP_PROTOCOL_PROPERTYGRP_SETUP_WAIT,
     68    VKI_REP_PROTOCOL_PROPERTYGRP_TX_START,
     69    VKI_REP_PROTOCOL_PROPERTYGRP_TX_COMMIT,
     70    VKI_REP_PROTOCOL_CLIENT_ADD_NOTIFY,
     71    VKI_REP_PROTOCOL_CLIENT_WAIT,
     72    VKI_REP_PROTOCOL_BACKUP,
     73    VKI_REP_PROTOCOL_SET_AUDIT_ANNOTATION,
     74    VKI_REP_PROTOCOL_SWITCH,
     75 };
     76 #elif (SOLARIS_REPCACHE_PROTOCOL_VERSION == 23)
     77 #define VKI_REPOSITORY_DOOR_VERSION (23 + VKI_REPOSITORY_DOOR_BASEVER)
     78 enum vki_rep_protocol_requestid {
     79    VKI_REP_PROTOCOL_CLOSE = ('C' << 8),
     80    VKI_REP_PROTOCOL_ENTITY_SETUP,
     81    VKI_REP_PROTOCOL_ENTITY_NAME,
     82    VKI_REP_PROTOCOL_ENTITY_PARENT_TYPE,
     83    VKI_REP_PROTOCOL_ENTITY_GET_CHILD,
     84    VKI_REP_PROTOCOL_ENTITY_GET_PARENT,
     85    VKI_REP_PROTOCOL_ENTITY_GET,
     86    VKI_REP_PROTOCOL_ENTITY_UPDATE,
     87    VKI_REP_PROTOCOL_ENTITY_CREATE_CHILD,
     88    VKI_REP_PROTOCOL_ENTITY_CREATE_PG,
     89    VKI_REP_PROTOCOL_ENTITY_DELETE,
     90    VKI_REP_PROTOCOL_ENTITY_UNDELETE,
     91    VKI_REP_PROTOCOL_ENTITY_REMOVE,
     92    VKI_REP_PROTOCOL_ENTITY_DELCUST,
     93    VKI_REP_PROTOCOL_BUNDLE_REMOVE,
     94    VKI_REP_PROTOCOL_ENTITY_RESET,
     95    VKI_REP_PROTOCOL_ENTITY_TEARDOWN,
     96    VKI_REP_PROTOCOL_ITER_SETUP,
     97    VKI_REP_PROTOCOL_ITER_START,
     98    VKI_REP_PROTOCOL_ITER_READ,
     99    VKI_REP_PROTOCOL_ITER_READ_VALUE,
    100    VKI_REP_PROTOCOL_ITER_RESET,
    101    VKI_REP_PROTOCOL_ITER_TEARDOWN,
    102    VKI_REP_PROTOCOL_NEXT_SNAPLEVEL,
    103    VKI_REP_PROTOCOL_SNAPSHOT_TAKE,
    104    VKI_REP_PROTOCOL_SNAPSHOT_TAKE_NAMED,
    105    VKI_REP_PROTOCOL_SNAPSHOT_ATTACH,
    106    VKI_REP_PROTOCOL_PROPERTY_GET_TYPE,
    107    VKI_REP_PROTOCOL_PROPERTY_GET_VALUE,
    108    VKI_REP_PROTOCOL_PG_SETUP_WAIT,
    109    VKI_REP_PROTOCOL_PG_TX_START,
    110    VKI_REP_PROTOCOL_PG_TX_COMMIT,
    111    VKI_REP_PROTOCOL_PROP_BUNDLE_REMOVE,
    112    VKI_REP_PROTOCOL_CLIENT_ADD_NOTIFY,
    113    VKI_REP_PROTOCOL_CLIENT_WAIT,
    114    VKI_REP_PROTOCOL_BACKUP,
    115    VKI_REP_PROTOCOL_SET_AUDIT_ANNOTATION,
    116    VKI_REP_PROTOCOL_UNSET_AUDIT_ANNOTATION,
    117    VKI_REP_PROTOCOL_SET_TX_DECORATION,
    118    VKI_REP_PROTOCOL_SWITCH,
    119    VKI_REP_PROTOCOL_DECORATION_GET_LAYER,
    120    VKI_REP_PROTOCOL_DECORATION_GET_TYPE,
    121    VKI_REP_PROTOCOL_DECORATION_GET_VALUE,
    122    VKI_REP_PROTOCOL_DECORATION_GET_BUNDLE,
    123    VKI_REP_PROTOCOL_ENTITY_INCONFLICT,
    124    VKI_REP_PROTOCOL_ENTITY_IS_MASKED,
    125    VKI_REP_PROTOCOL_CLIENT_REMOVE_NOTIFY,
    126 };
    127 #elif (SOLARIS_REPCACHE_PROTOCOL_VERSION == 25)
    128 #define VKI_REPOSITORY_DOOR_VERSION (25 + VKI_REPOSITORY_DOOR_BASEVER)
    129 enum vki_rep_protocol_requestid {
    130    VKI_REP_PROTOCOL_CLOSE = ('C' << 8),
    131    VKI_REP_PROTOCOL_ENTITY_SETUP,
    132    VKI_REP_PROTOCOL_ENTITY_NAME,
    133    VKI_REP_PROTOCOL_ENTITY_FMRI,
    134    VKI_REP_PROTOCOL_ENTITY_PARENT_TYPE,
    135    VKI_REP_PROTOCOL_ENTITY_GET_CHILD,
    136    VKI_REP_PROTOCOL_ENTITY_GET_PARENT,
    137    VKI_REP_PROTOCOL_ENTITY_GET_ROOT,
    138    VKI_REP_PROTOCOL_ENTITY_GET,
    139    VKI_REP_PROTOCOL_ENTITY_UPDATE,
    140    VKI_REP_PROTOCOL_ENTITY_CREATE_CHILD,
    141    VKI_REP_PROTOCOL_ENTITY_CREATE_PG,
    142    VKI_REP_PROTOCOL_ENTITY_DELETE,
    143    VKI_REP_PROTOCOL_ENTITY_UNDELETE,
    144    VKI_REP_PROTOCOL_ENTITY_REMOVE,
    145    VKI_REP_PROTOCOL_ENTITY_DELCUST,
    146    VKI_REP_PROTOCOL_BUNDLE_REMOVE,
    147    VKI_REP_PROTOCOL_ENTITY_RESET,
    148    VKI_REP_PROTOCOL_ENTITY_TEARDOWN,
    149    VKI_REP_PROTOCOL_ITER_SETUP,
    150    VKI_REP_PROTOCOL_ITER_START,
    151    VKI_REP_PROTOCOL_ITER_READ,
    152    VKI_REP_PROTOCOL_ITER_READ_VALUE,
    153    VKI_REP_PROTOCOL_ITER_RESET,
    154    VKI_REP_PROTOCOL_ITER_TEARDOWN,
    155    VKI_REP_PROTOCOL_NEXT_SNAPLEVEL,
    156    VKI_REP_PROTOCOL_SNAPSHOT_TAKE,
    157    VKI_REP_PROTOCOL_SNAPSHOT_TAKE_NAMED,
    158    VKI_REP_PROTOCOL_SNAPSHOT_ATTACH,
    159    VKI_REP_PROTOCOL_PROPERTY_GET_TYPE,
    160    VKI_REP_PROTOCOL_PROPERTY_GET_VALUE,
    161    VKI_REP_PROTOCOL_PG_SETUP_WAIT,
    162    VKI_REP_PROTOCOL_PG_TX_START,
    163    VKI_REP_PROTOCOL_PG_TX_COMMIT,
    164    VKI_REP_PROTOCOL_PROP_BUNDLE_REMOVE,
    165    VKI_REP_PROTOCOL_CLIENT_ADD_NOTIFY,
    166    VKI_REP_PROTOCOL_CLIENT_WAIT,
    167    VKI_REP_PROTOCOL_BACKUP,
    168    VKI_REP_PROTOCOL_SET_AUDIT_ANNOTATION,
    169    VKI_REP_PROTOCOL_UNSET_AUDIT_ANNOTATION,
    170    VKI_REP_PROTOCOL_SET_TX_DECORATION,
    171    VKI_REP_PROTOCOL_SWITCH,
    172    VKI_REP_PROTOCOL_DECORATION_GET_LAYER,
    173    VKI_REP_PROTOCOL_DECORATION_GET_TYPE,
    174    VKI_REP_PROTOCOL_DECORATION_GET_VALUE,
    175    VKI_REP_PROTOCOL_DECORATION_GET_BUNDLE,
    176    VKI_REP_PROTOCOL_ENTITY_INCONFLICT,
    177    VKI_REP_PROTOCOL_ENTITY_IS_MASKED,
    178    VKI_REP_PROTOCOL_CLIENT_REMOVE_NOTIFY,
    179 };
    180 #elif (SOLARIS_REPCACHE_PROTOCOL_VERSION == 26)
    181 #define VKI_REPOSITORY_DOOR_VERSION (26 + VKI_REPOSITORY_DOOR_BASEVER)
    182 enum vki_rep_protocol_requestid {
    183    VKI_REP_PROTOCOL_CLOSE = ('C' << 8),
    184    VKI_REP_PROTOCOL_ENTITY_SETUP,
    185    VKI_REP_PROTOCOL_ENTITY_NAME,
    186    VKI_REP_PROTOCOL_ENTITY_FMRI,
    187    VKI_REP_PROTOCOL_ENTITY_PARENT_TYPE,
    188    VKI_REP_PROTOCOL_ENTITY_GET_CHILD,
    189    VKI_REP_PROTOCOL_ENTITY_GET_PARENT,
    190    VKI_REP_PROTOCOL_ENTITY_GET_ROOT,
    191    VKI_REP_PROTOCOL_ENTITY_GET,
    192    VKI_REP_PROTOCOL_ENTITY_UPDATE,
    193    VKI_REP_PROTOCOL_ENTITY_CREATE_CHILD,
    194    VKI_REP_PROTOCOL_ENTITY_CREATE_PG,
    195    VKI_REP_PROTOCOL_ENTITY_DELETE,
    196    VKI_REP_PROTOCOL_ENTITY_UNDELETE,
    197    VKI_REP_PROTOCOL_ENTITY_REMOVE,
    198    VKI_REP_PROTOCOL_ENTITY_DELCUST,
    199    VKI_REP_PROTOCOL_BUNDLE_REMOVE,
    200    VKI_REP_PROTOCOL_ENTITY_RESET,
    201    VKI_REP_PROTOCOL_ENTITY_TEARDOWN,
    202    VKI_REP_PROTOCOL_ITER_SETUP,
    203    VKI_REP_PROTOCOL_ITER_START,
    204    VKI_REP_PROTOCOL_ITER_READ,
    205    VKI_REP_PROTOCOL_ITER_READ_VALUE,
    206    VKI_REP_PROTOCOL_ITER_RESET,
    207    VKI_REP_PROTOCOL_ITER_TEARDOWN,
    208    VKI_REP_PROTOCOL_NEXT_SNAPLEVEL,
    209    VKI_REP_PROTOCOL_SNAPSHOT_TAKE,
    210    VKI_REP_PROTOCOL_SNAPSHOT_TAKE_NAMED,
    211    VKI_REP_PROTOCOL_SNAPSHOT_ATTACH,
    212    VKI_REP_PROTOCOL_PROPERTY_GET_TYPE,
    213    VKI_REP_PROTOCOL_PROPERTY_GET_VALUE,
    214    VKI_REP_PROTOCOL_PG_SETUP_WAIT,
    215    VKI_REP_PROTOCOL_PG_TX_START,
    216    VKI_REP_PROTOCOL_PG_TX_COMMIT,
    217    VKI_REP_PROTOCOL_PROP_BUNDLE_REMOVE,
    218    VKI_REP_PROTOCOL_CLIENT_ADD_NOTIFY,
    219    VKI_REP_PROTOCOL_CLIENT_WAIT,
    220    VKI_REP_PROTOCOL_BACKUP,
    221    VKI_REP_PROTOCOL_SET_AUDIT_ANNOTATION,
    222    VKI_REP_PROTOCOL_UNSET_AUDIT_ANNOTATION,
    223    VKI_REP_PROTOCOL_SET_TX_DECORATION,
    224    VKI_REP_PROTOCOL_SWITCH,
    225    VKI_REP_PROTOCOL_DECORATION_GET_LAYER,
    226    VKI_REP_PROTOCOL_DECORATION_GET_TYPE,
    227    VKI_REP_PROTOCOL_DECORATION_GET_VALUE,
    228    VKI_REP_PROTOCOL_DECORATION_GET_BUNDLE,
    229    VKI_REP_PROTOCOL_ENTITY_INCONFLICT,
    230    VKI_REP_PROTOCOL_ENTITY_IS_MASKED,
    231    VKI_REP_PROTOCOL_CLIENT_REMOVE_NOTIFY,
    232    VKI_REP_PROTOCOL_MAX_REQUEST
    233 };
    234 #else
    235 #error Unsupported repcache protocol version
    236 #endif
    237 
    238 #define VKI_REPOSITORY_DOOR_NAME "/system/volatile/repository_door"
    239 #define VKI_REP_PROTOCOL_NAME_LEN 120
    240 enum vki_repository_door_requestid {
    241    VKI_REPOSITORY_DOOR_REQUEST_CONNECT = (('M' << 8) | 1)
    242 };
    243 enum vki_repository_door_statusid {
    244    VKI_REPOSITORY_DOOR_SUCCESS                = 0,
    245    VKI_REPOSITORY_DOOR_FAIL_BAD_REQUEST       = 1,
    246    VKI_REPOSITORY_DOOR_FAIL_VERSION_MISMATCH  = 2,
    247    VKI_REPOSITORY_DOOR_FAIL_BAD_FLAG          = 3,
    248    VKI_REPOSITORY_DOOR_FAIL_NO_RESOURCES      = 4,
    249    VKI_REPOSITORY_DOOR_FAIL_PERMISSION_DENIED = 5
    250 };
    251 typedef struct vki_repository_door_request {
    252    vki_uint32_t rdr_version;
    253    enum vki_repository_door_requestid rdr_request;
    254    vki_uint32_t rdr_flags;
    255    vki_uint32_t rdr_debug;
    256 } vki_repository_door_request_t;
    257 typedef struct vki_repository_door_response {
    258    enum vki_repository_door_statusid rdr_status;
    259 } vki_repository_door_response_t;
    260 typedef struct vki_rep_protocol_request {
    261    enum vki_rep_protocol_requestid rpr_request;
    262 } vki_rep_protocol_request_t;
    263 struct vki_rep_protocol_entity_setup {
    264    enum vki_rep_protocol_requestid rpr_request;
    265    vki_uint32_t rpr_entityid;
    266    vki_uint32_t rpr_entitytype;
    267 };
    268 struct vki_rep_protocol_entity_name {
    269    enum vki_rep_protocol_requestid rpr_request;
    270    vki_uint32_t rpr_entityid;
    271    vki_uint32_t rpr_answertype;
    272 };
    273 struct vki_rep_protocol_entity_get {
    274    enum vki_rep_protocol_requestid rpr_request;
    275    vki_uint32_t rpr_entityid;
    276    vki_uint32_t rpr_object;
    277 };
    278 struct vki_rep_protocol_entity_get_child {
    279    enum vki_rep_protocol_requestid rpr_request;
    280    vki_uint32_t rpr_entityid;
    281    vki_uint32_t rpr_childid;
    282    char rpr_name[VKI_REP_PROTOCOL_NAME_LEN];
    283 };
    284 struct vki_rep_protocol_entity_parent {
    285    enum vki_rep_protocol_requestid rpr_request;
    286    vki_uint32_t rpr_entityid;
    287    vki_uint32_t rpr_outid;
    288 };
    289 struct vki_rep_protocol_entity_root {
    290    enum vki_rep_protocol_requestid rpr_request;
    291    vki_uint32_t rpr_entityid;
    292    vki_uint32_t rpr_outid;
    293 };
    294 struct vki_rep_protocol_entity_reset {
    295    enum vki_rep_protocol_requestid rpr_request;
    296    vki_uint32_t rpr_entityid;
    297 };
    298 struct vki_rep_protocol_entity_teardown {
    299    enum vki_rep_protocol_requestid rpr_request;
    300    vki_uint32_t rpr_entityid;
    301 };
    302 struct vki_rep_protocol_iter_read {
    303    enum vki_rep_protocol_requestid rpr_request;
    304    vki_uint32_t rpr_iterid;
    305    vki_uint32_t rpr_sequence;
    306    vki_uint32_t rpr_entityid;
    307 };
    308 struct vki_rep_protocol_iter_read_value {
    309    enum vki_rep_protocol_requestid rpr_request;
    310    vki_uint32_t rpr_iterid;
    311    vki_uint32_t rpr_sequence;
    312 };
    313 struct vki_rep_protocol_iter_request {
    314    enum vki_rep_protocol_requestid rpr_request;
    315    vki_uint32_t rpr_iterid;
    316 };
    317 struct vki_rep_protocol_iter_start {
    318    enum vki_rep_protocol_requestid rpr_request;
    319    vki_uint32_t rpr_iterid;
    320    vki_uint32_t rpr_entity;
    321    vki_uint32_t rpr_itertype;
    322    vki_uint32_t rpr_flags;
    323    char rpr_pattern[VKI_REP_PROTOCOL_NAME_LEN];
    324 };
    325 struct vki_rep_protocol_property_request {
    326    enum vki_rep_protocol_requestid rpr_request;
    327    vki_uint32_t rpr_entityid;
    328 };
    329 
    330 
    331 
    332 
    333 #endif /* __VKI_SOLARIS_REPCACHE_21_H */
    334