zs_open, zs_close - open and close the zones statistics facility
cc [ flag ... ] file... -lzonestat [ libary ... ] #include <zonestat.h> zs_ctl_t zs_open();
void zs_close(zs_ctl_t zsctl);
The zs_open() function connects to the zones statistic facility and returns a zonestat control object, which can then be used to read zone utilization information.
All reads using a zonestat control object are relative to the point in time in which the object was returned by zs_open(). For example, CPU usage will be reported as usage since the zs_open() call was made.
The zs_close() function closes the connection to the zones statistics facility and frees all associated resources.
On success, zs_open() returns a pointer to a zonestat control object. On failure, zs_open() returns NULL and sets errno to indicate the error.
The zs_open() function will fail if:
There are insufficient resources available.
Opening would exceed the maximum number of file descriptors allowed for the current process.
There is insufficient memory available.
The caller does not have privilege proc_info.
Unable to connect to the zones monitoring service. See Notes below.
See attributes(5) for descriptions of the following attributes:
The zs_open() and zs_close() functions are MT-safe, with the exception that only one thread may actively use a zs_ctl_t object at any time. Synchronization is left to the application.
zonestat(1), pooladm(1M), psrset(1M), rcapadm(1M), swap(1M), zoneadm(1M), zonestatd(1M), libpool(3LIB), libzonestat(3LIB), zs_pset(3ZONESTAT), zs_property(3ZONESTAT), zs_pset_zone(3ZONESTAT), zs_resource(3ZONESTAT), zs_usage(3ZONESTAT), zs_zone(3ZONESTAT), attributes(5), resource-controls(5)
The service svc:/system/zones-monitoring:default must be enabled in the global zone in order for zs_open() to succeed. This requirement exists for use of libzonestat in both the global zone and non-global zones.