getksym.2 (2010 09)

g
getksym(2) getksym(2)
[ENAMETOOLONG]
modname is greater than MODMAXNAMELEN characters long, or symname is greater than
MAXSYMNMLEN characters long.
[ENOMATCH]
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
getksym()
obtains a symbol name (and an offset) given an
address.
#include <sys/types.h>
#include <sys/ksym.h>
#include <elf.h>
uint64_t value=0x12345678, info=0;
char symname[MAXSYMNMLEN];
/* name will be placed in symname, and offset in info */
if (getksym(symname, NULL, &value, &info) != 0) {
perror("getksym");
return(-1);
}
The following code sequence and call to getksym() obtains an address given a symbol name.
#include <sys/types.h>
#include <sys/ksym.h>
#include <elf.h>
uint64_t value=0, info=0;
/* The address will be placed in value */
if (getksym("bzero",NULL, &value, &info) != 0) {
perror("getksym");
return(-1);
}
SEE ALSO
kmem(7).
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010