Open System Services Programmer's Guide
Example 20 Using fopen_guardian() in an OSS Module
/* Verify current process is an OSS process */
#ifndef _OSS_TARGET
#error “Wrong systype”
#endif
#include <stdio.h>
int main (int argc, char *argv[]) {
FILE *G_File;
FILE *P_File;
int c;
/* Open the Guardian file, note that since this is an OSS
process, need to explicitly call a version of fopen()that
opens a Guardian file. */
G_File = fopen_guardian ("$system.system.stdioh", "r");
/* Because this is an OSS process, we get the OSS fopen() by
default. */
P_File = fopen("mystdio.h", "w");
/* Note that the rest of the I/O routines do not require
environment-specific parameters. They can operate on OSS or
Guardian files. */
while(!feof(G_File)) {
c = getc(G_File); /* read from Guardian file */
putc(c, P_File); /* write to OSS file */
}
fclose(G_File);
fclose(P_File);
return(0);
}
Accessing Files on SMF Logical Disk Volumes
Beginning with the J06.15 and H06.26 RVUs, new HP NonStop Storage Management Foundation
(SMF) features are:
• All OSS file-system functions that currently operate on unstructured Guardian files by name
operate the same on unstructured Guardian files on an SMF virtual disk. The OSS functions
are: access(), chdir(), chown(), creat(), creat64(), lchown(), lstat(),
lstat64(), open(), open64(), rename(), stat(), stat64(), statvfs(),
statvfs64(), and utime().
• All OSS file-system functions that currently operate on file descriptors for an open of a Guardian
file operate the same on file descriptors for an open of a Guardian file on an SMF virtual disk.
The OSS functions are: close(), dup(), dup2(), fchown(), fcntl(), fstat(),
fstat64(), fstatvfs(), fstatvfs64(), fsync(), ftruncate(),
ftruncate64(), lseek(), lseek64(), read(), read64_(), write(), and
write64().
• Read access to Guardian edit files on an SMF virtual disk is supported.
• Creation of an OSS process from an OSS program file residing on a SMF virtual disk is
supported.
For more details about SMF features beginning with the J06.15 and H06.26 RVUs, see the HP
NonStopStorage Management Foundation User’s Guide.
Accessing Files From the Guardian API
Guardian files can be managed from the Guardian API as described in the Guardian Programmer’s
Guide and the Guardian Procedure Calls Reference Manual.
68 Managing Files