Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > K

kmem(7)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

kmem — perform I/O on kernel memory, based on symbol name

SYNOPSIS

#include <sys/ksym.h> int ioctl( int kmemfd, int command, void *rks );

DESCRIPTION

When used with a valid file descriptor for /dev/kmem (kmemfd), ioctl can be used to manipulate kernel memory. The specifics of this manipulation depend on the command given as follows:

MIOC_READKSYM

Read mirk_buflen bytes of kernel memory starting at the address for mirk_symname into mirk_buf. rks is a pointer to a mioc_rksym structure, defined below.

MIOC_IREADKSYM

Indirect read. Read sizeof(void *) bytes of kernel memory starting at the address for mirk_symname and use that as the address from which to read mirk_buflen bytes of kernel memory into mirk_buf. rks is a pointer to a mioc_rksym structure.

MIOC_WRITEKSYM

Write mirk_buflen bytes from mirk_buf into kernel memory starting at the address for mirk_symname. rks is a pointer to a mioc_rksym structure.

MIOC_IWRITEKSYM

Indirect write. Read sizeof(void *) bytes of kernel memory starting at the address for mirk_symname and use that as the kernel memory address into which mirk_buflen bytes from mirk_buf are written. rks is a pointer to a mioc_rksym structure.

MIOC_LOCKSYM

Increase the hold count by one for the dynamically loaded module whose name is given by rks, a pointer to a character string, thereby preventing its unloading.

MIOC_UNLOCKSYM

Decrease the hold count by one for the dynamically loaded module whose name is given by rks, a pointer to a character string. If the count is thereby reduced to 0, the module becomes a candidate for unloading.

The struct mioc_rksym definition is:

struct mioc_rksym { char * mirk_modname; /* limit search for symname to module modname; if NULL use standard search order */ char * mirk_symname; /* name of symbol whose address is the basis for this operation */ void * mirk_buf; /* buffer into/from which read/write takes place */ size_t mirk_buflen; /* length (in bytes) of desired operation */ };

RETURN VALUE

ioctl returns one of the following values:

0

Successful completion.

-1

Failure. errno is set to indicate the error.

ERRORS

In addition to the values described in ioctl(2), the kmem ioctl also sets errno to one of the following values if the corresponding condition is detected.

EINVAL

modname does not represent a currently loaded module or this is an MIOC_UNLOCKSYM and the hold count is already 0.

ENXIO

kmemfd open on wrong minor device (i.e., not /dev/kmem).

EBADF

kmemfd open for reading and this is an MIOC_WRITEKSYM.

ENOMATCH

symname not found.

ENAMETOOLONG

modname is greater than MODMAXNAMELEN characters long, or symname is greater that MAXSYMNMLEN characters long.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.