Guardian Programmer's Guide

Table Of Contents
Coordinating Concurrent File Access
Guardian Programmer’s Guide 421922-014
3 - 2
Setting the Access Mode
The following example opens three files, one for reading and writing, one for read-only
access, and one for write-only access:
LITERAL READ^WRITE = 0;
LITERAL READ^ONLY = 1;
LITERAL WRITE^ONLY = 2;
.
.
.
ERROR := FILE_OPEN_(FILENAME1:LENGTH1,
FILENUM1,
READ^WRITE);
IF ERROR <> 0 THEN ...
ERROR := FILE_OPEN_(FILENAME2:LENGTH2,
FILENUM2,
READ^ONLY);
IF ERROR <> 0 THEN ...
ERROR := FILE_OPEN_(FILENAME3:LENGTH3,
FILENUM3,
WRITE^ONLY);
IF ERROR <> 0 THEN ...
Whether access to the file is granted, however, depends on file ownership and on the
security assigned to the file by the owner. The file owner has the right to determine
who can open the file and for what purpose. The file owner determines who is allowed
to read from the file, write to the file, execute the file, and purge the file. Access to the
file for any of these purposes can be limited to the file owner, the group or network
community the owner belongs to, or all users of the system or network. (Access can
be controlled at a finer-grained level if the file is Safeguard protected.)
If access to the file is refused because of security, the FILE_OPEN_ procedure returns
an error.
The output of the TACL FILEINFO command shows the security assigned to each file.
The columns headed “RWEP” show the security assigned for reading, writing,
executing, and purging, respectively, as follows:
To access any file on a remote node requires matching remote passwords on the local
node and the remote node.
O Only the file owner on the local node
U Only the file owner on the local node or a remote node
G Users in the same group as the owner and on the local node
C Users in the same group as the owner on the local node or a remote node
Access by local super-ID user only
A All users on the local node
N All users on the local node or any remote node