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