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 39The 40.Fn kldsym 41system call returns the address of the symbol specified in 42.Fa data 43in the module specified by 44.Fa fileid . 45If 46.Fa fileid 47is 0, all loaded modules are searched. 48Currently, the only 49.Fa cmd 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 91system call will fail if: 92.Bl -tag -width Er 93.It Bq Er EINVAL 94Invalid value in 95.Fa data->version 96or 97.Fa cmd . 98.It Bq Er ENOENT 99The 100.Fa fileid 101argument 102is invalid, 103or 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 116The 117.Fn kldsym 118system call first appeared in 119.Fx 3.0 . 120