Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > b38d2da330d1936e5ab1307c039c4941 > files > 179

octave-doc-3.6.4-3.mga4.noarch.rpm

<html lang="en">
<head>
<title>Controlling Subprocesses - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="System-Utilities.html#System-Utilities" title="System Utilities">
<link rel="prev" href="Networking-Utilities.html#Networking-Utilities" title="Networking Utilities">
<link rel="next" href="Process-ID-Information.html#Process-ID-Information" title="Process ID Information">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Controlling-Subprocesses"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Process-ID-Information.html#Process-ID-Information">Process ID Information</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Networking-Utilities.html#Networking-Utilities">Networking Utilities</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="System-Utilities.html#System-Utilities">System Utilities</a>
<hr>
</div>

<h3 class="section">36.5 Controlling Subprocesses</h3>

<p>Octave includes some high-level commands like <code>system</code> and
<code>popen</code> 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.

   <p>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 src/toplev.cc -->
   <p><a name="doc_002dsystem"></a>

<div class="defun">
&mdash; Built-in Function:  <b>system</b> (<var>"string"</var>)<var><a name="index-system-3241"></a></var><br>
&mdash; Built-in Function:  <b>system</b> (<var>"string", return_output</var>)<var><a name="index-system-3242"></a></var><br>
&mdash; Built-in Function:  <b>system</b> (<var>"string", return_output, type</var>)<var><a name="index-system-3243"></a></var><br>
&mdash; Built-in Function: [<var>status</var>, <var>output</var>] = <b>system</b> (<var><small class="dots">...</small></var>)<var><a name="index-system-3244"></a></var><br>
<blockquote><p>Execute a shell command specified by <var>string</var>. 
If the optional argument <var>type</var> 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 <var>type</var> argument is omitted, it
defaults to the value "sync".

        <p>If <var>system</var> is called with one or more output arguments, or if the
optional argument <var>return_output</var> 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
<code>system</code> through the pager, use a command like

     <pre class="example">          [output, text] = system ("cmd");
          disp (text);
</pre>
        <p class="noindent">or

     <pre class="example">          printf ("%s\n", nthargout (2, "system", "cmd"));
</pre>
        <p>The <code>system</code> 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,

     <pre class="example">          [status, output] = system ("echo foo; exit 2");
</pre>
        <p class="noindent">will set the variable <code>output</code> to the string &lsquo;<samp><span class="samp">foo</span></samp>&rsquo;, and the
variable <code>status</code> to the integer &lsquo;<samp><span class="samp">2</span></samp>&rsquo;.

        <p>For commands run asynchronously, <var>status</var> is the process id of the
command shell that is started to run the command. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dunix.html#doc_002dunix">unix</a>, <a href="doc_002ddos.html#doc_002ddos">dos</a>. 
</p></blockquote></div>

<!-- unix scripts/miscellaneous/unix.m -->
   <p><a name="doc_002dunix"></a>

<div class="defun">
&mdash; Function File:  <b>unix</b> (<var>"command"</var>)<var><a name="index-unix-3245"></a></var><br>
&mdash; Function File: <var>status</var> = <b>unix</b> (<var>"command"</var>)<var><a name="index-unix-3246"></a></var><br>
&mdash; Function File: [<var>status</var>, <var>text</var>] = <b>unix</b> (<var>"command"</var>)<var><a name="index-unix-3247"></a></var><br>
&mdash; Function File: [<small class="dots">...</small>] = <b>unix</b> (<var>"command", "-echo"</var>)<var><a name="index-unix-3248"></a></var><br>
<blockquote><p>Execute a system command if running under a Unix-like operating
system, otherwise do nothing.  Return the exit status of the program
in <var>status</var> and any output from the command in <var>text</var>. 
When called with no output argument, or the "-echo" argument is
given, then <var>text</var> is also sent to standard output. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002ddos.html#doc_002ddos">dos</a>, <a href="doc_002dsystem.html#doc_002dsystem">system</a>, <a href="doc_002disunix.html#doc_002disunix">isunix</a>, <a href="doc_002dispc.html#doc_002dispc">ispc</a>. 
</p></blockquote></div>

