mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-29 16:30:19 +02:00
(Ports and File Descriptors): Tweaks to fcntl.
This commit is contained in:
parent
90a6008b1e
commit
fbc11ba164
1 changed files with 13 additions and 5 deletions
|
@ -472,10 +472,11 @@ If @var{size} is omitted, a default size will be used.
|
|||
@end defvar
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} fcntl object cmd [value]
|
||||
@deffn {Scheme Procedure} fcntl port/fd cmd [value]
|
||||
@deffnx {C Function} scm_fcntl (object, cmd, value)
|
||||
Apply @var{cmd} on @var{object}, either a port or file descriptor.
|
||||
The @var{value} is an integer argument, for the @code{SET} commands.
|
||||
Apply @var{cmd} on @var{port/fd}, either a port or file descriptor.
|
||||
The @var{value} argument is used by the @code{SET} commands described
|
||||
below, it's an integer value.
|
||||
|
||||
Values for @var{cmd} are:
|
||||
|
||||
|
@ -497,6 +498,13 @@ flag,
|
|||
@example
|
||||
(fcntl port F_SETFD FD_CLOEXEC)
|
||||
@end example
|
||||
|
||||
Or better, set it but leave any other possible future flags unchanged,
|
||||
|
||||
@example
|
||||
(fcntl port F_SETFD (logior FD_CLOEXEC
|
||||
(fcntl port F_GETFD)))
|
||||
@end example
|
||||
@end defvar
|
||||
@end defvar
|
||||
|
||||
|
@ -509,8 +517,8 @@ A common use is to set @code{O_NONBLOCK} on a network socket. The
|
|||
following sets that flag, and leaves other flags unchanged.
|
||||
|
||||
@example
|
||||
(fcntl sock F_SETFL
|
||||
(logior (fcntl sock F_GETFL) O_NONBLOCK))
|
||||
(fcntl sock F_SETFL (logior O_NONBLOCK
|
||||
(fcntl sock F_GETFL)))
|
||||
@end example
|
||||
@end defvar
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue