186d7f5d3SJohn Marino.\" Copyright (c) 2001 Chris Costello <chris@FreeBSD.org> 286d7f5d3SJohn Marino.\" All rights reserved. 386d7f5d3SJohn Marino.\" 486d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without 586d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions 686d7f5d3SJohn Marino.\" are met: 786d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright 886d7f5d3SJohn Marino.\" notice, this list of conditions and the following disclaimer. 986d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright 1086d7f5d3SJohn Marino.\" notice, this list of conditions and the following disclaimer in the 1186d7f5d3SJohn Marino.\" documentation and/or other materials provided with the distribution. 1286d7f5d3SJohn Marino.\" 1386d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1486d7f5d3SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1586d7f5d3SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1686d7f5d3SJohn Marino.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1786d7f5d3SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1886d7f5d3SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1986d7f5d3SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2086d7f5d3SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2186d7f5d3SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2286d7f5d3SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2386d7f5d3SJohn Marino.\" SUCH DAMAGE. 2486d7f5d3SJohn Marino.\" 2586d7f5d3SJohn Marino.\" $FreeBSD: src/lib/libc/sys/kldsym.2,v 1.1.2.3 2001/12/14 18:34:01 ru Exp $ 2686d7f5d3SJohn Marino.\" $DragonFly: src/lib/libc/sys/kldsym.2,v 1.3 2008/05/02 02:05:04 swildner Exp $ 2786d7f5d3SJohn Marino.\" 2886d7f5d3SJohn Marino.Dd July 26, 2001 2986d7f5d3SJohn Marino.Dt KLDSYM 2 3086d7f5d3SJohn Marino.Os 3186d7f5d3SJohn Marino.Sh NAME 3286d7f5d3SJohn Marino.Nm kldsym 3386d7f5d3SJohn Marino.Nd look up address by symbol name in a KLD 3486d7f5d3SJohn Marino.Sh LIBRARY 3586d7f5d3SJohn Marino.Lb libc 3686d7f5d3SJohn Marino.Sh SYNOPSIS 3786d7f5d3SJohn Marino.In sys/param.h 3886d7f5d3SJohn Marino.In sys/linker.h 3986d7f5d3SJohn Marino.Ft int 4086d7f5d3SJohn Marino.Fn kldsym "int fileid" "int command" "void *data" 4186d7f5d3SJohn Marino.Sh DESCRIPTION 4286d7f5d3SJohn MarinoThe 4386d7f5d3SJohn Marino.Fn kldsym 4486d7f5d3SJohn Marinofunction returns the address of the symbol specified in 4586d7f5d3SJohn Marino.Fa data 4686d7f5d3SJohn Marinoin the module specified by 4786d7f5d3SJohn Marino.Fa fileid . 4886d7f5d3SJohn MarinoCurrently, the only 4986d7f5d3SJohn Marino.Fa command 5086d7f5d3SJohn Marinoimplemented is 5186d7f5d3SJohn Marino.Dv KLDSYM_LOOKUP . 5286d7f5d3SJohn Marino.Pp 5386d7f5d3SJohn MarinoThe 5486d7f5d3SJohn Marino.Fa data 5586d7f5d3SJohn Marinoargument is of the following structure: 5686d7f5d3SJohn Marino.Bd -literal -offset indent 5786d7f5d3SJohn Marinostruct kld_sym_lookup { 5886d7f5d3SJohn Marino int version; /* sizeof(struct kld_sym_lookup) */ 5986d7f5d3SJohn Marino char *symname; /* Symbol name we are looking up */ 6086d7f5d3SJohn Marino u_long symvalue; 6186d7f5d3SJohn Marino size_t symsize; 6286d7f5d3SJohn Marino}; 6386d7f5d3SJohn Marino.Ed 6486d7f5d3SJohn Marino.Pp 6586d7f5d3SJohn MarinoThe 6686d7f5d3SJohn Marino.Va version 6786d7f5d3SJohn Marinomember is to be set 6886d7f5d3SJohn Marinoby the code calling 6986d7f5d3SJohn Marino.Fn kldsym 7086d7f5d3SJohn Marinoto 7186d7f5d3SJohn Marino.Fn sizeof "struct kld_sym_lookup" . 7286d7f5d3SJohn MarinoThe next two members, 7386d7f5d3SJohn Marino.Va version 7486d7f5d3SJohn Marinoand 7586d7f5d3SJohn Marino.Va symname , 7686d7f5d3SJohn Marinoare specified by the user. 7786d7f5d3SJohn MarinoThe last two, 7886d7f5d3SJohn Marino.Va symvalue 7986d7f5d3SJohn Marinoand 8086d7f5d3SJohn Marino.Va symsize , 8186d7f5d3SJohn Marinoare filled in by 8286d7f5d3SJohn Marino.Fn kldsym 8386d7f5d3SJohn Marinoand contain the address associated with 8486d7f5d3SJohn Marino.Va symname 8586d7f5d3SJohn Marinoand the size of the data it points to, respectively. 8686d7f5d3SJohn Marino.Sh RETURN VALUES 8786d7f5d3SJohn Marino.Rv -std kldsym 8886d7f5d3SJohn Marino.Sh ERRORS 8986d7f5d3SJohn MarinoThe 9086d7f5d3SJohn Marino.Fn kldsym 9186d7f5d3SJohn Marinofunction will fail if: 9286d7f5d3SJohn Marino.Bl -tag -width Er 9386d7f5d3SJohn Marino.It Bq Er EINVAL 9486d7f5d3SJohn MarinoInvalid value in 9586d7f5d3SJohn Marino.Fa data->version 9686d7f5d3SJohn Marinoor 9786d7f5d3SJohn Marino.Fa command . 9886d7f5d3SJohn Marino.It Bq Er ENOENT 9986d7f5d3SJohn Marino.Fa fileid 10086d7f5d3SJohn Marinois invalid, 10186d7f5d3SJohn Marinoor the specified symbol could not be found. 10286d7f5d3SJohn Marino.El 10386d7f5d3SJohn Marino.Sh SEE ALSO 10486d7f5d3SJohn Marino.Xr kldfind 2 , 10586d7f5d3SJohn Marino.Xr kldfirstmod 2 , 10686d7f5d3SJohn Marino.Xr kldload 2 , 10786d7f5d3SJohn Marino.Xr kldnext 2 , 10886d7f5d3SJohn Marino.Xr kldunload 2 , 10986d7f5d3SJohn Marino.Xr modfind 2 , 11086d7f5d3SJohn Marino.Xr modnext 2 , 11186d7f5d3SJohn Marino.Xr modstat 2 , 11286d7f5d3SJohn Marino.Xr kld 4 11386d7f5d3SJohn Marino.Sh HISTORY 11486d7f5d3SJohn MarinoThe 11586d7f5d3SJohn Marino.Fn kldsym 11686d7f5d3SJohn Marinofunction first appeared in 11786d7f5d3SJohn Marino.Fx 3.0 . 118