octave: Controlling Subprocesses

 
 36.5 Controlling Subprocesses
 =============================
 
 Octave includes some high-level commands like ‘system’ and ‘popen’ for
 starting subprocesses.  If you want to run another program to perform
 some task and then look at its output, you will probably want to use
 these functions.
 
    Octave also provides several very low-level Unix-like functions which
 can also be used for starting subprocesses, but you should probably only
 use them if you can’t find any way to do what you need with the
 higher-level functions.
 
  -- : system ("STRING")
  -- : system ("STRING", RETURN_OUTPUT)
  -- : system ("STRING", RETURN_OUTPUT, TYPE)
  -- : [STATUS, OUTPUT] = system (...)
      Execute a shell command specified by STRING.
 
      If the optional argument TYPE is "async", the process is started in
      the background and the process ID of the child process is returned
      immediately.  Otherwise, the child process is started and Octave
      waits until it exits.  If the TYPE argument is omitted, it defaults
      to the value "sync".
 
      If SYSTEM is called with one or more output arguments, or if the
      optional argument RETURN_OUTPUT is true and the subprocess is
      started synchronously, then the output from the command is returned
      as a variable.  Otherwise, if the subprocess is executed
      synchronously, its output is sent to the standard output.  To send
      the output of a command executed with ‘system’ through the pager,
      use a command like
 
           [~, text] = system ("cmd");
           disp (text);
 
      or
 
           printf ("%s\n", nthargout (2, "system", "cmd"));
 
      The ‘system’ function can return two values.  The first is the exit
      status of the command and the second is any output from the command
      that was written to the standard output stream.  For example,
 
           [status, output] = system ("echo foo; exit 2");
 
      will set the variable ‘output’ to the string ‘foo’, and the
      variable ‘status’ to the integer ‘2’.
 
      For commands run asynchronously, STATUS is the process id of the
      command shell that is started to run the command.
 
      See also: Seeunix XREFunix, Seedos XREFdos.
 
  -- : unix ("COMMAND")
  -- : STATUS = unix ("COMMAND")
  -- : [STATUS, TEXT] = unix ("COMMAND")
  -- : [...] = unix ("COMMAND", "-echo")
      Execute a system command if running under a Unix-like operating
      system, otherwise do nothing.
 
      Octave waits for the external command to finish before returning
      the exit status of the program in STATUS and any output in TEXT.
 
      When called with no output argument, or the "-echo" argument is
      given, then TEXT is also sent to standard output.
 
DONTPRINTYET       See also: Seedos XREFdos, Seesystem XREFsystem, *noteDONTPRINTYET       See also: Seedos XREFdos, Seesystem XREFsystem, See
      isunix XREFisunix, Seeismac XREFismac, Seeispc XREFispc.
 
  -- : dos ("COMMAND")
  -- : STATUS = dos ("COMMAND")
  -- : [STATUS, TEXT] = dos ("COMMAND")
  -- : [...] = dos ("COMMAND", "-echo")
      Execute a system command if running under a Windows-like operating
      system, otherwise do nothing.
 
      Octave waits for the external command to finish before returning
      the exit status of the program in STATUS and any output in TEXT.
 
      When called with no output argument, or the "-echo" argument is
      given, then TEXT is also sent to standard output.
 
