Go to main content

man pages section 3: Extended Library Functions, Volume 3

Exit Print View

Updated: Thursday, June 13, 2019
 
 

Paddr_to_text_map (3PROC)

Name

Paddr_to_map, Paddr_to_text_map, Pname_to_map, Preset_maps, Pupdate_maps - map a process address or object name to an object mapping

Synopsis

#include <procfs.h>
#include <libproc.h>
const prmap_t *Paddr_to_map(ps_prochandle_t *Pr, uintptr_t addr);
const prmap_t *Paddr_to_text_map(ps_prochandle_t *Pr, uintptr_t addr);
const prmap_t *Pname_to_map(ps_prochandle_t *Pr, const char *name);
void Preset_maps(ps_prochandle_t *Pr);
void Pupdate_maps(ps_prochandle_t *Pr);

Description

The Pr argument identifies a victim process or core file attached to the controlling process by the create and grab interfaces. For more information, see the Pcreate(3PROC) and Pgrab(3PROC) man pages.

The Paddr_to_map() function retrieves the /proc mapping structure corresponding to the virtual address of the victim process specified by the addr argument.

The Paddr_to_text_map() function is the same as the Paddr_to_map() function except that it returns a pointer that is not NULL. The pointer is returned only if the mapping it finds, is a read-only executable text mapping as created by the dynamic linker for a dynamic object (shared library).

The Pname_to_map() function retrieves the /proc mapping structure corresponding to the text mapping of a dynamic object (shared library) named by the name argument, for example, the libc.so library.

The Preset_maps() function clears all of the mapping knowledge that has been gathered by the library for the victim process. This must be called by the controlling process when the victim process has executed an exec() function thereby invalidating all of its previous address space mappings.

The Pupdate_maps() function iterates through all the address space mappings of the victim process, validating or updating the information already gathered, or gathering new information. This is usually not necessary, but may be called when it is suspected that the mappings have changed, either because the controlling process has just grabbed the victim process or because of dynamic linker activity in the victim process.

Return Values

On successful completion, the Paddr_to_map(), Paddr_to_text_map(), and Pname_to_map() functions return a pointer to a /proc mapping structure. On error, they return NULL and set errno to indicate the error. For more information, see the proc(5) man page.

The Preset_maps() and Pupdate_maps() functions have no return values.

Errors

On failure, this errno value may be set:

ENODATA

No object mapping was found

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Unsafe

See Also

libproc(3LIB), libproc.h(3HEAD), Pcreate(3PROC), Pgrab(3PROC), proc(5)