/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <alloca.h>
#include <assert.h>
#include <door.h>
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include <unistd.h>
#include <zonestat.h>
#include <zonestat_private.h>
#include <zonestat_impl.h>
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
/* Compute max, treating ZS_LIMIT_NONE as zero */
#define ZS_MAXOF(a, b) { \
if ((b) != ZS_LIMIT_NONE) { \
if ((a) == ZS_LIMIT_NONE) \
(a) = (b); \
else if ((b) > (a)) \
(b) = (a); \
} \
}
/* Add two caps together, treating ZS_LIMIT_NONE as zero */
#define ZS_ADD_CAP(a, b) { \
if ((b) != ZS_LIMIT_NONE) { \
if ((a) == ZS_LIMIT_NONE) \
(a) = (b); \
else \
(a) += (b); \
} \
}
#define ZS_MAXOFTS(a, b) { \
/*
* Functions for reading and manipulating resource usage.
*/
static int
{
int fd;
return (fd);
}
static struct zs_zone *
{
return (zone);
}
return (NULL);
}
static struct zs_zone *
{
return (zone);
}
return (NULL);
}
static struct zs_usage *
{
struct zs_usage *u;
struct zs_system *s;
if (u == NULL)
return (NULL);
if (s == NULL) {
free(u);
return (NULL);
}
u->zsu_system = s;
return (u);
}
static void
{
if (func == ZS_COMPUTE_USAGE_HIGH) {
/* Compute max of caps */
/* Compute max memory and limit usages */
return;
}
/* Add in memory and limit usages */
}
static int
{
/*
* Walk zones, assume lists are always sorted the same. Include
* all zones that exist in the new usage.
*/
int cmp;
if (cmp > 0) {
/*
* Old interval does not contain zone in new
* interval. Zone is new. Add zone to result.
*/
return (-1);
zres->zsz_intervals = 0;
else
zres);
} else {
}
if (func == ZS_COMPUTE_USAGE_AVERAGE)
zres->zsz_intervals++;
continue;
} else if (cmp < 0) {
/*
* Start interval contains zones that is not in the
* end interval. This zone is gone. Leave zone in
* old usage, but do not add it to result usage
*/
continue;
}
/* Zone is in both start and end interval. Compute interval */
} else {
/* add zone to new usage */
return (-1);
}
if (func == ZS_COMPUTE_USAGE_AVERAGE)
zres->zsz_intervals++;
if (func == ZS_COMPUTE_USAGE_INTERVAL) {
/*
* If zone is in the old interval, but has been
* rebooted, don't subtract its old interval usage
*/
continue;
}
zold->zsz_cap_time);
B_FALSE);
} else {
}
}
return (0);
/* Add in any remaining zones in the new interval */
return (-1);
if (func == ZS_COMPUTE_USAGE_AVERAGE)
zres->zsz_intervals++;
else
}
return (0);
}
static void
{
if (func == ZS_COMPUTE_USAGE_HIGH) {
return;
}
}
static int
{
/*
* Walk psets usages, assume lists are always sorted the same. Include
* all pset usages that exist in the new pset.
*/
else
int cmp;
if (cmp > 0) {
/*
* Old interval does not contain usage new
* interval. Usage is new.
*/
sizeof (struct zs_pset_zone));
return (-1);
pures->zspz_intervals = 0;
pures);
else
pures);
} else {
}
if (func == ZS_COMPUTE_USAGE_AVERAGE)
pures->zspz_intervals++;
else if (func == ZS_COMPUTE_USAGE_TOTAL) {
/* Add pset's time so far to the zone usage */
}
continue;
} else if (cmp < 0) {
/*
* Old interval contains pset_zone that is not in the
* new interval. This zone is no longer using the
* pset. Leave pset_zone in old interval, but do not
* add it to result usage.
*
* For total utilization, add pset time to zone that
* has run in this pset before.
*/
if (func == ZS_COMPUTE_USAGE_TOTAL) {
/* Add new pset time to the zone usage */
}
continue;
}
/*
* Zone is using pset in both start and end interval. Compute
* interval
*/
} else {
sizeof (struct zs_pset_zone));
return (-1);
}
if (func == ZS_COMPUTE_USAGE_AVERAGE)
pures->zspz_intervals++;
if (func == ZS_COMPUTE_USAGE_INTERVAL) {
/*
* If pset usage has been destroyed and re-created
* since start interval, don't subtract the start
* interval.
*/
continue;
}
} else {
}
}
if (func == ZS_COMPUTE_USAGE_TOTAL) {
}
}
/* No need to add new pset zone usages if result pset is new pset */
return (0);
/* Add in any remaining new psets in the new interval */
pures = (struct zs_pset_zone *)
return (-1);
if (func == ZS_COMPUTE_USAGE_AVERAGE)
pures->zspz_intervals++;
else
}
return (0);
}
static void
{
if (func == ZS_COMPUTE_USAGE_HIGH) {
return;
}
}
static int
{
/*
* Walk psets, assume lists are always sorted the same. Include
* all psets that exist at the end of the interval.
*/
int cmp;
if (cmp > 0) {
/*
* Old interval does not contain pset in new
* interval. Pset is new.
*/
return (-1);
pres->zsp_intervals = 0;
sizeof (struct zs_pset_zone),
else
pres);
} else {
}
return (-1);
if (func == ZS_COMPUTE_USAGE_AVERAGE ||
pres->zsp_intervals++;
continue;
} else if (cmp < 0) {
/*
* Start interval contains psets that is not in the
* end interval. This pset is gone. Leave pset in
* old usage, but do not add it to result usage.
*/
continue;
}
/* Pset is in both start and end interval. Compute interval */
} else {
return (-1);
sizeof (struct zs_pset_zone),
}
if (func == ZS_COMPUTE_USAGE_AVERAGE ||
pres->zsp_intervals++;
if (func == ZS_COMPUTE_USAGE_INTERVAL) {
/*
* If pset as been destroyed and re-created since start
* interval, don't subtract the start interval.
*/
goto usages;
}
} else {
}
return (-1);
}
return (0);
/* Add in any remaining psets in the new interval */
return (-1);
sizeof (struct zs_pset_zone),
if (func == ZS_COMPUTE_USAGE_AVERAGE ||
pres->zsp_intervals++;
else
return (-1);
}
return (0);
}
static int
{
break;
}
zone = (zs_link_zone_t)
return (-1);
}
if (is_vlink) {
else
}
return (0);
}
static void
{
switch (func) {
case ZS_COMPUTE_USAGE_HIGH:
break;
case ZS_COMPUTE_USAGE_AVERAGE:
/* fall through */
case ZS_COMPUTE_USAGE_TOTAL:
break;
default:
break;
}
}
static int
{
/*
* Walk vlinks, assume lists are always sorted the same. Include
* all vlink usages that exist in the new datalink.
*/
else
int cmp;
if (cmp > 0) {
/*
* Old interval does not contain the vlink in new
* interval. This vlink is new or renamed. Put it
* in result usage but don't add it to totals. We
* under port the vlink usage by up to one interval.
*/
sizeof (struct zs_datalink));
return (-1);
dures->zsl_intervals = 0;
dures);
else
dures);
B_TRUE) != 0)
return (-1);
} else {
}
/* vlink is always up */
if (func == ZS_COMPUTE_USAGE_AVERAGE)
dures->zsl_intervals++;
continue;
} else if (cmp < 0) {
/*
* Old interval contains vlink that is not in the
* new interval. This vlink is no longer present.
* Leave the vlink in old interval, but do not
* add it to result usage.
*/
continue;
}
/*
* vlink is in both start and end interval. Compute interval
*/
} else {
sizeof (struct zs_datalink));
return (-1);
}
if (func == ZS_COMPUTE_USAGE_AVERAGE ||
dures->zsl_intervals++;
if (func == ZS_COMPUTE_USAGE_INTERVAL) {
/*
* add byte counts to link total
*/
return (-1);
} else
}
/* Add in any remaining new datalink in the new interval */
sizeof (struct zs_datalink));
return (-1);
}
/* vlink is always up */
if (func == ZS_COMPUTE_USAGE_AVERAGE)
dures->zsl_intervals++;
return (-1);
}
return (0);
}
static int
{
/*
* Walk datalinks, assume lists are always sorted the same. Include
* all datalinks that exist at the end of the interval.
*/
int cmp;
if (cmp > 0) {
/*
* Old interval does not contain the link in new
* interval. Link is new. Add it to result. We
* don't have sufficient information on this new
* datalink to know whether it is new, renamed, or
* used to be an aggr port device. Don't add stats
* here.
*/
sizeof (struct zs_datalink));
return (-1);
dres->zsl_intervals = 0;
sizeof (struct zs_datalink),
sizeof (struct zs_link_zone),
else
} else {
}
/*
* increment interval count for up phys link
* or etherstub
*/
if (func == ZS_COMPUTE_USAGE_AVERAGE &&
dres->zsl_intervals++;
func) != 0)
return (-1);
continue;
} else if (cmp < 0) {
/*
* Start interval contains link that is not in the
* end interval. This link is gone. Leave link in
* old usage, but do not add it to result usage
*/
continue;
}
/* Link is in both start and end interval. Compute interval */
} else {
sizeof (struct zs_datalink));
return (-1);
sizeof (struct zs_datalink),
sizeof (struct zs_link_zone),
}
/* increment interval count for "up" phys link or etherstub */
if ((func == ZS_COMPUTE_USAGE_AVERAGE ||
func == ZS_COMPUTE_USAGE_HIGH) &&
dres->zsl_intervals++;
if (func == ZS_COMPUTE_USAGE_INTERVAL) {
/*
* reset total_* counters as they are supposed
* to count this interval only
*/
dres->zsl_total_rbytes = 0;
dres->zsl_total_obytes = 0;
dres->zsl_total_prbytes = 0;
dres->zsl_total_pobytes = 0;
/* add to link total */
return (-1);
} else
!= 0)
return (-1);
}
/* Add in any remaining links in the new interval */
sizeof (struct zs_datalink));
return (-1);
sizeof (struct zs_datalink),
sizeof (struct zs_link_zone),
/*
* increment interval count for up phys link
* or etherstub
*/
if (func == ZS_COMPUTE_USAGE_AVERAGE &&
dres->zsl_intervals++;
}
!= 0)
return (-1);
return (-1);
}
return (0);
}
char *
{
}
static zoneid_t
{
}
static uint_t
{
return (zone->zsz_iptype);
}
static uint_t
{
return (zone->zsz_cputype);
}
char *
{
}
char *
{
}
static uint_t
{
return (zone->zsz_scheds);
}
static uint_t
{
return (zone->zsz_default_sched);
}
static uint64_t
{
/* If no time yet, treat as zero */
return (0);
}
/*
* Convert total and used time into percent used.
*/
static uint_t
{
return (res);
}
/*
* Convert total and used time, plus number of cpus, into number of cpus
* used, where 100 equals 1 cpu used.
*/
static uint64_t
{
}
static uint64_t
{
/* No processes found in FSS */
return (ZS_LIMIT_NONE);
return (zone->zsz_cpu_shares);
}
static uint64_t
{
return (zone->zsz_cpu_cap);
}
static uint64_t
{
return (ZS_LIMIT_NONE);
}
static uint64_t
{
return (ZS_LIMIT_NONE);
return (ZS_LIMIT_NONE);
return (ZS_LIMIT_NONE);
}
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static uint64_t
{
/* If no time yet, treat as zero */
if (total == 0)
return (0);
}
/*
* Convert a total and used value into a percent used.
*/
static uint_t
{
return (res);
}
static uint_t
{
return (ZS_PCT_NONE);
B_TRUE));
}
static uint_t
{
return (ZS_PCT_NONE);
return (ZS_PCT_NONE);
return (ZS_PCT_NONE);
B_FALSE));
}
static uint64_t
{
return (zone->zsz_ram_cap);
}
static uint64_t
{
return (zone->zsz_vm_cap);
}
static uint64_t
{
return (zone->zsz_locked_cap);
}
static uint64_t
{
return (ZS_LIMIT_NONE);
return (zone->zsz_usage_ram);
}
static uint64_t
{
return (ZS_LIMIT_NONE);
return (zone->zsz_usage_vm);
}
static uint64_t
{
return (ZS_LIMIT_NONE);
return (zone->zsz_usage_locked);
}
char *
{
}
static psetid_t
{
}
static uint64_t
{
}
static uint64_t
{
return (pset->zsp_online);
}
{
}
{
}
static uint_t
{
return (pset->zsp_scheds);
}
static uint_t
{
return (pz->zspz_scheds);
}
static double
{
}
static uint64_t
{
return (ZS_LIMIT_NONE);
return (pset->zsp_cpu_shares);
}
static uint64_t
{
return (ZS_LIMIT_NONE);
return (pz->zspz_cpu_shares);
}
static uint_t
{
return (pset->zsp_cputype);
}
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static uint_t
{
}
static uint_t
{
}
static uint_t
{
B_TRUE));
}
static uint_t
{
B_TRUE));
}
static uint_t
{
B_TRUE));
}
static uint_t
{
B_TRUE));
}
static uint_t
{
}
static uint64_t
{
}
static void
{
*t = pz->zspz_cpu_usage;
}
static uint_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint_t
{
return (ZS_PCT_NONE);
}
}
/*
* Return the fraction of total shares for a pset allocated to the zone.
*/
static uint_t
{
return (ZS_PCT_NONE);
return (ZS_PCT_NONE);
return (ZS_PCT_NONE);
return (0);
if (pz->zspz_cpu_shares == 0)
return (0);
B_TRUE));
}
/*
* Of a zones shares, what percent of cpu time is it using. For instance,
* if a zone has 50% of shares, and is using 50% of the cpu time, then it is
* using 100% of its share.
*/
static uint_t
{
double sharefactor;
double total;
double used;
double pct;
return (ZS_PCT_NONE);
return (ZS_PCT_NONE);
return (ZS_PCT_NONE);
if (pz->zspz_cpu_shares == 0)
return (ZS_PCT_NONE);
/* Common scaling function won't do sharefactor. */
/* Allow percent of share used to exceed 100% */
}
static void
{
}
static void
{
}
static void
{
}
static uint_t
{
}
static uint_t
{
}
static void
{
}
static uint_t
{
}
static void
{
}
static uint_t
{
}
static void
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint_t
{
B_TRUE));
}
static uint64_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint64_t
{
return (zone->zsz_usage_ram);
}
static uint_t
{
}
static uint_t
{
return (ZS_PCT_NONE);
if (zone->zsz_ram_cap == 0) {
return (0);
}
/* Allow ram cap to exeed 100% */
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint64_t
{
return (zone->zsz_usage_vm);
}
static uint_t
{
}
static uint_t
{
return (ZS_PCT_NONE);
if (zone->zsz_vm_cap == 0)
return (0);
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint64_t
{
return (zone->zsz_usage_locked);
}
static uint_t
{
}
static uint_t
{
return (ZS_PCT_NONE);
if (zone->zsz_locked_cap == 0)
return (0);
}
static uint64_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint_t
{
}
static uint_t
{
}
static uint_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
return (zone->zsz_processes);
}
static uint64_t
{
}
static uint64_t
{
}
static uint64_t
{
return (zone->zsz_shmids);
}
static uint64_t
{
return (zone->zsz_semids);
}
static uint64_t
{
return (zone->zsz_msgids);
}
static uint64_t
{
}
static uint64_t
{
return (zone->zsz_tot_pbytes);
}
static uint_t
{
}
static uint_t
{
}
static uint_t
{
}
static uint_t
{
}
static uint_t
{
}
static uint_t
{
}
static uint_t
{
}
static uint_t
{
}
static uint_t
{
return (ZS_PCT_NONE);
if (zone->zsz_processes_cap == 0)
return (0);
}
static uint_t
{
return (ZS_PCT_NONE);
if (zone->zsz_lwps_cap == 0)
return (0);
}
static uint_t
{
return (ZS_PCT_NONE);
if (zone->zsz_shm_cap == 0)
return (0);
}
static uint_t
{
return (ZS_PCT_NONE);
if (zone->zsz_shmids_cap == 0)
return (0);
B_TRUE));
}
static uint_t
{
return (ZS_PCT_NONE);
if (zone->zsz_semids_cap == 0)
return (0);
B_TRUE));
}
static uint_t
{
return (ZS_PCT_NONE);
if (zone->zsz_msgids_cap == 0)
return (0);
B_TRUE));
}
static uint_t
{
return (ZS_PCT_NONE);
if (zone->zsz_lofi_cap == 0)
return (0);
B_TRUE));
}
/* All funcs above this line should be static */
void
{
}
/*
* ERRORS
*
* EINTR signal received, process forked, or zonestatd exited
* ESRCH zonestatd not responding
*/
static zs_usage_t
{
uint_t i, j;
char *next;
cmd[0] = ZSD_CMD_READ;
switch (errno) {
case EINTR:
case EAGAIN:
case ENOMEM:
break;
case EMFILE:
case EOVERFLOW:
break;
default:
}
return (NULL);
}
return (NULL);
}
/* LINTED */
usage->zsu_intervals = 0;
/* Fix up next pointers inside usage_t */
/* LINTED */
for (i = 0; i < usage->zsu_nzones; i++) {
/* LINTED */
zone->zsz_intervals = 0;
}
for (i = 0; i < usage->zsu_npsets; i++) {
/* LINTED */
for (j = 0; j < pset->zsp_nusage; j++) {
/* LINTED */
next += sizeof (struct zs_pset_zone);
pz->zspz_intervals = 0;
}
pset->zsp_intervals = 0;
}
for (i = 0; i < usage->zsu_ndatalinks; i++) {
/* LINTED */
next += sizeof (struct zs_datalink);
for (j = 0; j < link->zsl_nclients; j++) {
/* LINTED */
next += sizeof (struct zs_datalink);
vl->zsl_intervals = 0;
}
}
if (init)
return ((zs_usage_t)usage);
/*
* If current usage tracking started after start usage, then
* no need to subtract start usage. This really can't happen,
* as zonestatd should never start over while this client is
* connected.
*/
return ((zs_usage_t)usage);
}
/*
* Compute usage relative to first open. Usage returned by
* zonestatd starts at an arbitrary point in the past.
*
*/
return ((zs_usage_t)usage);
}
{
}
/*
* Open connection to zonestatd. NULL of failure, with errno set:
*
* EPERM: Insufficent privilege (no PRIV_PROC_INFO)
* ESRCH: Zones monitoring service not available or responding
* ENOTSUP: Incompatiable zones monitoring service version.
* EINTR: Server exited or client forked.
* ENOMEM: as malloc(3c)
* EAGAIN: asl malloc(3c)
*
*/
zs_open()
{
int *res;
int fd;
int errno_save;
return (NULL);
fd = zs_connect_zonestatd();
if (fd < 0) {
return (NULL);
}
cmd[0] = ZSD_CMD_CONNECT;
errno_save = errno;
switch (errno_save) {
case ENOMEM:
case EAGAIN:
break;
case EINTR:
break;
case EMFILE:
case EOVERFLOW:
break;
default:
}
return (NULL);
}
/* LINTED */
return (NULL);
}
return (NULL);
}
return (NULL);
}
return (NULL);
}
/*
* Get the initial usage from zonestatd. This creates a
* zero-point on which to base future usages returned by
* zs_read().
*/
errno_save = errno;
if (errno_save == EINTR)
else
return (NULL);
}
}
/*
* Public api for interval diff
*/
{
return (NULL);
}
/*
* In USAGE_INTERVAL case,
* sres - points to usage struct which is diff of snew and sold
* sold - points to stats from last interval
* snew - points to stats from current interval
* In USAGE_HIGH | AVERAGE | TOTAL case,
* sres and sold - point same struct that is running total of previous
* intervals.
* snew - points to a struct contains diff of snew and sold computed
* in current interval.
*
* Return NULL on error.
* ERRORS:
* EINVAL: Invalid function.
*/
{
if (func != ZS_COMPUTE_USAGE_INTERVAL &&
func != ZS_COMPUTE_USAGE_TOTAL &&
func != ZS_COMPUTE_USAGE_AVERAGE &&
abort();
ures = zs_usage_alloc();
return (NULL);
}
switch (func) {
/* Use system totals from newer interval */
break;
case ZS_COMPUTE_USAGE_HIGH:
/* Find max cpus */
/* Find max cpu times */
/* These don't change */
/*
* Add in memory values and limits. Scale memory to
* avoid overflow.
*/
snew->zss_ram_kern);
snew->zss_vm_total);
snew->zss_vm_kern);
snew->zss_vm_zones);
break;
case ZS_COMPUTE_USAGE_TOTAL:
/* FALLTHROUGH */
case ZS_COMPUTE_USAGE_AVERAGE:
ures->zsu_intervals++;
/*
* Add cpus. The total report will divide this by the
* number of intervals to give the average number of cpus
* over all intervals.
*/
/* Add in cpu times */
/* These don't change */
/*
* Add in memory values and limits. Scale memory to
* avoid overflow.
*/
}
/* Add in new values. */
/* add in new net stats */
break;
default:
if (alloced)
abort();
}
goto err;
goto err;
goto err;
return ((zs_usage_t)ures);
err:
if (alloced)
return (NULL);
}
void
{
return;
}
}
}
}
}
{
return (NULL);
goto err;
goto err;
goto err;
return ((zs_usage_set_t)set);
err:
return (NULL);
}
void
{
}
int
{
/* Compute ongoing functions for usage set */
set->zsus_count++;
return (0);
}
int
{
return (set->zsus_count);
}
{
struct zs_usage *u;
struct zs_system *s;
struct zs_zone *z;
struct zs_pset *p;
switch (func) {
case ZS_COMPUTE_SET_HIGH:
case ZS_COMPUTE_SET_TOTAL:
u = set->zsus_total;
break;
case ZS_COMPUTE_SET_AVERAGE:
break;
default:
abort();
}
s = u->zsu_system;
s->zss_ram_total /= u->zsu_intervals;
s->zss_ram_total *= 1024;
s->zss_ram_kern /= u->zsu_intervals;
s->zss_ram_kern *= 1024;
s->zss_ram_zones /= u->zsu_intervals;
s->zss_ram_zones *= 1024;
s->zss_locked_kern /= u->zsu_intervals;
s->zss_locked_kern *= 1024;
s->zss_locked_zones /= u->zsu_intervals;
s->zss_locked_zones *= 1024;
s->zss_vm_total /= u->zsu_intervals;
s->zss_vm_total *= 1024;
s->zss_vm_kern /= u->zsu_intervals;
s->zss_vm_kern *= 1024;
s->zss_vm_zones /= u->zsu_intervals;
s->zss_vm_zones *= 1024;
s->zss_swap_total /= u->zsu_intervals;
s->zss_swap_total *= 1024;
s->zss_swap_used /= u->zsu_intervals;
s->zss_swap_used *= 1024;
s->zss_processes /= u->zsu_intervals;
s->zss_lwps /= u->zsu_intervals;
s->zss_shm /= u->zsu_intervals;
s->zss_shm *= 1024;
s->zss_shmids /= u->zsu_intervals;
s->zss_semids /= u->zsu_intervals;
s->zss_msgids /= u->zsu_intervals;
s->zss_lofi /= u->zsu_intervals;
if (average) {
} else {
/*
* networking total needs to be normalized
* to a "bytes per second number".
*/
}
s->zss_net_bytes /= divisor;
s->zss_net_rbytes /= divisor;
s->zss_net_obytes /= divisor;
s->zss_net_pbytes /= divisor;
s->zss_net_prbytes /= divisor;
s->zss_net_pobytes /= divisor;
s->zss_net_pused /= divisor;
s->zss_ncpus /= u->zsu_intervals;
s->zss_ncpus_online /= u->zsu_intervals;
z = list_next(&u->zsu_zone_list, z)) {
if (average) {
intervals = z->zsz_intervals;
} else {
assert(z->zsz_intervals == 0);
intervals = u->zsu_intervals;
}
if (z->zsz_cpu_cap != ZS_LIMIT_NONE)
z->zsz_cpu_cap /= z->zsz_intervals;
if (z->zsz_ram_cap != ZS_LIMIT_NONE)
z->zsz_ram_cap /= z->zsz_intervals;
if (z->zsz_vm_cap != ZS_LIMIT_NONE)
z->zsz_vm_cap /= z->zsz_intervals;
if (z->zsz_locked_cap != ZS_LIMIT_NONE)
z->zsz_locked_cap /= z->zsz_intervals;
if (z->zsz_processes_cap != ZS_LIMIT_NONE)
z->zsz_processes_cap /= z->zsz_intervals;
if (z->zsz_lwps_cap != ZS_LIMIT_NONE)
z->zsz_lwps_cap /= z->zsz_intervals;
if (z->zsz_shm_cap != ZS_LIMIT_NONE)
z->zsz_shm_cap /= z->zsz_intervals;
if (z->zsz_shmids_cap != ZS_LIMIT_NONE)
z->zsz_shmids_cap /= z->zsz_intervals;
if (z->zsz_semids_cap != ZS_LIMIT_NONE)
z->zsz_semids_cap /= z->zsz_intervals;
if (z->zsz_msgids_cap != ZS_LIMIT_NONE)
z->zsz_msgids_cap /= z->zsz_intervals;
if (z->zsz_lofi_cap != ZS_LIMIT_NONE)
z->zsz_lofi_cap /= z->zsz_intervals;
z->zsz_usage_ram /= intervals;
z->zsz_usage_locked /= intervals;
z->zsz_usage_vm /= intervals;
z->zsz_processes /= intervals;
z->zsz_shmids /= intervals;
z->zsz_semids /= intervals;
z->zsz_msgids /= intervals;
z->zsz_cpus_online /= intervals;
z->zsz_cpu_shares /= intervals;
}
p = list_next(&u->zsu_pset_list, p)) {
intervals = p->zsp_intervals;
p->zsp_online /= intervals;
p->zsp_importance /= intervals;
p->zsp_cpu_shares /= intervals;
if (average) {
} else {
intervals = p->zsp_intervals;
}
}
}
l = list_next(&u->zsu_datalink_list, l)) {
if (average) {
/*
* interval should be at least 1 as a down link
* may not have a chance to increment interval count
*/
if (l->zsl_intervals == 0)
divisor = 1;
else
} else
/*
* networking total needs to be normalized
* to a "bytes per second number".
*/
l->zsl_rbytes /= divisor;
l->zsl_obytes /= divisor;
l->zsl_prbytes /= divisor;
l->zsl_pobytes /= divisor;
l->zsl_total_rbytes /= divisor;
l->zsl_total_obytes /= divisor;
l->zsl_total_prbytes /= divisor;
l->zsl_total_pobytes /= divisor;
if (average) {
/*
* interval should be at least 1 as a down link
* may not have a chance to increment interval
* count
*/
if (vl->zsl_intervals == 0)
vdivisor = 1;
else
} else
/*
* networking total needs to be normalized
* to a "bytes per second number".
*/
1000000000;
}
}
return ((zs_usage_t)u);
}
/*
* Returns B_TRUE if property is valid. Otherwise, returns B_FALSE.
*/
{
switch (prop) {
return (B_TRUE);
default:
return (B_FALSE);
}
}
/*
* Returns 0 on success. Trips abort() on invalid property.
*/
{
struct zs_property *p;
switch (prop) {
p = &u->zsu_system->zss_prop_cpu_total;
p->zsp_type = DATA_TYPE_UINT64;
break;
p = &u->zsu_system->zss_prop_cpu_online;
p->zsp_type = DATA_TYPE_UINT64;
break;
p = &u->zsu_system->zss_prop_cpu_1min;
p->zsp_type = DATA_TYPE_DOUBLE;
break;
p = &u->zsu_system->zss_prop_cpu_5min;
p->zsp_type = DATA_TYPE_DOUBLE;
break;
p = &u->zsu_system->zss_prop_cpu_15min;
p->zsp_type = DATA_TYPE_DOUBLE;
p->zsp_v.zsv_double =
break;
default:
abort();
}
return ((zs_property_t)p);
}
/*
* Returns true if resource is supported.
*/
{
switch (res) {
case ZS_RESOURCE_CPU:
case ZS_RESOURCE_RAM_RSS:
case ZS_RESOURCE_RAM_LOCKED:
case ZS_RESOURCE_VM:
case ZS_RESOURCE_DISK_SWAP:
case ZS_RESOURCE_SHM_MEMORY:
case ZS_RESOURCE_LWPS:
case ZS_RESOURCE_PROCESSES:
case ZS_RESOURCE_SHM_IDS:
case ZS_RESOURCE_SEM_IDS:
case ZS_RESOURCE_MSG_IDS:
case ZS_RESOURCE_LOFI:
return (B_TRUE);
default:
return (B_FALSE);
}
}
/*
* Returns true if resource supports user
*/
{
switch (res) {
case ZS_RESOURCE_CPU:
case ZS_RESOURCE_RAM_RSS:
case ZS_RESOURCE_RAM_LOCKED:
case ZS_RESOURCE_VM:
case ZS_RESOURCE_SHM_MEMORY:
case ZS_RESOURCE_LWPS:
case ZS_RESOURCE_PROCESSES:
case ZS_RESOURCE_SHM_IDS:
case ZS_RESOURCE_SEM_IDS:
case ZS_RESOURCE_MSG_IDS:
case ZS_RESOURCE_LOFI:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_SYSTEM:
case ZS_USER_ZONES:
case ZS_USER_FREE:
return (B_TRUE);
default:
return (B_FALSE);
}
case ZS_RESOURCE_DISK_SWAP:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_FREE:
return (B_TRUE);
default:
return (B_FALSE);
}
default:
return (B_FALSE);
}
}
/*
* Returns one of ZS_RESOURCE_TYPE_* on success. Asserts on invalid
* resource.
*/
{
switch (res) {
case ZS_RESOURCE_CPU:
return (ZS_RESOURCE_TYPE_TIME);
/* NOTREACHED */
break;
case ZS_RESOURCE_RAM_RSS:
case ZS_RESOURCE_RAM_LOCKED:
case ZS_RESOURCE_VM:
case ZS_RESOURCE_DISK_SWAP:
case ZS_RESOURCE_SHM_MEMORY:
return (ZS_RESOURCE_TYPE_BYTES);
/* NOTREACHED */
break;
case ZS_RESOURCE_LWPS:
case ZS_RESOURCE_PROCESSES:
case ZS_RESOURCE_SHM_IDS:
case ZS_RESOURCE_SEM_IDS:
case ZS_RESOURCE_MSG_IDS:
case ZS_RESOURCE_LOFI:
return (ZS_RESOURCE_TYPE_COUNT);
/* NOTREACHED */
break;
default:
abort();
}
}
/*
* Get total available resource on system
*/
{
uint64_t v;
switch (res) {
case ZS_RESOURCE_CPU:
v = zs_cpu_total_cpu(u);
break;
case ZS_RESOURCE_RAM_RSS:
v = zs_physical_memory_total(u);
break;
case ZS_RESOURCE_RAM_LOCKED:
v = zs_locked_memory_total(u);
break;
case ZS_RESOURCE_VM:
v = zs_virtual_memory_total(u);
break;
case ZS_RESOURCE_DISK_SWAP:
v = zs_disk_swap_total(u);
break;
case ZS_RESOURCE_LWPS:
v = zs_lwps_total(u);
break;
case ZS_RESOURCE_PROCESSES:
v = zs_processes_total(u);
break;
case ZS_RESOURCE_SHM_MEMORY:
v = zs_shm_total(u);
break;
case ZS_RESOURCE_SHM_IDS:
v = zs_shmids_total(u);
break;
case ZS_RESOURCE_SEM_IDS:
v = zs_semids_total(u);
break;
case ZS_RESOURCE_MSG_IDS:
v = zs_msgids_total(u);
break;
case ZS_RESOURCE_LOFI:
v = zs_lofi_total(u);
break;
case ZS_RESOURCE_NET_SPEED:
v = zs_net_total(u);
break;
default:
abort();
}
return (v);
}
/*
* Get amount of used resource.
*/
{
uint64_t v;
switch (res) {
case ZS_RESOURCE_CPU:
switch (user) {
case ZS_USER_ALL:
v = zs_cpu_usage_all_cpu(u);
break;
case ZS_USER_SYSTEM:
v = zs_cpu_usage_kernel_cpu(u);
break;
case ZS_USER_ZONES:
v = zs_cpu_usage_zones_cpu(u);
break;
case ZS_USER_FREE:
v = zs_cpu_usage_idle_cpu(u);
break;
default:
abort();
}
break;
case ZS_RESOURCE_RAM_RSS:
switch (user) {
case ZS_USER_ALL:
v = zs_physical_memory_usage_all(u);
break;
case ZS_USER_SYSTEM:
v = zs_physical_memory_usage_kernel(u);
break;
case ZS_USER_ZONES:
v = zs_physical_memory_usage_zones(u);
break;
case ZS_USER_FREE:
v = zs_physical_memory_usage_free(u);
break;
default:
abort();
}
break;
case ZS_RESOURCE_RAM_LOCKED:
switch (user) {
case ZS_USER_ALL:
v = zs_locked_memory_usage_all(u);
break;
case ZS_USER_SYSTEM:
v = zs_locked_memory_usage_kernel(u);
break;
case ZS_USER_ZONES:
v = zs_locked_memory_usage_zones(u);
break;
case ZS_USER_FREE:
v = zs_locked_memory_usage_free(u);
break;
default:
abort();
}
break;
case ZS_RESOURCE_VM:
switch (user) {
case ZS_USER_ALL:
v = zs_virtual_memory_usage_all(u);
break;
case ZS_USER_SYSTEM:
v = zs_virtual_memory_usage_kernel(u);
break;
case ZS_USER_ZONES:
v = zs_virtual_memory_usage_zones(u);
break;
case ZS_USER_FREE:
v = zs_virtual_memory_usage_free(u);
break;
default:
abort();
}
break;
case ZS_RESOURCE_DISK_SWAP:
switch (user) {
case ZS_USER_ALL:
v = zs_disk_swap_usage_all(u);
break;
case ZS_USER_FREE:
v = zs_disk_swap_usage_free(u);
break;
case ZS_USER_SYSTEM:
case ZS_USER_ZONES:
/* FALLTHROUGH */
default:
abort();
}
break;
case ZS_RESOURCE_LWPS:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_lwps_usage_all(u);
break;
case ZS_USER_FREE:
v = zs_lwps_total(u) - zs_lwps_usage_all(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_PROCESSES:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_processes_usage_all(u);
break;
case ZS_USER_FREE:
v = zs_processes_total(u) - zs_processes_usage_all(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_SHM_MEMORY:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_shm_usage_all(u);
break;
case ZS_USER_FREE:
v = zs_shm_total(u) -
zs_shm_usage_all(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_SHM_IDS:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_shmids_usage_all(u);
break;
case ZS_USER_FREE:
v = zs_shmids_total(u) - zs_shmids_usage_all(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_SEM_IDS:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_semids_usage_all(u);
break;
case ZS_USER_FREE:
v = zs_semids_total(u) - zs_semids_usage_all(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_MSG_IDS:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_msgids_usage_all(u);
break;
case ZS_USER_FREE:
v = zs_msgids_total(u) - zs_msgids_usage_all(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_LOFI:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_lofi_usage_all(u);
break;
case ZS_USER_FREE:
v = zs_lofi_total(u) - zs_lofi_usage_all(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_NET_ALL:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_net_bytes(u);
break;
case ZS_USER_SYSTEM:
case ZS_USER_FREE:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_NET_IN:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_net_rbytes(u);
break;
case ZS_USER_SYSTEM:
case ZS_USER_FREE:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_NET_OUT:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_net_obytes(u);
break;
case ZS_USER_SYSTEM:
case ZS_USER_FREE:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_NET_PHYS_ALL:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_net_pbytes(u);
break;
case ZS_USER_SYSTEM:
case ZS_USER_FREE:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_NET_PHYS_IN:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_net_prbytes(u);
break;
case ZS_USER_SYSTEM:
case ZS_USER_FREE:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_NET_PHYS_OUT:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_net_pobytes(u);
break;
case ZS_USER_SYSTEM:
case ZS_USER_FREE:
v = 0;
break;
default:
abort();
}
break;
default:
abort();
}
return (v);
}
/*
* Get used resource as a percent of total resource.
*/
{
uint64_t v;
switch (res) {
case ZS_RESOURCE_CPU:
switch (user) {
case ZS_USER_ALL:
v = zs_cpu_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
v = zs_cpu_usage_kernel_pct(u);
break;
case ZS_USER_ZONES:
v = zs_cpu_usage_zones_pct(u);
break;
case ZS_USER_FREE:
v = zs_cpu_usage_idle_pct(u);
break;
default:
abort();
}
break;
case ZS_RESOURCE_RAM_RSS:
switch (user) {
case ZS_USER_ALL:
v = zs_physical_memory_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
break;
case ZS_USER_ZONES:
break;
case ZS_USER_FREE:
break;
default:
abort();
}
break;
case ZS_RESOURCE_RAM_LOCKED:
switch (user) {
case ZS_USER_ALL:
v = zs_locked_memory_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
break;
case ZS_USER_ZONES:
v = zs_locked_memory_usage_zones_pct(u);
break;
case ZS_USER_FREE:
v = zs_locked_memory_usage_free_pct(u);
break;
default:
abort();
}
break;
case ZS_RESOURCE_VM:
switch (user) {
case ZS_USER_ALL:
v = zs_virtual_memory_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
break;
case ZS_USER_ZONES:
break;
case ZS_USER_FREE:
v = zs_virtual_memory_usage_free_pct(u);
break;
default:
abort();
}
break;
case ZS_RESOURCE_DISK_SWAP:
switch (user) {
case ZS_USER_ALL:
v = zs_disk_swap_usage_all_pct(u);
break;
case ZS_USER_FREE:
v = zs_disk_swap_usage_free_pct(u);
break;
case ZS_USER_SYSTEM:
case ZS_USER_ZONES:
/* FALLTHROUGH */
default:
abort();
}
break;
case ZS_RESOURCE_LWPS:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_lwps_usage_all_pct(u);
break;
case ZS_USER_FREE:
v = ZSD_PCT_INT - zs_lwps_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_PROCESSES:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_processes_usage_all_pct(u);
break;
case ZS_USER_FREE:
v = ZSD_PCT_INT - zs_processes_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_SHM_MEMORY:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_shm_usage_all_pct(u);
break;
case ZS_USER_FREE:
v = ZSD_PCT_INT - zs_shm_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_SHM_IDS:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_shmids_usage_all_pct(u);
break;
case ZS_USER_FREE:
v = ZSD_PCT_INT - zs_shmids_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_SEM_IDS:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_semids_usage_all_pct(u);
break;
case ZS_USER_FREE:
v = ZSD_PCT_INT - zs_semids_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_MSG_IDS:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_msgids_usage_all_pct(u);
break;
case ZS_USER_FREE:
v = ZSD_PCT_INT - zs_msgids_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_LOFI:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_lofi_usage_all_pct(u);
break;
case ZS_USER_FREE:
v = ZSD_PCT_INT - zs_lofi_usage_all_pct(u);
break;
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
case ZS_RESOURCE_NET_PHYS_ALL:
switch (user) {
case ZS_USER_ALL:
case ZS_USER_ZONES:
v = zs_pbytes_usage_all_pct(u);
break;
case ZS_USER_FREE:
case ZS_USER_SYSTEM:
v = 0;
break;
default:
abort();
}
break;
default:
abort();
}
return (v);
}
/*
* Get resource used by individual zone.
*/
{
uint64_t v;
switch (res) {
case ZS_RESOURCE_CPU:
v = zs_cpu_usage_zone_cpu(z);
break;
case ZS_RESOURCE_RAM_RSS:
v = zs_physical_memory_usage_zone(z);
break;
case ZS_RESOURCE_RAM_LOCKED:
v = zs_locked_memory_usage_zone(z);
break;
case ZS_RESOURCE_VM:
v = zs_virtual_memory_usage_zone(z);
break;
case ZS_RESOURCE_DISK_SWAP:
abort();
break;
case ZS_RESOURCE_LWPS:
v = zs_lwps_usage_zone(z);
break;
case ZS_RESOURCE_PROCESSES:
v = zs_processes_usage_zone(z);
break;
case ZS_RESOURCE_SHM_MEMORY:
v = zs_shm_usage_zone(z);
break;
case ZS_RESOURCE_SHM_IDS:
v = zs_shmids_usage_zone(z);
break;
case ZS_RESOURCE_SEM_IDS:
v = zs_semids_usage_zone(z);
break;
case ZS_RESOURCE_MSG_IDS:
v = zs_msgids_usage_zone(z);
break;
case ZS_RESOURCE_LOFI:
v = zs_lofi_usage_zone(z);
break;
case ZS_RESOURCE_NET_PHYS_ALL:
v = zs_pbytes_usage_zone(z);
break;
default:
abort();
}
return (v);
}
/*
* Get resource used by individual zone as percent
*/
{
uint_t v;
switch (res) {
case ZS_RESOURCE_CPU:
v = zs_cpu_usage_zone_pct(z);
break;
case ZS_RESOURCE_RAM_RSS:
break;
case ZS_RESOURCE_RAM_LOCKED:
v = zs_locked_memory_usage_zone_pct(z);
break;
case ZS_RESOURCE_VM:
v = zs_virtual_memory_usage_zone_pct(z);
break;
case ZS_RESOURCE_DISK_SWAP:
abort();
break;
case ZS_RESOURCE_LWPS:
v = zs_lwps_usage_zone_pct(z);
break;
case ZS_RESOURCE_PROCESSES:
v = zs_processes_usage_zone_pct(z);
break;
case ZS_RESOURCE_SHM_MEMORY:
v = zs_shm_usage_zone_pct(z);
break;
case ZS_RESOURCE_SHM_IDS:
v = zs_shmids_usage_zone_pct(z);
break;
case ZS_RESOURCE_SEM_IDS:
v = zs_semids_usage_zone_pct(z);
break;
case ZS_RESOURCE_MSG_IDS:
v = zs_msgids_usage_zone_pct(z);
break;
case ZS_RESOURCE_LOFI:
v = zs_lofi_usage_zone_pct(z);
break;
case ZS_RESOURCE_NET_PHYS_ALL:
v = zs_pbytes_usage_zone_pct(z);
break;
default:
abort();
}
return (v);
}
/*
* Get total time available for a resource
*/
void
{
switch (res) {
case ZS_RESOURCE_CPU:
zs_cpu_total_time(u, t);
break;
case ZS_RESOURCE_RAM_RSS:
case ZS_RESOURCE_RAM_LOCKED:
case ZS_RESOURCE_VM:
case ZS_RESOURCE_DISK_SWAP:
case ZS_RESOURCE_LWPS:
case ZS_RESOURCE_PROCESSES:
case ZS_RESOURCE_SHM_MEMORY:
case ZS_RESOURCE_SHM_IDS:
case ZS_RESOURCE_SEM_IDS:
case ZS_RESOURCE_MSG_IDS:
case ZS_RESOURCE_LOFI:
/* FALLTHROUGH */
default:
abort();
}
}
/*
* Get total time used for a resource
*/
void
timestruc_t *t)
{
switch (res) {
case ZS_RESOURCE_CPU:
switch (user) {
case ZS_USER_ALL:
zs_cpu_usage_all(u, t);
break;
case ZS_USER_SYSTEM:
zs_cpu_usage_kernel(u, t);
break;
case ZS_USER_ZONES:
zs_cpu_usage_zones(u, t);
break;
case ZS_USER_FREE:
zs_cpu_usage_idle(u, t);
break;
default:
abort();
}
break;
case ZS_RESOURCE_RAM_RSS:
case ZS_RESOURCE_RAM_LOCKED:
case ZS_RESOURCE_VM:
case ZS_RESOURCE_DISK_SWAP:
case ZS_RESOURCE_LWPS:
case ZS_RESOURCE_PROCESSES:
case ZS_RESOURCE_SHM_MEMORY:
case ZS_RESOURCE_SHM_IDS:
case ZS_RESOURCE_SEM_IDS:
case ZS_RESOURCE_MSG_IDS:
case ZS_RESOURCE_LOFI:
/* FALLTHROUGH */
default:
abort();
}
}
/*
* Get total resource time used for a particular zone
*/
void
{
switch (res) {
case ZS_RESOURCE_CPU:
zs_cpu_usage_zone(z, t);
break;
case ZS_RESOURCE_RAM_RSS:
case ZS_RESOURCE_RAM_LOCKED:
case ZS_RESOURCE_VM:
case ZS_RESOURCE_DISK_SWAP:
case ZS_RESOURCE_SHM_MEMORY:
case ZS_RESOURCE_LWPS:
case ZS_RESOURCE_PROCESSES:
case ZS_RESOURCE_SHM_IDS:
case ZS_RESOURCE_SEM_IDS:
case ZS_RESOURCE_MSG_IDS:
case ZS_RESOURCE_LOFI:
/* FALLTHROUGH */
default:
abort();
}
}
int
{
int i = 0;
/* copy what fits of the zone list into the buffer */
/* put the global zone at the first position */
if (i < num) {
} else {
}
}
i++;
}
return (i);
}
{
}
/*
* Test if zone property is supported.
*/
{
switch (prop) {
case ZS_ZONE_PROP_NAME:
case ZS_ZONE_PROP_ID:
case ZS_ZONE_PROP_IPTYPE:
case ZS_ZONE_PROP_CPUTYPE:
case ZS_ZONE_PROP_SCHEDULERS:
case ZS_ZONE_PROP_CPU_SHARES:
case ZS_ZONE_PROP_POOLNAME:
case ZS_ZONE_PROP_PSETNAME:
return (B_TRUE);
default:
return (B_FALSE);
}
}
/*
* Gets a zone property
*/
{
struct zs_property *p;
switch (prop) {
case ZS_ZONE_PROP_NAME:
p = &zone->zsz_prop_name;
p->zsp_type = DATA_TYPE_STRING;
break;
case ZS_ZONE_PROP_ID:
p = &zone->zsz_prop_id;
p->zsp_type = DATA_TYPE_INT32;
break;
case ZS_ZONE_PROP_IPTYPE:
p = &zone->zsz_prop_iptype;
p->zsp_type = DATA_TYPE_UINT32;
break;
case ZS_ZONE_PROP_CPUTYPE:
p = &zone->zsz_prop_cputype;
p->zsp_type = DATA_TYPE_UINT32;
break;
case ZS_ZONE_PROP_SCHEDULERS:
p = &zone->zsz_prop_schedulers;
p->zsp_type = DATA_TYPE_UINT32;
break;
case ZS_ZONE_PROP_CPU_SHARES:
p = &zone->zsz_prop_cpushares;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_ZONE_PROP_POOLNAME:
p = &zone->zsz_prop_poolname;
p->zsp_type = DATA_TYPE_STRING;
break;
case ZS_ZONE_PROP_PSETNAME:
p = &zone->zsz_prop_psetname;
p->zsp_type = DATA_TYPE_STRING;
break;
p = &zone->zsz_prop_defsched;
p->zsp_type = DATA_TYPE_UINT32;
break;
default:
abort();
}
return ((zs_property_t)p);
}
{
switch (limit) {
case ZS_LIMIT_CPU:
case ZS_LIMIT_CPU_SHARES:
case ZS_LIMIT_RAM_RSS:
case ZS_LIMIT_RAM_LOCKED:
case ZS_LIMIT_VM:
case ZS_LIMIT_SHM_MEMORY:
case ZS_LIMIT_LWPS:
case ZS_LIMIT_PROCESSES:
case ZS_LIMIT_SHM_IDS:
case ZS_LIMIT_MSG_IDS:
case ZS_LIMIT_SEM_IDS:
case ZS_LIMIT_LOFI:
return (B_TRUE);
default:
return (B_FALSE);
}
}
{
switch (limit) {
case ZS_LIMIT_CPU:
case ZS_LIMIT_CPU_SHARES:
return (ZS_LIMIT_TYPE_TIME);
case ZS_LIMIT_RAM_RSS:
case ZS_LIMIT_RAM_LOCKED:
case ZS_LIMIT_VM:
case ZS_LIMIT_SHM_MEMORY:
return (ZS_LIMIT_TYPE_BYTES);
case ZS_LIMIT_LWPS:
case ZS_LIMIT_PROCESSES:
case ZS_LIMIT_SHM_IDS:
case ZS_LIMIT_MSG_IDS:
case ZS_LIMIT_SEM_IDS:
case ZS_LIMIT_LOFI:
return (ZS_LIMIT_TYPE_COUNT);
default:
abort();
}
}
/*
* Gets the zones limit. Returns ZS_LIMIT_NONE if no limit set.
*/
{
uint64_t v;
switch (limit) {
case ZS_LIMIT_CPU:
v = zs_zone_cpu_cap(z);
break;
case ZS_LIMIT_CPU_SHARES:
v = zs_zone_cpu_shares(z);
break;
case ZS_LIMIT_RAM_RSS:
v = zs_zone_physical_memory_cap(z);
break;
case ZS_LIMIT_RAM_LOCKED:
v = zs_zone_locked_memory_cap(z);
break;
case ZS_LIMIT_VM:
v = zs_zone_virtual_memory_cap(z);
break;
case ZS_LIMIT_LWPS:
v = z->zsz_lwps_cap;
break;
case ZS_LIMIT_PROCESSES:
v = z->zsz_processes_cap;
break;
case ZS_LIMIT_SHM_MEMORY:
v = z->zsz_shm_cap;
break;
case ZS_LIMIT_SHM_IDS:
v = z->zsz_shmids_cap;
break;
case ZS_LIMIT_SEM_IDS:
v = z->zsz_semids_cap;
break;
case ZS_LIMIT_MSG_IDS:
v = z->zsz_msgids_cap;
break;
case ZS_LIMIT_LOFI:
v = z->zsz_lofi_cap;
break;
default:
abort();
}
return (v);
}
/*
* Gets the amount of resource used for a limit. Returns ZS_LIMIT_NONE if
* no limit configured.
*/
{
uint64_t v;
switch (limit) {
case ZS_LIMIT_CPU:
v = zs_zone_cpu_cap_used(z);
break;
case ZS_LIMIT_CPU_SHARES:
v = zs_zone_cpu_shares_used(z);
break;
case ZS_LIMIT_RAM_RSS:
v = zs_zone_physical_memory_cap_used(z);
break;
case ZS_LIMIT_RAM_LOCKED:
v = zs_zone_locked_memory_cap_used(z);
break;
case ZS_LIMIT_VM:
v = zs_zone_virtual_memory_cap_used(z);
break;
case ZS_LIMIT_LWPS:
v = z->zsz_lwps;
break;
case ZS_LIMIT_PROCESSES:
v = z->zsz_processes;
break;
case ZS_LIMIT_SHM_MEMORY:
v = z->zsz_shm;
break;
case ZS_LIMIT_SHM_IDS:
v = z->zsz_shmids;
break;
case ZS_LIMIT_SEM_IDS:
v = z->zsz_semids;
break;
case ZS_LIMIT_MSG_IDS:
v = z->zsz_msgids;
break;
case ZS_LIMIT_LOFI:
v = z->zsz_lofi;
break;
default:
abort();
}
return (v);
}
/*
* Gets time used under limit. Time is zero if no limit is configured
*/
void
{
switch (limit) {
case ZS_LIMIT_CPU:
if (z->zsz_cpu_cap == ZS_LIMIT_NONE) {
v->tv_sec = 0;
v->tv_nsec = 0;
break;
}
zs_zone_cpu_cap_time(z, v);
break;
case ZS_LIMIT_CPU_SHARES:
if (z->zsz_cpu_shares == ZS_LIMIT_NONE ||
z->zsz_cpu_shares == ZS_SHARES_UNLIMITED ||
z->zsz_cpu_shares == 0 ||
(z->zsz_scheds & ZS_SCHED_FSS) == 0) {
v->tv_sec = 0;
v->tv_nsec = 0;
break;
}
zs_zone_cpu_share_time(z, v);
break;
case ZS_LIMIT_RAM_RSS:
case ZS_LIMIT_RAM_LOCKED:
case ZS_LIMIT_VM:
case ZS_LIMIT_SHM_MEMORY:
case ZS_LIMIT_LWPS:
case ZS_LIMIT_PROCESSES:
case ZS_LIMIT_SHM_IDS:
case ZS_LIMIT_MSG_IDS:
case ZS_LIMIT_SEM_IDS:
case ZS_LIMIT_LOFI:
/* FALLTHROUGH */
default:
abort();
}
}
/*
* Errno is set on error:
*
* EINVAL: No such property
* ENOENT: No time value for the specified limit.
* ESRCH: No limit is configured.
*
* If no limit is configured, the value will be ZS_PCT_NONE
*/
void
{
switch (limit) {
case ZS_LIMIT_CPU:
if (z->zsz_cpu_cap == ZS_LIMIT_NONE) {
t->tv_sec = 0;
t->tv_nsec = 0;
break;
}
zs_zone_cpu_cap_time_used(z, t);
break;
case ZS_LIMIT_CPU_SHARES:
if (z->zsz_cpu_shares == ZS_LIMIT_NONE ||
z->zsz_cpu_shares == ZS_SHARES_UNLIMITED ||
z->zsz_cpu_shares == 0 ||
(z->zsz_scheds & ZS_SCHED_FSS) == 0) {
t->tv_sec = 0;
t->tv_nsec = 0;
break;
}
zs_zone_cpu_share_time_used(z, t);
break;
case ZS_LIMIT_RAM_RSS:
case ZS_LIMIT_RAM_LOCKED:
case ZS_LIMIT_VM:
case ZS_LIMIT_SHM_MEMORY:
case ZS_LIMIT_LWPS:
case ZS_LIMIT_PROCESSES:
case ZS_LIMIT_SHM_IDS:
case ZS_LIMIT_MSG_IDS:
case ZS_LIMIT_SEM_IDS:
case ZS_LIMIT_LOFI:
/* FALLTHROUGH */
default:
abort();
}
}
/*
* Get a zones usage as a percent of the limit. Return ZS_PCT_NONE if
* no limit is configured.
*/
{
uint_t v;
switch (limit) {
case ZS_LIMIT_CPU:
v = zs_zone_cpu_cap_pct(z);
break;
case ZS_LIMIT_CPU_SHARES:
v = zs_zone_cpu_shares_pct(z);
break;
case ZS_LIMIT_RAM_RSS:
v = zs_zone_physical_memory_cap_pct(z);
break;
case ZS_LIMIT_RAM_LOCKED:
v = zs_zone_locked_memory_cap_pct(z);
break;
case ZS_LIMIT_VM:
v = zs_zone_virtual_memory_cap_pct(z);
break;
case ZS_LIMIT_LWPS:
v = zs_lwps_zone_cap_pct(z);
break;
case ZS_LIMIT_PROCESSES:
v = zs_processes_zone_cap_pct(z);
break;
case ZS_LIMIT_SHM_MEMORY:
v = zs_shm_zone_cap_pct(z);
break;
case ZS_LIMIT_SHM_IDS:
v = zs_shmids_zone_cap_pct(z);
break;
case ZS_LIMIT_SEM_IDS:
v = zs_semids_zone_cap_pct(z);
break;
case ZS_LIMIT_MSG_IDS:
v = zs_msgids_zone_cap_pct(z);
break;
case ZS_LIMIT_LOFI:
v = zs_lofi_zone_cap_pct(z);
break;
default:
abort();
}
return (v);
}
int
{
int i = 0;
/* copy what fits of the pset list into the buffer */
/* put the default pset at the first position */
if (i < num) {
} else {
}
}
i++;
}
return (i);
}
{
}
/*
* Test if pset property is supported
*/
{
switch (prop) {
case ZS_PSET_PROP_NAME:
case ZS_PSET_PROP_ID:
case ZS_PSET_PROP_CPUTYPE:
case ZS_PSET_PROP_SIZE:
case ZS_PSET_PROP_ONLINE:
case ZS_PSET_PROP_MIN:
case ZS_PSET_PROP_MAX:
case ZS_PSET_PROP_CPU_SHARES:
case ZS_PSET_PROP_SCHEDULERS:
case ZS_PSET_PROP_LOAD_1MIN:
case ZS_PSET_PROP_LOAD_5MIN:
case ZS_PSET_PROP_LOAD_15MIN:
return (B_TRUE);
default:
return (B_FALSE);
}
}
/*
* Test if psets support usage for the given user
*/
{
switch (user) {
case ZS_USER_ALL:
case ZS_USER_SYSTEM:
case ZS_USER_ZONES:
case ZS_USER_FREE:
return (B_TRUE);
default:
return (B_FALSE);
}
}
/*
* Get various properties on a pset.
*/
{
struct zs_property *p;
switch (prop) {
case ZS_PSET_PROP_NAME:
p = &pset->zsp_prop_name;
p->zsp_type = DATA_TYPE_STRING;
break;
case ZS_PSET_PROP_ID:
p = &pset->zsp_prop_id;
p->zsp_type = DATA_TYPE_INT32;
break;
case ZS_PSET_PROP_CPUTYPE:
p = &pset->zsp_prop_cputype;
p->zsp_type = DATA_TYPE_UINT32;
break;
case ZS_PSET_PROP_SIZE:
p = &pset->zsp_prop_size;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_PSET_PROP_ONLINE:
p = &pset->zsp_prop_online;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_PSET_PROP_MIN:
p = &pset->zsp_prop_min;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_PSET_PROP_MAX:
p = &pset->zsp_prop_max;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_PSET_PROP_CPU_SHARES:
p = &pset->zsp_prop_cpushares;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_PSET_PROP_SCHEDULERS:
p = &pset->zsp_prop_schedulers;
p->zsp_type = DATA_TYPE_UINT32;
break;
case ZS_PSET_PROP_LOAD_1MIN:
p = &pset->zsp_prop_1min;
p->zsp_type = DATA_TYPE_DOUBLE;
break;
case ZS_PSET_PROP_LOAD_5MIN:
p = &pset->zsp_prop_5min;
p->zsp_type = DATA_TYPE_DOUBLE;
break;
case ZS_PSET_PROP_LOAD_15MIN:
p = &pset->zsp_prop_15min;
p->zsp_type = DATA_TYPE_DOUBLE;
break;
default:
abort();
}
return ((zs_property_t)p);
}
void
{
*t = pset->zsp_total_time;
}
{
}
/*
* Get total time used for pset
*/
void
{
switch (user) {
case ZS_USER_ALL:
zs_pset_usage_all(pset, t);
break;
case ZS_USER_SYSTEM:
zs_pset_usage_kernel(pset, t);
break;
case ZS_USER_ZONES:
zs_pset_usage_zones(pset, t);
break;
case ZS_USER_FREE:
zs_pset_usage_idle(pset, t);
break;
default:
abort();
}
}
/*
* Get cpus used for pset
*/
{
uint_t v;
switch (user) {
case ZS_USER_ALL:
v = zs_pset_usage_all_cpus(pset);
break;
case ZS_USER_SYSTEM:
break;
case ZS_USER_ZONES:
v = zs_pset_usage_zones_cpus(pset);
break;
case ZS_USER_FREE:
v = zs_pset_usage_idle_cpus(pset);
break;
default:
abort();
}
return (v);
}
/*
* Get percent of pset cpu time used
*/
{
uint_t v;
switch (user) {
case ZS_USER_ALL:
v = zs_pset_usage_all_pct(pset);
break;
case ZS_USER_SYSTEM:
v = zs_pset_usage_kernel_pct(pset);
break;
case ZS_USER_ZONES:
v = zs_pset_usage_zones_pct(pset);
break;
case ZS_USER_FREE:
v = zs_pset_usage_idle_pct(pset);
break;
default:
abort();
}
return (v);
}
int
{
int i = 0;
/* copy what fits of the pset's zone list into the buffer */
/* put the global zone at the first position */
if (i < num) {
} else {
}
}
i++;
}
return (i);
}
{
}
{
}
{
}
/*
* Test if property is supported.
*/
{
switch (prop) {
case ZS_PZ_PROP_CPU_CAP:
case ZS_PZ_PROP_CPU_SHARES:
case ZS_PZ_PROP_SCHEDULERS:
return (B_TRUE);
default:
return (B_FALSE);
}
}
/*
* Get a property describing a zone's usage of a pset
*/
{
struct zs_property *p;
switch (prop) {
case ZS_PZ_PROP_CPU_CAP:
p = &pz->zspz_prop_cpucap;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_PZ_PROP_CPU_SHARES:
p = &pz->zspz_prop_cpushares;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_PZ_PROP_SCHEDULERS:
p = &pz->zspz_prop_schedulers;
p->zsp_type = DATA_TYPE_UINT32;
break;
default:
abort();
}
return ((zs_property_t)p);
}
void
{
}
{
return (zs_pset_zone_usage_cpus(pz));
}
/*
* Test if percent for a pset_zone is supported
*/
{
switch (pct) {
case ZS_PZ_PCT_PSET:
case ZS_PZ_PCT_CPU_CAP:
case ZS_PZ_PCT_PSET_SHARES:
case ZS_PZ_PCT_CPU_SHARES:
return (B_TRUE);
default:
return (B_FALSE);
}
}
/*
* Get percent of a psets cpus used by a zone
*/
{
uint_t v;
switch (pct) {
case ZS_PZ_PCT_PSET:
break;
case ZS_PZ_PCT_CPU_CAP:
break;
case ZS_PZ_PCT_PSET_SHARES:
break;
case ZS_PZ_PCT_CPU_SHARES:
break;
default:
abort();
}
return (v);
}
{
return (p->zsp_type);
}
char *
{
return (p->zsp_v.zsv_string);
}
double
{
return (p->zsp_v.zsv_double);
}
{
return (p->zsp_v.zsv_uint64);
}
{
}
{
}
int
{
}
int
{
int i = 0;
/* copy what fits of the datalink list into the buffer */
if (i < num)
i++;
}
return (i);
}
int
{
int i = 0;
/* copy what fits of the client list into the buffer */
if (i < num)
i++;
}
return (i);
}
int
int num)
{
int i = 0;
/* copy what fits of the client list into the buffer */
if (i < num)
i++;
}
return (i);
}
char *
{
return (link->zsl_linkname);
}
char *
{
return (link->zsl_devname);
}
char *
{
return (link->zsl_zonename);
}
static uint64_t
{
}
char *
{
}
static int
{
}
static uint64_t
{
}
static uint64_t
{
return (link->zsl_rbytes);
}
static uint64_t
{
return (link->zsl_obytes);
}
static uint64_t
{
return (link->zsl_prbytes);
}
static uint64_t
{
return (link->zsl_pobytes);
}
static uint64_t
{
}
static uint64_t
{
return (link->zsl_total_rbytes);
}
static uint64_t
{
return (link->zsl_total_obytes);
}
static uint64_t
{
return (link->zsl_total_prbytes);
}
static uint64_t
{
return (link->zsl_total_pobytes);
}
/*
* Get a datalink property
*/
{
struct zs_property *p;
switch (prop) {
case ZS_LINK_PROP_NAME:
p = &link->zsl_prop_linkname;
p->zsp_type = DATA_TYPE_STRING;
break;
case ZS_LINK_PROP_DEVNAME:
p = &link->zsl_prop_devname;
p->zsp_type = DATA_TYPE_STRING;
break;
case ZS_LINK_PROP_ZONENAME:
p = &link->zsl_prop_zonename;
p->zsp_type = DATA_TYPE_STRING;
break;
case ZS_LINK_PROP_SPEED:
p = &link->zsl_prop_speed;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_PROP_STATE:
p = &link->zsl_prop_state;
p->zsp_type = DATA_TYPE_STRING;
break;
case ZS_LINK_PROP_CLASS:
p = &link->zsl_prop_class;
p->zsp_type = DATA_TYPE_UINT32;
break;
case ZS_LINK_PROP_RBYTE:
p = &link->zsl_prop_rbytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_PROP_OBYTE:
p = &link->zsl_prop_obytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_PROP_PRBYTES:
p = &link->zsl_prop_prbytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_PROP_POBYTES:
p = &link->zsl_prop_pobytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_PROP_TOT_BYTES:
p = &link->zsl_prop_tot_bytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_PROP_TOT_RBYTES:
p = &link->zsl_prop_tot_rbytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_PROP_TOT_OBYTES:
p = &link->zsl_prop_tot_obytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_PROP_TOT_PRBYTES:
p = &link->zsl_prop_tot_prbytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_PROP_TOT_POBYTES:
p = &link->zsl_prop_tot_pobytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_PROP_MAXBW:
p = &link->zsl_prop_maxbw;
p->zsp_type = DATA_TYPE_UINT64;
break;
default:
abort();
}
return ((zs_property_t)p);
}
char *
{
}
static uint64_t
{
return (link_zone->zlz_total_bytes);
}
static uint64_t
{
return (link_zone->zlz_total_rbytes);
}
static uint64_t
{
return (link_zone->zlz_total_obytes);
}
static uint64_t
{
return (link_zone->zlz_total_prbytes);
}
static uint64_t
{
return (link_zone->zlz_total_pobytes);
}
static uint64_t
{
return (link_zone->zlz_total_bw);
}
static uint64_t
{
return (link_zone->zlz_partial_bw);
}
/*
* Get property of a zone under a datalink
*/
{
struct zs_property *p;
switch (prop) {
case ZS_LINK_ZONE_PROP_NAME:
p = &link_zone->zlz_prop_name;
p->zsp_type = DATA_TYPE_STRING;
break;
case ZS_LINK_ZONE_PROP_BYTES:
p = &link_zone->zlz_prop_bytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_ZONE_PROP_RBYTES:
p = &link_zone->zlz_prop_rbytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_ZONE_PROP_OBYTES:
p = &link_zone->zlz_prop_obytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
p = &link_zone->zlz_prop_prbytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
p = &link_zone->zlz_prop_pobytes;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_ZONE_PROP_MAXBW:
p = &link_zone->zlz_prop_bw;
p->zsp_type = DATA_TYPE_UINT64;
break;
case ZS_LINK_ZONE_PROP_PARTBW:
p = &link_zone->zlz_prop_partbw;
p->zsp_type = DATA_TYPE_UINT32;
break;
default:
abort();
}
return ((zs_property_t)p);
}