5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include "lint.h"
28 #include <sys/types.h>
29 #include <sys/syscall.h>
30 #include <sys/zone.h>
31 #include <sys/priv.h>
32 #include <priv_private.h>
33 #include <zone.h>
34 #include <sys/tsol/label.h>
35 #include <dlfcn.h>
36 #include <stdlib.h>
37 #include <errno.h>
38
39 zoneid_t
40 zone_create(const char *name, const char *root, const struct priv_set *privs,
41 const char *rctls, size_t rctlsz, const char *zfs, size_t zfssz,
42 int *extended_error, int match, int doi, const bslabel_t *label, int flags)
43 {
44 zone_def zd;
45 priv_data_t *d;
46
47 LOADPRIVDATA(d);
48
49 zd.zone_name = name;
50 zd.zone_root = root;
51 zd.zone_privs = privs;
52 zd.zone_privssz = d->pd_setsize;
53 zd.rctlbuf = rctls;
54 zd.rctlbufsz = rctlsz;
55 zd.zfsbuf = zfs;
56 zd.zfsbufsz = zfssz;
57 zd.extended_error = extended_error;
58 zd.match = match;
59 zd.doi = doi;
60 zd.label = label;
61 zd.flags = flags;
62
63 return ((zoneid_t)syscall(SYS_zone, ZONE_CREATE, &zd));
64 }
65
66 int
67 zone_boot(zoneid_t zoneid)
68 {
69 return (syscall(SYS_zone, ZONE_BOOT, zoneid));
70 }
71
72 int
73 zone_shutdown(zoneid_t zoneid)
74 {
75 return (syscall(SYS_zone, ZONE_SHUTDOWN, zoneid));
76 }
77
78 int
79 zone_destroy(zoneid_t zoneid)
80 {
81 return (syscall(SYS_zone, ZONE_DESTROY, zoneid));
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright 2011 Joyent Inc. All rights reserved.
26 */
27
28 #include "lint.h"
29 #include <sys/types.h>
30 #include <sys/syscall.h>
31 #include <sys/zone.h>
32 #include <sys/priv.h>
33 #include <priv_private.h>
34 #include <zone.h>
35 #include <sys/tsol/label.h>
36 #include <dlfcn.h>
37 #include <stdlib.h>
38 #include <errno.h>
39
40 zoneid_t
41 zone_create(const char *name, const char *root, const struct priv_set *privs,
42 const char *rctls, size_t rctlsz, const char *zfs, size_t zfssz,
43 int *extended_error, int match, int doi, const bslabel_t *label, int flags,
44 zoneid_t zone_did)
45 {
46 zone_def zd;
47 priv_data_t *d;
48
49 LOADPRIVDATA(d);
50
51 zd.zone_name = name;
52 zd.zone_root = root;
53 zd.zone_privs = privs;
54 zd.zone_privssz = d->pd_setsize;
55 zd.rctlbuf = rctls;
56 zd.rctlbufsz = rctlsz;
57 zd.zfsbuf = zfs;
58 zd.zfsbufsz = zfssz;
59 zd.extended_error = extended_error;
60 zd.match = match;
61 zd.doi = doi;
62 zd.label = label;
63 zd.flags = flags;
64 zd.zone_did = zone_did;
65
66 return ((zoneid_t)syscall(SYS_zone, ZONE_CREATE, &zd));
67 }
68
69 int
70 zone_boot(zoneid_t zoneid)
71 {
72 return (syscall(SYS_zone, ZONE_BOOT, zoneid));
73 }
74
75 int
76 zone_shutdown(zoneid_t zoneid)
77 {
78 return (syscall(SYS_zone, ZONE_SHUTDOWN, zoneid));
79 }
80
81 int
82 zone_destroy(zoneid_t zoneid)
83 {
84 return (syscall(SYS_zone, ZONE_DESTROY, zoneid));
|