Extended Accounting File Access Library Functions
easetitem(3EXACT)
NAME
easetitem, eaalloc, eastrdup, easetgroup,
eamatchobjectcatalog, eaattachtoobject,
eaattachtogroup, eafree, eastrfree, eafreeitem,
eafreeobject - create, destroy and manipulate exacct
objects
SYNOPSIS
cc [ flag... ] file... -lexacct [ library... ]
#include
int easetitem(eaobjectt *obj, eacatalogt tag, void *value,
sizet valsize);
void *eaalloc(sizet size);
char *eastrdup(char *ptr);
int easetgroup(eaobjectt *obj, eacatalogt tag);
int eamatchobjectcatalog(eaobjectt *obj, eacatalogt catmask);
void eaattachtoobject(eaobjectt *headobj, eaobjectt *obj);
void eaattachtogroup(eaobjectt *groupobj, eaobjectt *obj);
void eafree(void *ptr, sizet size);
void eastrfree(char *ptr);
int eafreeitem(eaobjectt *obj, int flag);
void eafreeobject(eaobjectt *obj, int flag);
DESCRIPTION
The eaalloc() function 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 eafree()
functions.
SunOS 5.11 Last change: 28 Nov 2001 1
Extended Accounting File Access Library Functions
easetitem(3EXACT)
The eastrdup() function can be used to duplicate a string
that is to be stored inside an eaobjectt structure.
The easetitem() function assigns the given exacct object
to be a data item with value set according to the remaining
arguments. For buffer-based data values (EXTSTRING,
EXTEXACTOBJECT, and EXTRAW), a copy of the passed buffer
is taken. In the case of EXTEXACTOBJECT, the passed
buffer should be a packed exacct object as returned by
eapackobject(3EXACT). Any item assigned with
easetitem() should be freed with eafreeitem() specifying
a flag value of EUPALOC when the item is no longer needed.
The eamatchobjectcatalog() function returns TRUE if the
exacct object specified by obj has a catalog tag that
matches the mask specified by catmask.
The eaattachtoobject() function attaches an object to the
given object. The eaattachtogroup() function attaches a
chain of objects as member items of the given group. Objects
are inserted at the end of the list of any previously
attached objects.
The eafree() function frees a block of memory previously
allocated by eaalloc().
The eastrfree() function frees a string previously copied
by eastrdup().
The eafreeitem() function frees the value fields in the
eaobjectt indicated by obj, if EUPALOC is specified. The
object itself is not freed. The eafreeobject() function
frees the specified object and any attached hierarchy of
objects. If the flag argument is set to EUPALOC,
eafreeobject() will also free any variable-length data in
the object hierarchy; if set to EUPNOALOC,
eafreeobject() will not free variable-length data. In
particular, these flags should correspond to those specified
in calls to eaunpackobject(3EXACT).
RETURN VALUES
The eamatchobjectcatalog() function returns 0 if the
object's catalog tag does not match the given mask, and 1 if
there is a match.
SunOS 5.11 Last change: 28 Nov 2001 2
Extended Accounting File Access Library Functions
easetitem(3EXACT)
Other integer-valued functions return 0 if successful. Oth-
erwise these functions return -1 and set the extended
accounting error code appropriately. Pointer-valued func-
tions return a valid pointer if successful and NUL other-
wise, setting the extended accounting error code appropri-
ately. The extended accounting error code can be examined
with eaerror(3EXACT).
ERORS
The easetitem(), easetgroup(), and
eamatchobjectcatalog() functions may fail if:
EXRSYSCALFAIL A system call invoked by the function
failed. The errno variable contains
the error value set by the underlying
call.
EXRINVALIDOBJECT The passed object is of an incorrect
type, for example passing a group
object to easetitem().
USAGE
The exacct file format can be used to represent data other
than that in the extended accounting format. By using a
unique creator type in the file header, application writers
can develop their own format suited to the needs of their
application.
EXAMPLES
Example 1 Open and close exacct file.
Construct an exacct file consisting of a single object con-
taining the current process ID.
#include
#include
#include
...
eafilet ef;
eaobjectt obj;
pidt mypid;
mypid = getpid();
easetitem(&obj, EXTUINT32 EXCDEFAULT EXTPROCPID,
&mypid, sizeof(mypid));
SunOS 5.11 Last change: 28 Nov 2001 3
Extended Accounting File Access Library Functions
easetitem(3EXACT)
...
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Evolving
MT-Level MT-Safe
SEE ALSO
read(2), eaerror(3EXACT), eaopen(3EXACT),
eapackobject(3EXACT), libexacct(3LIB), attributes(5)
SunOS 5.11 Last change: 28 Nov 2001 4
Extended Accounting File Access Library Functions
easetitem(3EXACT)
SunOS 5.11 Last change: 28 Nov 2001 5
|