xref: /dragonfly/lib/libc/sys/kldsym.2 (revision 984263bc)
1.\" Copyright (c) 2001 Chris Costello <chris@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD: src/lib/libc/sys/kldsym.2,v 1.1.2.3 2001/12/14 18:34:01 ru Exp $
26.\"
27.Dd July 26, 2001
28.Dt KLDSYM 2
29.Os
30.Sh NAME
31.Nm kldsym
32.Nd look up address by symbol name in a KLD
33.Sh LIBRARY
34.Lb libc
35.Sh SYNOPSIS
36.In sys/param.h
37.In sys/linker.h
38.Ft int
39.Fn kldsym "int fileid" "int command" "void *data"
40.Sh DESCRIPTION
41The
42.Fn kldsym
43function returns the address of the symbol specified in
44.Fa data
45in the module specified by
46.Fa fileid .
47Currently, the only
48.Fa command
49implemented is
50.Dv KLDSYM_LOOKUP .
51.Pp
52The
53.Fa data
54argument is of the following structure:
55.Pp
56.Bd -literal -offset indent
57struct kld_sym_lookup {
58    int         version;        /* sizeof(struct kld_sym_lookup) */
59    char        *symname;       /* Symbol name we are looking up */
60    u_long      symvalue;
61    size_t      symsize;
62};
63.Ed
64.Pp
65The
66.Va version
67member is to be set
68by the code calling
69.Fn kldsym
70to
71.Fn sizeof "struct kld_sym_lookup" .
72The next two members,
73.Va version
74and
75.Va symname ,
76are specified by the user.
77The last two,
78.Va symvalue
79and
80.Va symsize ,
81are filled in by
82.Fn kldsym
83and contain the address associated with
84.Va symname
85and the size of the data it points to, respectively.
86.Sh RETURN VALUES
87.Rv -std kldsym
88.Sh ERRORS
89The
90.Fn kldsym
91function will fail if:
92.Bl -tag -width Er
93.It Bq Er EINVAL
94Invalid value in
95.Fa data->version
96or
97.Fa command .
98.It Bq Er ENOENT
99.Fa fileid
100is invalid,
101or the specified symbol could not be found.
102.El
103.Sh SEE ALSO
104.Xr kldfind 2 ,
105.Xr kldfirstmod 2 ,
106.Xr kldload 2 ,
107.Xr kldnext 2 ,
108.Xr kldunload 2 ,
109.Xr modfind 2 ,
110.Xr modnext 2 ,
111.Xr modstat 2 ,
112.Xr kld 4
113.Sh HISTORY
114The
115.Fn kldsym
116function first appeared in
117.Fx 3.0 .
118