DONTPRINTYET       See also: Seeunix XREFunix, Seesystem XREFsystem, *noteDONTPRINTYET       See also: Seeunix XREFunix, Seesystem XREFsystem, See
      isunix XREFisunix, Seeismac XREFismac, Seeispc XREFispc.
 
  -- : open FILE
  -- : OUTPUT = open (FILE)
      Open the file FILE in Octave or in an external application based on
      the file type as determined by the filename extension.
 
      Recognized file types are
 
      ‘.m’
           Open file in the editor.
 
      ‘.mat’
           Load the file in the base workspace.
 
      ‘.exe’
           Execute the program (on Windows systems only).
 
      Other file types are opened in the appropriate external
      application.
 
  -- : OUTPUT = perl (SCRIPTFILE)
  -- : OUTPUT = perl (SCRIPTFILE, ARGUMENT1, ARGUMENT2, ...)
  -- : [OUTPUT, STATUS] = perl (...)
      Invoke Perl script SCRIPTFILE, possibly with a list of command line
      arguments.
 
      Return output in OUTPUT and optional status in STATUS.  If
      SCRIPTFILE is not an absolute filename it is searched for in the
      current directory and then in the Octave loadpath.
 
      See also: Seesystem XREFsystem, Seepython XREFpython.
 
  -- : OUTPUT = python (SCRIPTFILE)
  -- : OUTPUT = python (SCRIPTFILE, ARGUMENT1, ARGUMENT2, ...)
  -- : [OUTPUT, STATUS] = python (...)
      Invoke Python script SCRIPTFILE, possibly with a list of command
      line arguments.
 
      Return output in OUTPUT and optional status in STATUS.  If
      SCRIPTFILE is not an absolute filename it is searched for in the
      current directory and then in the Octave loadpath.
 
      See also: Seesystem XREFsystem, Seeperl XREFperl.
 
  -- : FID = popen (COMMAND, MODE)
      Start a process and create a pipe.
 
      The name of the command to run is given by COMMAND.  The argument
      MODE may be
 
      "r"
           The pipe will be connected to the standard output of the
           process, and open for reading.
 
      "w"
           The pipe will be connected to the standard input of the
           process, and open for writing.
 
      The file identifier corresponding to the input or output stream of
      the process is returned in FID.
 
      For example:
 
           fid = popen ("ls -ltr / | tail -3", "r");
           while (ischar (s = fgets (fid)))
             fputs (stdout, s);
           endwhile
 
              ⊣ drwxr-xr-x  33 root  root  3072 Feb 15 13:28 etc
              ⊣ drwxr-xr-x   3 root  root  1024 Feb 15 13:28 lib
              ⊣ drwxrwxrwt  15 root  root  2048 Feb 17 14:53 tmp
 
      See also: Seepopen2 XREFpopen2.
 
  -- : pclose (FID)
      Close a file identifier that was opened by ‘popen’.
 
      The function ‘fclose’ may also be used for the same purpose.
 
      See also: Seefclose XREFfclose, Seepopen XREFpopen.
 
  -- : [IN, OUT, PID] = popen2 (COMMAND, ARGS)
      Start a subprocess with two-way communication.
 
      The name of the process is given by COMMAND, and ARGS is an array
      or cell array of strings containing options for the command.
 
      The file identifiers for the input and output streams of the
      subprocess are returned in IN and OUT.  If execution of the command
      is successful, PID contains the process ID of the subprocess.
      Otherwise, PID is −1.
 
      For example:
 
           [in, out, pid] = popen2 ("sort", "-r");
           fputs (in, "these\nare\nsome\nstrings\n");
           fclose (in);
           EAGAIN = errno ("EAGAIN");
           done = false;
           do
             s = fgets (out);
             if (ischar (s))
               fputs (stdout, s);
             elseif (errno () == EAGAIN)
               pause (0.1);
               fclear (out);
             else
               done = true;
             endif
           until (done)
           fclose (out);
           waitpid (pid);
 
              ⊣ these
              ⊣ strings
              ⊣ some
              ⊣ are
 
      Note that ‘popen2’, unlike ‘popen’, will not "reap" the child
      process.  If you don’t use ‘waitpid’ to check the child’s exit
      status, it will linger until Octave exits.
 
      See also: Seepopen XREFpopen, Seewaitpid XREFwaitpid.
 
  -- : VAL = EXEC_PATH ()
  -- : OLD_VAL = EXEC_PATH (NEW_VAL)
  -- : EXEC_PATH (NEW_VAL, "local")
      Query or set the internal variable that specifies a colon separated
      list of directories to append to the shell PATH when executing
      external programs.
 
      The initial value of is taken from the environment variable
      ‘OCTAVE_EXEC_PATH’, but that value can be overridden by the command
      line argument ‘--exec-path PATH’.
 
      When called from inside a function with the "local" option, the
      variable is changed locally for the function and any subroutines it
      calls.  The original variable value is restored when exiting the
      function.
 
