06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

pREPC+ <strong>System</strong> <strong>Calls</strong> fopen<br />

Error Codes<br />

Notes<br />

Refer to Appendix B.<br />

1. The disk files are managed by the pHILE + file system manager and are<br />

designated by pHILE + pathnames (for example, 0.1/abc). The I/O devices are<br />

identified by pSOS+ logical device numbers represented as a string of the form<br />

M.N, where M is the major number and N is the minor number of the I/O device<br />

(for example, 0.1). When reading or writing disk files, the pREPC+ library calls<br />

the pHILE+ file system manager. When reading or writing I/O devices, the<br />

pREPC+ library calls the pSOS+ I/O Supervisor directly.<br />

2. fopen() internally makes a call to the pHILE+ open_f function when it opens<br />

a disk file and the pSOS+ de_open function when it opens an I/O device.<br />

3. If the volume is an NFS volume, two conditions can cause problems related to<br />

the file mode. The conditions are as follows:<br />

a. A file that did not previously exist is created in an NFS volume by the<br />

fopen() call with a UNIX-like privilege mode automatically set to 0x180<br />

(octal 600/rw for the user.) If, for example, the mode in the fopen() call is<br />

manually specified as w, a conflict could result. The pREPC+ library allows<br />

only file operations that are valid for the specified mode. Therefore (using<br />

the preceding example), the pREPC+ library does not allow a read operation<br />

on the following file:<br />

fopen("0.0/file1.dat", "w");<br />

b. The restrictions placed on file operations depend on the mode extended to<br />

files that exist prior to the fopen() call. For example:<br />

fopen("0.0/file2.dat", "r");<br />

succeeds if file2.dat exists prior to the fopen() call. A subsequent read<br />

operation would fail if that file had an access mode (under NFS) that did not<br />

allow a user-read. Currently, no method exists under the pREPC+ library to<br />

change the access mode of an NFS file.<br />

4. Since the underlying mechanism (pHILE+ and pSOS+ I/O device manager) do<br />

not, as of yet, support the concept of text files, pREPC+ treats text files as<br />

binary files. However, for forward compatibility, you must specify the “b”<br />

character in the mode string if the file being opened through fopen contains<br />

<strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong> 3-41<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!