Guardian Programmer's Guide

Table Of Contents
Using the File System
Guardian Programmer’s Guide 421922-014
2 - 14
Creating Files
named. (See the discussion earlier in this section about named and unnamed
processes.)
If the process is created programmatically using the PROCESS_CREATE_ procedure,
the process is named or unnamed depending on the information supplied with the call.
One parameter of the PROCESS_CREATE_ procedure is known as the
name-option parameter. If it is 1, then the process is named using the name
supplied in the name:length parameter.
When creating processes from $SYSTEM.SYSnn, specifying the $SYSTEM.SYSTEM
subvolume is recommended. When you specify the $SYSTEM.SYSTEM subvolume,
the system dynamically searches for the object file first in the $SYSTEM.SYSTEM
subvolume. If the object file is not found in $SYSTEM.SYSTEM, the search continues
in the $SYSTEM.SYSnn subvolume. When you specify the $SYSTEM.SYSnn
subvolume, you are explicitly specifying the location of the object. This means that any
stored reference to the object must be updated to point to the location of the new
object whenever a new version of the operating system is installed.
The following example starts a process from the program contained in the disk file
\SYSTEM1.$MASTER.PROGS.SERVER and names the process $SER1. This
example uses the literal ZSYS^VAL^PCREATOPT^NAMEINCALL supplied in the
ZSYSTAL file to specify that the process will be named. This example also uses the
ZSYS^VAL^LEN^PROCESSDESCR literal from the ZSYSTAL file to specify the
maximum length of the returned process descriptor.
OBJECT^FILENAME ':=' "\SYSTEM1.$MASTER.PROGS.SERVER"
-> @S^PTR;
OBJFILENAME^LEN := @S^PTR '-' @OBJECT^FILENAME;
NAME^OPTION := ZSYS^VAL^PCREATOPT^NAMEINCALL;
PROCESS^NAME ':=' "$SER1" -> @S^PTR;
PROCESSNAME^LEN := @S^PTR '-' @PROCESS^NAME;
ERROR := PROCESS_CREATE_(
OBJECT^FILENAME:OBJFILENAME^LEN,
!library^file:lib^name^len!,
!swap^file:swap^name^len!,
!ext^swap^file:ext^swap^len!,
!priority!,
!processor!,
!process^handle!,
!error^detail!,
NAME^OPTION,
PROCESS^NAME:PROCESSNAME^LEN,
DESCR:ZSYS^VAL^LEN^PROCESSDESCR,
DESCLEN);
Your program can now send messages to $SER1 by opening and writing data to the
process file name returned in the DESCR array variable.
As when creating any file, you need to supply the maximum file-name length. Again
we recommend using the ZSYS^VAL^LEN^PROCESSDESCR literal from the
ZSYSTAL file for this purpose. The actual length of the process descriptor is returned
in the DESCLEN integer variable.