DONTPRINTYET       See also: SeeIMAGE_PATH XREFIMAGE_PATH, *noteOCTAVE_HOME:
DONTPRINTYET       See also: SeeIMAGE_PATH XREFIMAGE_PATH, SeeOCTAVE_HOME

      XREFOCTAVE_HOME.
 
    In most cases, the following functions simply decode their arguments
 and make the corresponding Unix system calls.  For a complete example of
 how they can be used, look at the definition of the function ‘popen2’.
 
  -- : [PID, MSG] = fork ()
      Create a copy of the current process.
 
      Fork can return one of the following values:
 
      > 0
           You are in the parent process.  The value returned from ‘fork’
           is the process id of the child process.  You should probably
           arrange to wait for any child processes to exit.
 
      0
           You are in the child process.  You can call ‘exec’ to start
           another process.  If that fails, you should probably call
           ‘exit’.
 
      < 0
           The call to ‘fork’ failed for some reason.  You must take
           evasive action.  A system dependent error message will be
           waiting in MSG.
 
  -- : [ERR, MSG] = exec (FILE, ARGS)
      Replace current process with a new process.
 
      Calling ‘exec’ without first calling ‘fork’ will terminate your
      current Octave process and replace it with the program named by
      FILE.  For example,
 
           exec ("ls", "-l")
 
      will run ‘ls’ and return you to your shell prompt.
 
      If successful, ‘exec’ does not return.  If ‘exec’ does return, ERR
      will be nonzero, and MSG will contain a system-dependent error
      message.
 
  -- : [READ_FD, WRITE_FD, ERR, MSG] = pipe ()
      Create a pipe and return the reading and writing ends of the pipe
      into READ_FD and WRITE_FD respectively.
 
      If successful, ERR is 0 and MSG is an empty string.  Otherwise, ERR
      is nonzero and MSG contains a system-dependent error message.
 
      See also: Seemkfifo XREFmkfifo.
 
  -- : [FID, MSG] = dup2 (OLD, NEW)
      Duplicate a file descriptor.
 
      If successful, FID is greater than zero and contains the new file
      ID.  Otherwise, FID is negative and MSG contains a system-dependent
      error message.
 
DONTPRINTYET       See also: Seefopen XREFfopen, Seefclose XREFfclose, *noteDONTPRINTYET       See also: Seefopen XREFfopen, Seefclose XREFfclose, See
      fcntl XREFfcntl.
 
  -- : [PID, STATUS, MSG] = waitpid (PID, OPTIONS)
      Wait for process PID to terminate.
 
      The PID argument can be:
 
      −1
           Wait for any child process.
 
      0
           Wait for any child process whose process group ID is equal to
           that of the Octave interpreter process.
 
      > 0
           Wait for termination of the child process with ID PID.
 
      The OPTIONS argument can be a bitwise OR of zero or more of the
      following constants:
 
      ‘0’
           Wait until signal is received or a child process exits (this
           is the default if the OPTIONS argument is missing).
 
      ‘WNOHANG’
           Do not hang if status is not immediately available.
 
      ‘WUNTRACED’
           Report the status of any child processes that are stopped, and
           whose status has not yet been reported since they stopped.
 
      ‘WCONTINUE’
           Return if a stopped child has been resumed by delivery of
           ‘SIGCONT’.  This value may not be meaningful on all systems.
 
      If the returned value of PID is greater than 0, it is the process
      ID of the child process that exited.  If an error occurs, PID will
      be less than zero and MSG will contain a system-dependent error
      message.  The value of STATUS contains additional system-dependent
      information about the subprocess that exited.
 