<!-- dos scripts/miscellaneous/dos.m -->
   <p><a name="doc_002ddos"></a>

<div class="defun">
&mdash; Function File:  <b>dos</b> (<var>"command"</var>)<var><a name="index-dos-3249"></a></var><br>
&mdash; Function File: <var>status</var> = <b>dos</b> (<var>"command"</var>)<var><a name="index-dos-3250"></a></var><br>
&mdash; Function File: [<var>status</var>, <var>text</var>] = <b>dos</b> (<var>"command"</var>)<var><a name="index-dos-3251"></a></var><br>
&mdash; Function File: [<small class="dots">...</small>] = <b>dos</b> (<var>"command", "-echo"</var>)<var><a name="index-dos-3252"></a></var><br>
<blockquote><p>Execute a system command if running under a Windows-like operating
system, otherwise do nothing.  Return the exit status of the program
in <var>status</var> and any output from the command in <var>text</var>. 
When called with no output argument, or the "-echo" argument is
given, then <var>text</var> is also sent to standard output. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dunix.html#doc_002dunix">unix</a>, <a href="doc_002dsystem.html#doc_002dsystem">system</a>, <a href="doc_002disunix.html#doc_002disunix">isunix</a>, <a href="doc_002dispc.html#doc_002dispc">ispc</a>. 
</p></blockquote></div>

<!-- perl scripts/miscellaneous/perl.m -->
   <p><a name="doc_002dperl"></a>

<div class="defun">
&mdash; Function File: [<var>output</var>, <var>status</var>] = <b>perl</b> (<var>scriptfile</var>)<var><a name="index-perl-3253"></a></var><br>
&mdash; Function File: [<var>output</var>, <var>status</var>] = <b>perl</b> (<var>scriptfile, argument1, argument2, <small class="dots">...</small></var>)<var><a name="index-perl-3254"></a></var><br>
<blockquote><p>Invoke Perl script <var>scriptfile</var> with possibly a list of
command line arguments. 
Returns output in <var>output</var> and status
in <var>status</var>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dsystem.html#doc_002dsystem">system</a>. 
</p></blockquote></div>

<!-- python scripts/miscellaneous/python.m -->
   <p><a name="doc_002dpython"></a>

<div class="defun">
&mdash; Function File: [<var>output</var>, <var>status</var>] = <b>python</b> (<var>scriptfile</var>)<var><a name="index-python-3255"></a></var><br>
&mdash; Function File: [<var>output</var>, <var>status</var>] = <b>python</b> (<var>scriptfile, argument1, argument2, <small class="dots">...</small></var>)<var><a name="index-python-3256"></a></var><br>
<blockquote><p>Invoke python script <var>scriptfile</var> with possibly a list of
command line arguments. 
Returns output in <var>output</var> and status
in <var>status</var>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dsystem.html#doc_002dsystem">system</a>. 
</p></blockquote></div>

<!-- popen src/file-io.cc -->
   <p><a name="doc_002dpopen"></a>

<div class="defun">
&mdash; Built-in Function: <var>fid</var> = <b>popen</b> (<var>command, mode</var>)<var><a name="index-popen-3257"></a></var><br>
<blockquote><p>Start a process and create a pipe.  The name of the command to run is
given by <var>command</var>.  The file identifier corresponding to the input
or output stream of the process is returned in <var>fid</var>.  The argument
<var>mode</var> may be

          <dl>
<dt><code>"r"</code><dd>The pipe will be connected to the standard output of the process, and
open for reading.

          <br><dt><code>"w"</code><dd>The pipe will be connected to the standard input of the process, and
open for writing. 
</dl>

        <p>For example:

     <pre class="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
</pre>
        </blockquote></div>

<!-- pclose src/file-io.cc -->
   <p><a name="doc_002dpclose"></a>

<div class="defun">
&mdash; Built-in Function:  <b>pclose</b> (<var>fid</var>)<var><a name="index-pclose-3258"></a></var><br>
<blockquote><p>Close a file identifier that was opened by <code>popen</code>.  You may also
use <code>fclose</code> for the same purpose. 
</p></blockquote></div>

