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.\" $DragonFly: src/lib/libc/sys/kldsym.2,v 1.3 2008/05/02 02:05:04 swildner Exp $ 27.\" 28.Dd July 26, 2001 29.Dt KLDSYM 2 30.Os 31.Sh NAME 32.Nm kldsym 33.Nd look up address by symbol name in a KLD 34.Sh LIBRARY 35.Lb libc 36.Sh SYNOPSIS 37.In sys/param.h 38.In sys/linker.h 39.Ft int 40.Fn kldsym "int fileid" "int command" "void *data" 41.Sh DESCRIPTION 42The 43.Fn kldsym 44function returns the address of the symbol specified in 45.Fa data 46in the module specified by 47.Fa fileid . 48Currently, the only 49.Fa command 50implemented is 51.Dv KLDSYM_LOOKUP . 52.Pp 53The 54.Fa data 55argument is of the following structure: 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