gtpa2m2hApplication Programming

File Access in the TPF File System

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.

Process Attributes

There are process attributes that are used to determine whether a process can access a file:

Access Permissions

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.

Note:
The access permission values used by the ZFILE chmod command are in octal notation.

Table 17. Access Permissions

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.

Rules to Determine File Accessibility

The following rules determine if a process can access a file:

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.