acct Subroutine

Purpose

Enables and disables process accounting.

Library

Standard C Library (libc.a)

Syntax

int acct ( Path)
char *Path;

Description

The acct subroutine enables the accounting routine when the Path parameter specifies the path name of the file to which an accounting record is written for each process that terminates. When the Path parameter is a 0 or null value, the acct subroutine disables the accounting routine.

If the Path parameter refers to a symbolic link, the acct subroutine causes records to be written to the file pointed to by the symbolic link.

If Network File System (NFS) is installed on your system, the accounting file can reside on another node.

Note: To ensure accurate accounting, each node must have its own accounting file. Although no two nodes should share accounting files, a node's accounting files can be located on any node in the network.

The calling process must have root user authority to use the acct subroutine.

Parameters

Item Description
Path Specifies a pointer to the path name of the file or a null pointer.

Return Values

Upon successful completion, the acct subroutine returns a value of 0. Otherwise, a value of -1 is returned and the global variable errno is set to indicate the error.

Error Codes

The acct subroutine is unsuccessful if one or more of the following are true:

Item Description
EACCES Write permission is denied for the named accounting file.
EACCES The file named by the Path parameter is not an ordinary file.
EBUSY An attempt is made to enable accounting when it is already enabled.
ENOENT The file named by the Path parameter does not exist.
EPERM The calling process does not have root user authority.
EROFS The named file resides on a read-only file system.

If NFS is installed on the system, the acct subroutine is unsuccessful if the following is true:

Item Description
ETIMEDOUT The connection timed out.