Print this page
remove support for non-ANSI compilation


   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*

  22  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  23  *
  24  *      Copyright (c) 1989 AT&T
  25  *        All Rights Reserved
  26  *
  27  */
  28 
  29 #ifndef _DLFCN_H
  30 #define _DLFCN_H
  31 
  32 #include <sys/feature_tests.h>
  33 #include <sys/types.h>
  34 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
  35 #include <sys/auxv.h>
  36 #include <sys/mman.h>
  37 #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 /*
  44  * Information structures for various dlinfo() requests.
  45  */
  46 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
  47 #ifdef __STDC__
  48 typedef struct  dl_info {
  49         const char      *dli_fname;     /* file containing address range */
  50         void            *dli_fbase;     /* base address of file image */
  51         const char      *dli_sname;     /* symbol name */
  52         void            *dli_saddr;     /* symbol address */
  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 typedef Dl_info         Dl_info_t;
  63 
  64 typedef struct  dl_serpath {
  65         char            *dls_name;      /* library search path name */
  66         uint_t          dls_flags;      /* path information */
  67 } Dl_serpath;
  68 typedef Dl_serpath      Dl_serpath_t;
  69 
  70 typedef struct  dl_serinfo {
  71         size_t          dls_size;       /* total buffer size */
  72         uint_t          dls_cnt;        /* number of path entries */
  73         Dl_serpath      dls_serpath[1]; /* there may be more than one */
  74 } Dl_serinfo;
  75 typedef Dl_serinfo      Dl_serinfo_t;
  76 
  77 typedef struct  dl_argsinfo {
  78         long            dla_argc;       /* process argument count */
  79         char            **dla_argv;     /* process arguments */
  80         char            **dla_envp;     /* process environment variables */
  81         auxv_t          *dla_auxv;      /* process auxv vectors */


  97         void            *dlui_segstart; /* start of segment described */
  98                                         /*  by unwind block */
  99         void            *dlui_segend;   /* end of segment described */
 100                                         /*  by unwind block */
 101 } Dl_amd64_unwindinfo;
 102 typedef Dl_amd64_unwindinfo     Dl_amd64_unwindinfo_t;
 103 
 104 typedef struct {
 105         const char      *dld_refname;   /* reference name */
 106         const char      *dld_depname;   /* new dependency name */
 107 } Dl_definfo_t;
 108 
 109 #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
 110 
 111 
 112 typedef ulong_t         Lmid_t;
 113 
 114 /*
 115  * Declarations used for dynamic linking support routines.
 116  */
 117 #ifdef __STDC__
 118 extern void     *dlopen(const char *, int);
 119 extern void     *dlsym(void *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
 120 extern int      dlclose(void *);
 121 extern char     *dlerror(void);
 122 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
 123 extern void     *dlmopen(Lmid_t, const char *, int);
 124 extern int      dladdr(void *, Dl_info *);
 125 extern int      dladdr1(void *, Dl_info *, void **, int);
 126 extern int      dldump(const char *, const char *, int);
 127 extern int      dlinfo(void *, int, void *);
 128 extern Dl_amd64_unwindinfo  *dlamd64getunwind(void *, Dl_amd64_unwindinfo *);
 129 #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 
 145 #pragma unknown_control_flow(dlopen, dlsym, dlclose, dlerror)
 146 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
 147 #pragma unknown_control_flow(dlmopen, dladdr, dladdr1, dldump, dlinfo)
 148 #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
 149 
 150 /*
 151  * Valid values for handle argument to dlsym(3x).
 152  */
 153 #define RTLD_NEXT               (void *)-1      /* look in `next' dependency */
 154 #define RTLD_DEFAULT            (void *)-2      /* look up symbol from scope */
 155                                                 /*      of current object */
 156 #define RTLD_SELF               (void *)-3      /* look in `ourself' */
 157 #define RTLD_PROBE              (void *)-4      /* look up symbol from scope */
 158                                                 /*      of current object, */
 159                                                 /*      using currently */
 160                                                 /*      loaded objects only. */
 161 /*
 162  * Valid values for mode argument to dlopen.
 163  */




   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
  23  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  24  *
  25  *      Copyright (c) 1989 AT&T
  26  *        All Rights Reserved
  27  *
  28  */
  29 
  30 #ifndef _DLFCN_H
  31 #define _DLFCN_H
  32 
  33 #include <sys/feature_tests.h>
  34 #include <sys/types.h>
  35 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
  36 #include <sys/auxv.h>
  37 #include <sys/mman.h>
  38 #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
  39 
  40 #ifdef  __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 /*
  45  * Information structures for various dlinfo() requests.
  46  */
  47 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)

  48 typedef struct  dl_info {
  49         const char      *dli_fname;     /* file containing address range */
  50         void            *dli_fbase;     /* base address of file image */
  51         const char      *dli_sname;     /* symbol name */
  52         void            *dli_saddr;     /* symbol address */
  53 } Dl_info;








  54 typedef Dl_info         Dl_info_t;
  55 
  56 typedef struct  dl_serpath {
  57         char            *dls_name;      /* library search path name */
  58         uint_t          dls_flags;      /* path information */
  59 } Dl_serpath;
  60 typedef Dl_serpath      Dl_serpath_t;
  61 
  62 typedef struct  dl_serinfo {
  63         size_t          dls_size;       /* total buffer size */
  64         uint_t          dls_cnt;        /* number of path entries */
  65         Dl_serpath      dls_serpath[1]; /* there may be more than one */
  66 } Dl_serinfo;
  67 typedef Dl_serinfo      Dl_serinfo_t;
  68 
  69 typedef struct  dl_argsinfo {
  70         long            dla_argc;       /* process argument count */
  71         char            **dla_argv;     /* process arguments */
  72         char            **dla_envp;     /* process environment variables */
  73         auxv_t          *dla_auxv;      /* process auxv vectors */


  89         void            *dlui_segstart; /* start of segment described */
  90                                         /*  by unwind block */
  91         void            *dlui_segend;   /* end of segment described */
  92                                         /*  by unwind block */
  93 } Dl_amd64_unwindinfo;
  94 typedef Dl_amd64_unwindinfo     Dl_amd64_unwindinfo_t;
  95 
  96 typedef struct {
  97         const char      *dld_refname;   /* reference name */
  98         const char      *dld_depname;   /* new dependency name */
  99 } Dl_definfo_t;
 100 
 101 #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
 102 
 103 
 104 typedef ulong_t         Lmid_t;
 105 
 106 /*
 107  * Declarations used for dynamic linking support routines.
 108  */

 109 extern void     *dlopen(const char *, int);
 110 extern void     *dlsym(void *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
 111 extern int      dlclose(void *);
 112 extern char     *dlerror(void);
 113 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
 114 extern void     *dlmopen(Lmid_t, const char *, int);
 115 extern int      dladdr(void *, Dl_info *);
 116 extern int      dladdr1(void *, Dl_info *, void **, int);
 117 extern int      dldump(const char *, const char *, int);
 118 extern int      dlinfo(void *, int, void *);
 119 extern Dl_amd64_unwindinfo  *dlamd64getunwind(void *, Dl_amd64_unwindinfo *);
 120 #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */














 121 
 122 #pragma unknown_control_flow(dlopen, dlsym, dlclose, dlerror)
 123 #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__)
 124 #pragma unknown_control_flow(dlmopen, dladdr, dladdr1, dldump, dlinfo)
 125 #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */
 126 
 127 /*
 128  * Valid values for handle argument to dlsym(3x).
 129  */
 130 #define RTLD_NEXT               (void *)-1      /* look in `next' dependency */
 131 #define RTLD_DEFAULT            (void *)-2      /* look up symbol from scope */
 132                                                 /*      of current object */
 133 #define RTLD_SELF               (void *)-3      /* look in `ourself' */
 134 #define RTLD_PROBE              (void *)-4      /* look up symbol from scope */
 135                                                 /*      of current object, */
 136                                                 /*      using currently */
 137                                                 /*      loaded objects only. */
 138 /*
 139  * Valid values for mode argument to dlopen.
 140  */