<!-- popen2 src/syscalls.cc -->
   <p><a name="doc_002dpopen2"></a>

<div class="defun">
&mdash; Built-in Function: [<var>in</var>, <var>out</var>, <var>pid</var>] = <b>popen2</b> (<var>command, args</var>)<var><a name="index-popen2-3259"></a></var><br>
<blockquote><p>Start a subprocess with two-way communication.  The name of the process
is given by <var>command</var>, and <var>args</var> is an array of strings
containing options for the command.  The file identifiers for the input
and output streams of the subprocess are returned in <var>in</var> and
<var>out</var>.  If execution of the command is successful, <var>pid</var>
contains the process ID of the subprocess.  Otherwise, <var>pid</var> is
&minus;1.

        <p>For example:

     <pre class="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)
              sleep (0.1);
              fclear (out);
            else
              done = true;
            endif
          until (done)
          fclose (out);
          waitpid (pid);
               -| these
               -| strings
               -| some
               -| are
</pre>
        <p>Note that <code>popen2</code>, unlike <code>popen</code>, will not "reap" the
child process.  If you don't use <code>waitpid</code> to check the child's
exit status, it will linger until Octave exits. 
</p></blockquote></div>

<!-- EXEC_PATH src/defaults.cc -->
   <p><a name="doc_002dEXEC_005fPATH"></a>

<div class="defun">
&mdash; Built-in Function: <var>val</var> = <b>EXEC_PATH</b> ()<var><a name="index-EXEC_005fPATH-3260"></a></var><br>
&mdash; Built-in Function: <var>old_val</var> = <b>EXEC_PATH</b> (<var>new_val</var>)<var><a name="index-EXEC_005fPATH-3261"></a></var><br>
&mdash; Built-in Function:  <b>EXEC_PATH</b> (<var>new_val, "local"</var>)<var><a name="index-EXEC_005fPATH-3262"></a></var><br>
<blockquote><p>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
<samp><span class="env">OCTAVE_EXEC_PATH</span></samp><!-- /@w -->, but that value can be overridden by
the command line argument <samp><span class="option">--exec-path PATH</span></samp>.

        <p>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. 
</p></blockquote></div>

   <p>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 <code>popen2</code>.

<!-- fork src/syscalls.cc -->
   <p><a name="doc_002dfork"></a>

<div class="defun">
&mdash; Built-in Function: [<var>pid</var>, <var>msg</var>] = <b>fork</b> ()<var><a name="index-fork-3263"></a></var><br>
<blockquote><p>Create a copy of the current process.

        <p>Fork can return one of the following values:

          <dl>
<dt>&gt; 0<dd>You are in the parent process.  The value returned from <code>fork</code> is
the process id of the child process.  You should probably arrange to
wait for any child processes to exit.

          <br><dt>0<dd>You are in the child process.  You can call <code>exec</code> to start another
process.  If that fails, you should probably call <code>exit</code>.

          <br><dt>&lt; 0<dd>The call to <code>fork</code> failed for some reason.  You must take evasive
action.  A system dependent error message will be waiting in <var>msg</var>. 
</dl>
        </p></blockquote></div>

<!-- exec src/syscalls.cc -->
   <p><a name="doc_002dexec"></a>

<div class="defun">
&mdash; Built-in Function: [<var>err</var>, <var>msg</var>] = <b>exec</b> (<var>file, args</var>)<var><a name="index-exec-3264"></a></var><br>
<blockquote><p>Replace current process with a new process.  Calling <code>exec</code> without
first calling <code>fork</code> will terminate your current Octave process and
replace it with the program named by <var>file</var>.  For example,

     <pre class="example">          exec ("ls" "-l")
</pre>
        <p class="noindent">will run <code>ls</code> and return you to your shell prompt.

        <p>If successful, <code>exec</code> does not return.  If <code>exec</code> does return,
<var>err</var> will be nonzero, and <var>msg</var> will contain a system-dependent
error message. 
</p></blockquote></div>

