Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:14

0001 /*  $NetBSD: dlfcn.h,v 1.21 2010/01/07 07:35:35 skrll Exp $ */
0002 
0003 /*-
0004  * Copyright (c) 1998 The NetBSD Foundation, Inc.
0005  * All rights reserved.
0006  *
0007  * This code is derived from software contributed to The NetBSD Foundation
0008  * by Paul Kranenburg.
0009  *
0010  * Redistribution and use in source and binary forms, with or without
0011  * modification, are permitted provided that the following conditions
0012  * are met:
0013  * 1. Redistributions of source code must retain the above copyright
0014  *    notice, this list of conditions and the following disclaimer.
0015  * 2. Redistributions in binary form must reproduce the above copyright
0016  *    notice, this list of conditions and the following disclaimer in the
0017  *    documentation and/or other materials provided with the distribution.
0018  *
0019  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
0020  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
0021  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
0022  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
0023  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0024  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0025  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0026  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0027  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0028  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0029  * POSSIBILITY OF SUCH DAMAGE.
0030  */
0031 
0032 #ifndef _DLFCN_H_
0033 #define _DLFCN_H_
0034 
0035 //#include <sys/featuretest.h>
0036 #include <sys/cdefs.h>
0037 
0038 #if defined(_NETBSD_SOURCE)
0039 typedef struct _dl_info {
0040     const char  *dli_fname; /* File defining the symbol */
0041     void        *dli_fbase; /* Base address */
0042     const char  *dli_sname; /* Symbol name */
0043     const void  *dli_saddr; /* Symbol address */
0044 } Dl_info;
0045 #endif /* defined(_NETBSD_SOURCE) */
0046 
0047 /*
0048  * User interface to the run-time linker.
0049  */
0050 __BEGIN_DECLS
0051 void    *dlopen(const char *, int);
0052 int dlclose(void *);
0053 void    *dlsym(void * __restrict, const char * __restrict);
0054 #if defined(_NETBSD_SOURCE)
0055 int dladdr(void * __restrict, Dl_info * __restrict);
0056 int dlctl(void *, int, void *);
0057 #endif
0058 int dlinfo(void *, int, void *);
0059 const char *dlerror(void);
0060 __END_DECLS
0061 
0062 /* Values for dlopen `mode'. */
0063 #define RTLD_LAZY   1
0064 #define RTLD_NOW    2
0065 #define RTLD_GLOBAL 0x100       /* Allow global searches in object */
0066 #define RTLD_LOCAL  0x200
0067 #if defined(_NETBSD_SOURCE)
0068 #define DL_LAZY     RTLD_LAZY   /* Compat */
0069 #endif
0070 
0071 /*
0072  * Special handle arguments for dlsym().
0073  */
0074 #define RTLD_NEXT   ((void *) -1)   /* Search subsequent objects. */
0075 #define RTLD_DEFAULT    ((void *) -2)   /* Use default search algorithm. */
0076 #define RTLD_SELF   ((void *) -3)   /* Search the caller itself. */
0077 
0078 /*
0079  * dlctl() commands
0080  */
0081 #if defined(_NETBSD_SOURCE)
0082 #define DL_GETERRNO 1
0083 #define DL_GETSYMBOL    2
0084 #if 0
0085 #define DL_SETSRCHPATH  x
0086 #define DL_GETLIST  x
0087 #define DL_GETREFCNT    x
0088 #define DL_GETLOADADDR  x
0089 #endif /* 0 */
0090 #endif /* defined(_NETBSD_SOURCE) */
0091 
0092 /*
0093  * dlinfo() commands
0094  *
0095  * From Solaris: http://docs.sun.com/app/docs/doc/816-5168/dlinfo-3c?a=view
0096  */
0097 #define RTLD_DI_UNRESOLVED  10
0098 #if defined(_NETBSD_SOURCE)
0099 #define RTLD_DI_LINKMAP     3
0100 #if 0
0101 #define RTLD_DI_ARGSINFO    1
0102 #define RTLD_DI_CONFIGADDR  2
0103 #define RTLD_DI_LMID        4
0104 #define RTLD_DI_SERINFO     5
0105 #define RTLD_DI_SERINFOSIZE 6
0106 #define RTLD_DI_ORIGIN      7
0107 #define RTLD_DI_GETSIGNAL   8
0108 #define RTLD_DI_SETSIGNAL   9
0109 #endif
0110 #endif /* _NETBSD_SOURCE */
0111 
0112 #endif /* !defined(_DLFCN_H_) */