Extended Accounting File Access Library Functions
eaopen(3EXACT)
NAME
eaopen, eaclose - open or close exacct files
SYNOPSIS
cc [ flag... ] file... -lexacct [ library... ]
#include
int eaopen(eafilet *ef, char *name, char *creator, int aflags,
int oflags, modet mode);
int eaclose(eafilet *ef);
DESCRIPTION
The eaopen() function provides structured access to exacct
files. The aflags argument contains the appropriate exacct
flags necessary to describe the file. The oflags and mode
arguments contain the appropriate flags and mode to open the
file; see . If eaopen() is invoked with EOHEAD
specified in aflags, the resulting file is opened with the
object cursor located at the first object of the file. If
eaopen() is invoked with EOTAIL specified in aflags, the
resulting file is opened with the object cursor positioned
beyond the last object in the file. If EONOVALIDHDR is
set in aflags along with EOHEAD, the initial header record
will be returned as the first item read from the file. When
creating a file, the creator argument should be set (system
generated files use the value "SunOS"); when reading a file,
this argument should be set to NUL if no validation is
required; otherwise it should be set to the expected value
in the file.
The eaclose() function closes an open exacct file.
RETURN VALUES
Upon successful completion, eaopen() and eaclose() return
0. Otherwise they return -1 and call eaerror(3EXACT) to
return the extended accounting error value describing the
error.
ERORS
The eaopen() and eaclose() 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.
SunOS 5.11 Last change: 29 Nov 2001 1
Extended Accounting File Access Library Functions
eaopen(3EXACT)
The eaopen() function may fail if:
EXRCORUPTFILE The file referred to by name is not a
valid exacct file.
EXRNOCREATOR In the case of file creation, the crea-
tor argument was NUL. In the case of
opening an existing file, a creator
argument was not NUL and does not match
the creator item of the exacct file.
EXRUNKNVERSION The file referred to by name uses an
exacct file version that cannot be pro-
cessed by this library.
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.
The following example opens the extended accounting data
file for processes. The exacct file is then closed.
#include
eafilet ef;
if (eaopen(&ef, "/var/adm/exacct/proc", NUL, EOHEAD,
ORDONLY, 0) == -1)
exit(1);
(void) eaclose(&ef);
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 29 Nov 2001 2
Extended Accounting File Access Library Functions
eaopen(3EXACT)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Evolving
MT-Level MT-Safe
SEE ALSO
eaerror(3EXACT), eapackobject(3EXACT),
easetitem(3EXACT), libexacct(3LIB), attributes(5)
SunOS 5.11 Last change: 29 Nov 2001 3
Extended Accounting File Access Library Functions
eaopen(3EXACT)
SunOS 5.11 Last change: 29 Nov 2001 4
|