Annotation of 43BSDReno/lib/libc/sys/access.2, revision 1.1.1.1

1.1       root        1: .\" Copyright (c) 1980 Regents of the University of California.
                      2: .\" All rights reserved.  The Berkeley software License Agreement
                      3: .\" specifies the terms and conditions for redistribution.
                      4: .\"
                      5: .\"    @(#)access.2    6.6 (Berkeley) 5/13/90
                      6: .\"
                      7: .TH ACCESS 2 "May 13, 1990"
                      8: .UC 4
                      9: .SH NAME
                     10: access \- determine accessibility of file
                     11: .SH SYNOPSIS
                     12: .nf
                     13: .ft B
                     14: #include <unistd.h>
                     15: 
                     16: accessible = access(path, mode)
                     17: int accessible;
                     18: char *path;
                     19: int mode;
                     20: .ft R
                     21: .fi
                     22: .SH DESCRIPTION
                     23: .I Access
                     24: checks the given
                     25: file
                     26: .I path
                     27: for accessibility according to
                     28: .IR mode ,
                     29: which is the bitwise inclusive OR of the access permissions to be
                     30: checked (R_OK for read permission, W_OK for write permission and X_OK
                     31: for execute/search permission) or the existence test, F_OK.
                     32: Specifying
                     33: .I mode
                     34: as F_OK tests whether the directories leading to the file can be
                     35: searched and the file exists.
                     36: .PP
                     37: The real user ID and the group access list
                     38: (including the real group ID) are
                     39: used in verifying permission, so this call
                     40: is useful to set-UID programs.
                     41: .PP
                     42: Notice that only access bits are checked.
                     43: A directory may be indicated as writable by
                     44: .IR access ,
                     45: but an attempt to open it for writing will fail
                     46: (although files may be created there);
                     47: a file may look executable, but
                     48: .I execve
                     49: will fail unless it is in proper format.
                     50: .SH "RETURN VALUE
                     51: If
                     52: .I path
                     53: cannot be found or if any of the desired access modes would
                     54: not be granted, then a \-1 value is returned; otherwise
                     55: a 0 value is returned.
                     56: .SH "ERRORS
                     57: Access to the file is denied if one or more of the following are true:
                     58: .TP 15
                     59: [ENOTDIR]
                     60: A component of the path prefix is not a directory.
                     61: .TP 15
                     62: [EINVAL]
                     63: The pathname contains a character with the high-order bit set.
                     64: .TP 15
                     65: [ENAMETOOLONG]
                     66: A component of a pathname exceeded 255 characters,
                     67: or an entire path name exceeded 1023 characters.
                     68: .TP 15
                     69: [ENOENT]
                     70: The named file does not exist.
                     71: .TP 15
                     72: [EACCES]
                     73: Search permission is denied for a component of the path prefix.
                     74: .TP 15
                     75: [ELOOP]
                     76: Too many symbolic links were encountered in translating the pathname.
                     77: .TP 15
                     78: [EROFS]
                     79: Write access is requested for a file on a read-only file system.
                     80: .TP 15
                     81: [ETXTBSY]
                     82: Write access is requested for a pure procedure (shared text)
                     83: file that is being executed.
                     84: .TP 15
                     85: [EACCES]
                     86: Permission bits of the file mode do not permit the requested
                     87: access, or search permission is denied on a component of the
                     88: path prefix.  The owner of a file has permission checked with
                     89: respect to the ``owner'' read, write, and execute mode bits,
                     90: members of the file's group other than the owner have permission
                     91: checked with respect to the ``group'' mode bits, and all
                     92: others have permissions checked with respect to the ``other''
                     93: mode bits.
                     94: .TP 15
                     95: [EFAULT]
                     96: .I Path
                     97: points outside the process's allocated address space.
                     98: .TP 15
                     99: [EIO]
                    100: An I/O error occurred while reading from or writing to the file system.
                    101: .SH "SEE ALSO
                    102: chmod(2), stat(2)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.