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