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