diff options
author | Andy Wingo <wingo@pobox.com> | 2011-06-16 18:27:57 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-06-16 19:47:26 +0200 |
commit | 32f94bf258bd032fa6f96fc76e4153086bc001f5 (patch) | |
tree | 3aeb6051c35e2efc8033018d99a0d2539893f939 | |
parent | 3d458a81c64e4696157b23c7c4c4c150aa4a93b8 (diff) | |
download | guile-32f94bf258bd032fa6f96fc76e4153086bc001f5.tar.gz |
O_CLOEXEC usage
* libguile/objcodes.c (scm_load_objcode):
* libguile/scmsigs.c (start_signal_delivery_thread):
* libguile/threads.c (guilify_self_1): Use O_CLOEXEC.
-rw-r--r-- | libguile/objcodes.c | 2 | ||||
-rw-r--r-- | libguile/scmsigs.c | 7 | ||||
-rw-r--r-- | libguile/threads.c | 12 |
3 files changed, 4 insertions, 17 deletions
diff --git a/libguile/objcodes.c b/libguile/objcodes.c index c45ca8585..526751acc 100644 --- a/libguile/objcodes.c +++ b/libguile/objcodes.c @@ -295,7 +295,7 @@ SCM_DEFINE (scm_load_objcode, "load-objcode", 1, 0, 0, SCM_VALIDATE_STRING (1, file); c_file = scm_to_locale_string (file); - fd = open (c_file, O_RDONLY); + fd = open (c_file, O_RDONLY | O_CLOEXEC); free (c_file); if (fd < 0) SCM_SYSERROR; diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c index 641d1b3c8..723d6a8c5 100644 --- a/libguile/scmsigs.c +++ b/libguile/scmsigs.c @@ -39,10 +39,6 @@ #include "libguile/validate.h" #include "libguile/scmsigs.h" -#ifdef HAVE_IO_H -#include <io.h> /* for mingw _pipe() */ -#endif - #ifdef HAVE_PROCESS_H #include <process.h> /* for mingw */ #endif @@ -61,7 +57,6 @@ /* This weird comma expression is because Sleep is void under Windows. */ #define sleep(sec) (Sleep ((sec) * 1000), 0) #define usleep(usec) (Sleep ((usec) / 1000), 0) -#define pipe(fd) _pipe (fd, 256, O_BINARY) #endif #include <full-write.h> @@ -208,7 +203,7 @@ start_signal_delivery_thread (void) scm_i_pthread_mutex_lock (&signal_delivery_thread_mutex); - if (pipe (signal_pipe) != 0) + if (pipe2 (signal_pipe, O_CLOEXEC) != 0) scm_syserror (NULL); signal_thread = scm_spawn_thread (signal_delivery_thread, NULL, scm_handle_by_message, diff --git a/libguile/threads.c b/libguile/threads.c index 97d9f6497..dba5d16f1 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -39,6 +39,7 @@ #endif #include <assert.h> +#include <fcntl.h> #include <nproc.h> #include "libguile/validate.h" @@ -57,15 +58,6 @@ #include "libguile/strings.h" #include "libguile/weaks.h" -#ifdef __MINGW32__ -#ifndef ETIMEDOUT -# define ETIMEDOUT WSAETIMEDOUT -#endif -# include <fcntl.h> -# include <process.h> -# define pipe(fd) _pipe (fd, 256, O_BINARY) -#endif /* __MINGW32__ */ - #include <full-read.h> @@ -538,7 +530,7 @@ guilify_self_1 (struct GC_stack_base *base) t.sleep_object = SCM_BOOL_F; t.sleep_fd = -1; - if (pipe (t.sleep_pipe) != 0) + if (pipe2 (t.sleep_pipe, O_CLOEXEC) != 0) /* FIXME: Error conditions during the initialization phase are handled gracelessly since public functions such as `scm_init_guile ()' currently have type `void'. */ |