ACCT(2V)

NAME
acct - turn accounting on or off

SYNOPSIS
int acct (path)
char *path;

DESCRIPTION

acct() is used to enable or disable the process accounting. If process accounting 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() call or a signal; see exit (2V) and sigvec(2). The effective user ID of the calling process must be super-user to use this call.

path points to a path name naming the accounting file. The accounting file format is given in acct(5).

The accounting routine is enabled if path is not a NULL pointer and no errors occur during the system call. It is disabled if path is a NULL pointer and no errors occur during the system call.

If accounting is already turned on, and a successful acct() call is made with a non-NULL path, all subsequent accounting records will be written to the new accounting file.

SYSTEM V DESCRIPTION

If accounting is already turned on, it is an error to call acct() with a non-NULL path.

RETURN VALUES

acct() returns:

0   on success.

-1  on failure and sets errno to indicate the error.

ERRORS

EACCES
    Search permission is denied for a component of the path prefix of path.

    The file referred to by path is not a regular file.

EFAULT
    path points outside the process's allocated address space.

EINVAL
    Support for accounting was not configured into the system.

EIO An I/O error occurred while reading from or writing to the file system.

ELOOP
    Too many symbolic links were encountered in translating the path name.

ENAMETOOLONG
    The length of the path argument exceeds {PATH_MAX}.

    A pathname component is longer than {NAME_MAX} (see sysconf(2V)) while {_POSIX_NO_TRUNC} is in effect (see pathconf(2V)).

ENOENT
    The named file does not exist.

ENOTDIR
    A component of the path prefix of path is not a directory.

EPERM
    The caller is not the super-user.

EROFS
    The named file resides on a read-only file system.

SYSTEM V ERRORS

EBUSY
    path is non-NULL, and accounting is already turned on.

ENOENT
    path points to an empty string.

SEE ALSO
exit(2V), sigvec(2), acct(5), sa(8)

BUGS

No accounting records are produced for programs running when a crash occurs. In particular non-terminating programs are never accounted for.

NOTES

Accounting is automatically disabled when free space on the file system the accounting file resides on drops below 2 percent; it is enabled when free space rises above 4 percent.