Print this page
    
remove support for non-ANSI compilation
    
      
        | Split | Close | 
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/head/dlfcn.h
          +++ new/usr/src/head/dlfcn.h
   1    1  /*
   2    2   * CDDL HEADER START
   3    3   *
   4    4   * The contents of this file are subject to the terms of the
   5    5   * Common Development and Distribution License (the "License").
   6    6   * You may not use this file except in compliance with the License.
   7    7   *
   8    8   * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9    9   * or http://www.opensolaris.org/os/licensing.
  10   10   * See the License for the specific language governing permissions
  11   11   * and limitations under the License.
  
    | ↓ open down ↓ | 11 lines elided | ↑ open up ↑ | 
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
       22 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  22   23   * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  23   24   *
  24   25   *      Copyright (c) 1989 AT&T
  25   26   *        All Rights Reserved
  26   27   *
  27   28   */
  28   29  
  29   30  #ifndef _DLFCN_H
  30   31  #define _DLFCN_H
  31   32  
  32   33  #include <sys/feature_tests.h>
  33   34  #include <sys/types.h>
  34   35  #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
  35   36  #include <sys/auxv.h>
  36   37  #include <sys/mman.h>
  
    | ↓ open down ↓ | 5 lines elided | ↑ open up ↑ | 
  37   38  #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
  38   39  
  39   40  #ifdef  __cplusplus
  40   41  extern "C" {
  41   42  #endif
  42   43  
  43   44  /*
  44   45   * Information structures for various dlinfo() requests.
  45   46   */
  46   47  #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
  47      -#ifdef __STDC__
  48   48  typedef struct  dl_info {
  49   49          const char      *dli_fname;     /* file containing address range */
  50   50          void            *dli_fbase;     /* base address of file image */
  51   51          const char      *dli_sname;     /* symbol name */
  52   52          void            *dli_saddr;     /* symbol address */
  53   53  } Dl_info;
  54      -#else
  55      -typedef struct  dl_info {
  56      -        char            *dli_fname;
  57      -        void            *dli_fbase;
  58      -        char            *dli_sname;
  59      -        void            *dli_saddr;
  60      -} Dl_info;
  61      -#endif /* __STDC__ */
  62   54  typedef Dl_info         Dl_info_t;
  63   55  
  64   56  typedef struct  dl_serpath {
  65   57          char            *dls_name;      /* library search path name */
  66   58          uint_t          dls_flags;      /* path information */
  67   59  } Dl_serpath;
  68   60  typedef Dl_serpath      Dl_serpath_t;
  69   61  
  70   62  typedef struct  dl_serinfo {
  71   63          size_t          dls_size;       /* total buffer size */
  72   64          uint_t          dls_cnt;        /* number of path entries */
  73   65          Dl_serpath      dls_serpath[1]; /* there may be more than one */
  74   66  } Dl_serinfo;
  75   67  typedef Dl_serinfo      Dl_serinfo_t;
  76   68  
  77   69  typedef struct  dl_argsinfo {
  78   70          long            dla_argc;       /* process argument count */
  79   71          char            **dla_argv;     /* process arguments */
  80   72          char            **dla_envp;     /* process environment variables */
  81   73          auxv_t          *dla_auxv;      /* process auxv vectors */
  82   74  } Dl_argsinfo;
  83   75  typedef Dl_argsinfo     Dl_argsinfo_t;
  84   76  
  85   77  typedef struct {
  86   78          mmapobj_result_t *dlm_maps;     /* mapping information */
  87   79          uint_t          dlm_acnt;       /* number of dlm_maps mappings */
  88   80          uint_t          dlm_rcnt;       /* number of returned mappings */
  89   81  } Dl_mapinfo_t;
  90   82  
  91   83  typedef struct {
  92   84          uint_t          dlui_version;   /* version # */
  93   85          uint_t          dlui_flags;     /* flags */
  94   86          char            *dlui_objname;  /* path to object */
  95   87          void            *dlui_unwindstart; /* star of unwind hdr */
  96   88          void            *dlui_unwindend; /* end of unwind hdr */
  97   89          void            *dlui_segstart; /* start of segment described */
  98   90                                          /*  by unwind block */
  99   91          void            *dlui_segend;   /* end of segment described */
 100   92                                          /*  by unwind block */
 101   93  } Dl_amd64_unwindinfo;
 102   94  typedef Dl_amd64_unwindinfo     Dl_amd64_unwindinfo_t;
 103   95  
 104   96  typedef struct {
 105   97          const char      *dld_refname;   /* reference name */
 106   98          const char      *dld_depname;   /* new dependency name */
  
    | ↓ open down ↓ | 35 lines elided | ↑ open up ↑ | 
 107   99  } Dl_definfo_t;
 108  100  
 109  101  #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
 110  102  
 111  103  
 112  104  typedef ulong_t         Lmid_t;
 113  105  
 114  106  /*
 115  107   * Declarations used for dynamic linking support routines.
 116  108   */
 117      -#ifdef __STDC__
 118  109  extern void     *dlopen(const char *, int);
 119  110  extern void     *dlsym(void *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
 120  111  extern int      dlclose(void *);
 121  112  extern char     *dlerror(void);
 122  113  #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
 123  114  extern void     *dlmopen(Lmid_t, const char *, int);
 124  115  extern int      dladdr(void *, Dl_info *);
 125  116  extern int      dladdr1(void *, Dl_info *, void **, int);
 126  117  extern int      dldump(const char *, const char *, int);
 127  118  extern int      dlinfo(void *, int, void *);
 128  119  extern Dl_amd64_unwindinfo  *dlamd64getunwind(void *, Dl_amd64_unwindinfo *);
 129  120  #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
 130      -#else
 131      -extern void     *dlopen();
 132      -extern void     *dlsym();
 133      -extern int      dlclose();
 134      -extern char     *dlerror();
 135      -#if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
 136      -extern void     *dlmopen();
 137      -extern int      dladdr();
 138      -extern int      dladdr1();
 139      -extern int      dldump();
 140      -extern int      dlinfo();
 141      -extern Dl_amd64_unwindinfo  *dlamd64getunwind();
 142      -#endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
 143      -#endif /* __STDC__ */
 144  121  
 145  122  #pragma unknown_control_flow(dlopen, dlsym, dlclose, dlerror)
 146  123  #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
 147  124  #pragma unknown_control_flow(dlmopen, dladdr, dladdr1, dldump, dlinfo)
 148  125  #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
 149  126  
 150  127  /*
 151  128   * Valid values for handle argument to dlsym(3x).
 152  129   */
 153  130  #define RTLD_NEXT               (void *)-1      /* look in `next' dependency */
 154  131  #define RTLD_DEFAULT            (void *)-2      /* look up symbol from scope */
 155  132                                                  /*      of current object */
 156  133  #define RTLD_SELF               (void *)-3      /* look in `ourself' */
 157  134  #define RTLD_PROBE              (void *)-4      /* look up symbol from scope */
 158  135                                                  /*      of current object, */
 159  136                                                  /*      using currently */
 160  137                                                  /*      loaded objects only. */
 161  138  /*
 162  139   * Valid values for mode argument to dlopen.
 163  140   */
 164  141  #define RTLD_LAZY               0x00001         /* deferred function binding */
 165  142  #define RTLD_NOW                0x00002         /* immediate function binding */
 166  143  #define RTLD_NOLOAD             0x00004         /* don't load object */
 167  144  
 168  145  #define RTLD_GLOBAL             0x00100         /* export symbols to others */
 169  146  #define RTLD_LOCAL              0x00000         /* symbols are only available */
 170  147                                                  /*      to group members */
 171  148  #define RTLD_PARENT             0x00200         /* add parent (caller) to */
 172  149                                                  /*      a group dependencies */
 173  150  #define RTLD_GROUP              0x00400         /* resolve symbols within */
 174  151                                                  /*      members of the group */
 175  152  #define RTLD_WORLD              0x00800         /* resolve symbols within */
 176  153                                                  /*      global objects */
 177  154  #define RTLD_NODELETE           0x01000         /* do not remove members */
 178  155  #define RTLD_FIRST              0x02000         /* only first object is */
 179  156                                                  /*      available for dlsym */
 180  157  #define RTLD_CONFGEN            0x10000         /* crle(1) config generation */
 181  158                                                  /*      internal use only */
 182  159  
 183  160  /*
 184  161   * Valid values for flag argument to dldump.
 185  162   */
 186  163  #define RTLD_REL_RELATIVE       0x00001         /* apply relative relocs */
 187  164  #define RTLD_REL_EXEC           0x00002         /* apply symbolic relocs that */
 188  165                                                  /*      bind to main */
 189  166  #define RTLD_REL_DEPENDS        0x00004         /* apply symbolic relocs that */
 190  167                                                  /*      bind to dependencies */
 191  168  #define RTLD_REL_PRELOAD        0x00008         /* apply symbolic relocs that */
 192  169                                                  /*      bind to preload objs */
 193  170  #define RTLD_REL_SELF           0x00010         /* apply symbolic relocs that */
 194  171                                                  /*      bind to ourself */
 195  172  #define RTLD_REL_WEAK           0x00020         /* apply symbolic weak relocs */
 196  173                                                  /*      even if unresolved */
 197  174  #define RTLD_REL_ALL            0x00fff         /* apply all relocs */
 198  175  
 199  176  #define RTLD_MEMORY             0x01000         /* use memory sections */
 200  177  #define RTLD_STRIP              0x02000         /* retain allocable sections */
 201  178                                                  /*      only */
 202  179  #define RTLD_NOHEAP             0x04000         /* do no save any heap */
 203  180  #define RTLD_CONFSET            0x10000         /* crle(1) config generation */
 204  181                                                  /*      internal use only */
 205  182  
 206  183  /*
 207  184   * Valid values for dladdr1() flags.
 208  185   */
 209  186  #define RTLD_DL_SYMENT          1               /* return symbol table entry */
 210  187  #define RTLD_DL_LINKMAP         2               /* return public link-map */
 211  188  #define RTLD_DL_MASK            0xffff
 212  189  
 213  190  
 214  191  /*
 215  192   * Arguments for dlinfo()
 216  193   */
 217  194  #define RTLD_DI_LMID            1               /* obtain link-map id */
 218  195  #define RTLD_DI_LINKMAP         2               /* obtain link-map */
 219  196  #define RTLD_DI_CONFIGADDR      3               /* obtain config addr */
 220  197  #define RTLD_DI_SERINFO         4               /* obtain search path info or */
 221  198  #define RTLD_DI_SERINFOSIZE     5               /*    associated info size */
 222  199  #define RTLD_DI_ORIGIN          6               /* obtain objects origin */
 223  200  #define RTLD_DI_PROFILENAME     7               /* obtain profile object name */
 224  201                                                  /*    internal use only */
 225  202  #define RTLD_DI_PROFILEOUT      8               /* obtain profile output name */
 226  203                                                  /*    internal use only */
 227  204  #define RTLD_DI_GETSIGNAL       9               /* get termination signal */
 228  205  #define RTLD_DI_SETSIGNAL       10              /* set termination signal */
 229  206  #define RTLD_DI_ARGSINFO        11              /* get process arguments */
 230  207                                                  /*    environment and auxv */
 231  208  #define RTLD_DI_MMAPS           12              /* obtain objects mappings or */
 232  209  #define RTLD_DI_MMAPCNT         13              /*    mapping count */
 233  210  #define RTLD_DI_DEFERRED        14              /* assign new dependency to a */
 234  211                                                  /*    deferred dependency */
 235  212  #define RTLD_DI_DEFERRED_SYM    15              /* assign new dependency to a */
 236  213                                                  /*    deferred dependency */
 237  214                                                  /*    using a symbol name */
 238  215  #define RTLD_DI_MAX             15
 239  216  
 240  217  #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
 241  218  /*
 242  219   * Version information for Dl_amd64_unwindinfo.dlui_version
 243  220   */
 244  221  #define DLUI_VERS_1             1
 245  222  #define DLUI_VERS_CURRENT       DLUI_VERS_1
 246  223  
 247  224  /*
 248  225   * Valid flags for Dl_amd64_unwindinfo.dlfi_flags
 249  226   */
 250  227  #define DLUI_FLG_NOUNWIND       0x0001          /* object has no Unwind info */
 251  228  #define DLUI_FLG_NOOBJ          0x0002          /* no object was found */
 252  229                                                  /*  matching the pc provided */
 253  230  #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
 254  231  
 255  232  #ifdef  __cplusplus
 256  233  }
 257  234  #endif
 258  235  
 259  236  #endif  /* _DLFCN_H */
  
    | ↓ open down ↓ | 106 lines elided | ↑ open up ↑ | 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX