xref: /illumos-gate/usr/src/man/man3proc/Pzonename.3proc (revision ed093b41a93e8563e6e1e5dae0768dda2a7bcc27)
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 PZONENAME 3PROC
16.Os
17.Sh NAME
18.Nm Pzonename ,
19.Nm Pzoneroot ,
20.Nm Pzonepath
21.Nd get zone name, root, and full object path
22.Sh LIBRARY
23.Lb libproc
24.Sh SYNOPSIS
25.In libproc.h
26.Ft char *
27.Fo Pzonename
28.Fa "struct ps_prochandle *P"
29.Fa "char *buf"
30.Fa "size_t nbyte"
31.Fc
32.Ft char *
33.Fo Pzoneroot
34.Fa "struct ps_prochandle *P"
35.Fa "char *buf"
36.Fa "size_t nbyte"
37.Fc
38.Ft char *
39.Fo Pzonepath
40.Fa "struct ps_prochandle *P"
41.Fa "const char *path"
42.Fa "char *buf"
43.Fa "size_t nbyte"
44.Fc
45.Sh DESCRIPTION
46The
47.Fn Pzonename
48function attempts to determine the name of the zone for the process
49handle
50.Fa P .
51If found, up to
52.Fa nbytes ,
53including a null terminator, will be written into
54.Fa buf .
55.Pp
56The
57.Fn Pzoneroot
58function attempts to determine the root of the zone corresponding to the
59process handle
60.Fa P .
61If found, up to
62.Fa nbytes ,
63including a null terminator, will be written into
64.Fa buf .
65If the root cannot be found, for example a core file that did not
66originate on the current system, then the empty string will be written
67into
68.Fa buf .
69.Pp
70The
71.Fn Pzonepath
72function attempts to derive the full path of the object
73.Fa path
74in a zone relative to the root associated with the current process
75handle
76.Fa P .
77If found, up to
78.Fa nbytes ,
79including a null terminator, will be written into
80.Fa buf .
81It is legal to use the same buffer for both
82.Fa path
83and
84.Fa buf ;
85it will not be updated unless the function completes successfully.
86.Sh RETURN VALUES
87Upon successful completion, the
88.Fn Pzonename ,
89.Fn Pzoneroot ,
90and
91.Fn Pzonepath
92functions return
93.Sy buf .
94Otherwise, if an error occurred,
95.Dv NULL
96is returned and
97.Sy errno
98is set.
99.Sh ERRORS
100The
101.Fn Pzonename
102and
103.Fn Pzoneroot
104functions will fail if:
105.Bl -tag -width Er
106.It Er ENODATA
107.Fa P
108refers to a core file and zone information was not available in the core
109dump or
110.Fa P
111refers to an ELF object grabbed through
112.Xr Pgrab_file 3PROC .
113.It Er EFAULT
114.Fa P
115refers to an active process and
116.Fa buf
117is invalid.
118.El
119.Pp
120The
121.Fn Pzoneroot
122function will fail if:
123.Bl -tag -width Er
124.It Er ENOMEM
125Insufficient memory was available on the system.
126.El
127.Sh INTERFACE STABILITY
128.Sy Uncommitted
129.Sh MT-LEVEL
130See
131.Sy LOCKING
132in
133.Xr libproc 3LIB .
134.Sh SEE ALSO
135.Xr getzoneidbyname 3C ,
136.Xr libproc 3LIB ,
137.Xr proc 5
138