<p>Use the <code class="code">man</code> command in your shell to get information about these functions.</p>
<p>For each of these functions there is a corresponding <strong class="pkg">GAP</strong> global function with the prefix <code class="code">IO_</code> before its name. Apart from minor differences (see below) they take exactly the same arguments as their C counterparts. Strings must be specified as <strong class="pkg">GAP</strong> strings and integers as <strong class="pkg">GAP</strong> immediate integers. Return values are in general the same as for the C counterparts. However, an error condition is indicated by the value <code class="code">fail</code> instead of -1, and if the result can only be success or failure, <code class="code">true</code> indicates success.</p>
<p>All errors are reported via the <code class="func">LastSystemError</code> (<a href="../../../doc/ref/chap9_mj.html#X87D278437A916905"><span class="RefLink">Reference: LastSystemError</span></a>) function.</p>
<p>In the C library a lot of integers are defined as macros in header files. All the necessary values for the above functions are bound to their name in the global <code class="code">IO</code> record.</p>
<p><em>Warning:</em> Existence of many of these functions and constants is platform dependent. The compilation process checks existence and this leads to the situation that on the <strong class="pkg">GAP</strong> levels the functions and constants are there or not. If you want to develop platform independent <strong class="pkg">GAP</strong> code using this package, then you have to check for existence of the functions and constants you need.</p>
<h4>3.1 <span class="Heading">Differences in arguments - an overview</span></h4>
<p>The <code class="code">open</code> function has to be called with three arguments. The version with two arguments is not available on the <strong class="pkg">GAP</strong> level.</p>
<p>The <code class="code">read</code> function takes four arguments: <var class="Arg">fd</var> is an integer file descriptor, <var class="Arg">st</var> is a <strong class="pkg">GAP</strong> string, <var class="Arg">offset</var> is an offset within this string (zero based), and <var class="Arg">count</var> is the maximal number of bytes to read. The data is read and stored into the string <var class="Arg">st</var>, starting at position <span class="SimpleMath">\(\textit{offset}+1\)</span>. The string <var class="Arg">st</var> is made long enough, such that <var class="Arg">count</var> bytes would fit into it, beginning at position <span class="SimpleMath">\(\textit{offset}+1\)</span>. The number of bytes read is returned or <code class="code">fail</code> in case of an error.</p>
<p>The <code class="code">write</code> function is similar, it also takes four arguments: <var class="Arg">fd</var> is an integer file descriptor, <var class="Arg">st</var> is a <strong class="pkg">GAP</strong> string, <var class="Arg">offset</var> is an offset within this string (zero based), and <var class="Arg">count</var> is the number of bytes to write, starting from position <span class="SimpleMath">\(\textit{offset}+1\)</span> in the string <var class="Arg">st</var>. The number of bytes written is returned, or a <code class="code">fail</code> in case of an error.</p>
<p>The <code class="code">opendir</code> function only returns <code class="code">true</code> or <code class="code">fail</code>.</p>
<p>The <code class="code">readdir</code> function takes no argument. It reads the directory that was specified in the last call to <code class="code">opendir</code>. It just returns a string, which is the name of a file or subdirectory in the corresponding directory. It returns <code class="code">false</code> after the last file name in the directory or <code class="code">fail</code> in case of an error.</p>
<p>The <code class="code">closedir</code> function takes no argument. It should be called after <code class="code">readdir</code> returned <code class="code">false</code> or <code class="code">fail</code> to avoid excessive use of file descriptors.</p>
<p>The functions <code class="code">stat</code>, <code class="code">fstat</code>, and <code class="code">lstat</code> only take one argument and return a <strong class="pkg">GAP</strong> record that has the same entries as a <code class="code">struct stat</code>.</p>
<p>The function <code class="code">socket</code> can optionally take a string as third argument. In that case it automatically calls <code class="code">getprotobyname</code> to look up the protocol name.</p>
<p>The functions <code class="code">bind</code> and <code class="code">connect</code> take only one string argument as address field, because the string already encodes the length.</p>
<p>There are two convenience functions <code class="func">IO_make_sockaddr_in</code> (<a href="chap3_mj.html#X878007A67E806CEF"><span class="RefLink">3.3-1</span></a>) and <code class="func">IO_MakeIPAddressPort</code> (<a href="chap4_mj.html#X8568CE6684C90CE5"><span class="RefLink">4.3-6</span></a>) to create such addresses. The first takes two arguments <var class="Arg">addr</var> and <var class="Arg">port</var>, where <var class="Arg">addr</var> is a string of length 4, containing the 4 bytes of the IP address and <var class="Arg">port</var> is a port number as <strong class="pkg">GAP</strong> integer. The function <code class="func">IO_MakeIPAddressPort</code> (<a href="chap4_mj.html#X8568CE6684C90CE5"><span class="RefLink">4.3-6</span></a>) takes the same arguments, but the first can be a string containing an IP address in dot notation like <q>137.226.152.77</q> or a hostname to be looked up.</p>
<p>The <code class="code">setsockopt</code> function has no argument <var class="Arg">optlen</var>. The length of the string <var class="Arg">optval</var> is taken.</p>
<p>The <code class="code">select</code> function works as the function <code class="code">UNIXSelect</code> in the <strong class="pkg">GAP</strong> library.</p>
<p>As of now, the file locking mechanisms of <code class="code">fcntl</code> using <code class="code">struct flock</code> are not yet implemented on the <strong class="pkg">GAP</strong> level.</p>
<h4>3.2 <span class="Heading">The low-level functions in detail</span></h4>
<p>Nearly all of this functions return an integer result in the C library. On the <strong class="pkg">GAP</strong> level this is either returned as a non-negative integer in case of success or as <code class="keyw">fail</code> in case of an error (where on the C level <span class="SimpleMath">\(-1\)</span> would be returned). If the integer can only be <span class="SimpleMath">\(0\)</span> for <q>no error</q> this is changed to <code class="keyw">true</code> on the <strong class="pkg">GAP</strong> level.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_accept</code>( <var class="Arg">fd</var>, <var class="Arg">addr</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Accepts an incoming network connection. For details see <q><code class="code">man 2 accept</code></q>. The argument <var class="Arg">addr</var> can be made with <code class="func">IO_make_sockaddr_in</code> (<a href="chap3_mj.html#X878007A67E806CEF"><span class="RefLink">3.3-1</span></a>) and contains its length such that no third argument is necessary.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_bind</code>( <var class="Arg">fd</var>, <var class="Arg">my_addr</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Binds a local address to a socket. For details see <q><code class="code">man 2 bind</code></q>. The argument <var class="Arg">my_addr</var> can be made with <code class="func">IO_make_sockaddr_in</code> (<a href="chap3_mj.html#X878007A67E806CEF"><span class="RefLink">3.3-1</span></a>) and contains its length such that no third argument is necessary.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_closedir</code>( )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">fail</code></p>
<p>Closes a directory. For details see <q><code class="code">man 3 closedir</code></q>. Has no arguments, because we only have one <code class="code">DIR</code> struct in the C part.</p>
<p>Connects to a remote socket. For details see <q><code class="code">man 2 connect</code></q>. The argument <var class="Arg">serv_addr</var> can be made with <code class="func">IO_make_sockaddr_in</code> (<a href="chap3_mj.html#X878007A67E806CEF"><span class="RefLink">3.3-1</span></a>) and contains its length such that no third argument is necessary.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_execv</code>( <var class="Arg">path</var>, <var class="Arg">argv</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: <code class="keyw">fail</code> or does not return</p>
<p>Replaces the process with another process. For details see <q><code class="code">man 3 execv</code></q>. The argument <var class="Arg">argv</var> is a list of strings. The called program does not have to be the first argument in this list.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_execve</code>( <var class="Arg">path</var>, <var class="Arg">argv</var>, <var class="Arg">envp</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: <code class="keyw">fail</code> or does not return</p>
<p>Replaces the process with another process. For details see <q><code class="code">man 3 execve</code></q>. The arguments <var class="Arg">argv</var> and <var class="Arg">envp</var> are both lists of strings. The called program does not have to be the first argument in <var class="Arg">argv</var>. The list <var class="Arg">envp</var> can be made with <code class="func">IO_MakeEnvList</code> (<a href="chap4_mj.html#X7CF3DB5081A91600"><span class="RefLink">4.3-8</span></a>) from a record acquired from <code class="func">IO_Environment</code> (<a href="chap4_mj.html#X7F9AAE018474E1D8"><span class="RefLink">4.3-7</span></a>) and modified later.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_execvp</code>( <var class="Arg">path</var>, <var class="Arg">argv</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: <code class="keyw">fail</code> or does not return</p>
<p>Replaces the process with another process. For details see <q><code class="code">man 3 execvp</code></q>. The argument <var class="Arg">argv</var> is a list of strings. The called program does not have to be the first argument in this list.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_exit</code>( <var class="Arg">status</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Stops process immediately with return code <var class="Arg">status</var>. For details see <q><code class="code">man 2 exit</code></q>. The argument <var class="Arg">status</var> must be an integer. Does not return.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_fork</code>( )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Forks off a child process, which is an identical copy. For details see <q><code class="code">man 2 fork</code></q>. Note that <code class="func">IO_fork</code> activates our SIGCHLD handler (see <code class="func">IO_InstallSIGCHLDHandler</code> (<a href="chap3_mj.html#X8383E62D86BE30C6"><span class="RefLink">3.3-3</span></a>)). Note that you must use the <code class="func">IO_WaitPid</code> (<a href="chap3_mj.html#X80737A008450184F"><span class="RefLink">3.2-66</span></a>) function to wait or check for the termination of child processes, or call <code class="func">IO_IgnorePid</code> (<a href="chap3_mj.html#X84295FC77CCB1066"><span class="RefLink">3.2-67</span></a>) to ignore the child.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_fstat</code>( <var class="Arg">fd</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: a record or <code class="keyw">fail</code></p>
<p>Returns the file meta data for an opened file. For details see <q><code class="code">man 2 fstat</code></q>. A <strong class="pkg">GAP</strong> record is returned with the same entries than a <code class="code">struct stat</code>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_getenv</code>( <var class="Arg">name</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: a string or <code class="keyw">fail</code></p>
<p>Return the current value of the environment variable <var class="Arg">name</var>. If the variable is not in the current environment, <code class="code">fail</code> is returned. For details see <q><code class="code">man 3 getenv</code></q>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_gethostbyname</code>( <var class="Arg">name</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: a record or <code class="keyw">fail</code></p>
<p>Return host information by name. For details see <q><code class="code">man 3 gethostbyname</code></q>. A <strong class="pkg">GAP</strong> record is returned with all the relevant information about the host.</p>
<p>Get a socket option. For details see <q><code class="code">man 2 getsockopt</code></q>. Note that the argument <var class="Arg">optval</var> carries its length around, such that no 5th argument is necessary.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_gettimeofday</code>( )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: A record with components <code class="code">tv_sec</code> and <code class="code">tv_usec</code></p>
<p>This returns the time elapsed since 1.1.1970, 0:00 GMT. The component <code class="code">tv_sec</code> contains the number of full seconds and the number <code class="code">tv_usec</code> the additional microseconds.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_gmtime</code>( <var class="Arg">seconds</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: A record</p>
<p>The argument is the number of seconds that have elapsed since 1.1.1970, 0:00 GMT. The result is a record with the current Greenwich mean time broken down into date and time as in the C-library function <code class="code">gmtime</code>.</p>
<p>Sends the signal <var class="Arg">sig</var> to the process with process ID <var class="Arg">pid</var>. For details see <q><code class="code">man 2 kill</code></q>. The signal numbers available can be found in the global <code class="code">IO</code> record with names like <code class="code">SIGTERM</code>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_localtime</code>( <var class="Arg">seconds</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: A record</p>
<p>The argument is the number of seconds that have elapsed since 1.1.1970, 0:00 GMT. The result is a record with the current local time broken down into date and time as in the C-library function <code class="code">localtime</code>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_lstat</code>( <var class="Arg">name</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: a record or <code class="keyw">fail</code></p>
<p>Returns the file meta data for a file not following links. For details see <q><code class="code">man 2 lstat</code></q>. A <strong class="pkg">GAP</strong> record is returned with the same entries than a <code class="code">struct stat</code>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_open</code>( <var class="Arg">pathname</var>, <var class="Arg">flags</var>, <var class="Arg">mode</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Open and possibly create a file or device. For details see <q><code class="code">man 2 open</code></q>. Only the variant with 3 arguments can be used.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_opendir</code>( <var class="Arg">name</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">false</code></p>
<p>Opens a directory. For details see <q><code class="code">man 3 opendir</code></q>. Note that only <code class="keyw">true</code> is returned if everything is OK, since only one <code class="code">DIR</code> struct is stored on the C level and thus only one directory can be open at any time.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_pipe</code>( )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: a record or <code class="keyw">fail</code></p>
<p>Create a pair of file descriptors with a pipe between them. For details see <q><code class="code">man 2 pipe</code></q>. Note that no arguments are needed. The result is either <code class="keyw">fail</code> in case of an error or a record with two components <code class="code">toread</code> and <codeclass="code">towrite</code> bound to the two filedescriptors for reading and writing respectively.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_read</code>( <var class="Arg">fd</var>, <var class="Arg">st</var>, <var class="Arg">offset</var>, <varclass="Arg">count</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Reads from file descriptor. For details see <q><code class="code">man 2 read</code></q>. Note that there is one more argument <var class="Arg">offset</var> to specify at which position in the string <var class="Arg">st</var> the read data should be stored. Note that <var class="Arg">offset</var> zero means at the beginning of the string, which is position 1 in <strong class="pkg">GAP</strong>. The number of bytes read or <code class="keyw">fail</code> in case of an error is returned.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_readdir</code>( )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: a string or <code class="keyw">fail</code> or <code class="keyw">false</code></p>
<p>Reads from a directory. For details see <q><code class="code">man 2 readdir</code></q>. Note that no argument is required as we have only one <code class="code">DIR</code> struct on the C level. If the directory is read completely <code class="keyw">false</code> is returned, and otherwise a string. An error is indicated by <code class="keyw">fail</code>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_readlink</code>( <var class="Arg">path</var>, <var class="Arg">buf</var>, <var class="Arg">bufsize</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Reads the value of a symbolic link. For details see <q><code class="code">man 2 readlink</code></q>. <var class="Arg">buf</var> is modified. The new length of <var class="Arg">buf</var> is returned or <code class="keyw">fail</code> in case of an error.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_recv</code>( <var class="Arg">fd</var>, <var class="Arg">st</var>, <var class="Arg">offset</var>, <varclass="Arg">len</var>, <var class="Arg">flags</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Receives data from a socket. For details see <q><code class="code">man 2 recv</code></q>. Note the additional argument <var class="Arg">offset</var> which plays the same role as for the <code class="func">IO_read</code> (<a href="chap3_mj.html#X84F3D862836BF17C"><span class="RefLink">3.2-46</span></a>) function.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_recvfrom</code>( <var class="Arg">fd</var>, <var class="Arg">st</var>, <var class="Arg">offset</var>, <var class="Arg">len</var>, <var class="Arg">flags</var>, <var class="Arg">addr</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Receives data from a socket with given address. For details see <q><code class="code">man 2 recvfrom</code></q>. Note the additional argument <var class="Arg">offset</var> which plays the same role as for the <code class="func">IO_read</code> (<a href="chap3_mj.html#X84F3D862836BF17C"><span class="RefLink">3.2-46</span></a>) function. The argument <var class="Arg">addr</var> can be made with <code class="func">IO_make_sockaddr_in</code> (<a href="chap3_mj.html#X878007A67E806CEF"><span class="RefLink">3.3-1</span></a>) and contains its length such that no 7th argument is necessary.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_rewinddir</code>( )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">fail</code></p>
<p>Rewinds a directory. For details see <q><code class="code">man 2 rewinddir</code></q>. Note that no argument is required as we have only one <code class="code">DIR</code> struct on the C level. Returns <code class="keyw">fail</code> only, if no prior <code class="func">IO_opendir</code> (<a href="chap3_mj.html#X78E234797EB01883"><span class="RefLink">3.2-44</span></a>) command has been called.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_seekdir</code>( <var class="Arg">offset</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">fail</code></p>
<p>Sets the position of the next readdir call. For details see <q><code class="code">man 3 seekdir</code></q>. Note that no second argument is required as we have only one <code class="code">DIR</code> struct on the C level.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_select</code>( <var class="Arg">inlist</var>, <var class="Arg">outlist</var>, <var class="Arg">exclist</var>, <var class="Arg">timeoutsec</var>, <var class="Arg">timeoutusec</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Used for I/O multiplexing. For details see <q><code class="code">man 2 select</code></q>. <var class="Arg">inlist</var>, <var class="Arg">outlist</var> and <var class="Arg">exclist</var> are lists of filedescriptors, which are modified. If the corresponding file descriptor is not yet ready, it is replaced by <code class="keyw">fail</code>. The timeout values <var class="Arg">timeoutsec</var> and <var class="Arg">timeoutusec</var> correspond to the usual arguments of <code class="code">select</code>, if both are immediate integers, they are set, otherwise <code class="code">select</code> is called with no timeout value.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_send</code>( <var class="Arg">fd</var>, <var class="Arg">st</var>, <var class="Arg">offset</var>, <varclass="Arg">len</var>, <var class="Arg">flags</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Sends data to a socket. For details see <q><code class="code">man 2 send</code></q>. Note that the additional argument <var class="Arg">offset</var> specifies the position of the data to send within the string <var class="Arg">st</var>. It is zero based, meaning that zero indicates the start of the string, which is position 1 in <strong class="pkg">GAP</strong>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_sendto</code>( <var class="Arg">fd</var>, <var class="Arg">st</var>, <var class="Arg">offset</var>, <var class="Arg">len</var>, <var class="Arg">flags</var>, <var class="Arg">addr</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Sends data to a socket. For details see <q><code class="code">man 2 sendto</code></q>. Note that the additional argument <var class="Arg">offset</var> specifies the position of the data to send within the string <var class="Arg">st</var>. It is zero based, meaning that zero indicates the start of the string, which is position 1 in <strong class="pkg">GAP</strong>. The argument <var class="Arg">addr</var> can be made with <code class="func">IO_make_sockaddr_in</code> (<a href="chap3_mj.html#X878007A67E806CEF"><span class="RefLink">3.3-1</span></a>) and contains its length such that no 7th argument is necessary.</p>
<p>Set the current value of the environment variable <var class="Arg">name</var> to <var class="Arg">value</var> if it has either not been set before, or <var class="Arg">overwrite</var> is <code class="code">true</code>. For details see <q><code class="code">man 3 setenv</code></q>.</p>
<p>Sets a socket option. For details see <q><code class="code">man 2 setsockopt</code></q>. Note that the argument <var class="Arg">optval</var> carries its length around, such that no 5th argument is necessary.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_socket</code>( <var class="Arg">domain</var>, <var class="Arg">type</var>, <var class="Arg">protocol</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Creates a socket, an endpoint for communication. For details see <q><code class="code">man 2 socket</code></q>. There is one little special: On systems that have <code class="code">getprotobyname</code> you can pass a string as third argument <var class="Arg">protocol</var> which is automatically looked up by <code class="code">getprotobyname</code>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_stat</code>( <var class="Arg">pathname</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: a record or <code class="keyw">fail</code></p>
<p>Returns the file metadata for the file <var class="Arg">pathname</var>. For details see <q><code class="code">man 2 stat</code></q>. A <strong class="pkg">GAP</strong> record is returned with the same entries than a <code class="code">struct stat</code>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_telldir</code>( )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: an integer or <code class="keyw">fail</code></p>
<p>Return current location in directory. For details see <q><code class="code">man 3 telldir</code></q>. Note that no second argument is required as we have only one <code class="code">DIR</code> struct on the C level.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IO_WaitPid</code>( <var class="Arg">pid</var>, <var class="Arg">wait</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: a record or <code class="keyw">fail</code> or <code class="keyw">false</code></p>
<p>Waits for the termination of a child process. For details see <q><code class="code">man 2 waitpid</code></q>. The first argument must be a process id, otherwise the function immediately exits with <code class="keyw">fail</code> as return value.</p>
<p>The second argument <var class="Arg">wait</var> must be either <code class="keyw">true</code> or <code class="keyw">false</code>. In the first case, the call blocks until new information about a terminated child process is available. In the second case no such waiting is performed, the call returns immediately. If the child process has not yet terminated, returns <code class="keyw">false</code>; otherwise, returns a <strong class="pkg">GAP</strong> record describing the PID, the return value of waitpid, if the process exited normally and the exit status of the process.</p>
<p>See <code class="func">IO_fork</code> (<a href="chap3_mj.html#X86C819F37D07ECF7"><span class="RefLink">3.2-19</span></a>). If you do not care about the return value of the process, call <code class="func">IO_IgnorePid</code> (<a href="chap3_mj.html#X84295FC77CCB1066"><span class="RefLink">3.2-67</span></a>).</p>
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.98Bemerkung:
Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.