  
  [1X3. Functions directly available from the C library[0X
  
  The  following  functions  from  the  C  library  are  made available as [5XGAP[0X
  functions:
  
  [10Xaccept[0X,  [10Xbind[0X,  [10Xchdir[0X,  [10Xchmod[0X,  [10Xchown[0X, [10Xclose[0X, [10Xclosedir[0X, [10Xconnect[0X, [10Xcreat[0X, [10Xdup[0X,
  [10Xdup2[0X,  [10Xexecv[0X,  [10Xexecve[0X,  [10Xexecvp[0X,  [10Xexit[0X,  [10Xfchmod[0X,  [10Xfchown[0X, [10Xfcntl[0X, [10Xfork[0X, [10Xfstat[0X,
  [10Xgethostbyname[0X,  [10Xgetpid[0X,  [10Xgetppid[0X,  [10Xgetsockopt[0X,  [10Xkill[0X,  [10Xlchown[0X, [10Xlink[0X, [10Xlisten[0X,
  [10Xlseek[0X,  [10Xlstat[0X,  [10Xmkdir[0X,  [10Xmkfifo[0X,  [10Xmknod[0X,  [10Xopen[0X, [10Xopendir[0X, [10Xpipe[0X, [10Xread[0X, [10Xreaddir[0X,
  [10Xreadlink[0X,  [10Xrecv[0X,  [10Xrecvfrom[0X, [10Xrename[0X, [10Xrewinddir[0X, [10Xrmdir[0X, [10Xseekdir[0X, [10Xselect[0X, [10Xsend[0X,
  [10Xsendto[0X, [10Xsetsockopt[0X, [10Xsocket[0X, [10Xstat[0X, [10Xsymlink[0X, [10Xtelldir[0X, [10Xunlink[0X, [10Xwrite[0X.
  
  Use the [10Xman[0X command in your shell to get information about these functions.
  
  For  each  of  these  functions there is a corresponding [5XGAP[0X global function
  with  the  prefix  [10XIO_[0X  before  its  name. Apart from minor differences (see
  below) they take exactly the same arguments as their C counterparts. Strings
  must  be  specified  as  [5XGAP[0X strings and integers as [5XGAP[0X immediate integers.
  Return values are in general the same as for the C counterparts. However, an
  error  condition  is  indicated  by the value [10Xfail[0X instead of -1, and if the
  result can only be success or failure, [10Xtrue[0X indicates success.
  
  All errors are reported via the [2XLastSystemError[0X ([14XReference: LastSystemError[0X)
  function.
  
  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 [10XIO[0X record.
  
  [13XWarning:[0X  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 [5XGAP[0X levels the functions and constants are there or
  not.  If  you  want  to  develop  platform  independent  [5XGAP[0X code using this
  package, then you have to check for existence of the functions and constants
  you need.
  
  
  [1X3.1 Differences in arguments - an overview[0X
  
  The  [10Xopen[0X  function  has to be called with three arguments. The version with
  two arguments is not available on the [5XGAP[0X level.
  
  The [10Xread[0X function takes four arguments: [3Xfd[0X is an integer file descriptor, [3Xst[0X
  is  a  [5XGAP[0X  string, [3Xoffset[0X is an offset within this string (zero based), and
  [3Xcount[0X  is  the  maximal number of bytes to read. The data is read and stored
  into  the  string  [3Xst[0X,  starting at position [3Xoffset[0X+1. The string [3Xst[0X is made
  long  enough, such that [3Xcount[0X bytes would fit into it, beginning at position
  [3Xoffset[0X+1. The number of bytes read is returned or [10Xfail[0X in case of an error.
  
  The  [10Xwrite[0X  function  is  similar,  it  also  takes four arguments: [3Xfd[0X is an
  integer file descriptor, [3Xst[0X is a [5XGAP[0X string, [3Xoffset[0X is an offset within this
  string  (zero  based),  and  [3Xcount[0X is the number of bytes to write, starting
  from  position  [3Xoffset[0X+1  in  the  string [3Xst[0X. The number of bytes written is
  returned, or a [10Xfail[0X in case of an error.
  
  The [10Xopendir[0X function only returns [10Xtrue[0X or [10Xfail[0X.
  
  The  [10Xreaddir[0X  function  takes  no  argument. It reads the directory that was
  specified  in  the  last call to [10Xopendir[0X. It just returns a string, which is
  the  name  of  a  file  or  subdirectory  in the corresponding directory. It
  returns  [10Xfalse[0X  after the last file name in the directory or [10Xfail[0X in case of
  an error.
  
  The  [10Xclosedir[0X  function takes no argument. It should be called after [10Xreaddir[0X
  returned [10Xfalse[0X or [10Xfail[0X to avoid excessive use of file descriptors.
  
  The functions [10Xstat[0X, [10Xfstat[0X, and [10Xlstat[0X only take one argument and return a [5XGAP[0X
  record that has the same entries as a [10Xstruct stat[0X.
  
  The  function [10Xsocket[0X can optionally take a string as third argument. In that
  case it automatically calls [10Xgetprotobyname[0X to look up the protocol name.
  
  The  functions  [10Xbind[0X  and  [10Xconnect[0X  take only one string argument as address
  field, because the string already encodes the length.
  
  There   are   two  convenience  functions  [2XIO_make_sockaddr_in[0X  ([14X3.3-1[0X)  and
  [2XIO_MakeIPAddressPort[0X  ([14X4.3-5[0X)  to create such addresses. The first takes two
  arguments  [3Xaddr[0X and [3Xport[0X, where [3Xaddr[0X is a string of length 4, containing the
  4  bytes  of  the  IP  address and [3Xport[0X is a port number as [5XGAP[0X integer. The
  function  [2XIO_MakeIPAddressPort[0X  ([14X4.3-5[0X)  takes  the  same arguments, but the
  first  can  be  a  string  containing  an  IP  address  in dot notation like
  "137.226.152.77".
  
  The  [10Xsetsockopt[0X  function  has  no argument [3Xoptlen[0X. The length of the string
  [3Xoptval[0X is taken.
  
  The [10Xselect[0X function works as the function [10XUNIXSelect[0X in the [5XGAP[0X library.
  
  As  of  now, the file locking mechanisms of [10Xfcntl[0X using [10Xstruct flock[0X are not
  yet implemented on the [5XGAP[0X level.
  
  
  [1X3.2 The low-level functions in detail[0X
  
  Nearly  all  of this functions return an integer result in the C library. On
  the  [5XGAP[0X  level this is either returned as a non-negative integer in case of
  success  or  as  [9Xfail[0X  in case of an error (where on the C level -1 would be
  returned).  If  the  integer can only be 0 for "no error" this is changed to
  [9Xtrue[0X on the [5XGAP[0X level.
  
  [1X3.2-1 IO_accept[0X
  
  [2X> IO_accept( [0X[3Xfd, addr[0X[2X ) ____________________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Accepts  an incoming network connection. For details see "[10Xman 2 accept[0X". The
  argument  [3Xaddr[0X can be made with [2XIO_make_sockaddr_in[0X ([14X3.3-1[0X) and contains its
  length such that no third argument is necessary.
  
  [1X3.2-2 IO_bind[0X
  
  [2X> IO_bind( [0X[3Xfd, my_addr[0X[2X ) ___________________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Binds  a  local  address  to  a  socket.  For  details see "[10Xman 2 bind[0X". The
  argument  [3Xmy_addr[0X  can be made with [2XIO_make_sockaddr_in[0X ([14X3.3-1[0X) and contains
  its length such that no third argument is necessary.
  
  [1X3.2-3 IO_chdir[0X
  
  [2X> IO_chdir( [0X[3Xpath[0X[2X ) _________________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Changes the current working directory. For details see "[10Xman 2 chdir[0X".
  
  [1X3.2-4 IO_chmod[0X
  
  [2X> IO_chmod( [0X[3Xpathname, mode[0X[2X ) _______________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Changes the mode of a file. For details see "[10Xman 2 chmod[0X".
  
  [1X3.2-5 IO_chown[0X
  
  [2X> IO_chown( [0X[3Xpath, owner, group[0X[2X ) ___________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Sets owner and/or group of file. For details see "[10Xman 2 chown[0X".
  
  [1X3.2-6 IO_close[0X
  
  [2X> IO_close( [0X[3Xfd[0X[2X ) ___________________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Closes a file descriptor. For details see "[10Xman 2 close[0X".
  
  [1X3.2-7 IO_closedir[0X
  
  [2X> IO_closedir( [0X[3X[0X[2X ) __________________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Closes  a  directory.  For  details  see "[10Xman 3 closedir[0X". Has no arguments,
  because we only have one [10XDIR[0X struct in the C part.
  
  [1X3.2-8 IO_connect[0X
  
  [2X> IO_connect( [0X[3Xfd, serv_addr[0X[2X ) ______________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Connects  to  a remote socket. For details see "[10Xman 2 connect[0X". The argument
  [3Xserv_addr[0X  can  be  made  with  [2XIO_make_sockaddr_in[0X ([14X3.3-1[0X) and contains its
  length such that no third argument is necessary.
  
  [1X3.2-9 IO_creat[0X
  
  [2X> IO_creat( [0X[3Xpathname, mode[0X[2X ) _______________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Creates a new file. For details see "[10Xman 2 creat[0X".
  
  [1X3.2-10 IO_dup[0X
  
  [2X> IO_dup( [0X[3Xoldfd[0X[2X ) __________________________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Duplicates a file descriptor. For details see "[10Xman 2 dup[0X".
  
  [1X3.2-11 IO_dup2[0X
  
  [2X> IO_dup2( [0X[3Xoldfd, newfd[0X[2X ) __________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Duplicates a file descriptor to a new one. For details see "[10Xman 2 dup2[0X".
  
  [1X3.2-12 IO_execv[0X
  
  [2X> IO_execv( [0X[3Xpath, argv[0X[2X ) ___________________________________________[0Xfunction
  [6XReturns:[0X  [9Xfail[0X or does not return
  
  Replaces  the  process  with another process. For details see "[10Xman 3 execv[0X".
  The  argument [3Xargv[0X is a list of strings. The called program does not have to
  be the first argument in this list.
  
  [1X3.2-13 IO_execve[0X
  
  [2X> IO_execve( [0X[3Xpath, argv, envp[0X[2X ) ____________________________________[0Xfunction
  [6XReturns:[0X  [9Xfail[0X or does not return
  
  Replaces  the  process with another process. For details see "[10Xman 3 execve[0X".
  The  arguments  [3Xargv[0X  and [3Xenvp[0X are both lists of strings. The called program
  does  not  have  to be the first argument in [3Xargv[0X. The list [3Xenvp[0X can be made
  with  [2XIO_MakeEnvList[0X  ([14X4.3-7[0X)  from  a  record  acquired from [2XIO_Environment[0X
  ([14X4.3-6[0X) and modified later.
  
  [1X3.2-14 IO_execvp[0X
  
  [2X> IO_execvp( [0X[3Xpath, argv[0X[2X ) __________________________________________[0Xfunction
  [6XReturns:[0X  [9Xfail[0X or does not return
  
  Replaces  the  process with another process. For details see "[10Xman 3 execvp[0X".
  The  argument [3Xargv[0X is a list of strings. The called program does not have to
  be the first argument in this list.
  
  [1X3.2-15 IO_exit[0X
  
  [2X> IO_exit( [0X[3Xstatus[0X[2X ) ________________________________________________[0Xfunction
  
  Stops  process  immediately  with return code [3Xstatus[0X. For details see "[10Xman 2
  exit[0X". The argument [3Xstatus[0X must be an integer. Does not return.
  
  [1X3.2-16 IO_fchmod[0X
  
  [2X> IO_fchmod( [0X[3Xfd, mode[0X[2X ) ____________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Changes mode of an opened file. For details see "[10Xman 2 fchmod[0X".
  
  [1X3.2-17 IO_fchown[0X
  
  [2X> IO_fchown( [0X[3Xfd, owner, group[0X[2X ) ____________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Changes  owner  and/or  group  of  an  opened  file.  For details see "[10Xman 2
  fchown[0X".
  
  [1X3.2-18 IO_fcntl[0X
  
  [2X> IO_fcntl( [0X[3Xfd, cmd, arg[0X[2X ) _________________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Does  various  things  to  control  the  behaviour of a file descriptor. For
  details see "[10Xman 2 fcntl[0X".
  
  [1X3.2-19 IO_fork[0X
  
  [2X> IO_fork( [0X[3X[0X[2X ) ______________________________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Forks  off a child process, which is an identical copy. For details see "[10Xman
  2  fork[0X".  Note  that if you want to use the [2XIO_WaitPid[0X ([14X3.2-55[0X) function to
  wait  or  check for the termination of child processes, you have to activate
  the  SIGCHLD  handler  for  this  package  beforehand  by using the function
  [2XIO_InstallSIGCHLDHandler[0X  ([14X3.3-3[0X).  Note  further that after that you cannot
  use       the       function       [2XInputOutputLocalProcess[0X       ([14XReference:
  InputOutputLocalProcess[0X)  any  more, since its SIGCHLD handler does not work
  any   more.   To   switch  back  to  that  functionality  use  the  function
  [2XIO_RestoreSIGCHLDHandler[0X ([14X3.3-4[0X).
  
  [1X3.2-20 IO_fstat[0X
  
  [2X> IO_fstat( [0X[3Xfd[0X[2X ) ___________________________________________________[0Xfunction
  [6XReturns:[0X  a record or [9Xfail[0X
  
  Returns  the  file  meta  data  for  an  opened file. For details see "[10Xman 2
  fstat[0X". A [5XGAP[0X record is returned with the same entries than a [10Xstruct stat[0X.
  
  [1X3.2-21 IO_gethostbyname[0X
  
  [2X> IO_gethostbyname( [0X[3Xname[0X[2X ) _________________________________________[0Xfunction
  [6XReturns:[0X  a record or [9Xfail[0X
  
  Return  host  information  by name. For details see "[10Xman 3 gethostbyname[0X". A
  [5XGAP[0X record is returned with all the relevant information about the host.
  
  [1X3.2-22 IO_getpid[0X
  
  [2X> IO_getpid( [0X[3X[0X[2X ) ____________________________________________________[0Xfunction
  [6XReturns:[0X  an integer
  
  Returns the process ID of the current process as an integer. For details see
  "[10Xman 2 getpid[0X".
  
  [1X3.2-23 IO_getppid[0X
  
  [2X> IO_getppid( [0X[3X[0X[2X ) ___________________________________________________[0Xfunction
  [6XReturns:[0X  an integer
  
  Returns  the  process ID of the parent of the current process as an integer.
  For details see "[10Xman 2 getppid[0X".
  
  [1X3.2-24 IO_getsockopt[0X
  
  [2X> IO_getsockopt( [0X[3Xfd, level, optname, optval[0X[2X ) ______________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfalse[0X
  
  Get  a  socket  option.  For  details  see "[10Xman 2 getsockopt[0X". Note that the
  argument  [3Xoptval[0X  carries  its  length  around, such that no 5th argument is
  necessary.
  
  [1X3.2-25 IO_kill[0X
  
  [2X> IO_kill( [0X[3Xpid, sig[0X[2X ) ______________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Sends  the  signal  [3Xsig[0X  to the process with process ID [3Xpid[0X. For details see
  "[10Xman  2  kill[0X".  The  signal numbers available can be found in the global [10XIO[0X
  record with names like [10XSIGTERM[0X.
  
  [1X3.2-26 IO_lchown[0X
  
  [2X> IO_lchown( [0X[3Xpath, owner, group[0X[2X ) __________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfalse[0X
  
  Changes  owner  and/or  group of a file not following links. For details see
  "[10Xman 2 lchown[0X".
  
  [1X3.2-27 IO_link[0X
  
  [2X> IO_link( [0X[3Xoldpath, newpath[0X[2X ) ______________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfalse[0X
  
  Create a hard link. For details see "[10Xman 2 link[0X".
  
  [1X3.2-28 IO_listen[0X
  
  [2X> IO_listen( [0X[3Xfd, backlog[0X[2X ) _________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfalse[0X
  
  Switch a socket to listening. For details see "[10Xman 2 listen[0X".
  
  [1X3.2-29 IO_lseek[0X
  
  [2X> IO_lseek( [0X[3Xfd, offset, whence[0X[2X ) ___________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Seeks within an open file. For details see "[10Xman 2 lseek[0X".
  
  [1X3.2-30 IO_lstat[0X
  
  [2X> IO_lstat( [0X[3Xname[0X[2X ) _________________________________________________[0Xfunction
  [6XReturns:[0X  a record or [9Xfail[0X
  
  Returns  the  file meta data for a file not following links. For details see
  "[10Xman  2 lstat[0X". A [5XGAP[0X record is returned with the same entries than a [10Xstruct
  stat[0X.
  
  [1X3.2-31 IO_mkdir[0X
  
  [2X> IO_mkdir( [0X[3Xpathname, mode[0X[2X ) _______________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfalse[0X
  
  Creates a directory. For details see "[10Xman 2 mkdir[0X".
  
  [1X3.2-32 IO_mkfifo[0X
  
  [2X> IO_mkfifo( [0X[3Xpathname, mode[0X[2X ) ______________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfalse[0X
  
  Creates a FIFO special file (a named pipe). For details see "[10Xman 3 mkfifo[0X".
  
  [1X3.2-33 IO_mknod[0X
  
  [2X> IO_mknod( [0X[3Xpathname, mode, dev[0X[2X ) __________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfalse[0X
  
  Create a special or ordinary file. For details see "[10Xman 2 mknod[0X".
  
  [1X3.2-34 IO_open[0X
  
  [2X> IO_open( [0X[3Xpathname, flags, mode[0X[2X ) _________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Open  and  possibly  create  a file or device. For details see "[10Xman 2 open[0X".
  Only the variant with 3 arguments can be used.
  
  [1X3.2-35 IO_opendir[0X
  
  [2X> IO_opendir( [0X[3Xname[0X[2X ) _______________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfalse[0X
  
  Opens  a  directory. For details see "[10Xman 3 opendir[0X". Note that only [9Xtrue[0X is
  returned  if  everything is OK, since only one [10XDIR[0X struct is stored on the C
  level and thus only one directory can be open at any time.
  
  [1X3.2-36 IO_pipe[0X
  
  [2X> IO_pipe( [0X[3X[0X[2X ) ______________________________________________________[0Xfunction
  [6XReturns:[0X  a record or [9Xfail[0X
  
  Create  a pair of file descriptors with a pipe between them. For details see
  "[10Xman  2  pipe[0X". Note that no arguments are needed. The result is either [9Xfail[0X
  in case of an error or a record with two components [10Xtoread[0X and [10Xtowrite[0X bound
  to the two filedescriptors for reading and writing respectively.
  
  [1X3.2-37 IO_read[0X
  
  [2X> IO_read( [0X[3Xfd, st, offset, count[0X[2X ) _________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Reads from file descriptor. For details see "[10Xman 2 read[0X". Note that there is
  one  more  argument [3Xoffset[0X to specify at which position in the string [3Xst[0X the
  read  data should be stored. Note that [3Xoffset[0X zero means at the beginning of
  the  string, which is position 1 in [5XGAP[0X. The number of bytes read or [9Xfail[0X in
  case of an error is returned.
  
  [1X3.2-38 IO_readdir[0X
  
  [2X> IO_readdir( [0X[3X[0X[2X ) ___________________________________________________[0Xfunction
  [6XReturns:[0X  a string or [9Xfail[0X or [9Xfalse[0X
  
  Reads  from  a  directory.  For  details  see  "[10Xman 2 readdir[0X". Note that no
  argument  is  required as we have only one [10XDIR[0X struct on the C level. If the
  directory  is  read completely [9Xfalse[0X is returned, and otherwise a string. An
  error is indicated by [9Xfail[0X.
  
  [1X3.2-39 IO_readlink[0X
  
  [2X> IO_readlink( [0X[3Xpath, buf, bufsize[0X[2X ) ________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Reads the value of a symbolic link. For details see "[10Xman 2 readlink[0X". [3Xbuf[0X is
  modified. The new length of [3Xbuf[0X is returned or [9Xfail[0X in case of an error.
  
  [1X3.2-40 IO_recv[0X
  
  [2X> IO_recv( [0X[3Xfd, st, offset, len, flags[0X[2X ) ____________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Receives  data  from  a  socket.  For  details  see  "[10Xman  2 recv[0X". Note the
  additional  argument  [3Xoffset[0X  which  plays  the same role as for the [2XIO_read[0X
  ([14X3.2-37[0X) function.
  
  [1X3.2-41 IO_recvfrom[0X
  
  [2X> IO_recvfrom( [0X[3Xfd, st, offset, len, flags, addr[0X[2X ) __________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Receives  data  from  a  socket  with  given address. For details see "[10Xman 2
  recvfrom[0X".  Note the additional argument [3Xoffset[0X which plays the same role as
  for  the  [2XIO_read[0X  ([14X3.2-37[0X)  function.  The  argument  [3Xaddr[0X can be made with
  [2XIO_make_sockaddr_in[0X  ([14X3.3-1[0X)  and  contains  its  length  such  that  no 7th
  argument is necessary.
  
  [1X3.2-42 IO_rename[0X
  
  [2X> IO_rename( [0X[3Xoldpath, newpath[0X[2X ) ____________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfalse[0X
  
  Renames a file or moves it. For details see "[10Xman 2 rename[0X".
  
  [1X3.2-43 IO_rewinddir[0X
  
  [2X> IO_rewinddir( [0X[3X[0X[2X ) _________________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Rewinds  a  directory.  For  details  see  "[10Xman  2  rewinddir[0X". Note that no
  argument  is required as we have only one [10XDIR[0X struct on the C level. Returns
  [9Xfail[0X only, if no prior [2XIO_opendir[0X ([14X3.2-35[0X) command has been called.
  
  [1X3.2-44 IO_rmdir[0X
  
  [2X> IO_rmdir( [0X[3Xname[0X[2X ) _________________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Removes an empty directory. For details see "[10Xman 2 rmdir[0X".
  
  [1X3.2-45 IO_seekdir[0X
  
  [2X> IO_seekdir( [0X[3Xoffset[0X[2X ) _____________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Sets the position of the next readdir call. For details see "[10Xman 3 seekdir[0X".
  Note  that  no second argument is required as we have only one [10XDIR[0X struct on
  the C level.
  
  [1X3.2-46 IO_select[0X
  
  [2X> IO_select( [0X[3Xinlist, outlist, exclist, timeoutsec, timeoutusec[0X[2X ) ___[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Used  for  I/O multiplexing. For details see "[10Xman 2 select[0X". [3Xinlist[0X, [3Xoutlist[0X
  and  [3Xexclist[0X  are  lists  of  filedescriptors,  which  are  modified. If the
  corresponding file descriptor is not yet ready, it is replaced by [9Xfail[0X.
  
  [1X3.2-47 IO_send[0X
  
  [2X> IO_send( [0X[3Xfd, st, offset, len, flags[0X[2X ) ____________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Sends  data  to  a  socket.  For  details  see  "[10Xman  2 send[0X". Note that the
  additional argument [3Xoffset[0X specifies the position of the data to send within
  the  string  [3Xst[0X.  It is zero based, meaning that zero indicates the start of
  the string, which is position 1 in [5XGAP[0X.
  
  [1X3.2-48 IO_sendto[0X
  
  [2X> IO_sendto( [0X[3Xfd, st, offset, len, flags, addr[0X[2X ) ____________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Sends  data  to  a  socket.  For  details  see "[10Xman 2 sendto[0X". Note that the
  additional argument [3Xoffset[0X specifies the position of the data to send within
  the  string  [3Xst[0X.  It is zero based, meaning that zero indicates the start of
  the  string,  which is position 1 in [5XGAP[0X. The argument [3Xaddr[0X can be made with
  [2XIO_make_sockaddr_in[0X  ([14X3.3-1[0X)  and  contains  its  length  such  that  no 7th
  argument is necessary.
  
  [1X3.2-49 IO_setsockopt[0X
  
  [2X> IO_setsockopt( [0X[3Xfd, level, optname, optval[0X[2X ) ______________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Sets  a  socket  option.  For  details see "[10Xman 2 setsockopt[0X". Note that the
  argument  [3Xoptval[0X  carries  its  length  around, such that no 5th argument is
  necessary.
  
  [1X3.2-50 IO_socket[0X
  
  [2X> IO_socket( [0X[3Xdomain, type, protocol[0X[2X ) ______________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Creates  a  socket,  an  endpoint  for communication. For details see "[10Xman 2
  socket[0X".  There  is  one little special: On systems that have [10Xgetprotobyname[0X
  you  can  pass  a  string  as third argument [3Xprotocol[0X which is automatically
  looked up by [10Xgetprotobyname[0X.
  
  [1X3.2-51 IO_stat[0X
  
  [2X> IO_stat( [0X[3Xpathname[0X[2X ) ______________________________________________[0Xfunction
  [6XReturns:[0X  a record or [9Xfail[0X
  
  Returns  the  file  metadata  for  the file [3Xpathname[0X. For details see "[10Xman 2
  stat[0X". A [5XGAP[0X record is returned with the same entries than a [10Xstruct stat[0X.
  
  [1X3.2-52 IO_symlink[0X
  
  [2X> IO_symlink( [0X[3Xoldpath, newpath[0X[2X ) ___________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Creates a symbolic link. For details see "[10Xman 2 symlink[0X".
  
  [1X3.2-53 IO_telldir[0X
  
  [2X> IO_telldir( [0X[3X[0X[2X ) ___________________________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Return  current location in directory. For details see "[10Xman 3 telldir[0X". Note
  that  no second argument is required as we have only one [10XDIR[0X struct on the C
  level.
  
  [1X3.2-54 IO_unlink[0X
  
  [2X> IO_unlink( [0X[3Xpathname[0X[2X ) ____________________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfail[0X
  
  Delete  a  name  and  possibly the file it refers to. For details see "[10Xman 2
  unlink[0X".
  
  [1X3.2-55 IO_WaitPid[0X
  
  [2X> IO_WaitPid( [0X[3Xpid, wait[0X[2X ) __________________________________________[0Xfunction
  [6XReturns:[0X  a record or [9Xfail[0X
  
  Waits  for  the  termination  of  a  child  process.  For details see "[10Xman 2
  waitpid[0X".  Returns  a  [5XGAP[0X record describing PID and exit status. The second
  argument  [3Xwait[0X  must  be  either  [9Xtrue[0X or [9Xfalse[0X. 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. See [2XIO_fork[0X ([14X3.2-19[0X).
  
  [1X3.2-56 IO_write[0X
  
  [2X> IO_write( [0X[3Xfd, st, offset, count[0X[2X ) ________________________________[0Xfunction
  [6XReturns:[0X  an integer or [9Xfail[0X
  
  Writes  to  a  file descriptor. For details see "[10Xman 2 write[0X". Note that the
  additional argument [3Xoffset[0X specifies the position of the data to send within
  the  string  [3Xst[0X.  It is zero based, meaning that zero indicates the start of
  the string, which is position 1 in [5XGAP[0X.
  
  
  [1X3.3 Further C level functions[0X
  
  The following functions do not correspond to functions in the C library, but
  are there to provide convenience to use other functions:
  
  [1X3.3-1 IO_make_sockaddr_in[0X
  
  [2X> IO_make_sockaddr_in( [0X[3Xip, port[0X[2X ) __________________________________[0Xfunction
  [6XReturns:[0X  a string or [9Xfail[0X
  
  Makes  a struct [10Xsockaddr_in[0X from IP address and port. The IP address must be
  given  as  a  string  of  length  four, containing the four bytes of an IPv4
  address  in  natural order. The port must be a port number. Returns a string
  containing  the  struct, which can be given to all functions above having an
  address argument.
  
  [1X3.3-2 IO_environ[0X
  
  [2X> IO_environ( [0X[3X[0X[2X ) ___________________________________________________[0Xfunction
  [6XReturns:[0X  a list of strings
  
  For  details see "[10Xman environ[0X". Returns the current environment as a list of
  strings of the form "key=value".
  
  [1X3.3-3 IO_InstallSIGCHLDHandler[0X
  
  [2X> IO_InstallSIGCHLDHandler( [0X[3X[0X[2X ) _____________________________________[0Xfunction
  [6XReturns:[0X  [9Xtrue[0X or [9Xfalse[0X
  
  Installs  our  SIGCHLD  handler. This functions works as an idempotent. That
  is,  calling  it  twice does exactly the same as calling it once. It returns
  [9Xtrue[0X  when  it  is called for the first time since then a pointer to the old
  signal handler is stored in a global variable. See [2XIO_fork[0X ([14X3.2-19[0X).
  
  [1X3.3-4 IO_RestoreSIGCHLDHandler[0X
  
  [2X> IO_RestoreSIGCHLDHandler( [0X[3X[0X[2X ) _____________________________________[0Xfunction
  
  Restores the original SIGCHLD handler. This function works as an idempotent.
  That  is,  calling  it  twice  does  exactly the same as calling it once. It
  returns   [9Xtrue[0X   when  it  is  called  for  the  first  time  after  calling
  [2XIO_InstallSIGCHLDHandler[0X ([14X3.3-3[0X). See [2XIO_fork[0X ([14X3.2-19[0X).
  
