The name of a file on disk.
The file mode to be tested. The legal modes are discussed below.
Zero is returned if the access mode is valid, otherwise -1 is returned and the errno is set.
This function checks a file for the following permissions. Two or more permissions in bitwise OR combinations can be checked at one time.
R_OK Test for read permission.
W_OK Test for write permission.
X_OK Test for execute permission.
F_OK Test for existence of file.
The library "const/Filesys.lsp" must be required to use the constants listed above.
Gamma> require_lisp("const/Filesys");
"/usr/cogent/lib/const/Filesys.lsp"
Gamma> system("touch /tmp/access_test");
0
Gamma> system("chmod a=rx /tmp/access_test");
0
Gamma> access("/tmp/access_test", R_OK|X_OK);
0
Gamma> access("/tmp/access_test", W_OK);
-1
Gamma>
See the Starting qserve and nserve section of the Common Functions chapter (Tutorial One), or the Start a Process section of the Common Functions for Any Program chapter (Tutorial Two), or the Linux, QNX 4, or QNX 6 section of the Abstracted Functions chapter in the Cogent Tools Demo and Tutorials book for examples of this function used in context.