<!-- pipe src/syscalls.cc -->
   <p><a name="doc_002dpipe"></a>

<div class="defun">
&mdash; Built-in Function: [<var>read_fd</var>, <var>write_fd</var>, <var>err</var>, <var>msg</var>] = <b>pipe</b> ()<var><a name="index-pipe-3265"></a></var><br>
<blockquote><p>Create a pipe and return the reading and writing ends of the pipe
into <var>read_fd</var> and <var>write_fd</var> respectively.

        <p>If successful, <var>err</var> is 0 and <var>msg</var> is an empty string. 
Otherwise, <var>err</var> is nonzero and <var>msg</var> contains a
system-dependent error message. 
</p></blockquote></div>

<!-- dup2 src/syscalls.cc -->
   <p><a name="doc_002ddup2"></a>

<div class="defun">
&mdash; Built-in Function: [<var>fid</var>, <var>msg</var>] = <b>dup2</b> (<var>old, new</var>)<var><a name="index-dup2-3266"></a></var><br>
<blockquote><p>Duplicate a file descriptor.

        <p>If successful, <var>fid</var> is greater than zero and contains the new file
ID.  Otherwise, <var>fid</var> is negative and <var>msg</var> contains a
system-dependent error message. 
</p></blockquote></div>

<!-- waitpid src/syscalls.cc -->
   <p><a name="doc_002dwaitpid"></a>

<div class="defun">
&mdash; Built-in Function: [<var>pid</var>, <var>status</var>, <var>msg</var>] = <b>waitpid</b> (<var>pid, options</var>)<var><a name="index-waitpid-3267"></a></var><br>
<blockquote><p>Wait for process <var>pid</var> to terminate.  The <var>pid</var> argument can be:

          <dl>
<dt>&minus;1<dd>Wait for any child process.

          <br><dt>0<dd>Wait for any child process whose process group ID is equal to that of
the Octave interpreter process.

          <br><dt>&gt; 0<dd>Wait for termination of the child process with ID <var>pid</var>. 
</dl>

        <p>The <var>options</var> argument can be a bitwise OR of zero or more of
the following constants:

          <dl>
<dt><code>0</code><dd>Wait until signal is received or a child process exits (this is the
default if the <var>options</var> argument is missing).

          <br><dt><code>WNOHANG</code><dd>Do not hang if status is not immediately available.

          <br><dt><code>WUNTRACED</code><dd>Report the status of any child processes that are stopped, and whose
status has not yet been reported since they stopped.

          <br><dt><code>WCONTINUE</code><dd>Return if a stopped child has been resumed by delivery of <code>SIGCONT</code>. 
This value may not be meaningful on all systems. 
</dl>

        <p>If the returned value of <var>pid</var> is greater than 0, it is the process
ID of the child process that exited.  If an error occurs, <var>pid</var> will
be less than zero and <var>msg</var> will contain a system-dependent error
message.  The value of <var>status</var> contains additional system-dependent
information about the subprocess that exited. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dWCONTINUE.html#doc_002dWCONTINUE">WCONTINUE</a>, <a href="doc_002dWCOREDUMP.html#doc_002dWCOREDUMP">WCOREDUMP</a>, <a href="doc_002dWEXITSTATUS.html#doc_002dWEXITSTATUS">WEXITSTATUS</a>, <a href="doc_002dWIFCONTINUED.html#doc_002dWIFCONTINUED">WIFCONTINUED</a>, <a href="doc_002dWIFSIGNALED.html#doc_002dWIFSIGNALED">WIFSIGNALED</a>, <a href="doc_002dWIFSTOPPED.html#doc_002dWIFSTOPPED">WIFSTOPPED</a>, <a href="doc_002dWNOHANG.html#doc_002dWNOHANG">WNOHANG</a>, <a href="doc_002dWSTOPSIG.html#doc_002dWSTOPSIG">WSTOPSIG</a>, <a href="doc_002dWTERMSIG.html#doc_002dWTERMSIG">WTERMSIG</a>, <a href="doc_002dWUNTRACED.html#doc_002dWUNTRACED">WUNTRACED</a>. 
</p></blockquote></div>

