Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)
When you use mkdir() for directories within the Guardian file system, the owner ID is set to
65535 (the group ID is set to 255), and the permission bits are set to “rwxrwxrwx.” Only Guardian
subvolumes can be created within the Guardian file system; mkdir() cannot create a Guardian
node, volume, or file.
Using the mknod() Function
The mknod() function can be used to create a new OSS file that is a FIFO, character-special,
directory, or regular file. If the file type is S_IFCHR (character-special), the following values are
defined for the device parameter:
• 00000003xxxxxxxx, infinite data source and data sink, such as /dev/null, where the
device number specified by xxxxxxxx is unique within the program.
• 00000002xxxxxxxx, a synonym for a controlling terminal, such as /dev/tty, where the
device number specified by xxxxxxxx is unique within the program.
In the Guardian file system (/G), only regular files (within subvolume directories) and directories
at the subvolume level can be created. The file protection parameters S_ISUID, S_ISGID, and
S_ISVTX are ignored, as they are for all files created in /G.
See also “Special Considerations for Files in Restricted-Access Filesets” (page 122).
Using the mkfifo() Function
You cannot use the mkfifo() function to create FIFOs in the Guardian file system.
See also “Special Considerations for Files in Restricted-Access Filesets” (page 122).
Using the open() and open64() Functions
The open()and open64() function calls can be used to open and create files in the Guardian
file system. Only odd-unstructured, EDIT, or tty-simulation process files can be opened. Attempts to
open other Guardian files fail. Regular Guardian files are opened in shared-exclusion mode; EDIT
files are opened in protected-exclusion mode. Only open64() function calls can be used to open
or create Guardian Format 2 files.
Files created in the Guardian file system are created as odd-unstructured, with a file code of 180
and access permissions of rwxr-xr-x. During open(), open64() ,creat(), or creat64()
function processing, all access permissions are checked. Checks are performed by standard
Guardian security mechanisms and by Safeguard for Guardian disk file and process access.
See also “Special Considerations for Files in Restricted-Access Filesets” (page 122).
Using the opendir(), readdir(), and readdir64() Functions
The opendir() function call can be used for OSS and Guardian directories. Using readdir()
and readdir64() on the /G, /G/vol, and /G/vol/subvol directories returns all entries, even
files inaccessible through OSS interfaces, such as Enscribe structured files and SQL tables and
views. The first readdir()or readdir64() call after opendir() or rewinddir() causes
the file system to retrieve a block of directory entries from an OSS name server.
For both Guardian and OSS directories, if files are added to a directory after a block of entries
is obtained from an OSS name server, it is possible that no entry is returned for the new files. The
same applies for deleted files.
See also “Special Considerations for Files in Restricted-Access Filesets” (page 122).
Using the read() and write() Functions
The read() and write() function calls read and write to OSS and Guardian files. In the OSS
environment, the maximum buffer size that can be read using read() or written using write()
is the value of the SSIZE_MAX constant (52 kilobytes). SSIZE_MAX is defined in the limits.h
file.
OSS C Programming Considerations 125