summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/zone.h
blob: 37bf4d8f8781576cdb16f0cf45e0dd9d92780f0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/* Declarations of zone functions and types.
   Copyright (C) 2008 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#ifndef _SYS_ZONE_H
#define _SYS_ZONE_H

#include <sys/types.h>
#include <sys/priv.h>
#include <sys/uadmin.h>
#include <sys/param.h>
#include <sys/tsol/label.h>

/* Subcall numbers.  */
#define ZONE_CREATE	0
#define ZONE_DESTROY	1
#define ZONE_GETATTR	2
#define ZONE_ENTER	3
#define ZONE_LIST	4
#define ZONE_SHUTDOWN	5
#define ZONE_LOOKUP	6
#define ZONE_BOOT	7
#define ZONE_VERSION	8
#define ZONE_SETATTR	9
#define ZONE_ADD_DATALINK	10
#define ZONE_DEL_DATALINK	11
#define ZONE_CHECK_DATALINK	12
#define ZONE_LIST_DATALINK	13

/* Miscellaneous.  */
#define GLOBAL_ZONEID	0
#define GLOBAL_ZONENAME	"global"
#define MIN_ZONEID	0
#define MIN_USERZONEID	1
#define MAX_ZONEID	9999
#define ZONEID_WIDTH	4
#define ALL_ZONES	(-1)
#define ZONENAME_MAX	64
#define ZONENAME_REGEXP	"[a-zA-Z0-9][-_.a-zA-Z0-9]{0,62}"
#define ZONES_TMPDIR	"/var/run/zones"
#define ZONE_DOOR_PATH	ZONES_TMPDIR "/%s.zoneadmd_door"

/* Zone attributes.  */
#define ZONE_ATTR_ROOT		1
#define ZONE_ATTR_NAME		2
#define ZONE_ATTR_STATUS	3
#define ZONE_ATTR_PRIVSET	4
#define ZONE_ATTR_UNIQID	5
#define ZONE_ATTR_POOLID	6
#define ZONE_ATTR_INITPID	7
#define ZONE_ATTR_SLBL		8
#define ZONE_ATTR_INITNAME	9
#define ZONE_ATTR_BOOTARGS	10
#define ZONE_ATTR_BRAND		11
#define ZONE_ATTR_PHYS_MCAP	12
#define ZONE_ATTR_SCHED_CLASS	13
#define ZONE_ATTR_FLAGS		14
#define ZONE_ATTR_BRAND_ATTRS	32768

/* Zone event strings. */
#define ZONE_EVENT_CHANNEL		"com.sun:zones:status"
#define ZONE_EVENT_STATUS_CLASS		"status"
#define ZONE_EVENT_STATUS_SUBCLASS	"change"
#define ZONE_EVENT_UNINITIALIZED	"uninitialized"
#define ZONE_EVENT_INITIALIZED		"initialized"
#define ZONE_EVENT_READY		"ready"
#define ZONE_EVENT_RUNNING		"running"
#define ZONE_EVENT_SHUTTING_DOWN	"shutting_down"

#define ZONE_CB_NAME		"zonename"
#define ZONE_CB_NEWSTATE	"newstate"
#define ZONE_CB_OLDSTATE	"oldstate"
#define ZONE_CB_TIMESTAMP	"when"
#define ZONE_CB_ZONEID		"zoneid"

/* Zone flags.  */
#define ZF_HASHED_LABEL	0x2
#define ZF_IS_SCRATCH	0x4
#define ZF_NET_EXCL	0x8

/* Zone create flags.  */
#define ZCF_NET_EXCL	0x1

/* Exit values.  */
#define ZONE_SUBPROC_OK			0
#define ZONE_SUBPROC_USAGE		253
#define ZONE_SUBPROC_NOTCOMPLETE	254
#define ZONE_SUBPROC_FATAL		255

typedef enum
  {
	ZONE_IS_UNINITIALIZED = 0,
	ZONE_IS_INITIALIZED,
	ZONE_IS_READY,
	ZONE_IS_BOOTING,
	ZONE_IS_RUNNING,
	ZONE_IS_SHUTTING_DOWN,
	ZONE_IS_EMPTY,
	ZONE_IS_DOWN,
	ZONE_IS_DYING,
	ZONE_IS_DEAD
  } zone_status_t;
#define ZONE_MIN_STATE	ZONE_IS_UNINITIALIZED
#define ZONE_MAX_STATE	ZONE_IS_DEAD

typedef struct
  {
	const char *zone_name;
	const char *zone_root;
	const struct priv_set *zone_privs;
	size_t zone_privssz;
	const char *rctlbuf;
	size_t rctlbufsz;
	int *extended_error;
	const char *zfsbuf;
	size_t zfsbufsz;
	int match;
	uint32_t doi;
	const bslabel_t *label;
	int flags;
  } zone_def;

typedef enum zone_cmd
  {
	Z_READY,
	Z_BOOT,
	Z_FORCEBOOT,
	Z_REBOOT,
	Z_HALT,
	Z_NOTE_UNINSTALLING,
	Z_MOUNT,
	Z_FORCEMOUNT,
	Z_UNMOUNT
  } zone_cmd_t;

typedef struct zone_cmd_arg
  {
	uint64_t uniqid;
	zone_cmd_t cmd;
	uint32_t _pad;
	char locale[MAXPATHLEN];
	char bootbuf[BOOTARGS_MAX];
  } zone_cmd_arg_t;

typedef struct zone_cmd_rval
  {
	int rval;
	char errbuf[1];
  } zone_cmd_rval_t;

#endif /* _SYS_ZONE_H */