From a01a9308f051ee1c7e214642d43a750dcd6dce7f Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 8 Feb 2012 20:05:04 +0100 Subject: [PATCH] fcntl: support F_DUPFD_CLOEXEC and O_CLOEXEC. * libguile/filesys.c (scm_fcntl): Document F_DUPFD_CLOEXEC. (scm_init_filesys): Define O_CLOEXEC and F_DUPFD_CLOEXEC. --- libguile/filesys.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libguile/filesys.c b/libguile/filesys.c index a45a56488..87e5588aa 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -948,7 +948,9 @@ SCM_DEFINE (scm_fcntl, "fcntl", 2, 1, 0, "Values for @var{cmd} are:\n\n" "@table @code\n" "@item F_DUPFD\n" - "Duplicate a file descriptor\n" + "Duplicate a file descriptor.\n" + "@item F_DUPFD_CLOEXEC\n" + "Duplicate a file descriptor, setting the @code{FD_CLOEXEC} flag.\n" "@item F_GETFD\n" "Get flags associated with the file descriptor.\n" "@item F_SETFD\n" @@ -1844,10 +1846,16 @@ scm_init_filesys () #ifdef O_NOTRANS scm_c_define ("O_NOTRANS", scm_from_int (O_NOTRANS)); #endif +#ifdef O_CLOEXEC + scm_c_define ("O_CLOEXEC", scm_from_int (O_CLOEXEC)); +#endif #ifdef F_DUPFD scm_c_define ("F_DUPFD", scm_from_int (F_DUPFD)); #endif +#ifdef F_DUPFD_CLOEXEC + scm_c_define ("F_DUPFD_CLOEXEC", scm_from_int (F_DUPFD_CLOEXEC)); +#endif #ifdef F_GETFD scm_c_define ("F_GETFD", scm_from_int (F_GETFD)); #endif