getksym - get information for a global kernel symbol
int getksym(char *symname, char *modname, uint64_t *value,
getksym is currently implemented as a macro.
There are two ways that getksym can be used to retrieve kernel symbol
information. As detailed below, if symname is provided, getksym
attempts to retrieve the value of the symbol; if value is provided,
the associated symbol name is retrieved.
getksym, given a symname, looks for a global (STB_GLOBAL or STB_WEAK)
symbol of that name in the symbol table of the static kernel and all
currently loaded kernel modules. If it finds a match, getksym 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.
The types returned are:
STT_NOTYPE unknown type
STT_FUNC text symbol (typically function)
STT_PARISC_MILLI millicode function
STT_OBJECT data symbol
The symbol name can be no more than MAXSYMNMLEN 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 that
If getksym is given a valid 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. The space
pointed to by symname must be at least MAXSYMNMLEN characters long.
Hewlett-Packard Company - 1 - HP-UX Release 11i: November 2000
getksym returns 0 upon successful completion. If an error occurs, a
value of -1 is returned and errno is set to indicated the error.
getksym fails if one or more of the following are true:
[ENOMATCH] The symbol name given is not found, or the value given is
not a currently valid address.
[EINVAL] modname does not represent a currently loaded module.
modname is greater than MODMAXNAMELEN characters long, or
symname is greater that MAXSYMNMLEN characters long.
Hewlett-Packard Company - 2 - HP-UX Release 11i: November 2000