From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 14803@debbugs.gnu.org
Subject: bug#14803: Setting close-on-exec flag consistently
Date: Sat, 06 Jul 2013 14:43:26 -0700 [thread overview]
Message-ID: <51D88F7E.3080502@cs.ucla.edu> (raw)
In-Reply-To: <834nc7y3o2.fsf@gnu.org>
On 07/06/2013 10:54 AM, Eli Zaretskii wrote:
>> Date: Sat, 06 Jul 2013 10:18:07 -0700
>> From: Paul Eggert <eggert@cs.ucla.edu>
>> On systems like w32 that lack SOCK_CLOEXEC, the code creates
>> sockets just as it did before (using plain 'socket' and 'accept'
>> rather than 'socket' and 'accept4' with SOCK_CLOEXEC).
>
> Given that w32 redirects calls to 'socket' to 'sys_socket', which is
> implemented on w32.c, will the above still work?
Yes, the idea is that it does the same calls as before,
to the same code in w32.c as before.
> I assume that lib/fcntl.c and
> lib/pipe2.c will not be compiled for w32, due to some configure test?
Yes, though that needs to be arranged. The following further
patch should do it:
=== modified file 'ChangeLog'
--- ChangeLog 2013-07-06 09:44:23 +0000
+++ ChangeLog 2013-07-06 21:39:31 +0000
@@ -1,7 +1,9 @@
2013-07-06 Paul Eggert <eggert@cs.ucla.edu>
Make file descriptors close-on-exec when possible (Bug#14803).
- * configure.ac (mkostemp): New function to check for.
+ * configure.ac (ac_cv_func_fcntl, gl_cv_func_fcntl_f_dupfd_cloexec)
+ (gl_cv_func_fcntl_f_dupfd_works, ac_cv_func_pipe2): Hotwire for MinGW.
+ (mkostemp): New function to check for.
(PTY_OPEN): Pass O_CLOEXEC to posix_openpt.
* lib/fcntl.c, lib/getdtablesize.c, lib/pipe2.c, m4/fcntl.m4:
* m4/getdtablesize.m4, m4/pipe2.m4: New files, taken from gnulib.
=== modified file 'configure.ac'
--- configure.ac 2013-07-06 07:04:07 +0000
+++ configure.ac 2013-07-06 21:33:56 +0000
@@ -634,6 +634,19 @@
# Avoid gnulib's threadlib module, as we do threads our own way.
AC_DEFUN([gl_THREADLIB])
+# On MinGW, Emacs supplies its own substitutes for some missing functions,
+# so hotwire the cache to pretend to Gnulib that the functions work;
+# that way, 'configure' won't arrange to build the Gnulib substitutes.
+if test "$opsys" = mingw32; then
+ # fcntl
+ ac_cv_func_fcntl=emulated # Any single word other than 'no' will do.
+ gl_cv_func_fcntl_f_dupfd_cloexec=yes # Actually 'no', but only 'yes' works.
+ gl_cv_func_fcntl_f_dupfd_works='no, but Emacs emulates yes'
+
+ # pipe2
+ ac_cv_func_pipe2='no, but Emacs emulates yes'
+fi
+
# Initialize gnulib right after choosing the compiler.
dnl Amongst other things, this sets AR and ARFLAGS.
gl_EARLY
next prev parent reply other threads:[~2013-07-06 21:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-06 9:13 bug#14803: Setting close-on-exec flag consistently Paul Eggert
2013-07-06 11:31 ` Eli Zaretskii
2013-07-06 17:18 ` Paul Eggert
2013-07-06 17:54 ` Eli Zaretskii
2013-07-06 21:43 ` Paul Eggert [this message]
2013-07-07 2:46 ` Eli Zaretskii
2013-07-07 6:34 ` Paul Eggert
2013-07-07 16:45 ` Eli Zaretskii
2013-07-07 18:01 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51D88F7E.3080502@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=14803@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.