cc [ flag... ] file... -lv12n [ library... ] #include <libv12n.h>
v12n_env_t * v12n_get_current_env(void);
v12n_env_t * v12n_get_parent_env(void);
char * v12n_get_env_prop(v12n_env_t *environment, v12n_prop_t property);
v12n_env_t ** v12n_list_supported_envs(void);
v12n_env_t ** v12n_list_envs(void);
v12n_env_t ** v12n_list_env_props(v12n_env_t *environment );
const char *v12n_get_prop_name(v12n_prop_t property);
void v12n_free_env(v12n_env_t *environment)
v12n_env_t * v12n_copy_env(v12n_env_t *environment )
v12n_env_t is an opaque type. The supported functions, return values, and errors are described below:
Returns the current environment. See below for the list of possible environment names.
Returns the parent environment. Currently, the parent environment can only be detected from a non-global zone. See below for the list of possible environment names.
Returns a string representation of a requested property for a given environment. The returned string must be freed by the caller.
Fills out a NULL-terminated array with all supported environments. The array and its contents must be freed by the caller. NULL is returned on error.
Fills out a NULL-terminated array with all known environments. The array and its contents must be freed by the caller. NULL is returned on error.
Fills out a NULL-terminated array with all known property types for the given environment. The array must be freed by the caller. NULL is returned on error.
Returns a string representation of a virtual environment property.
Frees the storage associated with an v12n_env_t.
Copies the supplied v12n_env_t. A new v12n_env_t is returned.
libv12n knows about the following environments. As some are SPARC or x86 specific, they may not be available on both platforms.
|
libv12n knows about the following properties. Properties depend both on the class as well as the name of the environment.
|
int v12n_capabilities();
int v12n_domain_roles();
int v12n_domain_uuid(uuid_t uuid);
size_t v12n_domain_name(char *buf, size_t buflen);
size_t v12n_ctrl_domain(char *buf, size_t buflen);
size_t v12n_chassis_serialno(char *buf, size_t buflen);
The v12n_capabilities() function returns the virtualization capabilities mask of the current domain. The virtualization capabilities bit mask consists of the following values:
|
The v12n_domain_roles() function returns the virtualization domain role mask. The virtualization domain role mask consists of the following values:
|
The v12n_domain_uuid() function stores the universally unique identifier (UUID) for the current virtualization domain in the uuid argument. See the libuuid(3LIB) manual page.
The v12n_domain_name() function stores the name of the current virtualization domain in the location specified by buf. buflen specifies the size in bytes of the buffer. If the buffer is too small to hold the complete null-terminated name, the first buflen bytes of the name are stored in the buffer. A buffer of size V12N_NAME_MAX is sufficient to hold any domain name. If buf is NULL or buflen is 0, the name is not copied into the buffer.
The v12n_ctrl_domain() function stores the control domain or dom0 network node name of the current domain in the location specified by buf. Note that a domain's control domain is volatile during a domain migration. The information returned by this function might be stale if the domain was in the process of migrating. buflen specifies the size in bytes of the buffer. If the buffer is too small to hold the complete null-terminated name, the first buflen bytes of the name are stored in the buffer. A buffer of size V12N_NAME_MAX is sufficient to hold the control domain node name string. If buf is NULL or buflen is 0, the name is not copied into the buffer.
The v12n_chassis_serialno() function stores the chassis serial number of the platform on which the current domain is running in the location specified by buf. Note that the chassis serial number is volatile during a domain migration. The information returned by this function might be stale if the domain was in the process of migrating. buflen specifies the size in bytes of the buffer. If the buffer is too small to hold the complete null-terminated name, the first buflen bytes of the name are stored in the buffer. A buffer of size V12N_NAME_MAX is sufficient to hold any chassis serial number string. If buf is NULL or buflen is 0, the name is not copied into the buffer.
On successful completion, the v12n_get_current_env(), v12n_get_parent_env() and v12n_copy_env() functions return an opaque pointer to a v12n_env_t representing an environment. Otherwise, the v12n_get_current_env() function returns NULL and sets errno to indicate the error.
On successful completion, the v12n_get_env_prop() returns a string holding the property value. the v12n_get_current_env() function returns NULL and sets errno to indicate the error.
On successful completion, the v12n_list_supported_envs(), v12n_list_envs(), and v12n_list_env_props() functions return an array. Otherwise, these functions return NULL and sets errno to indicate the error.
On successful completion, the v12n_capabilties() and v12n_domain_roles() functions return a non-negative bit mask. Otherwise, the v12n_domain_roles() function returns -1 and sets errno to indicate the error.
On successful completion, the v12n_domain_uuid() function returns 0. Otherwise, the v12n_domain_uuid() function returns -1 and sets errno to indicate the error.
On successful completion, the v12n_domain_name(), v12n_ctrl_domain(), and v12n_chassis_serialno() functions return the buffer size required to hold the full non-terminated string. Otherwise, these functions return -1 and set errno to indicate the error.
The v12n_get_current_env() and v12n_get_parent_env () functions fail if:
Insufficient memory to complete the operation.
The calling process has insufficient privilege for accessing device configuration data (x86 only).
The devinfo(7D) driver is not installed properly (x86 only).
The v12n_list_supported_envs() function will fail if:
Insufficient memory to complete the operation.
The v12n_get_env_prop() function will fail if:
The specified environment or property does not exist.
Insufficient memory to complete the operation.
For the logical domain properties:
See v12n_chassis_serialno()
See v12n_ctrl_domain()
See v12n_domain_name()
See v12n_domain_roles()
See v12n_domain_roles()
See v12n_domain_roles()
See v12n_domain_roles()
See v12n_domain_uuid()
The v12n_list_envs(), v12n_list_env_props (), and v12n_get_prop_name() functions will fail if:
Insufficient memory to complete the operation.
The specified value does not exist.
The v12n_copy_env() function will fail if:
Insufficient memory to complete the operation.
The v12n_domain_roles() function fails with EPERM when the calling process has an ID other than the privileged user.
The v12n_domain_name() function will fail if:
The calling process has an ID other than the privileged user.
Virtualization is not supported or enabled on this domain.
buf points to an illegal address.
The sun4v machine description is inaccessible or has no uuid node.
The v12n_domain_uuid() function will fail if:
The calling process has an ID other than the privileged user.
Virtualization is not supported or enabled on this domain.
buf points to an illegal address.
The sun4v machine description is inaccessible or has no uuid node.
The v12n_ctrl_domain() function will fail if:
The calling process has an ID other than the privileged user.
Virtualization is not supported or enabled on this domain.
buf points to an illegal address.
The domain service on the control domain did not respond within the timeout value.
The v12n_chassis_serialno() function will fail if:
The calling process has an ID other than the privileged user.
Virtualization is not supported or enabled on this domain.
buf points to an illegal address.
The domain service on the control domain did not respond within the timeout value.
See attributes(5) for descriptions of the following attributes:
|
virtinfo(1M) , libuuid (3LIB), libv12n(3LIB) , attributes (5)