Go to main content

Resource Management and Oracle® Solaris Zones Developer's Guide

Exit Print View

Updated: February 2021
 
 

Extended Accounting API Functions

    The extended accounting API contains functions that perform actions such as:

  • exacct system calls

  • Operations on the exacct file

  • Operations on exacct objects

This section provides tables describing these functions. The function name is a link to its man page.

exacct System Calls

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

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

Operations on the exacct File

The following table lists the functions that provide access to the exacct file.

Table 2  exacct File Functions
Function Man Page
Description
Closes an exacct file.
Determines the creator of the exacct file.
Gets the name of the host on which the exacct file was created.
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.
Reads the basic fields (eo_catalog and eo_type) into an ea_object_t structure and rewinds to the head of the record.
Opens an exacct file.
Skips back one object in the exacct file and reads the basic fields (eo_catalog and eo_type) into an ea_object_t structure.
Appends the specified object to the open exacct file.

Operations on exacct Objects

The following table lists the functions that are used to access exacct objects.

Table 3  exacct Object Functions
Function Man Page
Description
Attaches a chain of exacct objects as member items of a specified group.
Attaches an exacct object to a specified exacct object.
Frees the value fields in the specified exacct object.
Frees the specified exacct object and any attached hierarchies of objects.
Checks an exacct object's mask to see whether that object has a specific catalog tag.
Assigns an exacct object and sets its values.
Sets the values of a group of exacct objects.

Extended Accounting Memory Management

The following table lists the functions associated with extended accounting memory management.

Table 4  Extended Accounting Memory Management Functions
Function Man Page
Description
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.
Copies an ea_object_t structure. 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 the ea_copy_tree function to recursively copy a group or a list of items.
The ea_copy_object_tree function recursively copies an ea_object_t structure. All elements in the eo_next list are copied. Any group objects are recursively copied. The returned object can be completely freed with the ea_free_object function by specifying the EUP_ALLOC flag.
Frees a block of memory previously allocated by the ea_alloc function.
Frees value fields of the designated object if EUP_ALLOC is specified. The object is not freed. The ea_free_object function 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 the ea_unpack_object function.
Frees variable-length data in object hierarchy.
Reads in nobj top-level objects from the file, returning the same data structure that would have originally been passed to the ea_write_object function. On encountering a group object, the ea_get_object function reads only the group header part of the group. The ea_get_object_tree function reads the group and all its member items, recursing into subrecords if necessary. The returned object data structure can be completely freed with the ea_free_object function by specifying the EUP_ALLOC flag.
Converts an exacct object from unpacked (in-memory) representation to packed (in-file) representation.
Duplicates a string that is to be stored inside an ea_object_t structure.
Frees a string previously copied by the ea_strdup function.
Converts an exacct object from packed (in-file) representation to unpacked (in-memory) representation.

Extended Accounting Miscellaneous Operations

These functions are associated with miscellaneous operations:

ea_error(3EXACCT)

Returns the error value of the last failure recorded by the invocation of one of the functions of the extended accounting library,libexacct.

ea_match_object_catalog(3EXACCT)

Returns TRUE if the exaact object specified by obj has a catalog tag that matches the mask specified by catmask.