man pages section 3: Extended Library Functions, Volume 4

Exit Print View

Updated: July 2014
 
 

zs_close(3ZONESTAT)

Name

zs_open, zs_close - open and close the zones statistics facility

Synopsis

cc [ flag ... ] file... -lzonestat [ libary ... ]
#include <zonestat.h>

zs_ctl_t zs_open();
void zs_close(zs_ctl_t zsctl);

Description

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.

Return Values

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.

Errors

The zs_open() function will fail if:

EAGAIN

There are insufficient resources available.

EMFILE

Opening would exceed the maximum number of file descriptors allowed for the current process.

ENOMEM

There is insufficient memory available.

EPERM

The caller does not have privilege proc_info.

ESRCH

Unable to connect to the zones monitoring service. See Notes below.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
See below.

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.

See also

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)

Notes

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.