]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - lib/libc/sys/kldsym.2
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / lib / libc / sys / kldsym.2
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$
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
41 The
42 .Fn kldsym
43 system call returns the address of the symbol specified in
44 .Fa data
45 in the module specified by
46 .Fa fileid .
47 If
48 .Fa fileid
49 is 0, all loaded modules are searched.
50 Currently, the only
51 .Fa command
52 implemented is
53 .Dv KLDSYM_LOOKUP .
54 .Pp
55 The
56 .Fa data
57 argument is of the following structure:
58 .Pp
59 .Bd -literal -offset indent
60 struct kld_sym_lookup {
61     int         version;        /* sizeof(struct kld_sym_lookup) */
62     char        *symname;       /* Symbol name we are looking up */
63     u_long      symvalue;
64     size_t      symsize;
65 };
66 .Ed
67 .Pp
68 The
69 .Va version
70 member is to be set
71 by the code calling
72 .Fn kldsym
73 to
74 .Fn sizeof "struct kld_sym_lookup" .
75 The next two members,
76 .Va version
77 and
78 .Va symname ,
79 are specified by the user.
80 The last two,
81 .Va symvalue
82 and
83 .Va symsize ,
84 are filled in by
85 .Fn kldsym
86 and contain the address associated with
87 .Va symname
88 and the size of the data it points to, respectively.
89 .Sh RETURN VALUES
90 .Rv -std kldsym
91 .Sh ERRORS
92 The
93 .Fn kldsym
94 system call will fail if:
95 .Bl -tag -width Er
96 .It Bq Er EINVAL
97 Invalid value in
98 .Fa data->version
99 or
100 .Fa command .
101 .It Bq Er ENOENT
102 The
103 .Fa fileid
104 argument
105 is invalid,
106 or the specified symbol could not be found.
107 .El
108 .Sh SEE ALSO
109 .Xr kldfind 2 ,
110 .Xr kldfirstmod 2 ,
111 .Xr kldload 2 ,
112 .Xr kldnext 2 ,
113 .Xr kldunload 2 ,
114 .Xr modfind 2 ,
115 .Xr modnext 2 ,
116 .Xr modstat 2 ,
117 .Xr kld 4
118 .Sh HISTORY
119 The
120 .Fn kldsym
121 system call first appeared in
122 .Fx 3.0 .