/[guile]/guile/guile-core/doc/ref/posix.texi
ViewVC logotype

Diff of /guile/guile-core/doc/ref/posix.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.4 by ttn, Tue Jan 8 09:22:36 2002 UTC revision 1.1.2.5 by ossau, Fri Mar 15 09:23:18 2002 UTC
# Line 145  one, so that dropping references to one Line 145  one, so that dropping references to one
145  in its garbage collection: it could be retrieved with fdopen or  in its garbage collection: it could be retrieved with fdopen or
146  fdes->ports.  fdes->ports.
147    
148  @deffn primitive port-revealed port  @deffn {Scheme Procedure} port-revealed port
149    @deffnx {C Function} scm_port_revealed (port)
150  Return the revealed count for @var{port}.  Return the revealed count for @var{port}.
151  @end deffn  @end deffn
152    
153  @deffn primitive set-port-revealed! port rcount  @deffn {Scheme Procedure} set-port-revealed! port rcount
154    @deffnx {C Function} scm_set_port_revealed_x (port, rcount)
155  Sets the revealed count for a port to a given value.  Sets the revealed count for a port to a given value.
156  The return value is unspecified.  The return value is unspecified.
157  @end deffn  @end deffn
158    
159  @deffn primitive fileno port  @deffn {Scheme Procedure} fileno port
160    @deffnx {C Function} scm_fileno (port)
161  Return the integer file descriptor underlying @var{port}.  Does  Return the integer file descriptor underlying @var{port}.  Does
162  not change its revealed count.  not change its revealed count.
163  @end deffn  @end deffn
164    
165  @deffn procedure port->fdes port  @deffn {Scheme Procedure} port->fdes port
166  Returns the integer file descriptor underlying @var{port}.  As a  Returns the integer file descriptor underlying @var{port}.  As a
167  side effect the revealed count of @var{port} is incremented.  side effect the revealed count of @var{port} is incremented.
168  @end deffn  @end deffn
169    
170  @deffn primitive fdopen fdes modes  @deffn {Scheme Procedure} fdopen fdes modes
171    @deffnx {C Function} scm_fdopen (fdes, modes)
172  Return a new port based on the file descriptor @var{fdes}.  Return a new port based on the file descriptor @var{fdes}.
173  Modes are given by the string @var{modes}.  The revealed count  Modes are given by the string @var{modes}.  The revealed count
174  of the port is initialized to zero.  The modes string is the  of the port is initialized to zero.  The modes string is the
175  same as that accepted by @ref{File Ports, open-file}.  same as that accepted by @ref{File Ports, open-file}.
176  @end deffn  @end deffn
177    
178  @deffn primitive fdes->ports fd  @deffn {Scheme Procedure} fdes->ports fd
179    @deffnx {C Function} scm_fdes_to_ports (fd)
180  Return a list of existing ports which have @var{fdes} as an  Return a list of existing ports which have @var{fdes} as an
181  underlying file descriptor, without changing their revealed  underlying file descriptor, without changing their revealed
182  counts.  counts.
183  @end deffn  @end deffn
184    
185  @deffn procedure fdes->inport fdes  @deffn {Scheme Procedure} fdes->inport fdes
186  Returns an existing input port which has @var{fdes} as its underlying file  Returns an existing input port which has @var{fdes} as its underlying file
187  descriptor, if one exists, and increments its revealed count.  descriptor, if one exists, and increments its revealed count.
188  Otherwise, returns a new input port with a revealed count of 1.  Otherwise, returns a new input port with a revealed count of 1.
189  @end deffn  @end deffn
190    
191  @deffn procedure fdes->outport fdes  @deffn {Scheme Procedure} fdes->outport fdes
192  Returns an existing output port which has @var{fdes} as its underlying file  Returns an existing output port which has @var{fdes} as its underlying file
193  descriptor, if one exists, and increments its revealed count.  descriptor, if one exists, and increments its revealed count.
194  Otherwise, returns a new output port with a revealed count of 1.  Otherwise, returns a new output port with a revealed count of 1.
195  @end deffn  @end deffn
196    
197  @deffn primitive primitive-move->fdes port fd  @deffn {Scheme Procedure} primitive-move->fdes port fd
198    @deffnx {C Function} scm_primitive_move_to_fdes (port, fd)
199  Moves the underlying file descriptor for @var{port} to the integer  Moves the underlying file descriptor for @var{port} to the integer
200  value @var{fdes} without changing the revealed count of @var{port}.  value @var{fdes} without changing the revealed count of @var{port}.
201  Any other ports already using this descriptor will be automatically  Any other ports already using this descriptor will be automatically
# Line 198  The return value is @code{#f} if the fil Line 204  The return value is @code{#f} if the fil
204  required value or @code{#t} if it was moved.  required value or @code{#t} if it was moved.
205  @end deffn  @end deffn
206    
207  @deffn procedure move->fdes port fdes  @deffn {Scheme Procedure} move->fdes port fdes
208  Moves the underlying file descriptor for @var{port} to the integer  Moves the underlying file descriptor for @var{port} to the integer
209  value @var{fdes} and sets its revealed count to one.  Any other ports  value @var{fdes} and sets its revealed count to one.  Any other ports
210  already using this descriptor will be automatically  already using this descriptor will be automatically
# Line 206  shifted to new descriptors and their rev Line 212  shifted to new descriptors and their rev
212  The return value is unspecified.  The return value is unspecified.
213  @end deffn  @end deffn
214    
215  @deffn procedure release-port-handle port  @deffn {Scheme Procedure} release-port-handle port
216  Decrements the revealed count for a port.  Decrements the revealed count for a port.
217  @end deffn  @end deffn
218    
219  @deffn primitive fsync object  @deffn {Scheme Procedure} fsync object
220    @deffnx {C Function} scm_fsync (object)
221  Copies any unwritten data for the specified output file descriptor to disk.  Copies any unwritten data for the specified output file descriptor to disk.
222  If @var{port/fd} is a port, its buffer is flushed before the underlying  If @var{port/fd} is a port, its buffer is flushed before the underlying
223  file descriptor is fsync'd.  file descriptor is fsync'd.
224  The return value is unspecified.  The return value is unspecified.
225  @end deffn  @end deffn
226    
227  @deffn primitive open path flags [mode]  @deffn {Scheme Procedure} open path flags [mode]
228    @deffnx {C Function} scm_open (path, flags, mode)
229  Open the file named by @var{path} for reading and/or writing.  Open the file named by @var{path} for reading and/or writing.
230  @var{flags} is an integer specifying how the file should be opened.  @var{flags} is an integer specifying how the file should be opened.
231  @var{mode} is an integer specifying the permission bits of the file, if  @var{mode} is an integer specifying the permission bits of the file, if
# Line 247  See the Unix documentation of the @code{ Line 255  See the Unix documentation of the @code{
255  for additional flags.  for additional flags.
256  @end deffn  @end deffn
257    
258  @deffn primitive open-fdes path flags [mode]  @deffn {Scheme Procedure} open-fdes path flags [mode]
259    @deffnx {C Function} scm_open_fdes (path, flags, mode)
260  Similar to @code{open} but return a file descriptor instead of  Similar to @code{open} but return a file descriptor instead of
261  a port.  a port.
262  @end deffn  @end deffn
263    
264  @deffn primitive close fd_or_port  @deffn {Scheme Procedure} close fd_or_port
265    @deffnx {C Function} scm_close (fd_or_port)
266  Similar to close-port (@pxref{Closing, close-port}), but also works on  Similar to close-port (@pxref{Closing, close-port}), but also works on
267  file descriptors.  A side effect of closing a file descriptor is that  file descriptors.  A side effect of closing a file descriptor is that
268  any ports using that file descriptor are moved to a different file  any ports using that file descriptor are moved to a different file
269  descriptor and have their revealed counts set to zero.  descriptor and have their revealed counts set to zero.
270  @end deffn  @end deffn
271    
272  @deffn primitive close-fdes fd  @deffn {Scheme Procedure} close-fdes fd
273    @deffnx {C Function} scm_close_fdes (fd)
274  A simple wrapper for the @code{close} system call.  A simple wrapper for the @code{close} system call.
275  Close file descriptor @var{fd}, which must be an integer.  Close file descriptor @var{fd}, which must be an integer.
276  Unlike close (@pxref{Ports and File Descriptors, close}),  Unlike close (@pxref{Ports and File Descriptors, close}),
# Line 267  the file descriptor will be closed even Line 278  the file descriptor will be closed even
278  The return value is unspecified.  The return value is unspecified.
279  @end deffn  @end deffn
280    
281  @deffn primitive unread-char char [port]  @deffn {Scheme Procedure} unread-char char [port]
282    @deffnx {C Function} scm_unread_char (char, port)
283  Place @var{char} in @var{port} so that it will be read by the  Place @var{char} in @var{port} so that it will be read by the
284  next read operation.  If called multiple times, the unread characters  next read operation.  If called multiple times, the unread characters
285  will be read again in last-in first-out order.  If @var{port} is  will be read again in last-in first-out order.  If @var{port} is
286  not supplied, the current input port is used.  not supplied, the current input port is used.
287  @end deffn  @end deffn
288    
289  @deffn primitive unread-string str port  @deffn {Scheme Procedure} unread-string str port
290  Place the string @var{str} in @var{port} so that its characters will be  Place the string @var{str} in @var{port} so that its characters will be
291  read in subsequent read operations.  If called multiple times, the  read in subsequent read operations.  If called multiple times, the
292  unread characters will be read again in last-in first-out order.  If  unread characters will be read again in last-in first-out order.  If
293  @var{port} is not supplied, the current-input-port is used.  @var{port} is not supplied, the current-input-port is used.
294  @end deffn  @end deffn
295    
296  @deffn primitive pipe  @deffn {Scheme Procedure} pipe
297    @deffnx {C Function} scm_pipe ()
298  Return a newly created pipe: a pair of ports which are linked  Return a newly created pipe: a pair of ports which are linked
299  together on the local machine.  The @emph{car} is the input  together on the local machine.  The @emph{car} is the input
300  port and the @emph{cdr} is the output port.  Data written (and  port and the @emph{cdr} is the output port.  Data written (and
# Line 307  All procedures also have the side effect Line 320  All procedures also have the side effect
320  ports using @var{newfd} are moved to a different file descriptor and have  ports using @var{newfd} are moved to a different file descriptor and have
321  their revealed counts set to zero.  their revealed counts set to zero.
322    
323  @deffn primitive dup->fdes fd_or_port [fd]  @deffn {Scheme Procedure} dup->fdes fd_or_port [fd]
324    @deffnx {C Function} scm_dup_to_fdes (fd_or_port, fd)
325  Return a new integer file descriptor referring to the open file  Return a new integer file descriptor referring to the open file
326  designated by @var{fd_or_port}, which must be either an open  designated by @var{fd_or_port}, which must be either an open
327  file port or a file descriptor.  file port or a file descriptor.
328  @end deffn  @end deffn
329    
330  @deffn procedure dup->inport port/fd [newfd]  @deffn {Scheme Procedure} dup->inport port/fd [newfd]
331  Returns a new input port using the new file descriptor.  Returns a new input port using the new file descriptor.
332  @end deffn  @end deffn
333    
334  @deffn procedure dup->outport port/fd [newfd]  @deffn {Scheme Procedure} dup->outport port/fd [newfd]
335  Returns a new output port using the new file descriptor.  Returns a new output port using the new file descriptor.
336  @end deffn  @end deffn
337    
338  @deffn procedure dup port/fd [newfd]  @deffn {Scheme Procedure} dup port/fd [newfd]
339  Returns a new port if @var{port/fd} is a port, with the same mode as the  Returns a new port if @var{port/fd} is a port, with the same mode as the
340  supplied port, otherwise returns an integer file descriptor.  supplied port, otherwise returns an integer file descriptor.
341  @end deffn  @end deffn
342    
343  @deffn procedure dup->port port/fd mode [newfd]  @deffn {Scheme Procedure} dup->port port/fd mode [newfd]
344  Returns a new port using the new file descriptor.  @var{mode} supplies a  Returns a new port using the new file descriptor.  @var{mode} supplies a
345  mode string for the port (@pxref{File Ports, open-file}).  mode string for the port (@pxref{File Ports, open-file}).
346  @end deffn  @end deffn
347    
348  @deffn procedure duplicate-port port modes  @deffn {Scheme Procedure} duplicate-port port modes
349  Returns a new port which is opened on a duplicate of the file  Returns a new port which is opened on a duplicate of the file
350  descriptor underlying @var{port}, with mode string @var{modes}  descriptor underlying @var{port}, with mode string @var{modes}
351  as for @ref{File Ports, open-file}.  The two ports  as for @ref{File Ports, open-file}.  The two ports
# Line 345  port. Line 359  port.
359  This procedure is equivalent to @code{(dup->port @var{port} @var{modes})}.  This procedure is equivalent to @code{(dup->port @var{port} @var{modes})}.
360  @end deffn  @end deffn
361    
362  @deffn primitive redirect-port old new  @deffn {Scheme Procedure} redirect-port old new
363    @deffnx {C Function} scm_redirect_port (old, new)
364  This procedure takes two ports and duplicates the underlying file  This procedure takes two ports and duplicates the underlying file
365  descriptor from @var{old-port} into @var{new-port}.  The  descriptor from @var{old-port} into @var{new-port}.  The
366  current file descriptor in @var{new-port} will be closed.  current file descriptor in @var{new-port} will be closed.
# Line 361  This procedure does not have any side ef Line 376  This procedure does not have any side ef
376  revealed counts.  revealed counts.
377  @end deffn  @end deffn
378    
379  @deffn primitive dup2 oldfd newfd  @deffn {Scheme Procedure} dup2 oldfd newfd
380    @deffnx {C Function} scm_dup2 (oldfd, newfd)
381  A simple wrapper for the @code{dup2} system call.  A simple wrapper for the @code{dup2} system call.
382  Copies the file descriptor @var{oldfd} to descriptor  Copies the file descriptor @var{oldfd} to descriptor
383  number @var{newfd}, replacing the previous meaning  number @var{newfd}, replacing the previous meaning
# Line 372  is made to move away ports which are usi Line 388  is made to move away ports which are usi
388  The return value is unspecified.  The return value is unspecified.
389  @end deffn  @end deffn
390    
391  @deffn primitive port-mode port  @deffn {Scheme Procedure} port-mode port
392  Return the port modes associated with the open port @var{port}.  Return the port modes associated with the open port @var{port}.
393  These will not necessarily be identical to the modes used when  These will not necessarily be identical to the modes used when
394  the port was opened, since modes such as "append" which are  the port was opened, since modes such as "append" which are
395  used only during port creation are not retained.  used only during port creation are not retained.
396  @end deffn  @end deffn
397    
398  @deffn primitive close-all-ports-except . ports  @deffn {Scheme Procedure} close-all-ports-except . ports
399    @deffnx {C Function} scm_close_all_ports_except (ports)
400  [DEPRECATED] Close all open file ports used by the interpreter  [DEPRECATED] Close all open file ports used by the interpreter
401  except for those supplied as arguments.  This procedure  except for those supplied as arguments.  This procedure
402  was intended to be used before an exec call to close file descriptors  was intended to be used before an exec call to close file descriptors
403  which are not needed in the new process.  However it has the  which are not needed in the new process.  However it has the
404  undesirable side-effect of flushing buffers, so it's deprecated.  undesirable side effect of flushing buffers, so it's deprecated.
405  Use port-for-each instead.  Use port-for-each instead.
406  @end deffn  @end deffn
407    
408  @deffn primitive port-for-each proc  @deffn {Scheme Procedure} port-for-each proc
409    @deffnx {C Function} scm_port_for_each (proc)
410  Apply @var{proc} to each port in the Guile port table  Apply @var{proc} to each port in the Guile port table
411  in turn.  The return value is unspecified.  More specifically,  in turn.  The return value is unspecified.  More specifically,
412  @var{proc} is applied exactly once to every port that exists  @var{proc} is applied exactly once to every port that exists
# Line 397  Changes to the port table while @var{por Line 415  Changes to the port table while @var{por
415  have no effect as far as @var{port-for-each} is concerned.  have no effect as far as @var{port-for-each} is concerned.
416  @end deffn  @end deffn
417    
418  @deffn primitive setvbuf port mode [size]  @deffn {Scheme Procedure} setvbuf port mode [size]
419    @deffnx {C Function} scm_setvbuf (port, mode, size)
420  Set the buffering mode for @var{port}.  @var{mode} can be:  Set the buffering mode for @var{port}.  @var{mode} can be:
421  @table @code  @table @code
422  @item _IONBF  @item _IONBF
# Line 410  If @var{size} is omitted, a default size Line 429  If @var{size} is omitted, a default size
429  @end table  @end table
430  @end deffn  @end deffn
431    
432  @deffn primitive fcntl object cmd [value]  @deffn {Scheme Procedure} fcntl object cmd [value]
433    @deffnx {C Function} scm_fcntl (object, cmd, value)
434  Apply @var{command} to the specified file descriptor or the underlying  Apply @var{command} to the specified file descriptor or the underlying
435  file descriptor of the specified port.  @var{value} is an optional  file descriptor of the specified port.  @var{value} is an optional
436  integer argument.  integer argument.
# Line 438  The value used to indicate the "close on Line 458  The value used to indicate the "close on
458  @end table  @end table
459  @end deffn  @end deffn
460    
461  @deffn primitive flock file operation  @deffn {Scheme Procedure} flock file operation
462    @deffnx {C Function} scm_flock (file, operation)
463  Apply or remove an advisory lock on an open file.  Apply or remove an advisory lock on an open file.
464  @var{operation} specifies the action to be done:  @var{operation} specifies the action to be done:
465  @table @code  @table @code
# Line 458  The return value is not specified. @var{ Line 479  The return value is not specified. @var{
479  file descriptor or an open file descriptor port.  file descriptor or an open file descriptor port.
480  @end deffn  @end deffn
481    
482  @deffn primitive select reads writes excepts [secs [usecs]]  @deffn {Scheme Procedure} select reads writes excepts [secs [usecs]]
483    @deffnx {C Function} scm_select (reads, writes, excepts, secs, usecs)
484  This procedure has a variety of uses: waiting for the ability  This procedure has a variety of uses: waiting for the ability
485  to provide input, accept output, or the existence of  to provide input, accept output, or the existence of
486  exceptional conditions on a collection of ports or file  exceptional conditions on a collection of ports or file
# Line 499  permissions, sizes and types of files); Line 521  permissions, sizes and types of files);
521  linking files; creating and removing directories and querying their  linking files; creating and removing directories and querying their
522  contents; syncing the file system and creating special files.  contents; syncing the file system and creating special files.
523    
524  @deffn primitive access? path how  @deffn {Scheme Procedure} access? path how
525    @deffnx {C Function} scm_access (path, how)
526  Return @code{#t} if @var{path} corresponds to an existing file  Return @code{#t} if @var{path} corresponds to an existing file
527  and the current process has the type of access specified by  and the current process has the type of access specified by
528  @var{how}, otherwise @code{#f}.  @var{how} should be specified  @var{how}, otherwise @code{#f}.  @var{how} should be specified
# Line 526  test for existence of the file. Line 549  test for existence of the file.
549  @end deffn  @end deffn
550    
551  @findex fstat  @findex fstat
552  @deffn primitive stat object  @deffn {Scheme Procedure} stat object
553    @deffnx {C Function} scm_stat (object)
554  Return an object containing various information about the file  Return an object containing various information about the file
555  determined by @var{obj}.  @var{obj} can be a string containing  determined by @var{obj}.  @var{obj} can be a string containing
556  a file name or a port or integer file descriptor which is open  a file name or a port or integer file descriptor which is open
# Line 585  An integer representing the access permi Line 609  An integer representing the access permi
609  @end table  @end table
610  @end deffn  @end deffn
611    
612  @deffn primitive lstat str  @deffn {Scheme Procedure} lstat str
613    @deffnx {C Function} scm_lstat (str)
614  Similar to @code{stat}, but does not follow symbolic links, i.e.,  Similar to @code{stat}, but does not follow symbolic links, i.e.,
615  it will return information about a symbolic link itself, not the  it will return information about a symbolic link itself, not the
616  file it points to.  @var{path} must be a string.  file it points to.  @var{path} must be a string.
617  @end deffn  @end deffn
618    
619  @deffn primitive readlink path  @deffn {Scheme Procedure} readlink path
620    @deffnx {C Function} scm_readlink (path)
621  Return the value of the symbolic link named by @var{path} (a  Return the value of the symbolic link named by @var{path} (a
622  string), i.e., the file that the link points to.  string), i.e., the file that the link points to.
623  @end deffn  @end deffn
624    
625  @findex fchown  @findex fchown
626  @findex lchown  @findex lchown
627  @deffn primitive chown object owner group  @deffn {Scheme Procedure} chown object owner group
628    @deffnx {C Function} scm_chown (object, owner, group)
629  Change the ownership and group of the file referred to by @var{object} to  Change the ownership and group of the file referred to by @var{object} to
630  the integer values @var{owner} and @var{group}.  @var{object} can be  the integer values @var{owner} and @var{group}.  @var{object} can be
631  a string containing a file name or, if the platform  a string containing a file name or, if the platform
# Line 614  as @code{-1}, then that ID is not change Line 641  as @code{-1}, then that ID is not change
641  @end deffn  @end deffn
642    
643  @findex fchmod  @findex fchmod
644  @deffn primitive chmod object mode  @deffn {Scheme Procedure} chmod object mode
645    @deffnx {C Function} scm_chmod (object, mode)
646  Changes the permissions of the file referred to by @var{obj}.  Changes the permissions of the file referred to by @var{obj}.
647  @var{obj} can be a string containing a file name or a port or integer file  @var{obj} can be a string containing a file name or a port or integer file
648  descriptor which is open on a file (in which case @code{fchmod} is used  descriptor which is open on a file (in which case @code{fchmod} is used
# Line 624  the new permissions as a decimal number, Line 652  the new permissions as a decimal number,
652  The return value is unspecified.  The return value is unspecified.
653  @end deffn  @end deffn
654    
655  @deffn primitive utime pathname [actime [modtime]]  @deffn {Scheme Procedure} utime pathname [actime [modtime]]
656    @deffnx {C Function} scm_utime (pathname, actime, modtime)
657  @code{utime} sets the access and modification times for the  @code{utime} sets the access and modification times for the
658  file named by @var{path}.  If @var{actime} or @var{modtime} is  file named by @var{path}.  If @var{actime} or @var{modtime} is
659  not supplied, then the current time is used.  @var{actime} and  not supplied, then the current time is used.  @var{actime} and
# Line 638  modification time to the current time. Line 667  modification time to the current time.
667  @end deffn  @end deffn
668    
669  @findex unlink  @findex unlink
670  @deffn primitive delete-file str  @deffn {Scheme Procedure} delete-file str
671    @deffnx {C Function} scm_delete_file (str)
672  Deletes (or "unlinks") the file specified by @var{path}.  Deletes (or "unlinks") the file specified by @var{path}.
673  @end deffn  @end deffn
674    
675  @deffn primitive copy-file oldfile newfile  @deffn {Scheme Procedure} copy-file oldfile newfile
676    @deffnx {C Function} scm_copy_file (oldfile, newfile)
677  Copy the file specified by @var{path-from} to @var{path-to}.  Copy the file specified by @var{path-from} to @var{path-to}.
678  The return value is unspecified.  The return value is unspecified.
679  @end deffn  @end deffn
680    
681  @findex rename  @findex rename
682  @deffn primitive rename-file oldname newname  @deffn {Scheme Procedure} rename-file oldname newname
683    @deffnx {C Function} scm_rename (oldname, newname)
684  Renames the file specified by @var{oldname} to @var{newname}.  Renames the file specified by @var{oldname} to @var{newname}.
685  The return value is unspecified.  The return value is unspecified.
686  @end deffn  @end deffn
687    
688  @deffn primitive link oldpath newpath  @deffn {Scheme Procedure} link oldpath newpath
689    @deffnx {C Function} scm_link (oldpath, newpath)
690  Creates a new name @var{newpath} in the file system for the  Creates a new name @var{newpath} in the file system for the
691  file named by @var{oldpath}.  If @var{oldpath} is a symbolic  file named by @var{oldpath}.  If @var{oldpath} is a symbolic
692  link, the link may or may not be followed depending on the  link, the link may or may not be followed depending on the
693  system.  system.
694  @end deffn  @end deffn
695    
696  @deffn primitive symlink oldpath newpath  @deffn {Scheme Procedure} symlink oldpath newpath
697    @deffnx {C Function} scm_symlink (oldpath, newpath)
698  Create a symbolic link named @var{path-to} with the value (i.e., pointing to)  Create a symbolic link named @var{path-to} with the value (i.e., pointing to)
699  @var{path-from}.  The return value is unspecified.  @var{path-from}.  The return value is unspecified.
700  @end deffn  @end deffn
701    
702  @deffn primitive mkdir path [mode]  @deffn {Scheme Procedure} mkdir path [mode]
703    @deffnx {C Function} scm_mkdir (path, mode)
704  Create a new directory named by @var{path}.  If @var{mode} is omitted  Create a new directory named by @var{path}.  If @var{mode} is omitted
705  then the permissions of the directory file are set using the current  then the permissions of the directory file are set using the current
706  umask.  Otherwise they are set to the decimal value specified with  umask.  Otherwise they are set to the decimal value specified with
707  @var{mode}.  The return value is unspecified.  @var{mode}.  The return value is unspecified.
708  @end deffn  @end deffn
709    
710  @deffn primitive rmdir path  @deffn {Scheme Procedure} rmdir path
711    @deffnx {C Function} scm_rmdir (path)
712  Remove the existing directory named by @var{path}.  The directory must  Remove the existing directory named by @var{path}.  The directory must
713  be empty for this to succeed.  The return value is unspecified.  be empty for this to succeed.  The return value is unspecified.
714  @end deffn  @end deffn
715    
716  @deffn primitive opendir dirname  @deffn {Scheme Procedure} opendir dirname
717    @deffnx {C Function} scm_opendir (dirname)
718  Open the directory specified by @var{path} and return a directory  Open the directory specified by @var{path} and return a directory
719  stream.  stream.
720  @end deffn  @end deffn
721    
722  @deffn primitive directory-stream? obj  @deffn {Scheme Procedure} directory-stream? obj
723    @deffnx {C Function} scm_directory_stream_p (obj)
724  Return a boolean indicating whether @var{object} is a directory  Return a boolean indicating whether @var{object} is a directory
725  stream as returned by @code{opendir}.  stream as returned by @code{opendir}.
726  @end deffn  @end deffn
727    
728  @deffn primitive readdir port  @deffn {Scheme Procedure} readdir port
729    @deffnx {C Function} scm_readdir (port)
730  Return (as a string) the next directory entry from the directory stream  Return (as a string) the next directory entry from the directory stream
731  @var{stream}.  If there is no remaining entry to be read then the  @var{stream}.  If there is no remaining entry to be read then the
732  end of file object is returned.  end of file object is returned.
733  @end deffn  @end deffn
734    
735  @deffn primitive rewinddir port  @deffn {Scheme Procedure} rewinddir port
736    @deffnx {C Function} scm_rewinddir (port)
737  Reset the directory port @var{stream} so that the next call to  Reset the directory port @var{stream} so that the next call to
738  @code{readdir} will return the first directory entry.  @code{readdir} will return the first directory entry.
739  @end deffn  @end deffn
740    
741  @deffn primitive closedir port  @deffn {Scheme Procedure} closedir port
742    @deffnx {C Function} scm_closedir (port)
743  Close the directory stream @var{stream}.  Close the directory stream @var{stream}.
744  The return value is unspecified.  The return value is unspecified.
745  @end deffn  @end deffn
746    
747  @deffn primitive sync  @deffn {Scheme Procedure} sync
748    @deffnx {C Function} scm_sync ()
749  Flush the operating system disk buffers.  Flush the operating system disk buffers.
750  The return value is unspecified.  The return value is unspecified.
751  @end deffn  @end deffn
752    
753  @deffn primitive mknod path type perms dev  @deffn {Scheme Procedure} mknod path type perms dev
754    @deffnx {C Function} scm_mknod (path, type, perms, dev)
755  Creates a new special file, such as a file corresponding to a device.  Creates a new special file, such as a file corresponding to a device.
756  @var{path} specifies the name of the file.  @var{type} should  @var{path} specifies the name of the file.  @var{type} should
757  be one of the following symbols:  be one of the following symbols:
# Line 726  E.g., Line 769  E.g.,
769  The return value is unspecified.  The return value is unspecified.
770  @end deffn  @end deffn
771    
772  @deffn primitive tmpnam  @deffn {Scheme Procedure} tmpnam
773    @deffnx {C Function} scm_tmpnam ()
774  Return a name in the file system that does not match any  Return a name in the file system that does not match any
775  existing file.  However there is no guarantee that another  existing file.  However there is no guarantee that another
776  process will not create the file after @code{tmpnam} is called.  process will not create the file after @code{tmpnam} is called.
# Line 734  Care should be taken if opening the file Line 778  Care should be taken if opening the file
778  @code{O_EXCL} open flag or use @code{mkstemp!} instead.  @code{O_EXCL} open flag or use @code{mkstemp!} instead.
779  @end deffn  @end deffn
780    
781  @deffn primitive mkstemp! tmpl  @deffn {Scheme Procedure} mkstemp! tmpl
782    @deffnx {C Function} scm_mkstemp (tmpl)
783  Create a new unique file in the file system and returns a new  Create a new unique file in the file system and returns a new
784  buffered port open for reading and writing to the file.  buffered port open for reading and writing to the file.
785  @var{tmpl} is a string specifying where the file should be  @var{tmpl} is a string specifying where the file should be
# Line 742  created: it must end with @code{XXXXXX} Line 787  created: it must end with @code{XXXXXX}
787  place to return the name of the temporary file.  place to return the name of the temporary file.
788  @end deffn  @end deffn
789    
790  @deffn primitive dirname filename  @deffn {Scheme Procedure} dirname filename
791    @deffnx {C Function} scm_dirname (filename)
792  Return the directory name component of the file name  Return the directory name component of the file name
793  @var{filename}. If @var{filename} does not contain a directory  @var{filename}. If @var{filename} does not contain a directory
794  component, @code{.} is returned.  component, @code{.} is returned.
795  @end deffn  @end deffn
796    
797  @deffn primitive basename filename [suffix]  @deffn {Scheme Procedure} basename filename [suffix]
798    @deffnx {C Function} scm_basename (filename, suffix)
799  Return the base name of the file name @var{filename}. The  Return the base name of the file name @var{filename}. The
800  base name is the file name without any directory components.  base name is the file name without any directory components.
801  If @var{suffix} is provided, and is equal to the end of  If @var{suffix} is provided, and is equal to the end of
# Line 783  The home directory. Line 830  The home directory.
830  The login shell.  The login shell.
831  @end table  @end table
832    
833  @deffn procedure getpwuid uid  @deffn {Scheme Procedure} getpwuid uid
834  Look up an integer userid in the user database.  Look up an integer userid in the user database.
835  @end deffn  @end deffn
836    
837  @deffn procedure getpwnam name  @deffn {Scheme Procedure} getpwnam name
838  Look up a user name string in the user database.  Look up a user name string in the user database.
839  @end deffn  @end deffn
840    
841  @deffn procedure setpwent  @deffn {Scheme Procedure} setpwent
842  Initializes a stream used by @code{getpwent} to read from the user database.  Initializes a stream used by @code{getpwent} to read from the user database.
843  The next use of @code{getpwent} will return the first entry.  The  The next use of @code{getpwent} will return the first entry.  The
844  return value is unspecified.  return value is unspecified.
845  @end deffn  @end deffn
846    
847  @deffn procedure getpwent  @deffn {Scheme Procedure} getpwent
848  Return the next entry in the user database, using the stream set by  Return the next entry in the user database, using the stream set by
849  @code{setpwent}.  @code{setpwent}.
850  @end deffn  @end deffn
851    
852  @deffn procedure endpwent  @deffn {Scheme Procedure} endpwent
853  Closes the stream used by @code{getpwent}.  The return value is unspecified.  Closes the stream used by @code{getpwent}.  The return value is unspecified.
854  @end deffn  @end deffn
855    
856  @deffn primitive setpw [arg]  @deffn {Scheme Procedure} setpw [arg]
857    @deffnx {C Function} scm_setpwent (arg)
858  If called with a true argument, initialize or reset the password data  If called with a true argument, initialize or reset the password data
859  stream.  Otherwise, close the stream.  The @code{setpwent} and  stream.  Otherwise, close the stream.  The @code{setpwent} and
860  @code{endpwent} procedures are implemented on top of this.  @code{endpwent} procedures are implemented on top of this.
861  @end deffn  @end deffn
862    
863  @deffn primitive getpw [user]  @deffn {Scheme Procedure} getpw [user]
864    @deffnx {C Function} scm_getpwuid (user)
865  Look up an entry in the user database.  @var{obj} can be an integer,  Look up an entry in the user database.  @var{obj} can be an integer,
866  a string, or omitted, giving the behaviour of getpwuid, getpwnam  a string, or omitted, giving the behaviour of getpwuid, getpwnam
867  or getpwent respectively.  or getpwent respectively.
# Line 832  The group id number. Line 881  The group id number.
881  A list of userids which have this group as a supplementary group.  A list of userids which have this group as a supplementary group.
882  @end table  @end table
883    
884  @deffn procedure getgrgid gid  @deffn {Scheme Procedure} getgrgid gid
885  Look up an integer group id in the group database.  Look up an integer group id in the group database.
886  @end deffn  @end deffn
887    
888  @deffn procedure getgrnam name  @deffn {Scheme Procedure} getgrnam name
889  Look up a group name in the group database.  Look up a group name in the group database.
890  @end deffn  @end deffn
891    
892  @deffn procedure setgrent  @deffn {Scheme Procedure} setgrent
893  Initializes a stream used by @code{getgrent} to read from the group database.  Initializes a stream used by @code{getgrent} to read from the group database.
894  The next use of @code{getgrent} will return the first entry.  The next use of @code{getgrent} will return the first entry.
895  The return value is unspecified.  The return value is unspecified.
896  @end deffn  @end deffn
897    
898  @deffn procedure getgrent  @deffn {Scheme Procedure} getgrent
899  Return the next entry in the group database, using the stream set by  Return the next entry in the group database, using the stream set by
900  @code{setgrent}.  @code{setgrent}.
901  @end deffn  @end deffn
902    
903  @deffn procedure endgrent  @deffn {Scheme Procedure} endgrent
904  Closes the stream used by @code{getgrent}.  Closes the stream used by @code{getgrent}.
905  The return value is unspecified.  The return value is unspecified.
906  @end deffn  @end deffn
907    
908  @deffn primitive setgr [arg]  @deffn {Scheme Procedure} setgr [arg]
909    @deffnx {C Function} scm_setgrent (arg)
910  If called with a true argument, initialize or reset the group data  If called with a true argument, initialize or reset the group data
911  stream.  Otherwise, close the stream.  The @code{setgrent} and  stream.  Otherwise, close the stream.  The @code{setgrent} and
912  @code{endgrent} procedures are implemented on top of this.  @code{endgrent} procedures are implemented on top of this.
913  @end deffn  @end deffn
914    
915  @deffn primitive getgr [name]  @deffn {Scheme Procedure} getgr [name]
916    @deffnx {C Function} scm_getgrgid (name)
917  Look up an entry in the group database.  @var{obj} can be an integer,  Look up an entry in the group database.  @var{obj} can be an integer,
918  a string, or omitted, giving the behaviour of getgrgid, getgrnam  a string, or omitted, giving the behaviour of getgrgid, getgrnam
919  or getgrent respectively.  or getgrent respectively.
# Line 871  or getgrent respectively. Line 922  or getgrent respectively.
922  In addition to the accessor procedures for the user database, the  In addition to the accessor procedures for the user database, the
923  following shortcut procedures are also available.  following shortcut procedures are also available.
924    
925  @deffn primitive cuserid  @deffn {Scheme Procedure} cuserid
926    @deffnx {C Function} scm_cuserid ()
927  Return a string containing a user name associated with the  Return a string containing a user name associated with the
928  effective user id of the process.  Return @code{#f} if this  effective user id of the process.  Return @code{#f} if this
929  information cannot be obtained.  information cannot be obtained.
930  @end deffn  @end deffn
931    
932  @deffn primitive getlogin  @deffn {Scheme Procedure} getlogin
933    @deffnx {C Function} scm_getlogin ()
934  Return a string containing the name of the user logged in on  Return a string containing the name of the user logged in on
935  the controlling terminal of the process, or @code{#f} if this  the controlling terminal of the process, or @code{#f} if this
936  information cannot be obtained.  information cannot be obtained.
# Line 887  information cannot be obtained. Line 940  information cannot be obtained.
940  @node Time  @node Time
941  @section Time  @section Time
942    
943  @deffn primitive current-time  @deffn {Scheme Procedure} current-time
944    @deffnx {C Function} scm_current_time ()
945  Return the number of seconds since 1970-01-01 00:00:00 UTC,  Return the number of seconds since 1970-01-01 00:00:00 UTC,
946  excluding leap seconds.  excluding leap seconds.
947  @end deffn  @end deffn
948    
949  @deffn primitive gettimeofday  @deffn {Scheme Procedure} gettimeofday
950    @deffnx {C Function} scm_gettimeofday ()
951  Return a pair containing the number of seconds and microseconds  Return a pair containing the number of seconds and microseconds
952  since 1970-01-01 00:00:00 UTC, excluding leap seconds.  Note:  since 1970-01-01 00:00:00 UTC, excluding leap seconds.  Note:
953  whether true microsecond resolution is available depends on the  whether true microsecond resolution is available depends on the
# Line 930  Time zone offset in seconds west of UTC Line 985  Time zone offset in seconds west of UTC
985  Time zone label (a string), not necessarily unique.  Time zone label (a string), not necessarily unique.
986  @end table  @end table
987    
988  @deffn primitive localtime time [zone]  @deffn {Scheme Procedure} localtime time [zone]
989    @deffnx {C Function} scm_localtime (time, zone)
990  Return an object representing the broken down components of  Return an object representing the broken down components of
991  @var{time}, an integer like the one returned by  @var{time}, an integer like the one returned by
992  @code{current-time}.  The time zone for the calculation is  @code{current-time}.  The time zone for the calculation is
# Line 938  optionally specified by @var{zone} (a st Line 994  optionally specified by @var{zone} (a st
994  @code{TZ} environment variable or the system default is used.  @code{TZ} environment variable or the system default is used.
995  @end deffn  @end deffn
996    
997  @deffn primitive gmtime time  @deffn {Scheme Procedure} gmtime time
998    @deffnx {C Function} scm_gmtime (time)
999  Return an object representing the broken down components of  Return an object representing the broken down components of
1000  @var{time}, an integer like the one returned by  @var{time}, an integer like the one returned by
1001  @code{current-time}.  The values are calculated for UTC.  @code{current-time}.  The values are calculated for UTC.
1002  @end deffn  @end deffn
1003    
1004  @deffn primitive mktime sbd_time [zone]  @deffn {Scheme Procedure} mktime sbd_time [zone]
1005    @deffnx {C Function} scm_mktime (sbd_time, zone)
1006  @var{bd-time} is an object representing broken down time and @code{zone}  @var{bd-time} is an object representing broken down time and @code{zone}
1007  is an optional time zone specifier (otherwise the TZ environment variable  is an optional time zone specifier (otherwise the TZ environment variable
1008  or the system default is used).  or the system default is used).
# Line 955  by @code{current-time}; the cdr is a bro Line 1013  by @code{current-time}; the cdr is a bro
1013  as @var{bd-time} but with normalized values.  as @var{bd-time} but with normalized values.
1014  @end deffn  @end deffn
1015    
1016  @deffn primitive tzset  @deffn {Scheme Procedure} tzset
1017    @deffnx {C Function} scm_tzset ()
1018  Initialize the timezone from the TZ environment variable  Initialize the timezone from the TZ environment variable
1019  or the system default.  It's not usually necessary to call this procedure  or the system default.  It's not usually necessary to call this procedure
1020  since it's done automatically by other procedures that depend on the  since it's done automatically by other procedures that depend on the
1021  timezone.  timezone.
1022  @end deffn  @end deffn
1023    
1024  @deffn primitive strftime format stime  @deffn {Scheme Procedure} strftime format stime
1025    @deffnx {C Function} scm_strftime (format, stime)
1026  Formats a time specification @var{time} using @var{template}.  @var{time}  Formats a time specification @var{time} using @var{template}.  @var{time}
1027  is an object with time components in the form returned by @code{localtime}  is an object with time components in the form returned by @code{localtime}
1028  or @code{gmtime}.  @var{template} is a string which can include formatting  or @code{gmtime}.  @var{template} is a string which can include formatting
# Line 972  is the formatted string. Line 1032  is the formatted string.
1032  @xref{Formatting Date and Time, , , libc, The GNU C Library Reference Manual}.)  @xref{Formatting Date and Time, , , libc, The GNU C Library Reference Manual}.)
1033  @end deffn  @end deffn
1034    
1035  @deffn primitive strptime format string  @deffn {Scheme Procedure} strptime format string
1036    @deffnx {C Function} scm_strptime (format, string)
1037  Performs the reverse action to @code{strftime}, parsing  Performs the reverse action to @code{strftime}, parsing
1038  @var{string} according to the specification supplied in  @var{string} according to the specification supplied in
1039  @var{template}.  The interpretation of month and day names is  @var{template}.  The interpretation of month and day names is
# Line 990  The value of this variable is the number Line 1051  The value of this variable is the number
1051  reported by the following procedures.  reported by the following procedures.
1052  @end defvar  @end defvar
1053    
1054  @deffn primitive times  @deffn {Scheme Procedure} times
1055    @deffnx {C Function} scm_times ()
1056  Return an object with information about real and processor  Return an object with information about real and processor
1057  time.  The following procedures accept such an object as an  time.  The following procedures accept such an object as an
1058  argument and return a selected component:  argument and return a selected component:
# Line 1014  terminated child processes. Line 1076  terminated child processes.
1076  @end table  @end table
1077  @end deffn  @end deffn
1078    
1079  @deffn primitive get-internal-real-time  @deffn {Scheme Procedure} get-internal-real-time
1080    @deffnx {C Function} scm_get_internal_real_time ()
1081  Return the number of time units since the interpreter was  Return the number of time units since the interpreter was
1082  started.  started.
1083  @end deffn  @end deffn
1084    
1085  @deffn primitive get-internal-run-time  @deffn {Scheme Procedure} get-internal-run-time
1086    @deffnx {C Function} scm_get_internal_run_time ()
1087  Return the number of time units of processor time used by the  Return the number of time units of processor time used by the
1088  interpreter.  Both @emph{system} and @emph{user} time are  interpreter.  Both @emph{system} and @emph{user} time are
1089  included but subprocesses are not.  included but subprocesses are not.
# Line 1028  included but subprocesses are not. Line 1092  included but subprocesses are not.
1092  @node Runtime Environment  @node Runtime Environment
1093  @section Runtime Environment  @section Runtime Environment
1094    
1095  @deffn primitive program-arguments  @deffn {Scheme Procedure} program-arguments
1096  @deffnx procedure command-line  @deffnx {Scheme Procedure} command-line
1097    @deffnx {C Function} scm_program_arguments ()
1098  Return the list of command line arguments passed to Guile, as a list of  Return the list of command line arguments passed to Guile, as a list of
1099  strings.  The list includes the invoked program name, which is usually  strings.  The list includes the invoked program name, which is usually
1100  @code{"guile"}, but excludes switches and parameters for command line  @code{"guile"}, but excludes switches and parameters for command line
1101  options like @code{-e} and @code{-l}.  options like @code{-e} and @code{-l}.
1102  @end deffn  @end deffn
1103    
1104  @deffn primitive getenv nam  @deffn {Scheme Procedure} getenv nam
1105    @deffnx {C Function} scm_getenv (nam)
1106  Looks up the string @var{name} in the current environment.  The return  Looks up the string @var{name} in the current environment.  The return
1107  value is @code{#f} unless a string of the form @code{NAME=VALUE} is  value is @code{#f} unless a string of the form @code{NAME=VALUE} is
1108  found, in which case the string @code{VALUE} is returned.  found, in which case the string @code{VALUE} is returned.
1109  @end deffn  @end deffn
1110    
1111  @c begin (scm-doc-string "boot-9.scm" "setenv")  @c begin (scm-doc-string "boot-9.scm" "setenv")
1112  @deffn procedure setenv name value  @deffn {Scheme Procedure} setenv name value
1113  Modifies the environment of the current process, which is  Modifies the environment of the current process, which is
1114  also the default environment inherited by child processes.  also the default environment inherited by child processes.
1115    
# Line 1055  to the environment, replacing any existi Line 1121  to the environment, replacing any existi
1121  The return value is unspecified.  The return value is unspecified.
1122  @end deffn  @end deffn
1123    
1124  @deffn primitive environ [env]  @deffn {Scheme Procedure} environ [env]
1125    @deffnx {C Function} scm_environ (env)
1126  If @var{env} is omitted, return the current environment (in the  If @var{env} is omitted, return the current environment (in the
1127  Unix sense) as a list of strings.  Otherwise set the current  Unix sense) as a list of strings.  Otherwise set the current
1128  environment, which is also the default environment for child  environment, which is also the default environment for child
# Line 1065  processes, to the supplied list of strin Line 1132  processes, to the supplied list of strin
1132  then the return value is unspecified.  then the return value is unspecified.
1133  @end deffn  @end deffn
1134    
1135  @deffn primitive putenv str  @deffn {Scheme Procedure} putenv str
1136    @deffnx {C Function} scm_putenv (str)
1137  Modifies the environment of the current process, which is  Modifies the environment of the current process, which is
1138  also the default environment inherited by child processes.  also the default environment inherited by child processes.
1139    
# Line 1084  The return value is unspecified. Line 1152  The return value is unspecified.
1152  @section Processes  @section Processes
1153    
1154  @findex cd  @findex cd
1155  @deffn primitive chdir str  @deffn {Scheme Procedure} chdir str
1156    @deffnx {C Function} scm_chdir (str)
1157  Change the current working directory to @var{path}.  Change the current working directory to @var{path}.
1158  The return value is unspecified.  The return value is unspecified.
1159  @end deffn  @end deffn
1160    
1161  @findex pwd  @findex pwd
1162  @deffn primitive getcwd  @deffn {Scheme Procedure} getcwd
1163    @deffnx {C Function} scm_getcwd ()
1164  Return the name of the current working directory.  Return the name of the current working directory.
1165  @end deffn  @end deffn
1166    
1167  @deffn primitive umask [mode]  @deffn {Scheme Procedure} umask [mode]
1168    @deffnx {C Function} scm_umask (mode)
1169  If @var{mode} is omitted, returns a decimal number representing the current  If @var{mode} is omitted, returns a decimal number representing the current
1170  file creation mask.  Otherwise the file creation mask is set to  file creation mask.  Otherwise the file creation mask is set to
1171  @var{mode} and the previous value is returned.  @var{mode} and the previous value is returned.
# Line 1102  file creation mask.  Otherwise the file Line 1173  file creation mask.  Otherwise the file
1173  E.g., @code{(umask #o022)} sets the mask to octal 22, decimal 18.  E.g., @code{(umask #o022)} sets the mask to octal 22, decimal 18.
1174  @end deffn  @end deffn
1175    
1176  @deffn primitive chroot path  @deffn {Scheme Procedure} chroot path
1177    @deffnx {C Function} scm_chroot (path)
1178  Change the root directory to that specified in @var{path}.  Change the root directory to that specified in @var{path}.
1179  This directory will be used for path names beginning with  This directory will be used for path names beginning with
1180  @file{/}.  The root directory is inherited by all children  @file{/}.  The root directory is inherited by all children
# Line 1110  of the current process.  Only the superu Line 1182  of the current process.  Only the superu
1182  root directory.  root directory.
1183  @end deffn  @end deffn
1184    
1185  @deffn primitive getpid  @deffn {Scheme Procedure} getpid
1186    @deffnx {C Function} scm_getpid ()
1187  Return an integer representing the current process ID.  Return an integer representing the current process ID.
1188  @end deffn  @end deffn
1189    
1190  @deffn primitive getgroups  @deffn {Scheme Procedure} getgroups
1191    @deffnx {C Function} scm_getgroups ()
1192  Return a vector of integers representing the current  Return a vector of integers representing the current
1193  supplementary group IDs.  supplementary group IDs.
1194  @end deffn  @end deffn
1195    
1196  @deffn primitive getppid  @deffn {Scheme Procedure} getppid
1197    @deffnx {C Function} scm_getppid ()
1198  Return an integer representing the process ID of the parent  Return an integer representing the process ID of the parent
1199  process.  process.
1200  @end deffn  @end deffn
1201    
1202  @deffn primitive getuid  @deffn {Scheme Procedure} getuid
1203    @deffnx {C Function} scm_getuid ()
1204  Return an integer representing the current real user ID.  Return an integer representing the current real user ID.
1205  @end deffn  @end deffn
1206    
1207  @deffn primitive getgid  @deffn {Scheme Procedure} getgid
1208    @deffnx {C Function} scm_getgid ()
1209  Return an integer representing the current real group ID.  Return an integer representing the current real group ID.
1210  @end deffn  @end deffn
1211    
1212  @deffn primitive geteuid  @deffn {Scheme Procedure} geteuid
1213    @deffnx {C Function} scm_geteuid ()
1214  Return an integer representing the current effective user ID.  Return an integer representing the current effective user ID.
1215  If the system does not support effective IDs, then the real ID  If the system does not support effective IDs, then the real ID
1216  is returned.  @code{(feature? 'EIDs)} reports whether the  is returned.  @code{(feature? 'EIDs)} reports whether the
1217  system supports effective IDs.  system supports effective IDs.
1218  @end deffn  @end deffn
1219    
1220  @deffn primitive getegid  @deffn {Scheme Procedure} getegid
1221    @deffnx {C Function} scm_getegid ()
1222  Return an integer representing the current effective group ID.  Return an integer representing the current effective group ID.
1223  If the system does not support effective IDs, then the real ID  If the system does not support effective IDs, then the real ID
1224  is returned.  @code{(feature? 'EIDs)} reports whether the  is returned.  @code{(feature? 'EIDs)} reports whether the
1225  system supports effective IDs.  system supports effective IDs.
1226  @end deffn  @end deffn
1227    
1228  @deffn primitive setuid id  @deffn {Scheme Procedure} setuid id
1229    @deffnx {C Function} scm_setuid (id)
1230  Sets both the real and effective user IDs to the integer @var{id}, provided  Sets both the real and effective user IDs to the integer @var{id}, provided
1231  the process has appropriate privileges.  the process has appropriate privileges.
1232  The return value is unspecified.  The return value is unspecified.
1233  @end deffn  @end deffn
1234    
1235  @deffn primitive setgid id  @deffn {Scheme Procedure} setgid id
1236    @deffnx {C Function} scm_setgid (id)
1237  Sets both the real and effective group IDs to the integer @var{id}, provided  Sets both the real and effective group IDs to the integer @var{id}, provided
1238  the process has appropriate privileges.  the process has appropriate privileges.
1239  The return value is unspecified.  The return value is unspecified.
1240  @end deffn  @end deffn
1241    
1242  @deffn primitive seteuid id  @deffn {Scheme Procedure} seteuid id
1243    @deffnx {C Function} scm_seteuid (id)
1244  Sets the effective user ID to the integer @var{id}, provided the process  Sets the effective user ID to the integer @var{id}, provided the process
1245  has appropriate privileges.  If effective IDs are not supported, the  has appropriate privileges.  If effective IDs are not supported, the
1246  real ID is set instead -- @code{(feature? 'EIDs)} reports whether the  real ID is set instead -- @code{(feature? 'EIDs)} reports whether the
# Line 1166  system supports effective IDs. Line 1248  system supports effective IDs.
1248  The return value is unspecified.  The return value is unspecified.
1249  @end deffn  @end deffn
1250    
1251  @deffn primitive setegid id  @deffn {Scheme Procedure} setegid id
1252    @deffnx {C Function} scm_setegid (id)
1253  Sets the effective group ID to the integer @var{id}, provided the process  Sets the effective group ID to the integer @var{id}, provided the process
1254  has appropriate privileges.  If effective IDs are not supported, the  has appropriate privileges.  If effective IDs are not supported, the
1255  real ID is set instead -- @code{(feature? 'EIDs)} reports whether the  real ID is set instead -- @code{(feature? 'EIDs)} reports whether the
# Line 1174  system supports effective IDs. Line 1257  system supports effective IDs.
1257  The return value is unspecified.  The return value is unspecified.
1258  @end deffn  @end deffn
1259    
1260  @deffn primitive getpgrp  @deffn {Scheme Procedure} getpgrp
1261    @deffnx {C Function} scm_getpgrp ()
1262  Return an integer representing the current process group ID.  Return an integer representing the current process group ID.
1263  This is the POSIX definition, not BSD.  This is the POSIX definition, not BSD.
1264  @end deffn  @end deffn
1265    
1266  @deffn primitive setpgid pid pgid  @deffn {Scheme Procedure} setpgid pid pgid
1267    @deffnx {C Function} scm_setpgid (pid, pgid)
1268  Move the process @var{pid} into the process group @var{pgid}.  @var{pid} or  Move the process @var{pid} into the process group @var{pgid}.  @var{pid} or
1269  @var{pgid} must be integers: they can be zero to indicate the ID of the  @var{pgid} must be integers: they can be zero to indicate the ID of the
1270  current process.  current process.
# Line 1187  Fails on systems that do not support job Line 1272  Fails on systems that do not support job
1272  The return value is unspecified.  The return value is unspecified.
1273  @end deffn  @end deffn
1274    
1275  @deffn primitive setsid  @deffn {Scheme Procedure} setsid
1276    @deffnx {C Function} scm_setsid ()
1277  Creates a new session.  The current process becomes the session leader  Creates a new session.  The current process becomes the session leader
1278  and is put in a new process group.  The process will be detached  and is put in a new process group.  The process will be detached
1279  from its controlling terminal if it has one.  from its controlling terminal if it has one.
1280  The return value is an integer representing the new process group ID.  The return value is an integer representing the new process group ID.
1281  @end deffn  @end deffn
1282    
1283  @deffn primitive waitpid pid [options]  @deffn {Scheme Procedure} waitpid pid [options]
1284    @deffnx {C Function} scm_waitpid (pid, options)
1285  This procedure collects status information from a child process which  This procedure collects status information from a child process which
1286  has terminated or (optionally) stopped.  Normally it will  has terminated or (optionally) stopped.  Normally it will
1287  suspend the calling process until this can be done.  If more than one  suspend the calling process until this can be done.  If more than one
# Line 1242  The following three Line 1329  The following three
1329  functions can be used to decode the process status code returned  functions can be used to decode the process status code returned
1330  by @code{waitpid}.  by @code{waitpid}.
1331    
1332  @deffn primitive status:exit-val status  @deffn {Scheme Procedure} status:exit-val status
1333    @deffnx {C Function} scm_status_exit_val (status)
1334  Return the exit status value, as would be set if a process  Return the exit status value, as would be set if a process
1335  ended normally through a call to @code{exit} or @code{_exit},  ended normally through a call to @code{exit} or @code{_exit},
1336  if any, otherwise @code{#f}.  if any, otherwise @code{#f}.
1337  @end deffn  @end deffn
1338    
1339  @deffn primitive status:term-sig status  @deffn {Scheme Procedure} status:term-sig status
1340    @deffnx {C Function} scm_status_term_sig (status)
1341  Return the signal number which terminated the process, if any,  Return the signal number which terminated the process, if any,
1342  otherwise @code{#f}.  otherwise @code{#f}.
1343  @end deffn  @end deffn
1344    
1345  @deffn primitive status:stop-sig status  @deffn {Scheme Procedure} status:stop-sig status
1346    @deffnx {C Function} scm_status_stop_sig (status)
1347  Return the signal number which stopped the process, if any,  Return the signal number which stopped the process, if any,
1348  otherwise @code{#f}.  otherwise @code{#f}.
1349  @end deffn  @end deffn
1350    
1351  @deffn primitive system [cmd]  @deffn {Scheme Procedure} system [cmd]
1352    @deffnx {C Function} scm_system (cmd)
1353  Execute @var{cmd} using the operating system's "command  Execute @var{cmd} using the operating system's "command
1354  processor".  Under Unix this is usually the default shell  processor".  Under Unix this is usually the default shell
1355  @code{sh}.  The value returned is @var{cmd}'s exit status as  @code{sh}.  The value returned is @var{cmd}'s exit status as
# Line 1269  If @code{system} is called without argum Line 1360  If @code{system} is called without argum
1360  indicating whether the command processor is available.  indicating whether the command processor is available.
1361  @end deffn  @end deffn
1362    
1363  @deffn primitive primitive-exit [status]  @deffn {Scheme Procedure} primitive-exit [status]
1364    @deffnx {C Function} scm_primitive_exit (status)
1365  Terminate the current process without unwinding the Scheme stack.  Terminate the current process without unwinding the Scheme stack.
1366  This is would typically be useful after a fork.  The exit status  This is would typically be useful after a fork.  The exit status
1367  is @var{status} if supplied, otherwise zero.  is @var{status} if supplied, otherwise zero.
1368  @end deffn  @end deffn
1369    
1370  @deffn primitive execl filename . args  @deffn {Scheme Procedure} execl filename . args
1371    @deffnx {C Function} scm_execl (filename, args)
1372  Executes the file named by @var{path} as a new process image.  Executes the file named by @var{path} as a new process image.
1373  The remaining arguments are supplied to the process; from a C program  The remaining arguments are supplied to the process; from a C program
1374  they are accessible as the @code{argv} argument to @code{main}.  they are accessible as the @code{argv} argument to @code{main}.
# Line 1289  This procedure is currently implemented Line 1382  This procedure is currently implemented
1382  call, but we call it @code{execl} because of its Scheme calling interface.  call, but we call it @code{execl} because of its Scheme calling interface.
1383  @end deffn  @end deffn
1384    
1385  @deffn primitive execlp filename . args  @deffn {Scheme Procedure} execlp filename . args
1386    @deffnx {C Function} scm_execlp (filename, args)
1387  Similar to @code{execl}, however if  Similar to @code{execl}, however if
1388  @var{filename} does not contain a slash  @var{filename} does not contain a slash
1389  then the file to execute will be located by searching the  then the file to execute will be located by searching the
# Line 1299  This procedure is currently implemented Line 1393  This procedure is currently implemented
1393  call, but we call it @code{execlp} because of its Scheme calling interface.  call, but we call it @code{execlp} because of its Scheme calling interface.
1394  @end deffn  @end deffn
1395    
1396  @deffn primitive execle filename env . args  @deffn {Scheme Procedure} execle filename env . args
1397    @deffnx {C Function} scm_execle (filename, env, args)
1398  Similar to @code{execl}, but the environment of the new process is  Similar to @code{execl}, but the environment of the new process is
1399  specified by @var{env}, which must be a list of strings as returned by the  specified by @var{env}, which must be a list of strings as returned by the
1400  @code{environ} procedure.  @code{environ} procedure.
# Line 1308  This procedure is currently implemented Line 1403  This procedure is currently implemented
1403  call, but we call it @code{execle} because of its Scheme calling interface.  call, but we call it @code{execle} because of its Scheme calling interface.
1404  @end deffn  @end deffn
1405    
1406  @deffn primitive primitive-fork  @deffn {Scheme Procedure} primitive-fork
1407    @deffnx {C Function} scm_fork ()
1408  Creates a new "child" process by duplicating the current "parent" process.  Creates a new "child" process by duplicating the current "parent" process.
1409  In the child the return value is 0.  In the parent the return value is  In the child the return value is 0.  In the parent the return value is
1410  the integer process ID of the child.  the integer process ID of the child.
# Line 1317  This procedure has been renamed from @co Line 1413  This procedure has been renamed from @co
1413  with the scsh fork.  with the scsh fork.
1414  @end deffn  @end deffn
1415    
1416  @deffn primitive nice incr  @deffn {Scheme Procedure} nice incr
1417    @deffnx {C Function} scm_nice (incr)
1418  Increment the priority of the current process by @var{incr}.  A higher  Increment the priority of the current process by @var{incr}.  A higher
1419  priority value means that the process runs less often.  priority value means that the process runs less often.
1420  The return value is unspecified.  The return value is unspecified.
1421  @end deffn  @end deffn
1422    
1423  @deffn primitive setpriority which who prio  @deffn {Scheme Procedure} setpriority which who prio
1424    @deffnx {C Function} scm_setpriority (which, who, prio)
1425  Set the scheduling priority of the process, process group  Set the scheduling priority of the process, process group
1426  or user, as indicated by @var{which} and @var{who}. @var{which}  or user, as indicated by @var{which} and @var{who}. @var{which}
1427  is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}  is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}
# Line 1339  processes.  Only the super-user may lowe Line 1437  processes.  Only the super-user may lowe
1437  The return value is not specified.  The return value is not specified.
1438  @end deffn  @end deffn
1439    
1440  @deffn primitive getpriority which who  @deffn {Scheme Procedure} getpriority which who
1441    @deffnx {C Function} scm_getpriority (which, who)
1442  Return the scheduling priority of the process, process group  Return the scheduling priority of the process, process group
1443  or user, as indicated by @var{which} and @var{who}. @var{which}  or user, as indicated by @var{which} and @var{who}. @var{which}
1444  is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}  is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}
# Line 1358  specified processes. Line 1457  specified processes.
1457    
1458  Procedures to raise, handle and wait for signals.  Procedures to raise, handle and wait for signals.
1459    
1460  @deffn primitive kill pid sig  @deffn {Scheme Procedure} kill pid sig
1461    @deffnx {C Function} scm_kill (pid, sig)
1462  Sends a signal to the specified process or group of processes.  Sends a signal to the specified process or group of processes.
1463    
1464  @var{pid} specifies the processes to which the signal is sent:  @var{pid} specifies the processes to which the signal is sent:
# Line 1388  Interrupt signal. Line 1488  Interrupt signal.
1488  @end defvar  @end defvar
1489  @end deffn  @end deffn
1490    
1491  @deffn primitive raise sig  @deffn {Scheme Procedure} raise sig
1492    @deffnx {C Function} scm_raise (sig)
1493  Sends a specified signal @var{sig} to the current process, where  Sends a specified signal @var{sig} to the current process, where
1494  @var{sig} is as described for the kill procedure.  @var{sig} is as described for the kill procedure.
1495  @end deffn  @end deffn
1496    
1497  @deffn primitive sigaction signum [handler [flags]]  @deffn {Scheme Procedure} sigaction signum [handler [flags]]
1498    @deffnx {C Function} scm_sigaction (signum, handler, flags)
1499  Install or report the signal handler for a specified signal.  Install or report the signal handler for a specified signal.
1500    
1501  @var{signum} is the signal number, which can be specified using the value  @var{signum} is the signal number, which can be specified using the value
# Line 1422  provide solutions to the problem of cons Line 1524  provide solutions to the problem of cons
1524  structures.  structures.
1525  @end deffn  @end deffn
1526    
1527  @deffn primitive restore-signals  @deffn {Scheme Procedure} restore-signals
1528    @deffnx {C Function} scm_restore_signals ()
1529  Return all signal handlers to the values they had before any call to  Return all signal handlers to the values they had before any call to
1530  @code{sigaction} was made.  The return value is unspecified.  @code{sigaction} was made.  The return value is unspecified.
1531  @end deffn  @end deffn
1532    
1533  @deffn primitive alarm i  @deffn {Scheme Procedure} alarm i
1534    @deffnx {C Function} scm_alarm (i)
1535  Set a timer to raise a @code{SIGALRM} signal after the specified  Set a timer to raise a @code{SIGALRM} signal after the specified
1536  number of seconds (an integer).  It's advisable to install a signal  number of seconds (an integer).  It's advisable to install a signal
1537  handler for  handler for
# Line 1439  if any.  The new value replaces the prev Line 1543  if any.  The new value replaces the prev
1543  no previous alarm, the return value is zero.  no previous alarm, the return value is zero.
1544  @end deffn  @end deffn
1545    
1546  @deffn primitive pause  @deffn {Scheme Procedure} pause
1547    @deffnx {C Function} scm_pause ()
1548  Pause the current process (thread?) until a signal arrives whose  Pause the current process (thread?) until a signal arrives whose
1549  action is to either terminate the current process or invoke a  action is to either terminate the current process or invoke a
1550  handler procedure.  The return value is unspecified.  handler procedure.  The return value is unspecified.
1551  @end deffn  @end deffn
1552    
1553  @deffn primitive sleep i  @deffn {Scheme Procedure} sleep i
1554    @deffnx {C Function} scm_sleep (i)
1555  Wait for the given number of seconds (an integer) or until a signal  Wait for the given number of seconds (an integer) or until a signal
1556  arrives.  The return value is zero if the time elapses or the number  arrives.  The return value is zero if the time elapses or the number
1557  of seconds remaining otherwise.  of seconds remaining otherwise.
1558  @end deffn  @end deffn
1559    
1560  @deffn primitive usleep i  @deffn {Scheme Procedure} usleep i
1561    @deffnx {C Function} scm_usleep (i)
1562  Sleep for I microseconds.  @code{usleep} is not available on  Sleep for I microseconds.  @code{usleep} is not available on
1563  all platforms.  all platforms.
1564  @end deffn  @end deffn
1565    
1566  @deffn primitive setitimer which_timer interval_seconds interval_microseconds value_seconds value_microseconds  @deffn {Scheme Procedure} setitimer which_timer interval_seconds interval_microseconds value_seconds value_microseconds
1567    @deffnx {C Function} scm_setitimer (which_timer, interval_seconds, interval_microseconds, value_seconds, value_microseconds)
1568  Set the timer specified by @var{which_timer} according to the given  Set the timer specified by @var{which_timer} according to the given
1569  @var{interval_seconds}, @var{interval_microseconds},  @var{interval_seconds}, @var{interval_microseconds},
1570  @var{value_seconds}, and @var{value_microseconds} values.  @var{value_seconds}, and @var{value_microseconds} values.
# Line 1474  microseconds of the timer @code{it_inter Line 1582  microseconds of the timer @code{it_inter
1582  the seconds and microseconds of the timer @code{it_value}.  the seconds and microseconds of the timer @code{it_value}.
1583  @end deffn  @end deffn
1584    
1585  @deffn primitive getitimer which_timer  @deffn {Scheme Procedure} getitimer which_timer
1586    @deffnx {C Function} scm_getitimer (which_timer)
1587  Return information about the timer specified by @var{which_timer}  Return information about the timer specified by @var{which_timer}
1588  Errors are handled as described in the guile info pages under ``POSIX  Errors are handled as described in the guile info pages under ``POSIX
1589  Interface Conventions''.  Interface Conventions''.
# Line 1492  the seconds and microseconds of the time Line 1601  the seconds and microseconds of the time
1601  @node Terminals and Ptys  @node Terminals and Ptys
1602  @section Terminals and Ptys  @section Terminals and Ptys
1603    
1604  @deffn primitive isatty? port  @deffn {Scheme Procedure} isatty? port
1605    @deffnx {C Function} scm_isatty_p (port)
1606  Return @code{#t} if @var{port} is using a serial non--file  Return @code{#t} if @var{port} is using a serial non--file
1607  device, otherwise @code{#f}.  device, otherwise @code{#f}.
1608  @end deffn  @end deffn
1609    
1610  @deffn primitive ttyname port  @deffn {Scheme Procedure} ttyname port
1611    @deffnx {C Function} scm_ttyname (port)
1612  Return a string with the name of the serial terminal device  Return a string with the name of the serial terminal device
1613  underlying @var{port}.  underlying @var{port}.
1614  @end deffn  @end deffn
1615    
1616  @deffn primitive ctermid  @deffn {Scheme Procedure} ctermid
1617    @deffnx {C Function} scm_ctermid ()
1618  Return a string containing the file name of the controlling  Return a string containing the file name of the controlling
1619  terminal for the current process.  terminal for the current process.
1620  @end deffn  @end deffn
1621    
1622  @deffn primitive tcgetpgrp port  @deffn {Scheme Procedure} tcgetpgrp port
1623    @deffnx {C Function} scm_tcgetpgrp (port)
1624  Return the process group ID of the foreground process group  Return the process group ID of the foreground process group
1625  associated with the terminal open on the file descriptor  associated with the terminal open on the file descriptor
1626  underlying @var{port}.  underlying @var{port}.
# Line 1520  terminated, and no other job has yet bee Line 1633  terminated, and no other job has yet bee
1633  foreground.  foreground.
1634  @end deffn  @end deffn
1635    
1636  @deffn primitive tcsetpgrp port pgid  @deffn {Scheme Procedure} tcsetpgrp port pgid
1637    @deffnx {C Function} scm_tcsetpgrp (port, pgid)
1638  Set the foreground process group ID for the terminal used by the file  Set the foreground process group ID for the terminal used by the file
1639  descriptor underlying @var{port} to the integer @var{pgid}.  descriptor underlying @var{port} to the integer @var{pgid}.
1640  The calling process  The calling process
# Line 1540  module: Line 1654  module:
1654  @end smalllisp  @end smalllisp
1655    
1656  @findex popen  @findex popen
1657  @deffn procedure open-pipe command modes  @deffn {Scheme Procedure} open-pipe command modes
1658  Executes the shell command @var{command} (a string) in a subprocess.  Executes the shell command @var{command} (a string) in a subprocess.
1659  A pipe to the process is created and returned.  @var{modes} specifies  A pipe to the process is created and returned.  @var{modes} specifies
1660  whether an input or output pipe to the process is created: it should  whether an input or output pipe to the process is created: it should
1661  be the value of @code{OPEN_READ} or @code{OPEN_WRITE}.  be the value of @code{OPEN_READ} or @code{OPEN_WRITE}.
1662  @end deffn  @end deffn
1663    
1664  @deffn procedure open-input-pipe command  @deffn {Scheme Procedure} open-input-pipe command
1665  Equivalent to @code{open-pipe} with mode @code{OPEN_READ}.  Equivalent to @code{open-pipe} with mode @code{OPEN_READ}.
1666  @end deffn  @end deffn
1667    
1668  @deffn procedure open-output-pipe command  @deffn {Scheme Procedure} open-output-pipe command
1669  Equivalent to @code{open-pipe} with mode @code{OPEN_WRITE}.  Equivalent to @code{open-pipe} with mode @code{OPEN_WRITE}.
1670  @end deffn  @end deffn
1671    
1672  @findex pclose  @findex pclose
1673  @deffn procedure close-pipe port  @deffn {Scheme Procedure} close-pipe port
1674  Closes the pipe created by @code{open-pipe}, then waits for the process  Closes the pipe created by @code{open-pipe}, then waits for the process
1675  to terminate and returns its status value, @xref{Processes, waitpid}, for  to terminate and returns its status value, @xref{Processes, waitpid}, for
1676  information on how to interpret this value.  information on how to interpret this value.
# Line 1582  between numeric and string formats. Line 1696  between numeric and string formats.
1696    
1697  @subsubsection IPv4 Address Conversion  @subsubsection IPv4 Address Conversion
1698    
1699  @deffn primitive inet-aton address  @deffn {Scheme Procedure} inet-aton address
1700    @deffnx {C Function} scm_inet_aton (address)
1701  Convert an IPv4 Internet address from printable string  Convert an IPv4 Internet address from printable string
1702  (dotted decimal notation) to an integer.  E.g.,  (dotted decimal notation) to an integer.  E.g.,
1703    
# Line 1591  Convert an IPv4 Internet address from pr Line 1706  Convert an IPv4 Internet address from pr
1706  @end lisp  @end lisp
1707  @end deffn  @end deffn
1708    
1709  @deffn primitive inet-ntoa inetid  @deffn {Scheme Procedure} inet-ntoa inetid
1710    @deffnx {C Function} scm_inet_ntoa (inetid)
1711  Convert an IPv4 Internet address to a printable  Convert an IPv4 Internet address to a printable
1712  (dotted decimal notation) string.  E.g.,  (dotted decimal notation) string.  E.g.,
1713    
# Line 1600  Convert an IPv4 Internet address to a pr Line 1716  Convert an IPv4 Internet address to a pr
1716  @end lisp  @end lisp
1717  @end deffn  @end deffn
1718    
1719  @deffn primitive inet-netof address  @deffn {Scheme Procedure} inet-netof address
1720    @deffnx {C Function} scm_inet_netof (address)
1721  Return the network number part of the given IPv4  Return the network number part of the given IPv4
1722  Internet address.  E.g.,  Internet address.  E.g.,
1723    
# Line 1609  Internet address.  E.g., Line 1726  Internet address.  E.g.,
1726  @end lisp  @end lisp
1727  @end deffn  @end deffn
1728    
1729  @deffn primitive inet-lnaof address  @deffn {Scheme Procedure} inet-lnaof address
1730    @deffnx {C Function} scm_lnaof (address)
1731  Return the local-address-with-network part of the given  Return the local-address-with-network part of the given
1732  IPv4 Internet address, using the obsolete class A/B/C system.  IPv4 Internet address, using the obsolete class A/B/C system.
1733  E.g.,  E.g.,
# Line 1619  E.g., Line 1737  E.g.,
1737  @end lisp  @end lisp
1738  @end deffn  @end deffn
1739    
1740  @deffn primitive inet-makeaddr net lna  @deffn {Scheme Procedure} inet-makeaddr net lna
1741    @deffnx {C Function} scm_inet_makeaddr (net, lna)
1742  Make an IPv4 Internet address by combining the network number  Make an IPv4 Internet address by combining the network number
1743  @var{net} with the local-address-within-network number  @var{net} with the local-address-within-network number
1744  @var{lna}.  E.g.,  @var{lna}.  E.g.,
# Line 1631  Make an IPv4 Internet address by combini Line 1750  Make an IPv4 Internet address by combini
1750    
1751  @subsubsection IPv6 Address Conversion  @subsubsection IPv6 Address Conversion
1752    
1753  @deffn primitive inet-ntop family address  @deffn {Scheme Procedure} inet-ntop family address
1754    @deffnx {C Function} scm_inet_ntop (family, address)
1755  Convert a network address into a printable string.  Convert a network address into a printable string.
1756  Note that unlike the C version of this function,  Note that unlike the C version of this function,
1757  the input is an integer with normal host byte ordering.  the input is an integer with normal host byte ordering.
# Line 1644  ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff Line 1764  ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
1764  @end lisp  @end lisp
1765  @end deffn  @end deffn
1766    
1767  @deffn primitive inet-pton family address  @deffn {Scheme Procedure} inet-pton family address
1768    @deffnx {C Function} scm_inet_pton (family, address)
1769  Convert a string containing a printable network address to  Convert a string containing a printable network address to
1770  an integer address.  Note that unlike the C version of this  an integer address.  Note that unlike the C version of this
1771  function,  function,
# Line 1674  identity inside software. Line 1795  identity inside software.
1795  The following functions accept a host object and return a selected  The following functions accept a host object and return a selected
1796  component:  component:
1797    
1798  @deffn procedure hostent:name host  @deffn {Scheme Procedure} hostent:name host
1799  The "official" hostname for @var{host}.  The "official" hostname for @var{host}.
1800  @end deffn  @end deffn
1801  @deffn procedure hostent:aliases host  @deffn {Scheme Procedure} hostent:aliases host
1802  A list of aliases for @var{host}.  A list of aliases for @var{host}.
1803  @end deffn  @end deffn
1804  @deffn procedure hostent:addrtype host  @deffn {Scheme Procedure} hostent:addrtype host
1805  The host address type.  For hosts with Internet addresses, this will  The host address type.  For hosts with Internet addresses, this will
1806  return @code{AF_INET}.  return @code{AF_INET}.
1807  @end deffn  @end deffn
1808  @deffn procedure hostent:length host  @deffn {Scheme Procedure} hostent:length host
1809  The length of each address for @var{host}, in bytes.  The length of each address for @var{host}, in bytes.
1810  @end deffn  @end deffn
1811  @deffn procedure hostent:addr-list host  @deffn {Scheme Procedure} hostent:addr-list host
1812  The list of network addresses associated with @var{host}.  The list of network addresses associated with @var{host}.
1813  @end deffn  @end deffn
1814    
1815  The following procedures are used to search the host database:  The following procedures are used to search the host database:
1816    
1817  @deffn primitive gethost [host]  @deffn {Scheme Procedure} gethost [host]
1818  @deffnx procedure gethostbyname hostname  @deffnx {Scheme Procedure} gethostbyname hostname
1819  @deffnx procedure gethostbyaddr address  @deffnx {Scheme Procedure} gethostbyaddr address
1820    @deffnx {C Function} scm_gethost (host)
1821  Look up a host by name or address, returning a host object.  The  Look up a host by name or address, returning a host object.  The
1822  @code{gethost} procedure will accept either a string name or an integer  @code{gethost} procedure will accept either a string name or an integer
1823  address; if given no arguments, it behaves like @code{gethostent} (see  address; if given no arguments, it behaves like @code{gethostent} (see
# Line 1710  Unusual conditions may result in errors Line 1832  Unusual conditions may result in errors
1832  The following procedures may be used to step through the host  The following procedures may be used to step through the host
1833  database from beginning to end.  database from beginning to end.
1834    
1835  @deffn procedure sethostent [stayopen]  @deffn {Scheme Procedure} sethostent [stayopen]
1836  Initialize an internal stream from which host objects may be read.  This  Initialize an internal stream from which host objects may be read.  This
1837  procedure must be called before any calls to @code{gethostent}, and may  procedure must be called before any calls to @code{gethostent}, and may
1838  also be called afterward to reset the host entry stream.  If  also be called afterward to reset the host entry stream.  If
# Line 1719  closed by subsequent @code{gethostbyname Line 1841  closed by subsequent @code{gethostbyname
1841  possibly giving an efficiency gain.  possibly giving an efficiency gain.
1842  @end deffn  @end deffn
1843    
1844  @deffn procedure gethostent  @deffn {Scheme Procedure} gethostent
1845  Return the next host object from the host database, or @code{#f} if  Return the next host object from the host database, or @code{#f} if
1846  there are no more hosts to be found (or an error has been encountered).  there are no more hosts to be found (or an error has been encountered).
1847  This procedure may not be used before @code{sethostent} has been called.  This procedure may not be used before @code{sethostent} has been called.
1848  @end deffn  @end deffn
1849    
1850  @deffn procedure endhostent  @deffn {Scheme Procedure} endhostent
1851  Close the stream used by @code{gethostent}.  The return value is unspecified.  Close the stream used by @code{gethostent}.  The return value is unspecified.
1852  @end deffn  @end deffn
1853    
1854  @deffn primitive sethost [stayopen]  @deffn {Scheme Procedure} sethost [stayopen]
1855    @deffnx {C Function} scm_sethost (stayopen)
1856  If @var{stayopen} is omitted, this is equivalent to @code{endhostent}.  If @var{stayopen} is omitted, this is equivalent to @code{endhostent}.
1857  Otherwise it is equivalent to @code{sethostent stayopen}.  Otherwise it is equivalent to @code{sethostent stayopen}.
1858  @end deffn  @end deffn
# Line 1738  Otherwise it is equivalent to @code{seth Line 1861  Otherwise it is equivalent to @code{seth
1861  The following functions accept an object representing a network  The following functions accept an object representing a network
1862  and return a selected component:  and return a selected component:
1863    
1864  @deffn procedure netent:name net  @deffn {Scheme Procedure} netent:name net
1865  The "official" network name.  The "official" network name.
1866  @end deffn  @end deffn
1867  @deffn procedure netent:aliases net  @deffn {Scheme Procedure} netent:aliases net
1868  A list of aliases for the network.  A list of aliases for the network.
1869  @end deffn  @end deffn
1870  @deffn procedure netent:addrtype net  @deffn {Scheme Procedure} netent:addrtype net
1871  The type of the network number.  Currently, this returns only  The type of the network number.  Currently, this returns only
1872  @code{AF_INET}.  @code{AF_INET}.
1873  @end deffn  @end deffn
1874  @deffn procedure netent:net net  @deffn {Scheme Procedure} netent:net net
1875  The network number.  The network number.
1876  @end deffn  @end deffn
1877    
1878  The following procedures are used to search the network database:  The following procedures are used to search the network database:
1879    
1880  @deffn primitive getnet [net]  @deffn {Scheme Procedure} getnet [net]
1881  @deffnx procedure getnetbyname net-name  @deffnx {Scheme Procedure} getnetbyname net-name
1882  @deffnx procedure getnetbyaddr net-number  @deffnx {Scheme Procedure} getnetbyaddr net-number
1883    @deffnx {C Function} scm_getnet (net)
1884  Look up a network by name or net number in the network database.  The  Look up a network by name or net number in the network database.  The
1885  @var{net-name} argument must be a string, and the @var{net-number}  @var{net-name} argument must be a string, and the @var{net-number}
1886  argument must be an integer.  @code{getnet} will accept either type of  argument must be an integer.  @code{getnet} will accept either type of
# Line 1767  given. Line 1891  given.
1891  The following procedures may be used to step through the network  The following procedures may be used to step through the network
1892  database from beginning to end.  database from beginning to end.
1893    
1894  @deffn procedure setnetent [stayopen]  @deffn {Scheme Procedure} setnetent [stayopen]
1895  Initialize an internal stream from which network objects may be read.  This  Initialize an internal stream from which network objects may be read.  This
1896  procedure must be called before any calls to @code{getnetent}, and may  procedure must be called before any calls to @code{getnetent}, and may
1897  also be called afterward to reset the net entry stream.  If  also be called afterward to reset the net entry stream.  If
# Line 1776  closed by subsequent @code{getnetbyname} Line 1900  closed by subsequent @code{getnetbyname}
1900  possibly giving an efficiency gain.  possibly giving an efficiency gain.
1901  @end deffn  @end deffn
1902    
1903  @deffn procedure getnetent  @deffn {Scheme Procedure} getnetent
1904  Return the next entry from the network database.  Return the next entry from the network database.
1905  @end deffn  @end deffn
1906    
1907  @deffn procedure endnetent  @deffn {Scheme Procedure} endnetent
1908  Close the stream used by @code{getnetent}.  The return value is unspecified.  Close the stream used by @code{getnetent}.  The return value is unspecified.
1909  @end deffn  @end deffn
1910    
1911  @deffn primitive setnet [stayopen]  @deffn {Scheme Procedure} setnet [stayopen]
1912    @deffnx {C Function} scm_setnet (stayopen)
1913  If @var{stayopen} is omitted, this is equivalent to @code{endnetent}.  If @var{stayopen} is omitted, this is equivalent to @code{endnetent}.
1914  Otherwise it is equivalent to @code{setnetent stayopen}.  Otherwise it is equivalent to @code{setnetent stayopen}.
1915  @end deffn  @end deffn
# Line 1794  Otherwise it is equivalent to @code{setn Line 1919  Otherwise it is equivalent to @code{setn
1919  The following functions accept an object representing a protocol  The following functions accept an object representing a protocol
1920  and return a selected component:  and return a selected component:
1921    
1922  @deffn procedure protoent:name protocol  @deffn {Scheme Procedure} protoent:name protocol
1923  The "official" protocol name.  The "official" protocol name.
1924  @end deffn  @end deffn
1925  @deffn procedure protoent:aliases protocol  @deffn {Scheme Procedure} protoent:aliases protocol
1926  A list of aliases for the protocol.  A list of aliases for the protocol.
1927  @end deffn  @end deffn
1928  @deffn procedure protoent:proto protocol  @deffn {Scheme Procedure} protoent:proto protocol
1929  The protocol number.  The protocol number.
1930  @end deffn  @end deffn
1931    
1932  The following procedures are used to search the protocol database:  The following procedures are used to search the protocol database:
1933    
1934  @deffn primitive getproto [protocol]  @deffn {Scheme Procedure} getproto [protocol]
1935  @deffnx procedure getprotobyname name  @deffnx {Scheme Procedure} getprotobyname name
1936  @deffnx procedure getprotobynumber number  @deffnx {Scheme Procedure} getprotobynumber number
1937    @deffnx {C Function} scm_getproto (protocol)
1938  Look up a network protocol by name or by number.  @code{getprotobyname}  Look up a network protocol by name or by number.  @code{getprotobyname}
1939  takes a string argument, and @code{getprotobynumber} takes an integer  takes a string argument, and @code{getprotobynumber} takes an integer
1940  argument.  @code{getproto} will accept either type, behaving like  argument.  @code{getproto} will accept either type, behaving like
# Line 1818  argument.  @code{getproto} will accept e Line 1944  argument.  @code{getproto} will accept e
1944  The following procedures may be used to step through the protocol  The following procedures may be used to step through the protocol
1945  database from beginning to end.  database from beginning to end.
1946    
1947  @deffn procedure setprotoent [stayopen]  @deffn {Scheme Procedure} setprotoent [stayopen]
1948  Initialize an internal stream from which protocol objects may be read.  This  Initialize an internal stream from which protocol objects may be read.  This
1949  procedure must be called before any calls to @code{getprotoent}, and may  procedure must be called before any calls to @code{getprotoent}, and may
1950  also be called afterward to reset the protocol entry stream.  If  also be called afterward to reset the protocol entry stream.  If
# Line 1827  closed by subsequent @code{getprotobynam Line 1953  closed by subsequent @code{getprotobynam
1953  possibly giving an efficiency gain.  possibly giving an efficiency gain.
1954  @end deffn  @end deffn
1955    
1956  @deffn procedure getprotoent  @deffn {Scheme Procedure} getprotoent
1957  Return the next entry from the protocol database.  Return the next entry from the protocol database.
1958  @end deffn  @end deffn
1959    
1960  @deffn procedure endprotoent  @deffn {Scheme Procedure} endprotoent
1961  Close the stream used by @code{getprotoent}.  The return value is unspecified.  Close the stream used by @code{getprotoent}.  The return value is unspecified.
1962  @end deffn  @end deffn
1963    
1964  @deffn primitive setproto [stayopen]  @deffn {Scheme Procedure} setproto [stayopen]
1965    @deffnx {C Function} scm_setproto (stayopen)
1966  If @var{stayopen} is omitted, this is equivalent to @code{endprotoent}.  If @var{stayopen} is omitted, this is equivalent to @code{endprotoent}.
1967  Otherwise it is equivalent to @code{setprotoent stayopen}.  Otherwise it is equivalent to @code{setprotoent stayopen}.
1968  @end deffn  @end deffn
# Line 1845  Otherwise it is equivalent to @code{setp Line 1972  Otherwise it is equivalent to @code{setp
1972  The following functions accept an object representing a service  The following functions accept an object representing a service
1973  and return a selected component:  and return a selected component:
1974    
1975  @deffn procedure servent:name serv  @deffn {Scheme Procedure} servent:name serv
1976  The "official" name of the network service.  The "official" name of the network service.
1977  @end deffn  @end deffn
1978  @deffn procedure servent:aliases serv  @deffn {Scheme Procedure} servent:aliases serv
1979  A list of aliases for the network service.  A list of aliases for the network service.
1980  @end deffn  @end deffn
1981  @deffn procedure servent:port serv  @deffn {Scheme Procedure} servent:port serv
1982  The Internet port used by the service.  The Internet port used by the service.
1983  @end deffn  @end deffn
1984  @deffn procedure servent:proto serv  @deffn {Scheme Procedure} servent:proto serv
1985  The protocol used by the service.  A service may be listed many times  The protocol used by the service.  A service may be listed many times
1986  in the database under different protocol names.  in the database under different protocol names.
1987  @end deffn  @end deffn
1988    
1989  The following procedures are used to search the service database:  The following procedures are used to search the service database:
1990    
1991  @deffn primitive getserv [name [protocol]]  @deffn {Scheme Procedure} getserv [name [protocol]]
1992  @deffnx procedure getservbyname name protocol  @deffnx {Scheme Procedure} getservbyname name protocol
1993  @deffnx procedure getservbyport port protocol  @deffnx {Scheme Procedure} getservbyport port protocol
1994    @deffnx {C Function} scm_getserv (name, protocol)
1995  Look up a network service by name or by service number, and return a  Look up a network service by name or by service number, and return a
1996  network service object.  The @var{protocol} argument specifies the name  network service object.  The @var{protocol} argument specifies the name
1997  of the desired protocol; if the protocol found in the network service  of the desired protocol; if the protocol found in the network service
# Line 1877  as its first argument; if given no argum Line 2005  as its first argument; if given no argum
2005  The following procedures may be used to step through the service  The following procedures may be used to step through the service
2006  database from beginning to end.  database from beginning to end.
2007    
2008  @deffn procedure setservent [stayopen]  @deffn {Scheme Procedure} setservent [stayopen]
2009  Initialize an internal stream from which service objects may be read.  This  Initialize an internal stream from which service objects may be read.  This
2010  procedure must be called before any calls to @code{getservent}, and may  procedure must be called before any calls to @code{getservent}, and may
2011  also be called afterward to reset the service entry stream.  If  also be called afterward to reset the service entry stream.  If
# Line 1886  closed by subsequent @code{getservbyname Line 2014  closed by subsequent @code{getservbyname
2014  possibly giving an efficiency gain.  possibly giving an efficiency gain.
2015  @end deffn  @end deffn
2016    
2017  @deffn procedure getservent  @deffn {Scheme Procedure} getservent
2018  Return the next entry from the services database.  Return the next entry from the services database.
2019  @end deffn  @end deffn
2020    
2021  @deffn procedure endservent  @deffn {Scheme Procedure} endservent
2022  Close the stream used by @code{getservent}.  The return value is unspecified.  Close the stream used by @code{getservent}.  The return value is unspecified.
2023  @end deffn  @end deffn
2024    
2025  @deffn primitive setserv [stayopen]  @deffn {Scheme Procedure} setserv [stayopen]
2026    @deffnx {C Function} scm_setserv (stayopen)
2027  If @var{stayopen} is omitted, this is equivalent to @code{endservent}.  If @var{stayopen} is omitted, this is equivalent to @code{endservent}.
2028  Otherwise it is equivalent to @code{setservent stayopen}.  Otherwise it is equivalent to @code{setservent stayopen}.
2029  @end deffn  @end deffn
# Line 1912  are always held in host order at the Sch Line 2041  are always held in host order at the Sch
2041  this section automatically convert between host and network order when  this section automatically convert between host and network order when
2042  required.  The arguments and return values are thus in host order.  required.  The arguments and return values are thus in host order.
2043    
2044  @deffn primitive socket family style proto  @deffn {Scheme Procedure} socket family style proto
2045    @deffnx {C Function} scm_socket (family, style, proto)
2046  Return a new socket port of the type specified by @var{family},  Return a new socket port of the type specified by @var{family},
2047  @var{style} and @var{proto}.  All three parameters are  @var{style} and @var{proto}.  All three parameters are
2048  integers.  Supported values for @var{family} are  integers.  Supported values for @var{family} are
# Line 1928  A single socket port cannot by used for Line 2058  A single socket port cannot by used for
2058  has been connected to another socket.  has been connected to another socket.
2059  @end deffn  @end deffn
2060    
2061  @deffn primitive socketpair family style proto  @deffn {Scheme Procedure} socketpair family style proto
2062    @deffnx {C Function} scm_socketpair (family, style, proto)
2063  Return a pair of connected (but unnamed) socket ports of the  Return a pair of connected (but unnamed) socket ports of the
2064  type specified by @var{family}, @var{style} and @var{proto}.  type specified by @var{family}, @var{style} and @var{proto}.
2065  Many systems support only socket pairs of the @code{AF_UNIX}  Many systems support only socket pairs of the @code{AF_UNIX}
# Line 1936  family.  Zero is likely to be the only m Line 2067  family.  Zero is likely to be the only m
2067  @var{proto}.  @var{proto}.
2068  @end deffn  @end deffn
2069    
2070  @deffn primitive getsockopt sock level optname  @deffn {Scheme Procedure} getsockopt sock level optname
2071    @deffnx {C Function} scm_getsockopt (sock, level, optname)
2072  Return the value of a particular socket option for the socket  Return the value of a particular socket option for the socket
2073  port @var{sock}.  @var{level} is an integer code for type of  port @var{sock}.  @var{level} is an integer code for type of
2074  option being requested, e.g., @code{SOL_SOCKET} for  option being requested, e.g., @code{SOL_SOCKET} for
# Line 1948  The returned value is typically an integ Line 2080  The returned value is typically an integ
2080  returns a pair of integers.  returns a pair of integers.
2081  @end deffn  @end deffn
2082    
2083  @deffn primitive setsockopt sock level optname value  @deffn {Scheme Procedure} setsockopt sock level optname value
2084    @deffnx {C Function} scm_setsockopt (sock, level, optname, value)
2085  Set the value of a particular socket option for the socket  Set the value of a particular socket option for the socket
2086  port @var{sock}.  @var{level} is an integer code for type of option  port @var{sock}.  @var{level} is an integer code for type of option
2087  being set, e.g., @code{SOL_SOCKET} for socket-level options.  being set, e.g., @code{SOL_SOCKET} for socket-level options.
# Line 1962  be a pair. Line 2095  be a pair.
2095  The return value is unspecified.  The return value is unspecified.
2096  @end deffn  @end deffn
2097    
2098  @deffn primitive shutdown sock how  @deffn {Scheme Procedure} shutdown sock how
2099    @deffnx {C Function} scm_shutdown (sock, how)
2100  Sockets can be closed simply by using @code{close-port}. The  Sockets can be closed simply by using @code{close-port}. The
2101  @code{shutdown} procedure allows reception or transmission on a  @code{shutdown} procedure allows reception or transmission on a
2102  connection to be shut down individually, according to the parameter  connection to be shut down individually, according to the parameter
# Line 1982  Stop both reception and transmission. Line 2116  Stop both reception and transmission.
2116  The return value is unspecified.  The return value is unspecified.
2117  @end deffn  @end deffn
2118    
2119  @deffn primitive connect sock fam address . args  @deffn {Scheme Procedure} connect sock fam address . args
2120    @deffnx {C Function} scm_connect (sock, fam, address, args)
2121  Initiate a connection from a socket using a specified address  Initiate a connection from a socket using a specified address
2122  family to the address  family to the address
2123  specified by @var{address} and possibly @var{args}.  specified by @var{address} and possibly @var{args}.
# Line 2006  where flowinfo and scope_id default to z Line 2141  where flowinfo and scope_id default to z
2141  The return value is unspecified.  The return value is unspecified.
2142  @end deffn  @end deffn
2143    
2144  @deffn primitive bind sock fam address . args  @deffn {Scheme Procedure} bind sock fam address . args
2145    @deffnx {C Function} scm_bind (sock, fam, address, args)
2146  Assign an address to the socket port @var{sock}.  Assign an address to the socket port @var{sock}.
2147  Generally this only needs to be done for server sockets,  Generally this only needs to be done for server sockets,
2148  so they know where to look for incoming connections.  A socket  so they know where to look for incoming connections.  A socket
# Line 2052  where flowinfo and scope_id default to z Line 2188  where flowinfo and scope_id default to z
2188  The return value is unspecified.  The return value is unspecified.
2189  @end deffn  @end deffn
2190    
2191  @deffn primitive listen sock backlog  @deffn {Scheme Procedure} listen sock backlog
2192    @deffnx {C Function} scm_listen (sock, backlog)
2193  Enable @var{sock} to accept connection  Enable @var{sock} to accept connection
2194  requests.  @var{backlog} is an integer specifying  requests.  @var{backlog} is an integer specifying
2195  the maximum length of the queue for pending connections.  the maximum length of the queue for pending connections.
# Line 2063  the queue. Line 2200  the queue.
2200  The return value is unspecified.  The return value is unspecified.
2201  @end deffn  @end deffn
2202    
2203  @deffn primitive accept sock  @deffn {Scheme Procedure} accept sock
2204    @deffnx {C Function} scm_accept (sock)
2205  Accept a connection on a bound, listening socket.  Accept a connection on a bound, listening socket.
2206  If there  If there
2207  are no pending connections in the queue, wait until  are no pending connections in the queue, wait until
# Line 2098  If the socket family is @code{AF_INET}, Line 2236  If the socket family is @code{AF_INET},
2236  number.  number.
2237  @end table  @end table
2238    
2239  @deffn primitive getsockname sock  @deffn {Scheme Procedure} getsockname sock
2240    @deffnx {C Function} scm_getsockname (sock)
2241  Return the address of @var{sock}, in the same form as the  Return the address of @var{sock}, in the same form as the
2242  object returned by @code{accept}.  On many systems the address  object returned by @code{accept}.  On many systems the address
2243  of a socket in the @code{AF_FILE} name space cannot be read.  of a socket in the @code{AF_FILE} namespace cannot be read.
2244  @end deffn  @end deffn
2245    
2246  @deffn primitive getpeername sock  @deffn {Scheme Procedure} getpeername sock
2247    @deffnx {C Function} scm_getpeername (sock)
2248  Return the address that @var{sock}  Return the address that @var{sock}
2249  is connected to, in the same form as the object returned by  is connected to, in the same form as the object returned by
2250  @code{accept}.  On many systems the address of a socket in the  @code{accept}.  On many systems the address of a socket in the
2251  @code{AF_FILE} name space cannot be read.  @code{AF_FILE} namespace cannot be read.
2252  @end deffn  @end deffn
2253    
2254  @deffn primitive recv! sock buf [flags]  @deffn {Scheme Procedure} recv! sock buf [flags]
2255    @deffnx {C Function} scm_recv (sock, buf, flags)
2256  Receive data from a socket port.  Receive data from a socket port.
2257  @var{sock} must already  @var{sock} must already
2258  be bound to the address from which data is to be received.  be bound to the address from which data is to be received.
# Line 2134  descriptor: Line 2275  descriptor:
2275  any unread buffered port data is ignored.  any unread buffered port data is ignored.
2276  @end deffn  @end deffn
2277    
2278  @deffn primitive send sock message [flags]  @deffn {Scheme Procedure} send sock message [flags]
2279    @deffnx {C Function} scm_send (sock, message, flags)
2280  Transmit the string @var{message} on a socket port @var{sock}.  Transmit the string @var{message} on a socket port @var{sock}.
2281  @var{sock} must already be bound to a destination address.  The  @var{sock} must already be bound to a destination address.  The
2282  value returned is the number of bytes transmitted --  value returned is the number of bytes transmitted --
# Line 2150  file descriptor: Line 2292  file descriptor:
2292  any unflushed buffered port data is ignored.  any unflushed buffered port data is ignored.
2293  @end deffn  @end deffn
2294    
2295  @deffn primitive recvfrom! sock str [flags [start [end]]]  @deffn {Scheme Procedure} recvfrom! sock str [flags [start [end]]]
2296    @deffnx {C Function} scm_recvfrom (sock, str, flags, start, end)
2297  Return data from the socket port @var{sock} and also  Return data from the socket port @var{sock} and also
2298  information about where the data was received from.  information about where the data was received from.
2299  @var{sock} must already be bound to the address from which  @var{sock} must already be bound to the address from which
# Line 2176  Note that the data is read directly from Line 2319  Note that the data is read directly from
2319  descriptor: any unread buffered port data is ignored.  descriptor: any unread buffered port data is ignored.
2320  @end deffn  @end deffn
2321    
2322  @deffn primitive sendto sock message fam address . args_and_flags  @deffn {Scheme Procedure} sendto sock message fam address . args_and_flags
2323    @deffnx {C Function} scm_sendto (sock, message, fam, address, args_and_flags)
2324  Transmit the string @var{message} on the socket port  Transmit the string @var{message} on the socket port
2325  @var{sock}.  The  @var{sock}.  The
2326  destination address is specified using the @var{fam},  destination address is specified using the @var{fam},
# Line 2202  between "host" and "network" order.  Alt Line 2346  between "host" and "network" order.  Alt
2346  this automatically for addresses, the conversion will still need to  this automatically for addresses, the conversion will still need to
2347  be done when sending or receiving encoded integer data from the network.  be done when sending or receiving encoded integer data from the network.
2348    
2349  @deffn primitive htons value  @deffn {Scheme Procedure} htons value
2350    @deffnx {C Function} scm_htons (value)
2351  Convert a 16 bit quantity from host to network byte ordering.  Convert a 16 bit quantity from host to network byte ordering.
2352  @var{value} is packed into 2 bytes, which are then converted  @var{value} is packed into 2 bytes, which are then converted
2353  and returned as a new integer.  and returned as a new integer.
2354  @end deffn  @end deffn
2355    
2356  @deffn primitive ntohs value  @deffn {Scheme Procedure} ntohs value
2357    @deffnx {C Function} scm_ntohs (value)
2358  Convert a 16 bit quantity from network to host byte ordering.  Convert a 16 bit quantity from network to host byte ordering.
2359  @var{value} is packed into 2 bytes, which are then converted  @var{value} is packed into 2 bytes, which are then converted
2360  and returned as a new integer.  and returned as a new integer.
2361  @end deffn  @end deffn
2362    
2363  @deffn primitive htonl value  @deffn {Scheme Procedure} htonl value
2364    @deffnx {C Function} scm_htonl (value)
2365  Convert a 32 bit quantity from host to network byte ordering.  Convert a 32 bit quantity from host to network byte ordering.
2366  @var{value} is packed into 4 bytes, which are then converted  @var{value} is packed into 4 bytes, which are then converted
2367  and returned as a new integer.  and returned as a new integer.
2368  @end deffn  @end deffn
2369    
2370  @deffn primitive ntohl value  @deffn {Scheme Procedure} ntohl value
2371    @deffnx {C Function} scm_ntohl (value)
2372  Convert a 32 bit quantity from network to host byte ordering.  Convert a 32 bit quantity from network to host byte ordering.
2373  @var{value} is packed into 4 bytes, which are then converted  @var{value} is packed into 4 bytes, which are then converted
2374  and returned as a new integer.  and returned as a new integer.
# Line 2248  These procedures are inconvenient to use Line 2396  These procedures are inconvenient to use
2396  This section lists the various procedures Guile provides for accessing  This section lists the various procedures Guile provides for accessing
2397  information about the system it runs on.  information about the system it runs on.
2398    
2399  @deffn primitive uname  @deffn {Scheme Procedure} uname
2400    @deffnx {C Function} scm_uname ()
2401  Return an object with some information about the computer  Return an object with some information about the computer
2402  system the program is running on.  system the program is running on.
2403  @end deffn  @end deffn
# Line 2269  The current version level within the rel Line 2418  The current version level within the rel
2418  A description of the hardware.  A description of the hardware.
2419  @end table  @end table
2420    
2421  @deffn primitive gethostname  @deffn {Scheme Procedure} gethostname
2422    @deffnx {C Function} scm_gethostname ()
2423  Return the host name of the current processor.  Return the host name of the current processor.
2424  @end deffn  @end deffn
2425    
2426  @deffn primitive sethostname name  @deffn {Scheme Procedure} sethostname name
2427    @deffnx {C Function} scm_sethostname (name)
2428  Set the host name of the current processor to @var{name}. May  Set the host name of the current processor to @var{name}. May
2429  only be used by the superuser.  The return value is not  only be used by the superuser.  The return value is not
2430  specified.  specified.
2431  @end deffn  @end deffn
2432    
2433  @c FIXME::martin: Not in libguile!  @c FIXME::martin: Not in libguile!
2434  @deffn primitive software-type  @deffn {Scheme Procedure} software-type
2435  Return a symbol describing the current platform's operating system.  Return a symbol describing the current platform's operating system.
2436  This may be one of AIX, VMS, UNIX, COHERENT, WINDOWS, MS-DOS, OS/2,  This may be one of AIX, VMS, UNIX, COHERENT, WINDOWS, MS-DOS, OS/2,
2437  THINKC, AMIGA, ATARIST, MACH, or ACORN.  THINKC, AMIGA, ATARIST, MACH, or ACORN.
# Line 2296  no other easy or unambiguous way of dete Line 2447  no other easy or unambiguous way of dete
2447  @node Locales  @node Locales
2448  @section Locales  @section Locales
2449    
2450  @deffn primitive setlocale category [locale]  @deffn {Scheme Procedure} setlocale category [locale]
2451    @deffnx {C Function} scm_setlocale (category, locale)
2452  If @var{locale} is omitted, return the current value of the  If @var{locale} is omitted, return the current value of the
2453  specified locale category as a system-dependent string.  specified locale category as a system-dependent string.
2454  @var{category} should be specified using the values  @var{category} should be specified using the values
# Line 2317  common system library functions of the s Line 2469  common system library functions of the s
2469  (or bad) as the underlying functions, so you should refer to your system  (or bad) as the underlying functions, so you should refer to your system
2470  documentation before using them.  documentation before using them.
2471    
2472  @deffn primitive crypt key salt  @deffn {Scheme Procedure} crypt key salt
2473    @deffnx {C Function} scm_crypt (key, salt)
2474  Encrypt @var{key} using @var{salt} as the salt value to the  Encrypt @var{key} using @var{salt} as the salt value to the
2475  crypt(3) library call.  crypt(3) library call.
2476  @end deffn  @end deffn
# Line 2325  crypt(3) library call. Line 2478  crypt(3) library call.
2478  Although @code{getpass} is not an encryption procedure per se, it  Although @code{getpass} is not an encryption procedure per se, it
2479  appears here because it is often used in combination with @code{crypt}:  appears here because it is often used in combination with @code{crypt}:
2480    
2481  @deffn primitive getpass prompt  @deffn {Scheme Procedure} getpass prompt
2482    @deffnx {C Function} scm_getpass (prompt)
2483  Display @var{prompt} to the standard error output and read  Display @var{prompt} to the standard error output and read
2484  a password from @file{/dev/tty}.  If this file is not  a password from @file{/dev/tty}.  If this file is not
2485  accessible, it reads from standard input.  The password may be  accessible, it reads from standard input.  The password may be

Legend:
Removed from v.1.1.2.4  
changed lines
  Added in v.1.1.2.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26