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