xref: /illumos-gate/usr/src/man/man3proc/Paddr_to_loadobj.3proc (revision 148434206d3ba623dff65e4b591dffc0ddadebf3)
1.\"
2.\" This file and its contents are supplied under the terms of the
3.\" Common Development and Distribution License ("CDDL"), version 1.0.
4.\" You may only use this file in accordance with the terms of version
5.\" 1.0 of the CDDL.
6.\"
7.\" A full copy of the text of the CDDL should have accompanied this
8.\" source.  A copy of the CDDL is also available via the Internet at
9.\" http://www.illumos.org/license/CDDL.
10.\"
11.\"
12.\" Copyright 2015 Joyent, Inc.
13.\"
14.Dd May 11, 2016
15.Dt PADDR_TO_LOADOBJ 3PROC
16.Os
17.Sh NAME
18.Nm Paddr_to_loadobj ,
19.Nm Plmid_to_loadobj ,
20.Nm Pname_to_loadobj
21.Nd lookup loaded object information
22.Sh SYNOPSIS
23.Lb libproc
24.In libproc.h
25.Ft "const rd_loadobj_t *"
26.Fo Paddr_to_loadobj
27.Fa "struct ps_prochandle *P"
28.Fa "uintptr_t addr"
29.Fc
30.Ft "const rd_loadobj_t *"
31.Fo Plmid_to_loadobj
32.Fa "struct ps_prochandle *P"
33.Fa "Lmid_t lmid"
34.Fa "const char *name"
35.Fc
36.Ft "const rd_loadobj_t *"
37.Fo Pname_to_loadobj
38.Fa "struct ps_prochandle *P"
39.Fa "const char *name"
40.Fc
41.Sh DESCRIPTION
42The
43.Fn Paddr_to_loadobj ,
44.Fn Plmid_to_loadobj ,
45and
46.Fn Pname_to_loadobj
47functions lookup loaded object information from the process handle
48.Fa P .
49This information is provided by the run-time link-editor,
50.Xr ld.so.1 1 ,
51and provides information about the loaded object such as the link-map
52identifier, the TLS module ID, and the address of various sections.
53.Pp
54The pointer to the data returned by the library will only be valid for
55as long as the handle
56.Fa P
57is valid. Any calls to
58.Xr Prelease 3PROC
59will invalidate the data.
60.Pp
61The
62.Fn Paddr_to_loadobj
63function attempts to find the loaded object information, if any, that exists for the
64address
65.Fa addr .
66Not all address correspond to memory regions that were loaded by the
67run-time link-editor. For example, if a user creates a region of
68anonymous memory through the
69.Xr mmap 2
70function, then it will not have any corresponding loaded module.
71.Pp
72The
73.Fn Pname_to_loadobj
74function looks up the object named
75.Fa name
76and returns the corresponding loaded object information. Two special
77values may be used for name. The macro
78.Dv PR_OBJ_EXEC
79refers to the executable object itself and the macro
80.Dv PR_OBJ_LDSO refers to the object ld.so.1 .
81.Pp
82The
83.Fn Plmid_to_loadobj
84function is similar to
85.Fn Pname_to_loadobj .
86It allows the use of a link-map identifier,
87.Fa lmid ,
88which constricts the search of the object named with
89.Fa name
90to that link-map. The special value of
91.Dv PR_LMID_EVERY
92may be passed to indicate that every link-map should be searched, which
93is equivalent in behavior to the
94.Fn Pname_to_loadobj
95function.
96.Sh RETURN VALUES
97Upon successful completion, the
98.Fn Paddr_to_loadobj ,
99.Fn Plmid_to_loadobj ,
100and
101.Fn Pname_to_loadobj
102functions return a pointer to the corresponding loadable object
103information.
104Otherwise, if none exists then
105.Dv NULL
106is returned.
107.Sh INTERFACE STABILITY
108.Sy Uncommitted
109.Sh MT-LEVEL
110See
111.Sy LOCKING
112in
113.Xr libproc 3LIB .
114.Sh SEE ALSO
115.Xr libproc 3LIB ,
116.Xr librtld_db 3LIB ,
117.Xr Prelease 3PROC
118