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