gtpa2m2h | Application Programming |
Access to a file in the file system is POSIX-compliant and is controlled by the effective user ID, effective group ID, and access permissions.
There are process attributes that are used to determine whether a process can access a file:
Associated with a file in the file system are access permissions that determine if a process can access a file. The access permissions available for a file are read, write, and execute (or any combination), and can be set for a file owner (or user), group, and users other than the owner or group. Users other than the owner or group are referred to as just other.
If the bit corresponding to the action that a process wants to take is on, file access is granted. Use the chmod function in a program to change the access permissions of a file. Use the ZFILE chmod command to manually change the access permissions of a file. Enter the ZFILE ls command with the -l parameter specified to display the access permissions of a file.
Table 17 shows a summary of the different access permissions and the settings used by the chmod function and the ZFILE chmod and ZFILE ls commands.
Accessed By | Access Type | chmod Function Settings | ZFILE chmod Command Settings | ZFILE ls Command Settings |
---|---|---|---|---|
User | Read | S_IRUSR | 0400 | r-------- |
Write | S_IWUSR | 0200 | -w------- | |
Execute | S_IXUSR | 0100 | --x------ | |
Group | Read | S_IRGRP | 0040 | ---r----- |
Write | S_IWGRP | 0020 | ----w---- | |
Execute | S_IXGRP | 0010 | -----x--- | |
Other | Read | S_IROTH | 0004 | ------r-- |
Write | S_IWOTH | 0002 | -------w- | |
Execute | S_IXOTH | 0001 | --------x |
See TPF C/C++ Language Support User's Guide for more information about the chmod function. See TPF Operations for more information about the ZFILE chmod and ZFILE ls commands.
The following rules determine if a process can access a file:
If they match, the user access permissions are checked.
If they match, the group access permissions are checked.
Use the ZFILE chmod and ZFILE chown commands to maintain file accessibility by changing the access permissions and the owner or group of a file in the file system. See TPF Operations for more information about ZFILE chmod and ZFILE chown commands.