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 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2013, Joyent, Inc. All rights reserved.
24 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2014 Igor Kozhukhov <ikozhukhov@gmail.com>.
26 */
27
28 #ifndef _SYS_ZONE_H
29 #define _SYS_ZONE_H
30
31 #include <sys/types.h>
32 #include <sys/mutex.h>
33 #include <sys/param.h>
34 #include <sys/rctl.h>
35 #include <sys/ipc_rctl.h>
36 #include <sys/pset.h>
37 #include <sys/tsol/label.h>
38 #include <sys/cred.h>
39 #include <sys/netstack.h>
40 #include <sys/uadmin.h>
41 #include <sys/ksynch.h>
42 #include <sys/socket_impl.h>
43 #include <netinet/in.h>
44
45 #ifdef __cplusplus
382
383 struct cpucap;
384
385 typedef struct {
386 kstat_named_t zm_zonename; /* full name, kstat truncates name */
387 kstat_named_t zm_utime;
388 kstat_named_t zm_stime;
389 kstat_named_t zm_wtime;
390 kstat_named_t zm_avenrun1;
391 kstat_named_t zm_avenrun5;
392 kstat_named_t zm_avenrun15;
393 kstat_named_t zm_run_ticks;
394 kstat_named_t zm_run_wait;
395 kstat_named_t zm_fss_shr_pct;
396 kstat_named_t zm_fss_pri_hi;
397 kstat_named_t zm_fss_pri_avg;
398 kstat_named_t zm_ffcap;
399 kstat_named_t zm_ffnoproc;
400 kstat_named_t zm_ffnomem;
401 kstat_named_t zm_ffmisc;
402 } zone_misc_kstat_t;
403
404 typedef struct zone {
405 /*
406 * zone_name is never modified once set.
407 */
408 char *zone_name; /* zone's configuration name */
409 /*
410 * zone_nodename and zone_domain are never freed once allocated.
411 */
412 char *zone_nodename; /* utsname.nodename equivalent */
413 char *zone_domain; /* srpc_domain equivalent */
414 /*
415 * zone_hostid is used for per-zone hostid emulation.
416 * Currently it isn't modified after it's set (so no locks protect
417 * accesses), but that might have to change when we allow
418 * administrators to change running zones' properties.
419 *
420 * The global zone's zone_hostid must always be HW_INVALID_HOSTID so
421 * that zone_get_hostid() will function correctly.
499 /*
500 * zone_kthreads is protected by zone_status_lock.
501 */
502 kthread_t *zone_kthreads; /* kernel threads in zone */
503 struct priv_set *zone_privset; /* limit set for zone */
504 /*
505 * zone_vfslist is protected by vfs_list_lock().
506 */
507 struct vfs *zone_vfslist; /* list of FS's mounted in zone */
508 uint64_t zone_uniqid; /* unique zone generation number */
509 struct cred *zone_kcred; /* kcred-like, zone-limited cred */
510 /*
511 * zone_pool is protected by pool_lock().
512 */
513 struct pool *zone_pool; /* pool the zone is bound to */
514 hrtime_t zone_pool_mod; /* last pool bind modification time */
515 /* zone_psetid is protected by cpu_lock */
516 psetid_t zone_psetid; /* pset the zone is bound to */
517
518 time_t zone_boot_time; /* Similar to boot_time */
519
520 /*
521 * The following two can be read without holding any locks. They are
522 * updated under cpu_lock.
523 */
524 int zone_ncpus; /* zone's idea of ncpus */
525 int zone_ncpus_online; /* zone's idea of ncpus_online */
526 /*
527 * List of ZFS datasets exported to this zone.
528 */
529 list_t zone_datasets; /* list of datasets */
530
531 ts_label_t *zone_slabel; /* zone sensitivity label */
532 int zone_match; /* require label match for packets */
533 tsol_mlp_list_t zone_mlps; /* MLPs on zone-private addresses */
534
535 boolean_t zone_restart_init; /* Restart init if it dies? */
536 struct brand *zone_brand; /* zone's brand */
537 void *zone_brand_data; /* store brand specific data */
538 id_t zone_defaultcid; /* dflt scheduling class id */
|
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 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2013, Joyent, Inc. All rights reserved.
24 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2014 Igor Kozhukhov <ikozhukhov@gmail.com>.
26 * Copyright 2016 Garrett D'Amore
27 */
28
29 #ifndef _SYS_ZONE_H
30 #define _SYS_ZONE_H
31
32 #include <sys/types.h>
33 #include <sys/mutex.h>
34 #include <sys/param.h>
35 #include <sys/rctl.h>
36 #include <sys/ipc_rctl.h>
37 #include <sys/pset.h>
38 #include <sys/tsol/label.h>
39 #include <sys/cred.h>
40 #include <sys/netstack.h>
41 #include <sys/uadmin.h>
42 #include <sys/ksynch.h>
43 #include <sys/socket_impl.h>
44 #include <netinet/in.h>
45
46 #ifdef __cplusplus
383
384 struct cpucap;
385
386 typedef struct {
387 kstat_named_t zm_zonename; /* full name, kstat truncates name */
388 kstat_named_t zm_utime;
389 kstat_named_t zm_stime;
390 kstat_named_t zm_wtime;
391 kstat_named_t zm_avenrun1;
392 kstat_named_t zm_avenrun5;
393 kstat_named_t zm_avenrun15;
394 kstat_named_t zm_run_ticks;
395 kstat_named_t zm_run_wait;
396 kstat_named_t zm_fss_shr_pct;
397 kstat_named_t zm_fss_pri_hi;
398 kstat_named_t zm_fss_pri_avg;
399 kstat_named_t zm_ffcap;
400 kstat_named_t zm_ffnoproc;
401 kstat_named_t zm_ffnomem;
402 kstat_named_t zm_ffmisc;
403 kstat_named_t zm_boot_hrtime;
404 } zone_misc_kstat_t;
405
406 typedef struct zone {
407 /*
408 * zone_name is never modified once set.
409 */
410 char *zone_name; /* zone's configuration name */
411 /*
412 * zone_nodename and zone_domain are never freed once allocated.
413 */
414 char *zone_nodename; /* utsname.nodename equivalent */
415 char *zone_domain; /* srpc_domain equivalent */
416 /*
417 * zone_hostid is used for per-zone hostid emulation.
418 * Currently it isn't modified after it's set (so no locks protect
419 * accesses), but that might have to change when we allow
420 * administrators to change running zones' properties.
421 *
422 * The global zone's zone_hostid must always be HW_INVALID_HOSTID so
423 * that zone_get_hostid() will function correctly.
501 /*
502 * zone_kthreads is protected by zone_status_lock.
503 */
504 kthread_t *zone_kthreads; /* kernel threads in zone */
505 struct priv_set *zone_privset; /* limit set for zone */
506 /*
507 * zone_vfslist is protected by vfs_list_lock().
508 */
509 struct vfs *zone_vfslist; /* list of FS's mounted in zone */
510 uint64_t zone_uniqid; /* unique zone generation number */
511 struct cred *zone_kcred; /* kcred-like, zone-limited cred */
512 /*
513 * zone_pool is protected by pool_lock().
514 */
515 struct pool *zone_pool; /* pool the zone is bound to */
516 hrtime_t zone_pool_mod; /* last pool bind modification time */
517 /* zone_psetid is protected by cpu_lock */
518 psetid_t zone_psetid; /* pset the zone is bound to */
519
520 time_t zone_boot_time; /* Similar to boot_time */
521 hrtime_t zone_boot_hrtime; /* gethrtime() at zone boot */
522
523 /*
524 * The following two can be read without holding any locks. They are
525 * updated under cpu_lock.
526 */
527 int zone_ncpus; /* zone's idea of ncpus */
528 int zone_ncpus_online; /* zone's idea of ncpus_online */
529 /*
530 * List of ZFS datasets exported to this zone.
531 */
532 list_t zone_datasets; /* list of datasets */
533
534 ts_label_t *zone_slabel; /* zone sensitivity label */
535 int zone_match; /* require label match for packets */
536 tsol_mlp_list_t zone_mlps; /* MLPs on zone-private addresses */
537
538 boolean_t zone_restart_init; /* Restart init if it dies? */
539 struct brand *zone_brand; /* zone's brand */
540 void *zone_brand_data; /* store brand specific data */
541 id_t zone_defaultcid; /* dflt scheduling class id */
|