>>-forkexecm--program--+------+--------------------------------><
'-parm-'
Function
forkexecm invokes
the fork and execmvs callable services to fork and exec a program
to be executed from the LINKLIB, LPALIB, or STEPLIB library.
Parameters
- program
- The name of the program.
- parm
- A parameter to be passed to the program.
Usage notes
- If the exec fails, the child process ends with a SIGABRT signal.
- If the fork succeeds, RETVAL contains
the PID for the child process.
- The child process has a unique process ID (PID) that does not
match any active process group ID.
- If a hierarchical file system (HFS) file has its FCTLCLOFORK flag
set on, it is not inherited by the child process. This flag is set
with the fcntl callable service.
- The process and system utilization times for the child are set
to zero.
- Any file locks previously set by the parent are not inherited
by the child.
- The child process has no alarms set (similar to the results of
a call to the alarm service with Wait_time specified as zero).
- The child has no pending signals.
- The following characteristics of the calling process are changed
when the new executable program is given control by the execmvs callable
service:
- The prior process image is replaced with a new process image for
the executable program to be run.
- All open files marked close-on-exec and all open directory streams
are closed.
- The input passed to the MVS™ executable
file by the service is consistent with what is passed as input to MVS programs. On input, the MVS program receives a single-entry
parameter list pointed to by register 1. The high-order bit of the
single parameter entry is set to 1.
The single
parameter entry is the address of a 2-byte length field followed by
an argument string. The length field describes the length of the
data that follows it. If a null argument and argument length are
specified in the call, the length field specifies 0 bytes
on input to the executable file.
- The call can invoke both unauthorized and authorized MVS programs:
- Unauthorized programs receive control in problem program state,
with PSW key 8.
- Authorized programs receive control in problem program state,
with PSW key 8 and APF authorization.
- The TASKLIB, STEPLIB, or JOBLIB DD data set allocations that are
active for the calling task at the time of the call to the execmvs
service are propagated to the new process image, if the data sets
they represent are found to be cataloged. Uncataloged data sets are
not propagated to the new process image. This causes the program
that is invoked to run with the same MVS program
search order as its invoker.
Example
In the following example, assume
that
pgm was assigned a value earlier in
the exec:
"forkexecm (pgm) 'hello world'"