Processes
=========
- primitive: chdir str
Change the current working directory to PATH. The return value is
unspecified.
- primitive: getcwd
Returns the name of the current working directory.
- primitive: umask [mode]
If MODE is omitted, retuns a decimal number representing the
current file creation mask. Otherwise the file creation mask is
set to MODE and the previous value is returned.
E.g., `(umask #o022)' sets the mask to octal 22, decimal 18.
- primitive: getpid
Returns an integer representing the current process ID.
- primitive: getgroups
Returns a vector of integers representing the current
supplimentary group IDs.
- primitive: getppid
Returns an integer representing the process ID of the parent
process.
- primitive: getuid
Returns an integer representing the current real user ID.
- primitive: getgid
Returns an integer representing the current real group ID.
- primitive: geteuid
Returns an integer representing the current effective user ID. If
the system does not support effective IDs, then the real ID is
returned. `(feature? 'EIDs)' reports whether the system supports
effective IDs.
- primitive: getegid
Returns an integer representing the current effective group ID.
If the system does not support effective IDs, then the real ID is
returned. `(feature? 'EIDs)' reports whether the system supports
effective IDs.
- primitive: setuid id
Sets both the real and effective user IDs to the integer ID,
provided the process has appropriate privileges. The return value
is unspecified.
- primitive: setgid id
Sets both the real and effective group IDs to the integer ID,
provided the process has appropriate privileges. The return value
is unspecified.
- primitive: seteuid id
Sets the effective user ID to the integer ID, provided the process
has appropriate privileges. If effective IDs are not supported,
the real ID is set instead - `(feature? 'EIDs)' reports whether the
system supports effective IDs. The return value is unspecified.
- primitive: setegid id
Sets the effective group ID to the integer ID, provided the process
has appropriate privileges. If effective IDs are not supported,
the real ID is set instead - `(feature? 'EIDs)' reports whether the
system supports effective IDs. The return value is unspecified.
- primitive: getpgrp
Returns an integer representing the current process group ID.
This is the POSIX definition, not BSD.
- primitive: setpgid pid pgid
Move the process PID into the process group PGID. PID or PGID
must be integers: they can be zero to indicate the ID of the
current process. Fails on systems that do not support job control.
The return value is unspecified.
- primitive: setsid
Creates a new session. The current process becomes the session
leader and is put in a new process group. The process will be
detached from its controlling terminal if it has one. The return
value is an integer representing the new process group ID.
- primitive: waitpid pid [options]
This procedure collects status information from a child process
which has terminated or (optionally) stopped. Normally it will
suspend the calling process until this can be done. If more than
one child process is eligible then one will be chosen by the
operating system.
The value of PID determines the behaviour:
PID greater than 0
Request status information from the specified child process.
PID equal to -1 or WAIT_ANY
Request status information for any child process.
PID equal to 0 or WAIT_MYPGRP
Request status information for any child process in the
current process group.
PID less than -1
Request status information for any child process whose
process group ID is -PID.
The OPTIONS argument, if supplied, should be the bitwise OR of the
values of zero or more of the following variables:
- Variable: WNOHANG
Return immediately even if there are no child processes to be
collected.
- Variable: WUNTRACED
Report status information for stopped processes as well as
terminated processes.
The return value is a pair containing:
1. The process ID of the child process, or 0 if `WNOHANG' was
specified and no process was collected.
2. The integer status value.
The following three functions can be used to decode the process status
code returned by `waitpid'.
- primitive: status:exit-val status
Returns the exit status value, as would be set if a process ended
normally through a call to `exit' or `_exit', if any, otherwise
`#f'.
- primitive: status:term-sig status
Returns the signal number which terminated the process, if any,
otherwise `#f'.
- primitive: status:stop-sig status
Returns the signal number which stopped the process, if any,
otherwise `#f'.
- primitive: system [cmd]
Executes CMD using the operating system's "command processor".
Under Unix this is usually the default shell `sh'. The value
returned is CMD's exit status as returned by `waitpid', which can
be interpreted using the functions above.
If `system' is called without arguments, it returns a boolean
indicating whether the command processor is available.
- primitive: primitive-exit [status]
Terminate the current process without unwinding the Scheme stack.
This is would typically be useful after a fork. The exit status
is STATUS if supplied, otherwise zero.
- primitive: execl filename . args
Executes the file named by PATH as a new process image. The
remaining arguments are supplied to the process; from a C program
they are accessable as the `argv' argument to `main'.
Conventionally the first ARG is the same as PATH. All arguments
must be strings.
If ARG is missing, PATH is executed with a null argument list,
which may have system-dependent side-effects.
This procedure is currently implemented using the `execv' system
call, but we call it `execl' because of its Scheme calling
interface.
- primitive: execlp filename . args
Similar to `execl', however if FILENAME does not contain a slash
then the file to execute will be located by searching the
directories listed in the `PATH' environment variable.
This procedure is currently implemented using the `execvp' system
call, but we call it `execlp' because of its Scheme calling
interface.
- primitive: execle filename env . args
Similar to `execl', but the environment of the new process is
specified by ENV, which must be a list of strings as returned by
the `environ' procedure.
This procedure is currently implemented using the `execve' system
call, but we call it `execle' because of its Scheme calling
interface.
- primitive: primitive-fork
Creates a new "child" process by duplicating the current "parent"
process. In the child the return value is 0. In the parent the
return value is the integer process ID of the child.
This procedure has been renamed from `fork' to avoid a naming
conflict with the scsh fork.
- primitive: nice incr
Increment the priority of the current process by INCR. A higher
priority value means that the process runs less often. The return
value is unspecified.