| Environment variables | categories Platform Process handling |
File system |
| categories | Process handling | normal dispatch | [XL] Core method |
fork is the standard UNIX interface to create new processes. fork creates a child process that is an image of the current process that only differs by the returned value which is:
| categories | Process handling | normal dispatch | [XL] Kernel method |
getpid() returns the process id of the calling process
| categories | Process handling | normal dispatch | [XL] Kernel method |
getppid() returns the parent process id of the calling process
| categories | Process handling | normal dispatch | [XL] Kernel method |
getuid() returns the real user ID of the calling process. Under windows this method always returns 0
| categories | Process handling | normal dispatch | [XL] Kernel method |
kill(p) terminates the process identified by the process id p. It first give a chance to the process to exit gracefully upon receipt of a SIGTERM signal. If the process still runs after a short timeout then a SIGKILL signal is send to the process. The caller should have necessary permissions.
| categories | Process handling | normal dispatch | [XL] Core interface |
fork, when called in CLAIRE applies all existing on_fork with the domain void. the on_fork callback is applied just before the fork, that is the parent process only. For instance :
| on_fork() : void -> printf("attemp to fork...\n") |
| categories | Process handling | normal dispatch | [XL] Core interface |
after a fork, CLAIRE applies all existing on_forked restrictions that have the domain boolean. the on_forked callback is applied with true from the child and false from the parent process. For instance :
| on_forked(parent?:boolean) : void -> printf("just forked (~I)\n", (if parent? princ("parent") else printf("child ~S", getpid()))) |
| categories | Process handling | open | [XL] Core class |
A process status is returned by waitpid and tell how a child process has exited:
| categories | Process handling | normal dispatch | [XL] Core method |
waitpid(p) is equivalent to waitpid(p, true)
| categories | Process handling | normal dispatch | [XL] Core method |
waitpid is a the UNIX interface to get status of child process. The parameter p specifies the set of child processes to wait for:
block?, when true, tell that the call should block until a waited child terminates.