dlfcn.h revision 1.14 1 1.14 bjh21 /* $NetBSD: dlfcn.h,v 1.14 2003/04/28 23:16:13 bjh21 Exp $ */
2 1.1 pk
3 1.9 pk /*-
4 1.9 pk * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 1.1 pk * All rights reserved.
6 1.1 pk *
7 1.9 pk * This code is derived from software contributed to The NetBSD Foundation
8 1.9 pk * by Paul Kranenburg.
9 1.9 pk *
10 1.1 pk * Redistribution and use in source and binary forms, with or without
11 1.1 pk * modification, are permitted provided that the following conditions
12 1.1 pk * are met:
13 1.1 pk * 1. Redistributions of source code must retain the above copyright
14 1.1 pk * notice, this list of conditions and the following disclaimer.
15 1.1 pk * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 pk * notice, this list of conditions and the following disclaimer in the
17 1.1 pk * documentation and/or other materials provided with the distribution.
18 1.1 pk * 3. All advertising materials mentioning features or use of this software
19 1.1 pk * must display the following acknowledgement:
20 1.9 pk * This product includes software developed by the NetBSD
21 1.9 pk * Foundation, Inc. and its contributors.
22 1.9 pk * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.9 pk * contributors may be used to endorse or promote products derived
24 1.9 pk * from this software without specific prior written permission.
25 1.1 pk *
26 1.9 pk * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.9 pk * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.9 pk * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.9 pk * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.9 pk * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.9 pk * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.9 pk * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.9 pk * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.9 pk * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.9 pk * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.9 pk * POSSIBILITY OF SUCH DAMAGE.
37 1.1 pk */
38 1.1 pk
39 1.1 pk #ifndef _DLFCN_H_
40 1.1 pk #define _DLFCN_H_
41 1.1 pk
42 1.14 bjh21 #include <sys/featuretest.h>
43 1.1 pk #include <sys/cdefs.h>
44 1.1 pk
45 1.14 bjh21 #if defined(_NETBSD_SOURCE)
46 1.7 pk typedef struct _dl_info {
47 1.7 pk const char *dli_fname; /* File defining the symbol */
48 1.7 pk void *dli_fbase; /* Base address */
49 1.7 pk const char *dli_sname; /* Symbol name */
50 1.12 thorpej const void *dli_saddr; /* Symbol address */
51 1.7 pk } Dl_info;
52 1.14 bjh21 #endif /* defined(_NETBSD_SOURCE) */
53 1.7 pk
54 1.1 pk /*
55 1.1 pk * User interface to the run-time linker.
56 1.1 pk */
57 1.2 pk __BEGIN_DECLS
58 1.13 simonb void *dlopen __P((const char *, int));
59 1.13 simonb int dlclose __P((void *));
60 1.13 simonb void *dlsym __P((void *, const char *));
61 1.14 bjh21 #if defined(_NETBSD_SOURCE)
62 1.13 simonb int dladdr __P((const void *, Dl_info *));
63 1.13 simonb int dlctl __P((void *, int, void *));
64 1.5 kleink #endif
65 1.13 simonb __aconst char *dlerror __P((void));
66 1.2 pk __END_DECLS
67 1.1 pk
68 1.1 pk /* Values for dlopen `mode'. */
69 1.3 pk #define RTLD_LAZY 1
70 1.3 pk #define RTLD_NOW 2
71 1.4 pk #define RTLD_GLOBAL 0x100 /* Allow global searches in object */
72 1.8 tv #define RTLD_LOCAL 0x200
73 1.14 bjh21 #if defined(_NETBSD_SOURCE)
74 1.4 pk #define DL_LAZY RTLD_LAZY /* Compat */
75 1.5 kleink #endif
76 1.1 pk
77 1.1 pk /*
78 1.1 pk * dlctl() commands
79 1.1 pk */
80 1.14 bjh21 #if defined(_NETBSD_SOURCE)
81 1.1 pk #define DL_GETERRNO 1
82 1.7 pk #define DL_GETSYMBOL 2
83 1.4 pk #if 0
84 1.1 pk #define DL_SETSRCHPATH x
85 1.1 pk #define DL_GETLIST x
86 1.1 pk #define DL_GETREFCNT x
87 1.1 pk #define DL_GETLOADADDR x
88 1.5 kleink #endif /* 0 */
89 1.14 bjh21 #endif /* defined(_NETBSD_SOURCE) */
90 1.1 pk
91 1.5 kleink #endif /* !defined(_DLFCN_H_) */
92