[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113348: Port recent close-on-exec changes to Cygwin
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r113348: Port recent close-on-exec changes to Cygwin. |
Date: |
Tue, 09 Jul 2013 17:16:26 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113348
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/14821
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2013-07-09 10:16:21 -0700
message:
Port recent close-on-exec changes to Cygwin.
* lib/binary-io.c, lib/binary-io.h: New files.
Merge from gnulib, incorporating:
2013-07-09 accept4, dup3, pipe2: port to Cygwin
* lib/pipe2.c: Update from gnulib, as part of this merge.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
added:
lib/binary-io.c binaryio.c-20130709170446-amc57a0k99prig27-1
lib/binary-io.h binaryio.h-20130709170446-amc57a0k99prig27-2
modified:
ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1538
admin/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-2226
admin/merge-gnulib mergegnulib-20120521022411-ndnoaiok33j6dn0g-1
lib/gnulib.mk gnulib.mk-20110108211121-3ig4un4ogtyyca3s-7
lib/pipe2.c pipe2.c-20130707175726-ax31vjqobh17obwz-3
m4/gnulib-comp.m4 glcomp.m4-20110127072028-6mkjqxjzdsx0wp15-1
=== modified file 'ChangeLog'
--- a/ChangeLog 2013-07-09 07:04:48 +0000
+++ b/ChangeLog 2013-07-09 17:16:21 +0000
@@ -1,5 +1,12 @@
2013-07-09 Paul Eggert <address@hidden>
+ Port recent close-on-exec changes to Cygwin (Bug#14821).
+ * lib/binary-io.c, lib/binary-io.h: New files.
+ Merge from gnulib, incorporating:
+ 2013-07-09 accept4, dup3, pipe2: port to Cygwin
+ * lib/pipe2.c: Update from gnulib, as part of this merge.
+ * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
+
Handle errno and exit status a bit more carefully.
* lib/ignore-value.h: Remove this gnulib-imported file.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog 2013-07-09 07:04:48 +0000
+++ b/admin/ChangeLog 2013-07-09 17:16:21 +0000
@@ -1,5 +1,8 @@
2013-07-09 Paul Eggert <address@hidden>
+ Port recent close-on-exec changes to Cygwin (Bug#14821).
+ * merge-gnulib (GNULIB_TOOL_FLAGS): Don't avoid binary-io.
+
Handle error numbers a bit more reliably.
* merge-gnulib (GNULIB_MODULES): Remove ignore-value.
=== modified file 'admin/merge-gnulib'
--- a/admin/merge-gnulib 2013-07-09 07:04:48 +0000
+++ b/admin/merge-gnulib 2013-07-09 17:16:21 +0000
@@ -41,7 +41,7 @@
'
GNULIB_TOOL_FLAGS='
- --avoid=binary-io --avoid=close --avoid=dup
+ --avoid=close --avoid=dup
--avoid=fchdir --avoid=fstat
--avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow
--avoid=open --avoid=openat-die --avoid=opendir
=== added file 'lib/binary-io.c'
--- a/lib/binary-io.c 1970-01-01 00:00:00 +0000
+++ b/lib/binary-io.c 2013-07-09 17:16:21 +0000
@@ -0,0 +1,3 @@
+#include <config.h>
+#define BINARY_IO_INLINE _GL_EXTERN_INLINE
+#include "binary-io.h"
=== added file 'lib/binary-io.h'
--- a/lib/binary-io.h 1970-01-01 00:00:00 +0000
+++ b/lib/binary-io.h 2013-07-09 17:16:21 +0000
@@ -0,0 +1,72 @@
+/* Binary mode I/O.
+ Copyright (C) 2001, 2003, 2005, 2008-2013 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _BINARY_H
+#define _BINARY_H
+
+/* For systems that distinguish between text and binary I/O.
+ O_BINARY is guaranteed by the gnulib <fcntl.h>. */
+#include <fcntl.h>
+
+/* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...',
+ so we include it here first. */
+#include <stdio.h>
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef BINARY_IO_INLINE
+# define BINARY_IO_INLINE _GL_INLINE
+#endif
+
+/* set_binary_mode (fd, mode)
+ sets the binary/text I/O mode of file descriptor fd to the given mode
+ (must be O_BINARY or O_TEXT) and returns the previous mode. */
+#if O_BINARY
+# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
+# include <io.h> /* declares setmode() */
+# define set_binary_mode setmode
+# else
+# define set_binary_mode _setmode
+# undef fileno
+# define fileno _fileno
+# endif
+#else
+ /* On reasonable systems, binary I/O is the only choice. */
+ /* Use a function rather than a macro, to avoid gcc warnings
+ "warning: statement with no effect". */
+BINARY_IO_INLINE int
+set_binary_mode (int fd, int mode)
+{
+ (void) fd;
+ (void) mode;
+ return O_BINARY;
+}
+#endif
+
+/* SET_BINARY (fd);
+ changes the file descriptor fd to perform binary I/O. */
+#ifdef __DJGPP__
+# include <unistd.h> /* declares isatty() */
+ /* Avoid putting stdin/stdout in binary mode if it is connected to
+ the console, because that would make it impossible for the user
+ to interrupt the program through Ctrl-C or Ctrl-Break. */
+# define SET_BINARY(fd) ((void) (!isatty (fd) ? (set_binary_mode (fd,
O_BINARY), 0) : 0))
+#else
+# define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY))
+#endif
+
+_GL_INLINE_HEADER_END
+
+#endif /* _BINARY_H */
=== modified file 'lib/gnulib.mk'
--- a/lib/gnulib.mk 2013-07-09 07:04:48 +0000
+++ b/lib/gnulib.mk 2013-07-09 17:16:21 +0000
@@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux
--avoid=binary-io --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat
--avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open
--avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd
--avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib
--makefile-name=gnulib.mk --conditional-dependencies --no-libtool
--macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat
close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr
dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir
filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops
largefile lstat manywarnings memrchr mktime pipe2 pselect pthread_sigmask
putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg
stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time
timer-time timespec-add timespec-sub unsetenv utimens warnings
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux
--avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix
--avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die
--avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select
--avoid=sigprocmask --avoid=sys_types --avoid=threadlib
--makefile-name=gnulib.mk --conditional-dependencies --no-libtool
--macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat
close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr
dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir
filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops
largefile lstat manywarnings memrchr mktime pipe2 pselect pthread_sigmask
putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdarg
stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time
timer-time timespec-add timespec-sub unsetenv utimens warnings
MOSTLYCLEANFILES += core *.stackdump
@@ -75,6 +75,12 @@
## end gnulib module at-internal
+## begin gnulib module binary-io
+
+libgnu_a_SOURCES += binary-io.h binary-io.c
+
+## end gnulib module binary-io
+
## begin gnulib module c-ctype
libgnu_a_SOURCES += c-ctype.h c-ctype.c
=== modified file 'lib/pipe2.c'
--- a/lib/pipe2.c 2013-07-07 18:00:14 +0000
+++ b/lib/pipe2.c 2013-07-09 17:16:21 +0000
@@ -22,10 +22,7 @@
#include <errno.h>
#include <fcntl.h>
-#if GNULIB_BINARY_IO
-# include "binary-io.h"
-#endif
-
+#include "binary-io.h"
#include "verify.h"
#if GNULIB_defined_O_NONBLOCK
@@ -141,13 +138,13 @@
# if O_BINARY
if (flags & O_BINARY)
{
- setmode (fd[1], O_BINARY);
- setmode (fd[0], O_BINARY);
+ set_binary_mode (fd[1], O_BINARY);
+ set_binary_mode (fd[0], O_BINARY);
}
else if (flags & O_TEXT)
{
- setmode (fd[1], O_TEXT);
- setmode (fd[0], O_TEXT);
+ set_binary_mode (fd[1], O_TEXT);
+ set_binary_mode (fd[0], O_TEXT);
}
# endif
=== modified file 'm4/gnulib-comp.m4'
--- a/m4/gnulib-comp.m4 2013-07-09 07:04:48 +0000
+++ b/m4/gnulib-comp.m4 2013-07-09 17:16:21 +0000
@@ -41,6 +41,7 @@
# Code from module alloca-opt:
# Code from module allocator:
# Code from module at-internal:
+ # Code from module binary-io:
# Code from module c-ctype:
# Code from module c-strcase:
# Code from module careadlinkat:
@@ -754,6 +755,8 @@
lib/allocator.c
lib/allocator.h
lib/at-func.c
+ lib/binary-io.c
+ lib/binary-io.h
lib/c-ctype.c
lib/c-ctype.h
lib/c-strcase.h
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113348: Port recent close-on-exec changes to Cygwin.,
Paul Eggert <=