JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Resource Management, Oracle Solaris Zones, and Oracle Solaris 10 Zones Developer's Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

1.  Resource Management in the Oracle Solaris Operating System

2.  Projects and Tasks

3.  Using the C Interface to Extended Accounting

Overview of the C Interface to Extended Accounting

Extended Accounting API Functions

exacct System Calls

Operations on the exacct File

Operations on exacct Objects

Memory Management

Miscellaneous Operations

C Code Examples for Accessing exacct Files

Programming Issues With exacct Files

4.  Using the Perl Interface to Extended Accounting

5.  Resource Controls

6.  Resource Pools

7.  Design Considerations for Resource Management Applications in Oracle Solaris Zones

8.  Configuration Examples

Index

Extended Accounting API Functions

The extended accounting API contains functions that perform the following:

exacct System Calls

The following table lists the system calls that interact with the extended accounting subsystem.

Table 3-1 Extended Accounting System Calls

Function
Description
Provides privileged processes with the ability to tag accounting records with additional data that is specific to the process
Enables privileged processes to request extended accounting buffers from the kernel for currently executing tasks and processes
Requests the kernel to write resource usage data for a specified task or process

Operations on the exacct File

These functions provide access to the exacct files:

Table 3-2 exacct File Functions

Function
Description
Opens an exacct file.
Closes an exacct file.
First time use on a group of objects reads data into an ea_object_t structure. Subsequent use on the group cycles through the objects in the group.
Appends the specified object to the open exacct file.
Reads the basic fields (eo_catalog and eo_type) into an ea_object_t structure and rewinds to the head of the record.
Skips back one object in the exacct file and reads the basic fields (eo_catalog and eo_type) into an ea_object_t.
Gets the name of the host on which the exacct file was created.
Determines the creator of the exacct file.

Operations on exacct Objects

These functions are used to access exacct objects:

Table 3-3 exacct Object Functions

Function
Description
Assigns an exacct object and sets the value(s).
Sets the values of a group of exacct objects.
Checks an exacct object's mask to see if that object has a specific catalog tag.
Attaches an exacct object to a specified exacct object.
Attaches a chain of exacct objects as member items of a specified group.
Frees the value fields in the specified exacct object.
Frees the specified exacct object and any attached hierarchies of objects.

Memory Management

The following table lists the functions associated with extended accounting memory management. The function name is a link to its man page.

Table 3-4 Extended Accounting Memory Management Functions

Link to man page
Description
Converts an exacct object from unpacked (in-memory) representation to packed (in-file) representation.
Converts an exacct object from packed (in-file) representation to unpacked (in-memory) representation.
Duplicates a string that is to be stored inside an ea_object_t structure.
Frees a string previously copied by ea_strdup().
Allocates a block of memory of the requested size. This block can be safely passed to libexacct functions, and can be safely freed by any of the ea_free functions.
Frees a block of memory previously allocated by ea_alloc().
Frees variable-length data in object hierarchy.
Frees value fields of designated object, if EUP_ALLOC is specified. The object is not freed. ea_free_object() frees the specified object and any attached hierarchy of objects. If the flag argument is set to EUP_ALLOC, ea_free_object() also frees any variable-length data in the object hierarchy. If the flag argument is set to EUP_NOALLOC, ea_free_object() does not free the variable-length data. In particular, these flags should correspond to the flags specified in calls to ea_unpack_object(3EXACCT).
Copies an ea_object_t. If the source object is part of a chain, only the current object is copied. If the source object is a group, only the group object is copied without its list of members. The group object eg_nobjs and eg_objs fields are set to 0 and NULL respectively. Use ea_copy_tree() to copy recursively a group or a list of items.
ea_copy_object_tree recursively copies an ea_object_t. All elements in the eo_next list are copied. Any group objects are recursively copied. The returned object can be completely freed with ea_free_object(3EXACCT) by specifying the EUP_ALLOC flag.
ea_get_object_tree()
Reads in nobj top-level objects from the file, returning the same data structure that would have originally been passed to ea_write_object(). On encountering a group object,ea_get_object() reads only the group header part of the group. ea_get_object_tree() reads the group and all its member items, recursing into subrecords if necessary. The returned object data structure can be completely freed with ea_free_object() by specifying the EUP_ALLOC flag.

Miscellaneous Operations

These functions are associated with miscellaneous operations: