]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/sys/kldsym.2
libc: simplify MDASM/NOASM checks
[FreeBSD/FreeBSD.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 .Dd October 17, 2016
26 .Dt KLDSYM 2
27 .Os
28 .Sh NAME
29 .Nm kldsym
30 .Nd look up address by symbol name in a KLD
31 .Sh LIBRARY
32 .Lb libc
33 .Sh SYNOPSIS
34 .In sys/param.h
35 .In sys/linker.h
36 .Ft int
37 .Fn kldsym "int fileid" "int cmd" "void *data"
38 .Sh DESCRIPTION
39 The
40 .Fn kldsym
41 system call returns the address of the symbol specified in
42 .Fa data
43 in the module specified by
44 .Fa fileid .
45 If
46 .Fa fileid
47 is 0, all loaded modules are searched.
48 Currently, the only
49 .Fa cmd
50 implemented is
51 .Dv KLDSYM_LOOKUP .
52 .Pp
53 The
54 .Fa data
55 argument is of the following structure:
56 .Bd -literal -offset indent
57 struct 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
65 The
66 .Va version
67 member is to be set
68 by the code calling
69 .Fn kldsym
70 to
71 .Fn sizeof "struct kld_sym_lookup" .
72 The next two members,
73 .Va version
74 and
75 .Va symname ,
76 are specified by the user.
77 The last two,
78 .Va symvalue
79 and
80 .Va symsize ,
81 are filled in by
82 .Fn kldsym
83 and contain the address associated with
84 .Va symname
85 and the size of the data it points to, respectively.
86 .Sh RETURN VALUES
87 .Rv -std kldsym
88 .Sh ERRORS
89 The
90 .Fn kldsym
91 system call will fail if:
92 .Bl -tag -width Er
93 .It Bq Er EINVAL
94 Invalid value in
95 .Fa data->version
96 or
97 .Fa cmd .
98 .It Bq Er ENOENT
99 The
100 .Fa fileid
101 argument
102 is invalid,
103 or the specified symbol could not be found.
104 .El
105 .Sh SEE ALSO
106 .Xr kldfind 2 ,
107 .Xr kldfirstmod 2 ,
108 .Xr kldload 2 ,
109 .Xr kldnext 2 ,
110 .Xr kldunload 2 ,
111 .Xr modfind 2 ,
112 .Xr modnext 2 ,
113 .Xr modstat 2 ,
114 .Xr kld 4
115 .Sh HISTORY
116 The
117 .Fn kldsym
118 system call first appeared in
119 .Fx 3.0 .