<!-- WCONTINUE src/syscalls.cc -->
   <p><a name="doc_002dWCONTINUE"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WCONTINUE</b> ()<var><a name="index-WCONTINUE-3268"></a></var><br>
<blockquote><p>Return the numerical value of the option argument that may be
passed to <code>waitpid</code> to indicate that it should also return
if a stopped child has been resumed by delivery of a <code>SIGCONT</code>
signal. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWNOHANG.html#doc_002dWNOHANG">WNOHANG</a>, <a href="doc_002dWUNTRACED.html#doc_002dWUNTRACED">WUNTRACED</a>. 
</p></blockquote></div>

<!-- WCOREDUMP src/syscalls.cc -->
   <p><a name="doc_002dWCOREDUMP"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WCOREDUMP</b> (<var>status</var>)<var><a name="index-WCOREDUMP-3269"></a></var><br>
<blockquote><p>Given <var>status</var> from a call to <code>waitpid</code>, return true if the
child produced a core dump.  This function should only be employed if
<code>WIFSIGNALED</code> 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). 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWIFEXITED.html#doc_002dWIFEXITED">WIFEXITED</a>, <a href="doc_002dWEXITSTATUS.html#doc_002dWEXITSTATUS">WEXITSTATUS</a>, <a href="doc_002dWIFSIGNALED.html#doc_002dWIFSIGNALED">WIFSIGNALED</a>, <a href="doc_002dWTERMSIG.html#doc_002dWTERMSIG">WTERMSIG</a>, <a href="doc_002dWIFSTOPPED.html#doc_002dWIFSTOPPED">WIFSTOPPED</a>, <a href="doc_002dWSTOPSIG.html#doc_002dWSTOPSIG">WSTOPSIG</a>, <a href="doc_002dWIFCONTINUED.html#doc_002dWIFCONTINUED">WIFCONTINUED</a>. 
</p></blockquote></div>

<!-- WEXITSTATUS src/syscalls.cc -->
   <p><a name="doc_002dWEXITSTATUS"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WEXITSTATUS</b> (<var>status</var>)<var><a name="index-WEXITSTATUS-3270"></a></var><br>
<blockquote><p>Given <var>status</var> from a call to <code>waitpid</code>, return the exit
status of the child.  This function should only be employed if
<code>WIFEXITED</code> returned true. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWIFEXITED.html#doc_002dWIFEXITED">WIFEXITED</a>, <a href="doc_002dWIFSIGNALED.html#doc_002dWIFSIGNALED">WIFSIGNALED</a>, <a href="doc_002dWTERMSIG.html#doc_002dWTERMSIG">WTERMSIG</a>, <a href="doc_002dWCOREDUMP.html#doc_002dWCOREDUMP">WCOREDUMP</a>, <a href="doc_002dWIFSTOPPED.html#doc_002dWIFSTOPPED">WIFSTOPPED</a>, <a href="doc_002dWSTOPSIG.html#doc_002dWSTOPSIG">WSTOPSIG</a>, <a href="doc_002dWIFCONTINUED.html#doc_002dWIFCONTINUED">WIFCONTINUED</a>. 
</p></blockquote></div>

<!-- WIFCONTINUED src/syscalls.cc -->
   <p><a name="doc_002dWIFCONTINUED"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WIFCONTINUED</b> (<var>status</var>)<var><a name="index-WIFCONTINUED-3271"></a></var><br>
<blockquote><p>Given <var>status</var> from a call to <code>waitpid</code>, return true if the
child process was resumed by delivery of <code>SIGCONT</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWIFEXITED.html#doc_002dWIFEXITED">WIFEXITED</a>, <a href="doc_002dWEXITSTATUS.html#doc_002dWEXITSTATUS">WEXITSTATUS</a>, <a href="doc_002dWIFSIGNALED.html#doc_002dWIFSIGNALED">WIFSIGNALED</a>, <a href="doc_002dWTERMSIG.html#doc_002dWTERMSIG">WTERMSIG</a>, <a href="doc_002dWCOREDUMP.html#doc_002dWCOREDUMP">WCOREDUMP</a>, <a href="doc_002dWIFSTOPPED.html#doc_002dWIFSTOPPED">WIFSTOPPED</a>, <a href="doc_002dWSTOPSIG.html#doc_002dWSTOPSIG">WSTOPSIG</a>. 
</p></blockquote></div>

