PADDR_TO_LOADOBJ(3PROC) Process Control Library Functions PADDR_TO_LOADOBJ(3PROC)

Paddr_to_loadobj, Plmid_to_loadobj, Pname_to_loadobj
lookup loaded object information

Process Control Library (libproc, -lproc)

#include <libproc.h>
const rd_loadobj_t *
Paddr_to_loadobj(struct ps_prochandle *P, uintptr_t addr);
const rd_loadobj_t *
Plmid_to_loadobj(struct ps_prochandle *P, Lmid_t lmid, const char *name);
const rd_loadobj_t *
Pname_to_loadobj(struct ps_prochandle *P, const char *name);

The Paddr_to_loadobj(), Plmid_to_loadobj(), and Pname_to_loadobj() functions lookup loaded object information from the process handle P. This information is provided by the run-time link-editor, ld.so.1(1), and provides information about the loaded object such as the link-map identifier, the TLS module ID, and the address of various sections.
The pointer to the data returned by the library will only be valid for as long as the handle P is valid. Any calls to Prelease(3PROC) will invalidate the data.
The Paddr_to_loadobj() function attempts to find the loaded object information, if any, that exists for the address addr. Not all address correspond to memory regions that were loaded by the run-time link-editor. For example, if a user creates a region of anonymous memory through the mmap(2) function, then it will not have any corresponding loaded module.
The Pname_to_loadobj() function looks up the object named name and returns the corresponding loaded object information. Two special values may be used for name. The macro PR_OBJ_EXEC refers to the executable object itself and the macro PR_OBJ_LDSO refers to the object ld.so.1.
The Plmid_to_loadobj() function is similar to Pname_to_loadobj(). It allows the use of a link-map identifier, lmid, which constricts the search of the object named with name to that link-map. The special value of PR_LMID_EVERY may be passed to indicate that every link-map should be searched, which is equivalent in behavior to the Pname_to_loadobj() function.

Upon successful completion, the Paddr_to_loadobj(), Plmid_to_loadobj(), and Pname_to_loadobj() functions return a pointer to the corresponding loadable object information. Otherwise, if none exists then NULL is returned.

Uncommitted

See LOCKING in libproc(3LIB).

libproc(3LIB), librtld_db(3LIB), Prelease(3PROC)
May 11, 2016 illumos