This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.16-ports-merge-227-ga277af2
- From: vapier at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 18 Aug 2012 04:36:26 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.16-ports-merge-227-ga277af2
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via a277af22ea038ff963355b603ade8d0a8a98eb5d (commit)
from fdab8fd3351de83f0d4a513552318f337e14c4cb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a277af22ea038ff963355b603ade8d0a8a98eb5d
commit a277af22ea038ff963355b603ade8d0a8a98eb5d
Author: Mike Frysinger <vapier@gentoo.org>
Date: Fri Aug 17 22:03:56 2012 -0400
split assume pipe2/dup3/sock_cloexec knobs
We can't assume sock_cloexec and pipe2 are bound together as the former
defines are found in glibc only while the latter are a combo of kernel
headers and glibc. So if we do a runtime detection of SOCK_CLOEXEC, but
pipe2() is a stub inside of glibc, we hit a problem. For example:
main()
{
getgrnam("portage");
if (!popen("ls", "r"))
perror("popen()");
}
getgrnam() will detect that the kernel supports SOCK_CLOEXEC and then set
both __have_sock_cloexec and __have_pipe2 to true. But if glibc was built
against older kernel headers where __NR_pipe2 does not exist, glibc will
have a ENOSYS stub for it. So popen() will always fail as glibc assumes
pipe2() works.
While this isn't too much of an issue for some arches as they added the
functionality to the kernel at the same time, not all arches are that
lucky.
Since the code already has dedicated names for each feature, delete the
defines wiring these three features together and make each one a proper
dedicated knob.
We've been carrying this in Gentoo since glibc-2.9.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
diff --git a/ChangeLog b/ChangeLog
index 79b5717..206206a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-08-18 Mike Frysinger <vapier@gentoo.org>
+
+ [BZ #9685]
+ * include/unistd.h (__have_pipe2): Change define into an extern int.
+ (__have_dup3): Likewise.
+ * socket/have_sock_cloexec.c: Include fcntl.h.
+ (__have_pipe2): New variable.
+ (__have_dup3): Likewise.
+
2012-08-17 Mike Frysinger <vapier@gentoo.org>
* sysdeps/unix/sysv/linux/nice.c: Adjust #include.
diff --git a/include/unistd.h b/include/unistd.h
index e4bff80..9d74fb4 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -174,11 +174,8 @@ extern int __libc_pause (void);
extern int __pause_nocancel (void) attribute_hidden;
extern int __have_sock_cloexec;
-/* At lot of other functionality became available at the same time as
- SOCK_CLOEXEC. Avoid defining separate variables for all of them
- unless it is really necessary. */
-#define __have_pipe2 __have_sock_cloexec
-#define __have_dup3 __have_sock_cloexec
+extern int __have_pipe2;
+extern int __have_dup3;
extern int __getlogin_r_loginuid (char *name, size_t namesize)
attribute_hidden;
diff --git a/socket/have_sock_cloexec.c b/socket/have_sock_cloexec.c
index d57cbcf..8cf0959 100644
--- a/socket/have_sock_cloexec.c
+++ b/socket/have_sock_cloexec.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2008-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,9 +15,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <fcntl.h>
#include <sys/socket.h>
#include <kernel-features.h>
#if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
int __have_sock_cloexec;
#endif
+
+#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
+int __have_pipe2;
+#endif
+
+#if defined O_CLOEXEC && !defined __ASSUME_DUP3
+int __have_dup3;
+#endif
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 9 +++++++++
include/unistd.h | 7 ++-----
socket/have_sock_cloexec.c | 11 ++++++++++-
3 files changed, 21 insertions(+), 6 deletions(-)
hooks/post-receive
--
GNU C Library master sources