xref: /illumos-gate/usr/src/man/man3proc/Paddr_to_loadobj.3proc (revision ab618543cc6fc4bc273c077ef5d247961cdb29d4)
143051d27SRobert Mustacchi.\"
243051d27SRobert Mustacchi.\" This file and its contents are supplied under the terms of the
343051d27SRobert Mustacchi.\" Common Development and Distribution License ("CDDL"), version 1.0.
443051d27SRobert Mustacchi.\" You may only use this file in accordance with the terms of version
543051d27SRobert Mustacchi.\" 1.0 of the CDDL.
643051d27SRobert Mustacchi.\"
743051d27SRobert Mustacchi.\" A full copy of the text of the CDDL should have accompanied this
843051d27SRobert Mustacchi.\" source.  A copy of the CDDL is also available via the Internet at
943051d27SRobert Mustacchi.\" http://www.illumos.org/license/CDDL.
1043051d27SRobert Mustacchi.\"
1143051d27SRobert Mustacchi.\"
1243051d27SRobert Mustacchi.\" Copyright 2015 Joyent, Inc.
1343051d27SRobert Mustacchi.\"
1443051d27SRobert Mustacchi.Dd May 11, 2016
1543051d27SRobert Mustacchi.Dt PADDR_TO_LOADOBJ 3PROC
1643051d27SRobert Mustacchi.Os
1743051d27SRobert Mustacchi.Sh NAME
1843051d27SRobert Mustacchi.Nm Paddr_to_loadobj ,
1943051d27SRobert Mustacchi.Nm Plmid_to_loadobj ,
2043051d27SRobert Mustacchi.Nm Pname_to_loadobj
2143051d27SRobert Mustacchi.Nd lookup loaded object information
22*ab618543SJohn Levon.Sh LIBRARY
2343051d27SRobert Mustacchi.Lb libproc
24*ab618543SJohn Levon.Sh SYNOPSIS
2543051d27SRobert Mustacchi.In libproc.h
2643051d27SRobert Mustacchi.Ft "const rd_loadobj_t *"
2743051d27SRobert Mustacchi.Fo Paddr_to_loadobj
2843051d27SRobert Mustacchi.Fa "struct ps_prochandle *P"
2943051d27SRobert Mustacchi.Fa "uintptr_t addr"
3043051d27SRobert Mustacchi.Fc
3143051d27SRobert Mustacchi.Ft "const rd_loadobj_t *"
3243051d27SRobert Mustacchi.Fo Plmid_to_loadobj
3343051d27SRobert Mustacchi.Fa "struct ps_prochandle *P"
3443051d27SRobert Mustacchi.Fa "Lmid_t lmid"
3543051d27SRobert Mustacchi.Fa "const char *name"
3643051d27SRobert Mustacchi.Fc
3743051d27SRobert Mustacchi.Ft "const rd_loadobj_t *"
3843051d27SRobert Mustacchi.Fo Pname_to_loadobj
3943051d27SRobert Mustacchi.Fa "struct ps_prochandle *P"
4043051d27SRobert Mustacchi.Fa "const char *name"
4143051d27SRobert Mustacchi.Fc
4243051d27SRobert Mustacchi.Sh DESCRIPTION
4343051d27SRobert MustacchiThe
4443051d27SRobert Mustacchi.Fn Paddr_to_loadobj ,
4543051d27SRobert Mustacchi.Fn Plmid_to_loadobj ,
4643051d27SRobert Mustacchiand
4743051d27SRobert Mustacchi.Fn Pname_to_loadobj
4843051d27SRobert Mustacchifunctions lookup loaded object information from the process handle
4943051d27SRobert Mustacchi.Fa P .
5043051d27SRobert MustacchiThis information is provided by the run-time link-editor,
5143051d27SRobert Mustacchi.Xr ld.so.1 1 ,
5243051d27SRobert Mustacchiand provides information about the loaded object such as the link-map
5343051d27SRobert Mustacchiidentifier, the TLS module ID, and the address of various sections.
5443051d27SRobert Mustacchi.Pp
5543051d27SRobert MustacchiThe pointer to the data returned by the library will only be valid for
5643051d27SRobert Mustacchias long as the handle
5743051d27SRobert Mustacchi.Fa P
5872d3dbb9SYuri Pankovis valid.
5972d3dbb9SYuri PankovAny calls to
6043051d27SRobert Mustacchi.Xr Prelease 3PROC
6143051d27SRobert Mustacchiwill invalidate the data.
6243051d27SRobert Mustacchi.Pp
6343051d27SRobert MustacchiThe
6443051d27SRobert Mustacchi.Fn Paddr_to_loadobj
6572d3dbb9SYuri Pankovfunction attempts to find the loaded object information, if any, that exists for
6672d3dbb9SYuri Pankovthe address
6743051d27SRobert Mustacchi.Fa addr .
6843051d27SRobert MustacchiNot all address correspond to memory regions that were loaded by the
6972d3dbb9SYuri Pankovrun-time link-editor.
7072d3dbb9SYuri PankovFor example, if a user creates a region of anonymous memory through the
7143051d27SRobert Mustacchi.Xr mmap 2
7243051d27SRobert Mustacchifunction, then it will not have any corresponding loaded module.
7343051d27SRobert Mustacchi.Pp
7443051d27SRobert MustacchiThe
7543051d27SRobert Mustacchi.Fn Pname_to_loadobj
7643051d27SRobert Mustacchifunction looks up the object named
7743051d27SRobert Mustacchi.Fa name
7872d3dbb9SYuri Pankovand returns the corresponding loaded object information.
7972d3dbb9SYuri PankovTwo special values may be used for name.
8072d3dbb9SYuri PankovThe macro
8143051d27SRobert Mustacchi.Dv PR_OBJ_EXEC
8243051d27SRobert Mustacchirefers to the executable object itself and the macro
8343051d27SRobert Mustacchi.Dv PR_OBJ_LDSO refers to the object ld.so.1 .
8443051d27SRobert Mustacchi.Pp
8543051d27SRobert MustacchiThe
8643051d27SRobert Mustacchi.Fn Plmid_to_loadobj
8743051d27SRobert Mustacchifunction is similar to
8843051d27SRobert Mustacchi.Fn Pname_to_loadobj .
8943051d27SRobert MustacchiIt allows the use of a link-map identifier,
9043051d27SRobert Mustacchi.Fa lmid ,
9143051d27SRobert Mustacchiwhich constricts the search of the object named with
9243051d27SRobert Mustacchi.Fa name
9372d3dbb9SYuri Pankovto that link-map.
9472d3dbb9SYuri PankovThe special value of
9543051d27SRobert Mustacchi.Dv PR_LMID_EVERY
9643051d27SRobert Mustacchimay be passed to indicate that every link-map should be searched, which
9743051d27SRobert Mustacchiis equivalent in behavior to the
9843051d27SRobert Mustacchi.Fn Pname_to_loadobj
9943051d27SRobert Mustacchifunction.
10043051d27SRobert Mustacchi.Sh RETURN VALUES
10143051d27SRobert MustacchiUpon successful completion, the
10243051d27SRobert Mustacchi.Fn Paddr_to_loadobj ,
10343051d27SRobert Mustacchi.Fn Plmid_to_loadobj ,
10443051d27SRobert Mustacchiand
10543051d27SRobert Mustacchi.Fn Pname_to_loadobj
10643051d27SRobert Mustacchifunctions return a pointer to the corresponding loadable object
10743051d27SRobert Mustacchiinformation.
10843051d27SRobert MustacchiOtherwise, if none exists then
10943051d27SRobert Mustacchi.Dv NULL
11043051d27SRobert Mustacchiis returned.
11143051d27SRobert Mustacchi.Sh INTERFACE STABILITY
11243051d27SRobert Mustacchi.Sy Uncommitted
11343051d27SRobert Mustacchi.Sh MT-LEVEL
11443051d27SRobert MustacchiSee
11543051d27SRobert Mustacchi.Sy LOCKING
11643051d27SRobert Mustacchiin
11743051d27SRobert Mustacchi.Xr libproc 3LIB .
11843051d27SRobert Mustacchi.Sh SEE ALSO
11943051d27SRobert Mustacchi.Xr libproc 3LIB ,
12043051d27SRobert Mustacchi.Xr librtld_db 3LIB ,
12143051d27SRobert Mustacchi.Xr Prelease 3PROC
122