2 * Copyright (c) 2010 The FreeBSD Foundation
5 * This software was developed by Rui Paulo under sponsorship from the
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #include <sys/param.h>
49 /* XXX struct rd_agent should be private. */
52 typedef struct rd_agent {
53 struct proc_handle *rda_php;
55 uintptr_t rda_dlactivity_addr;
56 uintptr_t rda_preinit_addr;
57 uintptr_t rda_postinit_addr;
59 struct procstat *rda_procstat;
62 typedef struct rd_loadobj {
63 uintptr_t rdl_saddr; /* start address */
64 uintptr_t rdl_eaddr; /* end address */
76 /* XXX some types missing */
77 RDL_TYPE_UNKNOWN = 255
79 unsigned char rdl_path[PATH_MAX];
95 typedef struct rd_notify {
110 typedef struct rd_event_msg {
121 RD_RESOLVE_TARGET_STEP
124 typedef struct rd_plt_info {
125 rd_skip_e pi_skip_method;
129 unsigned int pi_flags;
132 #define RD_FLG_PI_PLTBOUND 0x0001
137 void rd_delete(rd_agent_t *);
138 const char *rd_errstr(rd_err_e);
139 rd_err_e rd_event_addr(rd_agent_t *, rd_event_e, rd_notify_t *);
140 rd_err_e rd_event_enable(rd_agent_t *, int);
141 rd_err_e rd_event_getmsg(rd_agent_t *, rd_event_msg_t *);
142 rd_err_e rd_init(int);
143 typedef int rl_iter_f(const rd_loadobj_t *, void *);
144 rd_err_e rd_loadobj_iter(rd_agent_t *, rl_iter_f *, void *);
145 void rd_log(const int);
146 rd_agent_t *rd_new(struct proc_handle *);
147 rd_err_e rd_objpad_enable(rd_agent_t *, size_t);
149 rd_err_e rd_plt_resolution(rd_agent_t *, uintptr_t, struct proc *,
150 uintptr_t, rd_plt_info_t *);
151 rd_err_e rd_reset(rd_agent_t *);
155 #endif /* _RTLD_DB_H_ */