<!-- WIFSIGNALED src/syscalls.cc -->
   <p><a name="doc_002dWIFSIGNALED"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WIFSIGNALED</b> (<var>status</var>)<var><a name="index-WIFSIGNALED-3272"></a></var><br>
<blockquote><p>Given <var>status</var> from a call to <code>waitpid</code>, return true if the
child process was terminated by a signal. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWIFEXITED.html#doc_002dWIFEXITED">WIFEXITED</a>, <a href="doc_002dWEXITSTATUS.html#doc_002dWEXITSTATUS">WEXITSTATUS</a>, <a href="doc_002dWTERMSIG.html#doc_002dWTERMSIG">WTERMSIG</a>, <a href="doc_002dWCOREDUMP.html#doc_002dWCOREDUMP">WCOREDUMP</a>, <a href="doc_002dWIFSTOPPED.html#doc_002dWIFSTOPPED">WIFSTOPPED</a>, <a href="doc_002dWSTOPSIG.html#doc_002dWSTOPSIG">WSTOPSIG</a>, <a href="doc_002dWIFCONTINUED.html#doc_002dWIFCONTINUED">WIFCONTINUED</a>. 
</p></blockquote></div>

<!-- WIFSTOPPED src/syscalls.cc -->
   <p><a name="doc_002dWIFSTOPPED"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WIFSTOPPED</b> (<var>status</var>)<var><a name="index-WIFSTOPPED-3273"></a></var><br>
<blockquote><p>Given <var>status</var> from a call to <code>waitpid</code>, return true if the
child process was stopped by delivery of a signal; this is only
possible if the call was done using <code>WUNTRACED</code> or when the child
is being traced (see ptrace(2)). 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWIFEXITED.html#doc_002dWIFEXITED">WIFEXITED</a>, <a href="doc_002dWEXITSTATUS.html#doc_002dWEXITSTATUS">WEXITSTATUS</a>, <a href="doc_002dWIFSIGNALED.html#doc_002dWIFSIGNALED">WIFSIGNALED</a>, <a href="doc_002dWTERMSIG.html#doc_002dWTERMSIG">WTERMSIG</a>, <a href="doc_002dWCOREDUMP.html#doc_002dWCOREDUMP">WCOREDUMP</a>, <a href="doc_002dWSTOPSIG.html#doc_002dWSTOPSIG">WSTOPSIG</a>, <a href="doc_002dWIFCONTINUED.html#doc_002dWIFCONTINUED">WIFCONTINUED</a>. 
</p></blockquote></div>

<!-- WIFEXITED src/syscalls.cc -->
   <p><a name="doc_002dWIFEXITED"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WIFEXITED</b> (<var>status</var>)<var><a name="index-WIFEXITED-3274"></a></var><br>
<blockquote><p>Given <var>status</var> from a call to <code>waitpid</code>, return true if the
child terminated normally. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWEXITSTATUS.html#doc_002dWEXITSTATUS">WEXITSTATUS</a>, <a href="doc_002dWIFSIGNALED.html#doc_002dWIFSIGNALED">WIFSIGNALED</a>, <a href="doc_002dWTERMSIG.html#doc_002dWTERMSIG">WTERMSIG</a>, <a href="doc_002dWCOREDUMP.html#doc_002dWCOREDUMP">WCOREDUMP</a>, <a href="doc_002dWIFSTOPPED.html#doc_002dWIFSTOPPED">WIFSTOPPED</a>, <a href="doc_002dWSTOPSIG.html#doc_002dWSTOPSIG">WSTOPSIG</a>, <a href="doc_002dWIFCONTINUED.html#doc_002dWIFCONTINUED">WIFCONTINUED</a>. 
</p></blockquote></div>