DONTPRINTYET       See also: SeeWCONTINUE XREFWCONTINUE, *noteWCOREDUMP:
DONTPRINTYET DONTPRINTYET       See also: SeeWCONTINUE XREFWCONTINUE, SeeWCOREDUMP

      XREFWCOREDUMP, SeeWEXITSTATUS XREFWEXITSTATUS, *noteDONTPRINTYET DONTPRINTYET       See also: SeeWCONTINUE XREFWCONTINUE, SeeWCOREDUMP

      XREFWCOREDUMP, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFCONTINUED XREFWIFCONTINUED, SeeWIFSIGNALED XREFWIFSIGNALED,
DONTPRINTYET       SeeWIFSTOPPED XREFWIFSTOPPED, SeeWNOHANG XREFWNOHANG, *noteDONTPRINTYET DONTPRINTYET       SeeWIFSTOPPED XREFWIFSTOPPED, SeeWNOHANG XREFWNOHANG, See
      WSTOPSIG XREFWSTOPSIG, SeeWTERMSIG XREFWTERMSIG, *noteDONTPRINTYET DONTPRINTYET       SeeWIFSTOPPED XREFWIFSTOPPED, SeeWNOHANG XREFWNOHANG, See
      WSTOPSIG XREFWSTOPSIG, SeeWTERMSIG XREFWTERMSIG, See
      WUNTRACED XREFWUNTRACED.
 
  -- : WCONTINUE ()
      Return the numerical value of the option argument that may be
      passed to ‘waitpid’ to indicate that it should also return if a
      stopped child has been resumed by delivery of a ‘SIGCONT’ signal.
 
      See also: Seewaitpid XREFwaitpid, SeeWNOHANG XREFWNOHANG,
      SeeWUNTRACED XREFWUNTRACED.
 
  -- : WCOREDUMP (STATUS)
      Given STATUS from a call to ‘waitpid’, return true if the child
      produced a core dump.
 
      This function should only be employed if ‘WIFSIGNALED’ returned
      true.  The macro used to implement this function is not specified
      in POSIX.1-2001 and is not available on some Unix implementations
      (e.g., AIX, SunOS).
 
DONTPRINTYET       See also: Seewaitpid XREFwaitpid, *noteWIFEXITED:
DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, See
      WIFSTOPPED XREFWIFSTOPPED, SeeWSTOPSIG XREFWSTOPSIG, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, See
      WIFSTOPPED XREFWIFSTOPPED, SeeWSTOPSIG XREFWSTOPSIG, See
      WIFCONTINUED XREFWIFCONTINUED.
 
  -- : WEXITSTATUS (STATUS)
      Given STATUS from a call to ‘waitpid’, return the exit status of
      the child.
 
      This function should only be employed if ‘WIFEXITED’ returned true.
 
DONTPRINTYET       See also: Seewaitpid XREFwaitpid, *noteWIFEXITED:
DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWIFSIGNALED XREFWIFSIGNALED, *noteWTERMSIG:
DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG

      XREFWTERMSIG, SeeWCOREDUMP XREFWCOREDUMP, *noteWIFSTOPPED:
DONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG

      XREFWTERMSIG, SeeWCOREDUMP XREFWCOREDUMP, SeeWIFSTOPPED

      XREFWIFSTOPPED, SeeWSTOPSIG XREFWSTOPSIG, *noteWIFCONTINUED:
DONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG

      XREFWTERMSIG, SeeWCOREDUMP XREFWCOREDUMP, SeeWIFSTOPPED

      XREFWIFSTOPPED, SeeWSTOPSIG XREFWSTOPSIG, SeeWIFCONTINUED

      XREFWIFCONTINUED.
 
  -- : WIFCONTINUED (STATUS)
      Given STATUS from a call to ‘waitpid’, return true if the child
      process was resumed by delivery of ‘SIGCONT’.
 
DONTPRINTYET       See also: Seewaitpid XREFwaitpid, *noteWIFEXITED:
DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, See
      WCOREDUMP XREFWCOREDUMP, SeeWIFSTOPPED XREFWIFSTOPPED, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, See
      WCOREDUMP XREFWCOREDUMP, SeeWIFSTOPPED XREFWIFSTOPPED, See
      WSTOPSIG XREFWSTOPSIG.
 
  -- : WIFSIGNALED (STATUS)
      Given STATUS from a call to ‘waitpid’, return true if the child
      process was terminated by a signal.
 
