The procedures described in this section control the creation of processes
and the execution of programs.
They are in the structures
Forkcreates a new child process and returns the child's process-id in the parent and
#fin the child.
thunkin a new process; no process-id is returned.
Fork-and-forgetuses an intermediate process to avoid creating a zombie process.
(process-id? x) -> boolean
(process-id=? process-id0 process-id1) -> boolean
(process-id->integer process-id) -> integer
(integer->process-id integer) -> process-id
Process-id?is a predicate for process-ids,
process-id=?compares two to see if they are the same, and
process-id-uidreturns the actual Unix id.
integer->process-idconvert process ids to and from integers.
(process-id-exit-status process-id) -> integer or #f
(process-id-terminating-signal process-id) -> signal or #f
process-id-exit-statuswill return its exit status. If the process is still running or was terminated by a signal then
#f. Similarly, if a child process was terminated by a signal
process-id-terminating-signalwill return that signal and will return
#fif the process is still running or terminated normally.
Wait-for-child-processblocks until the child process terminates. Scheme 48 may reap child processes before the user requests their exit status, but it does not always do so.
statusas its exit status.
(exec program-name arg0 ...)
(exec-with-environment program-name env arg0 ...)
(exec-file filename arg0 ...)
(exec-file-with-environment filename env arg0 ...)
(exec-with-alias name lookup? maybe-env arguments)
exec-with-environmentlook up the new program in the search path, while
exec-file-with-environmentexecute a particular file. The environment is either inherited from the current process (
exec-file) or given as an argument (
argishould be strings.
Envshould be a list of strings of the form
". The first four procedures add their first argument,
filename, before the
Exec-with-alias is an omnibus procedure that subsumes the other
Name is looked up in the search path if
lookup? is true
and is used as a filename otherwise.
Maybe-env is either a list of strings for the environment of the
new program or
#f in which case the new program inherits its
environment from the current one.
Arguments should be a list of strings; unlike with the other four
name is not added to this list (hence
Previous: Process primitives | Next: Process primitives