4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
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.
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]
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
33 #include <libzonecfg.h>
37 extern boolean_t gz_capped
;
39 /* round up to next y = 2^n */
40 #define ROUNDUP(x, y) (((x) + ((y) - 1)) & ~((y) - 1))
43 update_zone(zone_entry_t
*zent
, void *walk_data
)
45 void(*update_notification_cb
)(char *, char *, int, uint64_t, int) =
46 (void(*)(char *, char *, int, uint64_t, int))walk_data
;
53 if (zone_getattr(zent
->zid
, ZONE_ATTR_PHYS_MCAP
, &mcap
,
54 sizeof (mcap
)) != -1 && mcap
!= 0)
55 max_rss
= ROUNDUP(mcap
, 1024) / 1024;
59 if (zent
->zid
== GLOBAL_ZONEID
) {
67 colid
.rcid_type
= RCIDT_ZONE
;
68 colid
.rcid_val
= zent
->zid
;
70 lcol
= lcollection_insert_update(&colid
, max_rss
, zent
->zname
,
72 if (update_notification_cb
!= NULL
)
73 update_notification_cb("zone", zent
->zname
, changes
, max_rss
,
74 (lcol
!= NULL
) ? lcol
->lcol_mark
: 0);
80 lcollection_update_zone(lcollection_update_type_t ut
,
81 void(*update_notification_cb
)(char *, char *, int, uint64_t, int))
88 * Enumerate running zones.
90 if (get_running_zones(&nzents
, &zents
) != 0)
93 for (i
= 0; i
< nzents
; i
++) {
94 update_zone(&zents
[i
], (void *)update_notification_cb
);