Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getksym(2) [hpux man page]

getksym(2)							System Calls Manual							getksym(2)

NAME
getksym() - get information for local and global kernel symbols SYNOPSIS
#include <sys/types.h> #include <sys/ksym.h> #include <elf.h> #include <elf_parisc.h> /* For STT_PARISC_MILLI on PA-RISC */ int getksym(char * symname, char * modname, uint64_t *value, uint64_t *info); DESCRIPTION
There are two ways that can be used to retrieve kernel symbol information. As detailed below, if symname is provided and value is set to zero, attempts to retrieve the value of the symbol; if a non-zero value is provided, the associated symbol name is retrieved. given a symname, looks for global or and local symbols of that name in the symbol table of the static kernel and all currently loaded ker- nel modules. If it finds a match, returns the value associated with that symbol (typically its address) in the space pointed to by value, and the type of that symbol in the space pointed to by info. NOTE: If there are two symbols (a local and a global symbol) with the same name, returns the first symbol that it finds with that name, which will be the local symbol. The types returned are: unknown type text symbol (typically function) PA-RISC millicode function (PA-RISC only) data symbol section symbol The symbol name can be no more than characters. If modname is set to the name (basename only) of a dynamically loaded module, then the search for the symbol name will only be in that module. If modname is NULL, then the search order for the symbol name will be the static kernel followed by each of the currently loaded modules in the order in which they were loaded. The module name can be no more than char- acters. If both a non-zero value and a symname are provided, the behavior of is undefined. If a zero value and an empty or NULL symname is pro- vided, the behavior of is undefined. If is given a valid non-zero address in the statically configured kernel or one of the currently loaded modules in the space pointed to by value, it will return, in the space pointed to by symname, the name of the symbol whose value is the closest one less than or equal to the given value and, in space pointed to by info, the difference between the address given and the value of the symbol found. NOTE: If two symbols (an symbol and an symbol) have the same address, returns the symbol. The space pointed to by symname must be at least characters long. RETURN VALUE
returns upon successful completion. If an error occurs, a value of is returned and is set to indicate the error. ERRORS
fails if one or more of the following are true: modname does not represent a currently loaded module. modname is greater than MODMAXNAMELEN characters long, or symname is greater than MAXSYMNMLEN characters long. The symbol name given is not found, or the value given is not a currently valid address. EXAMPLES
The following code sequence and call to obtains a symbol name (and an offset) given an address. The following code sequence and call to obtains an address given a symbol name. SEE ALSO
kmem(7). getksym(2)

Check Out this Related Man Page

KLDSYM(2)                                                     BSD System Calls Manual                                                    KLDSYM(2)

NAME
kldsym -- look up address by symbol name in a KLD LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/param.h> #include <sys/linker.h> int kldsym(int fileid, int command, void *data); DESCRIPTION
The kldsym() system call returns the address of the symbol specified in data in the module specified by fileid. If fileid is 0, all loaded modules are searched. Currently, the only command implemented is KLDSYM_LOOKUP. The data argument is of the following structure: struct kld_sym_lookup { int version; /* sizeof(struct kld_sym_lookup) */ char *symname; /* Symbol name we are looking up */ u_long symvalue; size_t symsize; }; The version member is to be set by the code calling kldsym() to sizeof(struct kld_sym_lookup). The next two members, version and symname, are specified by the user. The last two, symvalue and symsize, are filled in by kldsym() and contain the address associated with symname and the size of the data it points to, respectively. RETURN VALUES
The kldsym() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
The kldsym() system call will fail if: [EINVAL] Invalid value in data->version or command. [ENOENT] The fileid argument is invalid, or the specified symbol could not be found. SEE ALSO
kldfind(2), kldfirstmod(2), kldload(2), kldnext(2), kldunload(2), modfind(2), modnext(2), modstat(2), kld(4) HISTORY
The kldsym() system call first appeared in FreeBSD 3.0. BSD July 26, 2001 BSD
Man Page