Go to the first, previous, next, last section, table of contents.


Processes

primitive: chdir path
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 path [arg] ...
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 path [arg] ...
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 execlv system call, but we call it execlp because of its Scheme calling interface.

primitive: execle path env [arg] ...
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: getenv name
Looks up the string name in the current environment. The return value is #f unless a string of the form NAME=VALUE is found, in which case the string VALUE is returned.

primitive: putenv string
Modifies the environment of the current process, which is also the default environment inherited by child processes.

If string is of the form NAME=VALUE then it will be written directly into the environment, replacing any existing environment string with name matching NAME. If string does not contain an equal sign, then any existing string with name matching string will be removed.

The return value is unspecified.

procedure: setenv name value
Modifies the environment of the current process, which is also the default environment inherited by child processes.

If value is #f, then name is removed from the environment. Otherwise, the string name=value is added to the environment, replacing any existing string with name matching name.

The return value is unspecified.

primitive: environ [env]
If env is omitted, returns the current environment as a list of strings. Otherwise it sets the current environment, which is also the default environment for child processes, to the supplied list of strings. Each member of env should be of the form NAME=VALUE and values of NAME should not be duplicated. If env is supplied then the return value is unspecified.

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.


Go to the first, previous, next, last section, table of contents.