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