CEEOFORK

CEEOFORK creates a new POSIX process, called a child process, supporting the POSIX 1003.1 fork() function. CEEOFORK supports the XPG4 standard vfork() function.
Note: The CEEOFORK CWI does not support the use of fork handlers. Support for the registration and execution of fork handlers only exists in the C/C++ Runtime Library.

Syntax

void CEEOFORK (function_code, pid, [fc])
INT4         *function_code;
INT4         *pid;
FEED_BACK    *fc;
CEEOFORK
Call this CWI interface as follows:
L     R15,CEECAACELV-CEECAA(,R12)     CAA address is in R12
L     R15,3284(,R15)
BALR  R14,R15
function_code (input)
A full word binary integer that specifies whether the function is fork() or vfork(). It must contain one of the following values:
0
Language Environment has been requested to perform fork(), if the member language tolerate the fork(). If so, perform fork().
1
Language Environment has been requested to perform vfork(), if the member language tolerate the vfork(). If so, perform vfork().
pid (output)
A full word binary integer to contain the process identifier of the newly-created child process. When fork() or vfork() returns to the calling (parent) process, it returns the process identifier of the newly create child.Because the child is a duplicate, it contains the same call to fork() or vfork() that was in the parent. Execution of the child begins with this fork() or vfork() call returning a value of zero, the child then proceeds with normal execution.If the pid is returned as minus 1, then no child process was created, for the reason specified in feedback token CEE510.
fc (output/optional)
The parameter in which the CWI service feedback code is placed. The following conditions can result from this CWI service.
Condition  
CEE000 Severity 0
Msg_No 0000
Message The service completed successfully.
CEE4SA Severity 3
Msg_No 5002
Message POSIX function not available. z/OS UNIX system services were not started.
CEE50V Severity 3
Msg_No 5151
Message Language Environment member identifier number [member_id] cannot tolerate the POSIX fork() or vfork() function.
CEE510 Severity 3
Msg_No 5152
Message The z/OS UNIX callable service for the fork() function was unsuccessful. The system return code was [return_code]; the reason code was [reason_code].
Note: The system return code and reason code are documented in the z/OS UNIX information.
CEE512 Severity 3
Msg_No 5154
Message The requested fork() or vfork() service failed because it was invoked from a multithread environment.
Qualifying data (when CEE510):
No. Name Input/ Output Type Value
1 parm_count Input INT4 3
2 return_code Input INT4 Return code from kernel, BPX1FRK function
nn
Codes defined by ANSI C, POSIX, and z/OS UNIX
3 reason_code Input INT4 Reason code from kernel, BPX1FRK function
nn
Codes defined by ANSI C, POSIX, and z/OS UNIX
Usage notes:
  1. The new process (called the child process) is a duplicate of the process that calls fork() (called the parent process).
  2. Member languages are notified (event code 24 and function code 1) that a fork() has been requested and can the member tolerate a fork().
    The event handler CEEEVnnn sets the return code in R15 to the following values:
    0
    Member language can tolerate fork()
    -4
    Member language cannot tolerate fork()
    16
    Event handler encountered an unrecoverable error.
  3. Member languages are notified (event code 24 and function code 2) to perform any required cleanup in the child process.
  4. The values of the return_code and reason_code (nn) are as defined in the z/OS UNIX System Services Programming: Assembler Callable Services Reference.
  5. This function is accessible independent of the POSIX runtime option.