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

Pzonename, Pzoneroot, Pzonepath
get zone name, root, and full object path

Process Control Library (libproc, -lproc)

#include <libproc.h>
char *
Pzonename(struct ps_prochandle *P, char *buf, size_t nbyte);
char *
Pzoneroot(struct ps_prochandle *P, char *buf, size_t nbyte);
char *
Pzonepath(struct ps_prochandle *P, const char *path, char *buf, size_t nbyte);

The Pzonename() function attempts to determine the name of the zone for the process handle P. If found, up to nbytes, including a null terminator, will be written into buf.
The Pzoneroot() function attempts to determine the root of the zone corresponding to the process handle P. If found, up to nbytes, including a null terminator, will be written into buf. If the root cannot be found, for example a core file that did not originate on the current system, then the empty string will be written into buf.
The Pzonepath() function attempts to derive the full path of the object path in a zone relative to the root associated with the current process handle P. If found, up to nbytes, including a null terminator, will be written into buf. It is legal to use the same buffer for both path and buf; it will not be updated unless the function completes successfully.

Upon successful completion, the Pzonename(), Pzoneroot(), and Pzonepath() functions return buf. Otherwise, if an error occurred, NULL is returned and errno is set.

The Pzonename() and Pzoneroot() functions will fail if:
 
 
P refers to a core file and zone information was not available in the core dump or P refers to an ELF object grabbed through Pgrab_file(3PROC).
 
 
P refers to an active process and buf is invalid.
The Pzoneroot() function will fail if:
 
 
Insufficient memory was available on the system.

Uncommitted

See LOCKING in libproc(3LIB).

getzoneidbyname(3C), libproc(3LIB), proc(4)
May 11, 2016 illumos