#include <as400_protos.h> pid_t fork400(const char *jobname, unsigned int resourceID); pid_t f_fork400(const char *jobname, unsigned int resourceID);
Note: These functions can only be used in an i5/OS PASE program. See i5/OS PASE for more information about creating i5/OS PASE programs.
The fork400() function creates a new process. The new process (the child process) is an almost exact copy of the calling process (the parent process). fork400() is called once (by the parent process), but returns twice (once in the parent process and once in the child process). fork400() is the same as the fork() function plus it allows additional i5/OS PASE unique options to be specified.
f_fork400() function is a similarly enhanced version of the f_fork() function. When f_fork400() (or f_fork()) is used, one of the exec functions must be called in the child process immediately after it is created. f_fork400() does not call the fork handlers so the application data, mutexes and the locks are all undefined in the child process.
The job name specified must begin with an alphabetic character [A-Z] or the characters [$#@]. The remaining characters must be alphanumeric [A-Z] or [0-9] or [$#@_.]. The string should not be longer than 10 characters (not including the terminating null character). If the specified jobname is invalid, the jobname parameter value is ignored.
Use the value of 0 to let the operating system select the resources affinity identifier value automatically.
fork400() and f_fork400() require no authority.
Upon successful completion, the fork400() or f_fork400() function returns a value of 0 to the child process and the process ID of the child process to the parent process. Otherwise, a value of -1 is returned to the parent process, no child process is created, and the errno global variable is set to indicate the error.
At least these errno values can be returned, with other values also possible (such as i5/OS-unique ILE errno EAPAR):
[EAGAIN] | Exceeds the limit on the total number of processes running or the system does not have the resources necessary to create another process. |
[ENOMEM] | Not enough space exists for this process. |
[EINVAL] | An invalid argument value was specified. |
Top | i5/OS PASE APIs | APIs by category |