DONTPRINTYET       See also: Seewaitpid XREFwaitpid, *noteWIFEXITED:
DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, *noteWTERMSIG:
DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, SeeWTERMSIG

      XREFWTERMSIG, SeeWCOREDUMP XREFWCOREDUMP, *noteWIFSTOPPED:
DONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, SeeWTERMSIG

      XREFWTERMSIG, SeeWCOREDUMP XREFWCOREDUMP, SeeWIFSTOPPED

      XREFWIFSTOPPED, SeeWSTOPSIG XREFWSTOPSIG, *noteWIFCONTINUED:
DONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, SeeWTERMSIG

      XREFWTERMSIG, SeeWCOREDUMP XREFWCOREDUMP, SeeWIFSTOPPED

      XREFWIFSTOPPED, SeeWSTOPSIG XREFWSTOPSIG, SeeWIFCONTINUED

      XREFWIFCONTINUED.
 
  -- : WIFSTOPPED (STATUS)
      Given STATUS from a call to ‘waitpid’, return true if the child
      process was stopped by delivery of a signal.
 
      This is only possible if the call was done using ‘WUNTRACED’ or
      when the child is being traced (see ptrace(2)).
 
DONTPRINTYET       See also: Seewaitpid XREFwaitpid, *noteWIFEXITED:
DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, See
      WCOREDUMP XREFWCOREDUMP, SeeWSTOPSIG XREFWSTOPSIG, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, See
      WCOREDUMP XREFWCOREDUMP, SeeWSTOPSIG XREFWSTOPSIG, See
      WIFCONTINUED XREFWIFCONTINUED.
 
  -- : WIFEXITED (STATUS)
      Given STATUS from a call to ‘waitpid’, return true if the child
      terminated normally.
 
DONTPRINTYET       See also: Seewaitpid XREFwaitpid, *noteWEXITSTATUS:
DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWEXITSTATUS

      XREFWEXITSTATUS, SeeWIFSIGNALED XREFWIFSIGNALED, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWEXITSTATUS

      XREFWEXITSTATUS, SeeWIFSIGNALED XREFWIFSIGNALED, See
      WTERMSIG XREFWTERMSIG, SeeWCOREDUMP XREFWCOREDUMP, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWEXITSTATUS

      XREFWEXITSTATUS, SeeWIFSIGNALED XREFWIFSIGNALED, See
      WTERMSIG XREFWTERMSIG, SeeWCOREDUMP XREFWCOREDUMP, See
      WIFSTOPPED XREFWIFSTOPPED, SeeWSTOPSIG XREFWSTOPSIG, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWEXITSTATUS

      XREFWEXITSTATUS, SeeWIFSIGNALED XREFWIFSIGNALED, See
      WTERMSIG XREFWTERMSIG, SeeWCOREDUMP XREFWCOREDUMP, See
      WIFSTOPPED XREFWIFSTOPPED, SeeWSTOPSIG XREFWSTOPSIG, See
      WIFCONTINUED XREFWIFCONTINUED.
 
  -- : WNOHANG ()
      Return the numerical value of the option argument that may be
      passed to ‘waitpid’ to indicate that it should return its status
      immediately instead of waiting for a process to exit.
 
DONTPRINTYET       See also: Seewaitpid XREFwaitpid, *noteWUNTRACED:
DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWUNTRACED

      XREFWUNTRACED, SeeWCONTINUE XREFWCONTINUE.
 
  -- : WSTOPSIG (STATUS)
      Given STATUS from a call to ‘waitpid’, return the number of the
      signal which caused the child to stop.
 
      This function should only be employed if ‘WIFSTOPPED’ returned
      true.
 