<!-- WNOHANG src/syscalls.cc -->
   <p><a name="doc_002dWNOHANG"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WNOHANG</b> ()<var><a name="index-WNOHANG-3275"></a></var><br>
<blockquote><p>Return the numerical value of the option argument that may be
passed to <code>waitpid</code> to indicate that it should return its
status immediately instead of waiting for a process to exit. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWUNTRACED.html#doc_002dWUNTRACED">WUNTRACED</a>, <a href="doc_002dWCONTINUE.html#doc_002dWCONTINUE">WCONTINUE</a>. 
</p></blockquote></div>

<!-- WSTOPSIG src/syscalls.cc -->
   <p><a name="doc_002dWSTOPSIG"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WSTOPSIG</b> (<var>status</var>)<var><a name="index-WSTOPSIG-3276"></a></var><br>
<blockquote><p>Given <var>status</var> from a call to <code>waitpid</code>, return the number of
the signal which caused the child to stop.  This function should only
be employed if <code>WIFSTOPPED</code> returned true. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWIFEXITED.html#doc_002dWIFEXITED">WIFEXITED</a>, <a href="doc_002dWEXITSTATUS.html#doc_002dWEXITSTATUS">WEXITSTATUS</a>, <a href="doc_002dWIFSIGNALED.html#doc_002dWIFSIGNALED">WIFSIGNALED</a>, <a href="doc_002dWTERMSIG.html#doc_002dWTERMSIG">WTERMSIG</a>, <a href="doc_002dWCOREDUMP.html#doc_002dWCOREDUMP">WCOREDUMP</a>, <a href="doc_002dWIFSTOPPED.html#doc_002dWIFSTOPPED">WIFSTOPPED</a>, <a href="doc_002dWIFCONTINUED.html#doc_002dWIFCONTINUED">WIFCONTINUED</a>. 
</p></blockquote></div>

<!-- WTERMSIG src/syscalls.cc -->
   <p><a name="doc_002dWTERMSIG"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WTERMSIG</b> (<var>status</var>)<var><a name="index-WTERMSIG-3277"></a></var><br>
<blockquote><p>Given <var>status</var> from a call to <code>waitpid</code>, return the number of
the signal that caused the child process to terminate.  This function
should only be employed if <code>WIFSIGNALED</code> returned true. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWIFEXITED.html#doc_002dWIFEXITED">WIFEXITED</a>, <a href="doc_002dWEXITSTATUS.html#doc_002dWEXITSTATUS">WEXITSTATUS</a>, <a href="doc_002dWIFSIGNALED.html#doc_002dWIFSIGNALED">WIFSIGNALED</a>, <a href="doc_002dWCOREDUMP.html#doc_002dWCOREDUMP">WCOREDUMP</a>, <a href="doc_002dWIFSTOPPED.html#doc_002dWIFSTOPPED">WIFSTOPPED</a>, <a href="doc_002dWSTOPSIG.html#doc_002dWSTOPSIG">WSTOPSIG</a>, <a href="doc_002dWIFCONTINUED.html#doc_002dWIFCONTINUED">WIFCONTINUED</a>. 
</p></blockquote></div>

<!-- WUNTRACED src/syscalls.cc -->
   <p><a name="doc_002dWUNTRACED"></a>

<div class="defun">
&mdash; Built-in Function:  <b>WUNTRACED</b> ()<var><a name="index-WUNTRACED-3278"></a></var><br>
<blockquote><p>Return the numerical value of the option argument that may be
passed to <code>waitpid</code> to indicate that it should also return
if the child process has stopped but is not traced via the
<code>ptrace</code> system call
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dwaitpid.html#doc_002dwaitpid">waitpid</a>, <a href="doc_002dWNOHANG.html#doc_002dWNOHANG">WNOHANG</a>, <a href="doc_002dWCONTINUE.html#doc_002dWCONTINUE">WCONTINUE</a>. 
</p></blockquote></div>

<!-- fcntl src/syscalls.cc -->
   <p><a name="doc_002dfcntl"></a>

