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