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

Psetzoneid
change processes zone id

Process Control Library (libproc, -lproc)

#include <libproc.h>
int
Psetzoneid(struct ps_prochandle *P, zoneid_t zoneid);

The Psetzoneid() function moves the process handle P into the zone specified by zoneid. A process that is in the non-global zone may only move between the global zone and its original zone. A process that is in the global zone may not use this interface to enter a non-global zone. This function will fail if called from a non-global zone. This function only manipulates the processes credentials.
Care should be taken when moving a process around temporarily, such that if the process that is manipulating P dies, it does not cause P to resume running while still in the global zone. It is suggested that the PR_KLC flag is set with Psetflags(3PROC) which will cause the process to terminate if the process that holds P unexpectedly terminates. See proc(4) for more information on the PR_KLC flag.
Note, only active processes may change their zone. It is an error to call this function on process handles that correspond to core files, zombie processes, or files.

Upon successful completion, the Psetzoneid() function returns 0 and changes the zone for P. Otherwise, -1 is returned and errno is set.

For a full list of possible errors see the DIAGNOSTICS section in proc(4).
The Psetzoneid() function will fail if:
 
 
zoneid does not correspond to an existing zone or the zone id is not the global zone or the original zone of P.
 
 
The caller does not hold the required privileges for zone configuration.

Uncommitted

See LOCKING in libproc(3LIB).

libproc(3LIB), proc(4), privileges(5), zones(5)
May 11, 2016 illumos