Index of Section 2 Manual Pages
| Interix / SUA | wcs_access.2 | Interix / SUA |
wcs_access(2) wcs_access(2)
access()
NAME
access(), wcs_access() - check access permissions of a file or pathname
SYNOPSIS
#include
int access (const char *path, int mode)
int wcs_access (const wchar_t *path, int mode)
DESCRIPTION
The access(2) and wcs_access(2) functions are identical except that the
wcs_access(2) function accepts wide characters in the path argument.
The access(2) and wcs_access(2) functions check that the file named by
path is actually accessible in terms of the access permissions indicated
by mode. The mode argument is the bitwise inclusive OR of the access
permissions to be checked; the permissions are:
R_OK
Read permission
W_OK
Write permission
X_OK
Execute/search permission
F_OK
File existence
The functions check all of path's components for access permissions
(including F_OK).
The functions use the program's real user ID, not the effective user ID;
it's normally used by setuid programs to check their actions.
If the process has appropriate privileges, the file may not actually have
the execute, read, or write permission bits set even though this function
indicates success for X_OK, R_OK or W_OK (respectively).
RETURN VALUES
The access(2) and wcs_access(2) functions return 0 on success, or -1 if
path cannot be found or if any of the desired access modes wouldn't be
granted.
ERRORS
Access to the file is denied if:
[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. The
owner of a file has permission checked with respect to the "owner"
read, write, and execute mode bits, members of the file's group other
than the owner have permission checked with respect to the "group"
mode bits, and all others have permissions checked with respect to the
"other" mode bits.
[EFAULT]
Path points outside the process's allocated address space.
[EINVAL]
The pathname is not valid, or the file is on a device that does not
support the call.
[EIO]
An I/O error occurred while reading from or writing to the file
system.
[ENAMETOOLONG]
A component of a pathname exceeded characters, or an entire path name
exceeded characters.
[ENOENT]
The named file does not exist.
[ELOOP]
Too many symbolic links were encountered in translating the pathname.
[ENOTDIR]
A component of the path prefix is not a directory.
[EROFS]
Write access is requested for a file on a read-only file system.
SEE ALSO
chmod(2)
stat(2)
USAGE NOTES
All of these functions are thread safe.
All of these functions are async-signal safe.