acct(2) CLIX acct(2)
NAME
acct - Enables or disables process accounting
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
int acct(
char *path );
PARAMETERS
path Points to a pathname naming the accounting file.
DESCRIPTION
The acct() function is used to enable or disable the system process
accounting routine. If the routine is enabled, an accounting record will
be written on an accounting file for each process that terminates.
Termination can be caused by one of two things: an exit() function call or
a signal. (See the exit() and signal() functions.) The effective user ID
of the calling process must be superuser to use this call.
The path variable points to a pathname naming the accounting file. The
accounting file format is given in acct.
The accounting routine is enabled if path is nonzero and no errors occur
during the function. It is disabled if path is 0 and no errors occur
during the function.
EXAMPLES
1. To enable accounting:
if (acct(acctfile) != 0)
perror("Accounting enable failed");
2. To disable accounting:
if (acct((char *)0) != 0)
perror("Accounting disable failed");
RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
2/94 - Intergraph Corporation 1
acct(2) CLIX acct(2)
ERRORS
The acct() function fails if one or more of the following are true:
[EPERM] The effective user of the calling process is not superuser.
[EBUSY] An attempt is being made to enable accounting when it is
already enabled.
[ENOTDIR] A component of the path prefix is not a directory.
[ENOENT] One or more components of the accounting file pathname do not
exist.
[EACCES] The file named by path is not an ordinary file.
[EROFS] The named file resides on a read-only file system.
[EFAULT] The value of path points to an illegal address.
RELATED INFORMATION
Functions: exit(2), signal(2)
Files: acct(4)
2 Intergraph Corporation - 2/94