Description

v12n_env_t is an opaque type. The supported
functions, return values, and errors are described below:

v12n_get_current_env()

Returns the current environment. See below for the
list of possible environment names.

v12n_get_parent_env()

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.

v12n_get_env_prop()

Returns a string representation of a requested property
for a given environment. The returned string must be freed by the
caller.

v12n_list_supported_envs()

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.

v12n_list_envs()

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.

v12n_list_env_props()

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.

v12n_get_prop_name()

Returns a string representation of a virtual environment
property.

v12n_free_env()

Frees the storage associated with an v12n_env_t.

v12n_copy_env()

Copies the supplied v12n_env_t.
A new v12n_env_t is returned.

Environments

Environments

libv12n knows about the following environments.
As some are SPARC or x86 specific, they may not be available on both
platforms.

Type

Name

Platform

Unknown

unknown

Both

Kernel-based Virtual Machine

kvm

x86

Logical Domains

logical-domain

SPARC

Non-Global Zone

non-global-zone

Both

Kernel Zone

kernel-zone

Both

VMware

vmware

x86

VirtualBox

virtualbox

x86

Xen

xen

x86

Properties

Properties

libv12n knows about the following properties.
Properties depend both on the class as well as the name of the environment.

Type

Class

Name

V12N_PROP_NAME

(all)

name

V12N_PROP_CLASS

(all)

class

V12N_PROP_LDOMS_CHASSIS

current

chassis-serial-number

V12N_PROP_LDOMS_CONTROL_NAME

current

control-name

V12N_PROP_LDOMS_NAME

current

domain-name

V12N_PROP_LDOMS_ROLE_CONTROL

current

control-role

V12N_PROP_LDOMS_ROLE_IO

current

io-role

V12N_PROP_LDOMS_ROLE_ROOT

current

root-role

V12N_PROP_LDOMS_ROLE_SERVICE

current

service-role

V12N_PROP_LDOMS_UUID

current

uuid

Legacy

Legacy

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:

Value

Description

V12N_CAP_SUPPORTED

Virtualization is supported on this domain.

V12N_CAP_ENABLED

Virtualization is enabled on this domain.

V12N_CAP_IMPL_LDOMS

Logical Domains is the supported virtualization implementation.

The v12n_domain_roles() function returns
the virtualization domain role mask. The virtualization domain role
mask consists of the following values:

Value

Description

V12N_ROLE_CONTROL

If the virtualization implementation is Logical Domains, and
this bit is one, the current domain is a control domain. If this bit
is zero, the current domain is a guest domain.

V12N_ROLE_IO

Current domain is an I/O domain.

V12N_ROLE_SERVICE

Current domain is a service domain.

V12N_ROLE_ROOT

Current domain is a root I/O domain.

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.

Return Values

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_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.