SYNOPSIS
#include <unistd.h>
int access(const char *pathname, int amode);
DESCRIPTION
The
The value of amode is either the bitwise inclusive-OR of the following access permissions to be checked, or is F_OK, which checks for the existence of the file:
- R_OK
-
Tests for Read permission
- W_OK
-
Tests for Write permission
- X_OK
-
Tests for Execute or Search permissions.
- D_OK
-
Tests for Delete permission
- P_OK
-
Tests for Change Permission permission.
- O_OK
-
Tests for Take Ownership permission.
If any access permissions are checked, each is checked individually, in the order listed earlier, for other, then group, then owner.
PARAMETERS
- pathname
-
A pointer to the file to be checked for access.
- amode
-
A bitwise-OR value that specifies the type of access to check for.
RETURN VALUES
If the
requested access is permitted,
- EACCES
-
Permission bits of the file mode do not permit the requested access, or search permission is denied on a component of the path prefix.
- EFAULT
-
The pathname parameter is not a valid pointer.
- EINTR
-
A signal interrupted the call.
- EINVAL
-
An invalid value was specified for amode.
- ENAMETOOLONG
-
The length of pathname exceeds PATH_MAX or the length of a pathname component exceeds NAME_MAX.
- ENOENT
-
pathname points to an empty string or to the name of a file that does not exist.
- ENOTDIR
-
A component of the pathname prefix is not a directory.
- EROFS
-
Write access was requested for a file residing on a read-only file system.
CONFORMANCE
POSIX.1 (1996), with exceptions.
MULTITHREAD SAFETY LEVEL
Async-signal-safe.
PORTING ISSUES
In file systems other than NTFS, access permissions are limited to DOS attribute information. Directories always have read and write access. Files have either read-only or read, write, execute access. With NTFS file systems, file access is fully implemented.
On NTFS, the DACL in the file descriptor determines the access permissions of a file. However, the DOS file attribute for read-only overrides the DACL -- if the read-only attribute is set, the write access is denied, even if otherwise allowed by the DACL. Refer to File Security in the Windows Concepts chapter of the PTC MKS Toolkit UNIX to Windows Porting Guide for more information
If the
File names are treated as multibyte sequences and are converted to Unicode (UTF-16)
before passing to Win32. The conversion is either performed based on the
current thread locale, set using
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
_NutConf() ,chmod() ,fstat() ,stat() ,xlocale()
- Miscellaneous:
- struct stat
PTC MKS Toolkit 10.4 Documentation Build 39.