Page 741 SEE ALSO bind(2), connect(2), listen(2), select(2), socket(2) BSD Man Page, 24 July 1993 accessaccessChecks user's permissions for a file SYNOPSIS #include <unistd.h> int access(const char *pathname,intmode); DESCRIPTION access checks whether the process would be allowed to read, write, or test for existence of the file (or other file system object) whose name is pathname. If pathname is a symbolic link, permissions of the file referred by this symbolic link are tested. mode is a mask consisting of one or more of R_OK, W_OK, X_OK, and F_OK. R_OK, W_OK, and X_OK request checking whether the file exists and has read, write, and execute permissions, respectively. F_OK just requests checking for the existence of the file. The tests depend on the permissions of the directories occurring in the path to the file, as given in pathname, and on the permissions of directories and files referred by symbolic links encountered on the way. The check is done with the process's real UID and GID, rather than with the effective IDs as is done when actually attempting an operation. This is to allow set-UID programs to easily determine the invoking user's authority. Only access bits are checked, not the file type or contents. Therefore, if a directory is found to be "writable," it probably means that files can be created in the directory, and not that the directory can be written as a file. Similarly, a DOS file may be found to be "executable," but the execve(2) call will still fail. RETURN VALUE On success (all requested permissions granted), 0 is returned. On error (at least 1 bit in mode asked for a permission that is denied, or some other error occurred), _1 is returned and errno is set appropriately. ERRORS
RESTRICTIONS access returns an error if any of the access types in the requested call fails, even if other types might be successful. access may not work correctly on NFS file systems with UID mapping enabled because UID mapping is done on the server and hidden from the client, which checks permissions. Page 742 CONFORMS TO SVID, AT&T, POSIX, X/OPEN, BSD 4.3 SEE ALSO stat(2), open(2), chmod(2), chown(2), setuid(2), setgid(2) Linux 1.2.13, 17 March 1996 acctacctSwitches process accounting on or off SYNOPSIS #include <unistd.h> int acct(const char *filename); DESCRIPTION Warning: Since this function is not implemented as of Linux 0.99.11, it will always return _1 and set errno to ENOSYS. If acctkit is installed, the function performs as advertised. When called with the name of an existing file as argument, accounting is turned on and records for each terminating process are appended to filename as it terminates. An argument of NULL causes accounting to be turned off. RETURN VALUE On success, 0 is returned. On error, _1 is returned and errno is set appropriately. NOTES No accounting is produced for programs running when a crash occurs. In particular, nonterminating processes are never accounted for. SEE ALSO acct(5) Linux 0.99.11, 10 August 1993 adjtimexadjtimexTunes kernel clock SYNOPSIS #include <sys/timex.h> int adjtimex(struct timex *buf); DESCRIPTION Linux uses David Mill's clock adjustment algorithm. adjtimex reads and optionally sets adjustment parameters for this algorithm. adjtimex takes a pointer to a timex structure, updates kernel parameters from field values, and returns the same structure with current kernel values. This structure is declared as follows: Page 743 struct timex { int mode; /* mode selector */ long offset; /* time offset (usec) */ long frequency; /* frequency offset (scaled ppm) */ long maxerror; /* maximum error (usec) */ long esterror; /* estimated error (usec) */ int status; /* clock command/status */ long time_constant; /* pll time constant */ long precision; /* clock precision (usec) (read only) */ long tolerance; /* clock frequency tolerance (ppm) (read only) */ struct timeval time; /* (read only) */ long tick; /* usecs between clock ticks */ }; The mode field determines which parameters, if any, to set. It may contain a bitwise-or combination of zero or more of the following bits: #define ADJ_OFFSET 0x0001 /* time offset */ #define ADJ_FREQUENCY 0x0002 /* frequency offset */ #define ADJ_MAXERROR 0x0004 /* maximum time error */ #define ADJ_ESTERROR 0x0008 /* estimated time error */ #define ADJ_STATUS 0x0010 /* clock status */ #define ADJ_TIMECONST 0x0020 /* pll time constant */ #define ADJ_TICK 0x4000 /* tick value */ #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ Ordinary users are restricted to a 0 value for mode. Only the superuser may set any parameters. RETURN VALUE On success, adjtimex returns the value of buf.status: #define TIME OK 0 /* clock synchronized */ #define TIME INS 1 /* insert leap second */ #define TIME DEL 2 /* delete leap second */ #define TIME OOP 3 /* leap second in progress */ #define TIME BAD 4 /* clock not synchronized */ On failure, adjtimex returns _1 and sets errno. ERRORS
SEE ALSO settimeofday(2) Linux 1.2.4, 15 April 1995 |