<div class="defun">
&mdash; Built-in Function: [<var>err</var>, <var>msg</var>] = <b>fcntl</b> (<var>fid, request, arg</var>)<var><a name="index-fcntl-3279"></a></var><br>
<blockquote><p>Change the properties of the open file <var>fid</var>.  The following values
may be passed as <var>request</var>:

          <dl>
<dt><code>F_DUPFD</code><a name="index-F_005fDUPFD-3280"></a><dd>Return a duplicate file descriptor.

          <br><dt><code>F_GETFD</code><a name="index-F_005fGETFD-3281"></a><dd>Return the file descriptor flags for <var>fid</var>.

          <br><dt><code>F_SETFD</code><a name="index-F_005fSETFD-3282"></a><dd>Set the file descriptor flags for <var>fid</var>.

          <br><dt><code>F_GETFL</code><a name="index-F_005fGETFL-3283"></a><dd>Return the file status flags for <var>fid</var>.  The following codes may be
returned (some of the flags may be undefined on some systems).

               <dl>
<dt><code>O_RDONLY</code><a name="index-O_005fRDONLY-3284"></a><dd>Open for reading only.

               <br><dt><code>O_WRONLY</code><a name="index-O_005fWRONLY-3285"></a><dd>Open for writing only.

               <br><dt><code>O_RDWR</code><a name="index-O_005fRDWR-3286"></a><dd>Open for reading and writing.

               <br><dt><code>O_APPEND</code><a name="index-O_005fAPPEND-3287"></a><dd>Append on each write.

               <br><dt><code>O_CREAT</code><a name="index-O_005fCREAT-3288"></a><dd>Create the file if it does not exist.

               <br><dt><code>O_NONBLOCK</code><a name="index-O_005fNONBLOCK-3289"></a><dd>Non-blocking mode.

               <br><dt><code>O_SYNC</code><a name="index-O_005fSYNC-3290"></a><dd>Wait for writes to complete.

               <br><dt><code>O_ASYNC</code><a name="index-O_005fASYNC-3291"></a><dd>Asynchronous I/O. 
</dl>

          <br><dt><code>F_SETFL</code><a name="index-F_005fSETFL-3292"></a><dd>Set the file status flags for <var>fid</var> to the value specified by
<var>arg</var>.  The only flags that can be changed are <code>O_APPEND</code><!-- /@w --> and
<code>O_NONBLOCK</code><!-- /@w -->. 
</dl>

        <p>If successful, <var>err</var> is 0 and <var>msg</var> is an empty string. 
Otherwise, <var>err</var> is nonzero and <var>msg</var> contains a
system-dependent error message. 
</p></blockquote></div>

<!-- kill src/syscalls.cc -->
   <p><a name="doc_002dkill"></a>

<div class="defun">
&mdash; Built-in Function: [<var>err</var>, <var>msg</var>] = <b>kill</b> (<var>pid, sig</var>)<var><a name="index-kill-3293"></a></var><br>
<blockquote><p>Send signal <var>sig</var> to process <var>pid</var>.

        <p>If <var>pid</var> is positive, then signal <var>sig</var> is sent to <var>pid</var>.

        <p>If <var>pid</var> is 0, then signal <var>sig</var> is sent to every process
in the process group of the current process.

        <p>If <var>pid</var> is -1, then signal <var>sig</var> is sent to every process
except process 1.

        <p>If <var>pid</var> is less than -1, then signal <var>sig</var> is sent to every
process in the process group <var>-pid</var>.

        <p>If <var>sig</var> is 0, then no signal is sent, but error checking is still
performed.

        <p>Return 0 if successful, otherwise return -1. 
</p></blockquote></div>

<!-- SIG src/sighandlers.cc -->
   <p><a name="doc_002dSIG"></a>

<div class="defun">
&mdash; Built-in Function:  <b>SIG</b> ()<var><a name="index-SIG-3294"></a></var><br>
<blockquote><p>Return a structure containing Unix signal names and their defined values. 
</p></blockquote></div>

   </body></html>