xref: /illumos-gate/usr/src/man/man3proc/Psetzoneid.3proc (revision b1e2e3fb17324e9ddf43db264a0c64da7756d9e6)
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 PSETZONEID 3PROC
16.Os
17.Sh NAME
18.Nm Psetzoneid
19.Nd change processes zone id
20.Sh LIBRARY
21.Lb libproc
22.Sh SYNOPSIS
23.In libproc.h
24.Ft int
25.Fo Psetzoneid
26.Fa "struct ps_prochandle *P"
27.Fa "zoneid_t zoneid"
28.Fc
29.Sh DESCRIPTION
30The
31.Fn Psetzoneid
32function moves the process handle
33.Fa P
34into the zone specified by
35.Fa zoneid .
36A process that is in the non-global zone may only move between the
37global zone and its original zone.
38A process that is in the global zone may not use this interface to enter a
39non-global zone.
40This function will fail if called from a non-global zone.
41This function only manipulates the processes credentials.
42.Pp
43Care should be taken when moving a process around temporarily, such that
44if the process that is manipulating
45.Fa P
46dies, it does not cause
47.Fa P
48to resume running while still in the global zone.
49It is suggested that the
50.Sy PR_KLC
51flag is set with
52.Xr Psetflags 3PROC
53which will cause the process to terminate if the process that holds
54.Fa P
55unexpectedly terminates.
56See
57.Xr proc 4
58for more information on the
59.Sy PR_KLC
60flag.
61.Pp
62Note, only active processes may change their zone.
63It is an error to call this function on process handles that correspond to core
64files, zombie processes, or files.
65.Sh RETURN VALUES
66Upon successful completion, the
67.Fn Psetzoneid
68function returns
69.Sy 0
70and changes the zone for
71.Fa P .
72Otherwise,
73.Sy -1
74is returned and
75.Sy errno
76is set.
77.Sh ERRORS
78For a full list of possible errors see the
79.Sy DIAGNOSTICS
80section in
81.Xr proc 4 .
82.Pp
83The
84.Fn Psetzoneid
85function will fail if:
86.Bl -tag -width Er
87.It Er EINVAL
88.Fa zoneid
89does not correspond to an existing zone or the zone id is not the global
90zone or the original zone of
91.Fa P .
92.It Er EPERM
93The caller does not hold the required privileges for zone configuration.
94.El
95.Sh INTERFACE STABILITY
96.Sy Uncommitted
97.Sh MT-LEVEL
98See
99.Sy LOCKING
100in
101.Xr libproc 3LIB .
102.Sh SEE ALSO
103.Xr libproc 3LIB ,
104.Xr proc 4 ,
105.Xr privileges 5 ,
106.Xr zones 5
107