DONTPRINTYET       See also: Seewaitpid XREFwaitpid, *noteWIFEXITED:
DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, See
      WCOREDUMP XREFWCOREDUMP, SeeWIFSTOPPED XREFWIFSTOPPED, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWTERMSIG XREFWTERMSIG, See
      WCOREDUMP XREFWCOREDUMP, SeeWIFSTOPPED XREFWIFSTOPPED, See
      WIFCONTINUED XREFWIFCONTINUED.
 
  -- : WTERMSIG (STATUS)
      Given STATUS from a call to ‘waitpid’, return the number of the
      signal that caused the child process to terminate.
 
      This function should only be employed if ‘WIFSIGNALED’ returned
      true.
 
DONTPRINTYET       See also: Seewaitpid XREFwaitpid, *noteWIFEXITED:
DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWCOREDUMP XREFWCOREDUMP, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWCOREDUMP XREFWCOREDUMP, See
      WIFSTOPPED XREFWIFSTOPPED, SeeWSTOPSIG XREFWSTOPSIG, *noteDONTPRINTYET DONTPRINTYET DONTPRINTYET DONTPRINTYET       See also: Seewaitpid XREFwaitpid, SeeWIFEXITED

      XREFWIFEXITED, SeeWEXITSTATUS XREFWEXITSTATUS, See
      WIFSIGNALED XREFWIFSIGNALED, SeeWCOREDUMP XREFWCOREDUMP, See
      WIFSTOPPED XREFWIFSTOPPED, SeeWSTOPSIG XREFWSTOPSIG, See
      WIFCONTINUED XREFWIFCONTINUED.
 
  -- : WUNTRACED ()
      Return the numerical value of the option argument that may be
      passed to ‘waitpid’ to indicate that it should also return if the
      child process has stopped but is not traced via the ‘ptrace’ system
      call
 
      See also: Seewaitpid XREFwaitpid, SeeWNOHANG XREFWNOHANG,
      SeeWCONTINUE XREFWCONTINUE.
 
  -- : [ERR, MSG] = fcntl (FID, REQUEST, ARG)
      Change the properties of the open file FID.
 
      The following values may be passed as REQUEST:
 
      ‘F_DUPFD’
           Return a duplicate file descriptor.
 
      ‘F_GETFD’
           Return the file descriptor flags for FID.
 
      ‘F_SETFD’
           Set the file descriptor flags for FID.
 
      ‘F_GETFL’
           Return the file status flags for FID.  The following codes may
           be returned (some of the flags may be undefined on some
           systems).
 
           ‘O_RDONLY’
                Open for reading only.
 
           ‘O_WRONLY’
                Open for writing only.
 
           ‘O_RDWR’
                Open for reading and writing.
 
           ‘O_APPEND’
                Append on each write.
 
           ‘O_CREAT’
                Create the file if it does not exist.
 
           ‘O_NONBLOCK’
                Non-blocking mode.
 
           ‘O_SYNC’
                Wait for writes to complete.
 
           ‘O_ASYNC’
                Asynchronous I/O.
 
      ‘F_SETFL’
           Set the file status flags for FID to the value specified by
           ARG.  The only flags that can be changed are ‘O_APPEND’ and
           ‘O_NONBLOCK’.
 
      If successful, ERR is 0 and MSG is an empty string.  Otherwise, ERR
      is nonzero and MSG contains a system-dependent error message.
 
      See also: Seefopen XREFfopen, Seedup2 XREFdup2.
 
  -- : [ERR, MSG] = kill (PID, SIG)
      Send signal SIG to process PID.
 
      If PID is positive, then signal SIG is sent to PID.
 
      If PID is 0, then signal SIG is sent to every process in the
      process group of the current process.
 
      If PID is -1, then signal SIG is sent to every process except
      process 1.
 
      If PID is less than -1, then signal SIG is sent to every process in
      the process group -PID.
 
      If SIG is 0, then no signal is sent, but error checking is still
      performed.
 
      Return 0 if successful, otherwise return -1.
 
  -- : SIG ()
      Return a structure containing Unix signal names and their defined
      values.