[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r9408 - in /fsf/glibc-2_11-branch/libc: ./ csu/ localedata/ localedata/locales/ login/programs/ nptl/ nptl/sysdeps/unix/sysv...
- To: commits@xxxxxxxxxx
- Subject: [commits] r9408 - in /fsf/glibc-2_11-branch/libc: ./ csu/ localedata/ localedata/locales/ login/programs/ nptl/ nptl/sysdeps/unix/sysv...
- From: eglibc@xxxxxxxxxx
- Date: Sat, 05 Dec 2009 08:05:32 -0000
Author: eglibc
Date: Sat Dec 5 00:05:32 2009
New Revision: 9408
Log:
Import glibc-2.11 for 2009-12-05
Added:
fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/grantpt.c
Modified:
fsf/glibc-2_11-branch/libc/ChangeLog
fsf/glibc-2_11-branch/libc/csu/elf-init.c
fsf/glibc-2_11-branch/libc/csu/libc-start.c
fsf/glibc-2_11-branch/libc/localedata/ChangeLog
fsf/glibc-2_11-branch/libc/localedata/locales/en_DK
fsf/glibc-2_11-branch/libc/localedata/locales/hsb_DE
fsf/glibc-2_11-branch/libc/localedata/locales/nl_NL
fsf/glibc-2_11-branch/libc/login/programs/pt_chown.c
fsf/glibc-2_11-branch/libc/nptl/ChangeLog
fsf/glibc-2_11-branch/libc/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
fsf/glibc-2_11-branch/libc/sunrpc/create_xid.c
fsf/glibc-2_11-branch/libc/sysdeps/unix/grantpt.c
Modified: fsf/glibc-2_11-branch/libc/ChangeLog
==============================================================================
--- fsf/glibc-2_11-branch/libc/ChangeLog (original)
+++ fsf/glibc-2_11-branch/libc/ChangeLog Sat Dec 5 00:05:32 2009
@@ -1,3 +1,20 @@
+2009-11-24 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * sysdeps/unix/grantpt.c (grantpt): Use CLOSE_ALL_FDS is available
+ before the exec.
+ * sysdeps/unix/sysv/linux/grantpt.c: New file.
+ * login/programs/pt_chown.c (main): Don't print message on errors
+ when doing real work.
+
+ * csu/elf-init.c (__libc_csu_irel): New function. Code to perform
+ irel relocations split out from...
+ (__libc_csu_init): ...here.
+ * csu/libc-start.c [!SHARED]: Call __libc_csu_irel early.
+
+2009-11-22 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * sunrpc/create_xid.c (_create_xid): Reinitialize state after fork.
+
2009-11-18 H.J. Lu <hongjiu.lu@xxxxxxxxx>
[BZ #10162]
Modified: fsf/glibc-2_11-branch/libc/csu/elf-init.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/csu/elf-init.c (original)
+++ fsf/glibc-2_11-branch/libc/csu/elf-init.c Sat Dec 5 00:05:32 2009
@@ -72,15 +72,14 @@
/* These functions are passed to __libc_start_main by the startup code.
These get statically linked into each program. For dynamically linked
programs, this module will come from libc_nonshared.a and differs from
- the libc.a module in that it doesn't call the preinit array. */
+ the libc.a module in that it doesn't call the preinit array and performs
+ explicit IREL{,A} relocations. */
-void
-__libc_csu_init (int argc, char **argv, char **envp)
-{
- /* For dynamically linked executables the preinit array is executed by
- the dynamic linker (before initializing any shared object. */
#ifndef LIBC_NONSHARED
+void
+__libc_csu_irel (void)
+{
# ifdef USE_MULTIARCH
# ifdef ELF_MACHINE_IRELA
{
@@ -98,7 +97,17 @@
}
# endif
# endif
+}
+#endif
+
+void
+__libc_csu_init (int argc, char **argv, char **envp)
+{
+ /* For dynamically linked executables the preinit array is executed by
+ the dynamic linker (before initializing any shared object. */
+
+#ifndef LIBC_NONSHARED
/* For static executables, preinit happens right before init. */
{
const size_t size = __preinit_array_end - __preinit_array_start;
Modified: fsf/glibc-2_11-branch/libc/csu/libc-start.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/csu/libc-start.c (original)
+++ fsf/glibc-2_11-branch/libc/csu/libc-start.c Sat Dec 5 00:05:32 2009
@@ -24,6 +24,9 @@
#include <bp-sym.h>
extern void __libc_init_first (int argc, char **argv, char **envp);
+#ifndef SHARED
+extern void __libc_csu_irel (void);
+#endif
extern int __libc_multiple_libcs;
@@ -134,6 +137,9 @@
}
# endif
+ /* Performe IREL{,A} relocations. */
+ __libc_csu_irel ();
+
/* Initialize the thread library at least a bit since the libgcc
functions are using thread functions if these are available and
we need to setup errno. */
Modified: fsf/glibc-2_11-branch/libc/localedata/ChangeLog
==============================================================================
--- fsf/glibc-2_11-branch/libc/localedata/ChangeLog (original)
+++ fsf/glibc-2_11-branch/libc/localedata/ChangeLog Sat Dec 5 00:05:32 2009
@@ -1,3 +1,15 @@
+2009-11-24 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * locales/hsb_DE: Define week, first_weekday, and first_workday.
+
+2009-11-23 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * locales/en_DK: Define week, first_weekday, and first_workday.
+
+2009-11-22 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * locales/nl_NL: Define week, first_weekday, and first_workday.
+
2009-10-30 Ulrich Drepper <drepper@xxxxxxxxxx>
* locales/it_CH: Fix typos in last change.
Modified: fsf/glibc-2_11-branch/libc/localedata/locales/en_DK
==============================================================================
--- fsf/glibc-2_11-branch/libc/localedata/locales/en_DK (original)
+++ fsf/glibc-2_11-branch/libc/localedata/locales/en_DK Sat Dec 5 00:05:32 2009
@@ -85,34 +85,34 @@
LC_TIME
abday "<U0053><U0075><U006E>";"<U004D><U006F><U006E>";/
- "<U0054><U0075><U0065>";"<U0057><U0065><U0064>";/
- "<U0054><U0068><U0075>";"<U0046><U0072><U0069>";/
- "<U0053><U0061><U0074>"
+ "<U0054><U0075><U0065>";"<U0057><U0065><U0064>";/
+ "<U0054><U0068><U0075>";"<U0046><U0072><U0069>";/
+ "<U0053><U0061><U0074>"
day "<U0053><U0075><U006E><U0064><U0061><U0079>";/
- "<U004D><U006F><U006E><U0064><U0061><U0079>";/
- "<U0054><U0075><U0065><U0073><U0064><U0061><U0079>";/
- "<U0057><U0065><U0064><U006E><U0065><U0073><U0064><U0061><U0079>";/
- "<U0054><U0068><U0075><U0072><U0073><U0064><U0061><U0079>";/
- "<U0046><U0072><U0069><U0064><U0061><U0079>";/
- "<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>"
+ "<U004D><U006F><U006E><U0064><U0061><U0079>";/
+ "<U0054><U0075><U0065><U0073><U0064><U0061><U0079>";/
+ "<U0057><U0065><U0064><U006E><U0065><U0073><U0064><U0061><U0079>";/
+ "<U0054><U0068><U0075><U0072><U0073><U0064><U0061><U0079>";/
+ "<U0046><U0072><U0069><U0064><U0061><U0079>";/
+ "<U0053><U0061><U0074><U0075><U0072><U0064><U0061><U0079>"
abmon "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
- "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
- "<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/
- "<U004A><U0075><U006C>";"<U0041><U0075><U0067>";/
- "<U0053><U0065><U0070>";"<U004F><U0063><U0074>";/
- "<U004E><U006F><U0076>";"<U0044><U0065><U0063>"
+ "<U004D><U0061><U0072>";"<U0041><U0070><U0072>";/
+ "<U004D><U0061><U0079>";"<U004A><U0075><U006E>";/
+ "<U004A><U0075><U006C>";"<U0041><U0075><U0067>";/
+ "<U0053><U0065><U0070>";"<U004F><U0063><U0074>";/
+ "<U004E><U006F><U0076>";"<U0044><U0065><U0063>"
mon "<U004A><U0061><U006E><U0075><U0061><U0072><U0079>";/
- "<U0046><U0065><U0062><U0072><U0075><U0061><U0072><U0079>";/
- "<U004D><U0061><U0072><U0063><U0068>";/
- "<U0041><U0070><U0072><U0069><U006C>";/
- "<U004D><U0061><U0079>";/
- "<U004A><U0075><U006E><U0065>";/
- "<U004A><U0075><U006C><U0079>";/
- "<U0041><U0075><U0067><U0075><U0073><U0074>";/
- "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
- "<U004F><U0063><U0074><U006F><U0062><U0065><U0072>";/
- "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
- "<U0044><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
+ "<U0046><U0065><U0062><U0072><U0075><U0061><U0072><U0079>";/
+ "<U004D><U0061><U0072><U0063><U0068>";/
+ "<U0041><U0070><U0072><U0069><U006C>";/
+ "<U004D><U0061><U0079>";/
+ "<U004A><U0075><U006E><U0065>";/
+ "<U004A><U0075><U006C><U0079>";/
+ "<U0041><U0075><U0067><U0075><U0073><U0074>";/
+ "<U0053><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
+ "<U004F><U0063><U0074><U006F><U0062><U0065><U0072>";/
+ "<U004E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
+ "<U0044><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
% date formats following ISO 8601-1988
d_t_fmt "<U0025><U0059><U002D><U0025><U006D><U002D><U0025><U0064><U0054><U0025><U0054><U0020><U0025><U005A>"
d_fmt "<U0025><U0059><U002D><U0025><U006D><U002D><U0025><U0064>"
@@ -122,6 +122,9 @@
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
<U0025><U005A><U0020><U0025><U0059>"
+week 7;19971130;4
+first_weekday 2
+first_workday 2
END LC_TIME
LC_MESSAGES
Modified: fsf/glibc-2_11-branch/libc/localedata/locales/hsb_DE
==============================================================================
--- fsf/glibc-2_11-branch/libc/localedata/locales/hsb_DE (original)
+++ fsf/glibc-2_11-branch/libc/localedata/locales/hsb_DE Sat Dec 5 00:05:32 2009
@@ -197,7 +197,7 @@
% letter;accent;case;specials
order_start forward;backward/
- ;forward;position
+ ;forward;position
% <CAPITAL> or <SMALL> letters first:
@@ -2136,16 +2136,16 @@
LC_TIME
abday "<U004E><U006A>";"<U0050><U00F3>";/
- "<U0057><U0075>";"<U0053><U0072>";/
- "<U0160><U0074>";"<U0050><U006A>";/
- "<U0053><U006F>"
+ "<U0057><U0075>";"<U0053><U0072>";/
+ "<U0160><U0074>";"<U0050><U006A>";/
+ "<U0053><U006F>"
day "<U004E><U006A><U0065><U0064><U017A><U0065><U006C><U0061>";/
- "<U0050><U00F3><U006E><U0064><U017A><U0065><U006C><U0061>";/
- "<U0057><U0075><U0074><U006F><U0072><U0061>";/
- "<U0053><U0072><U006A><U0065><U0064><U0061>";/
- "<U0160><U0074><U0076><U00F3><U0072><U0074><U006B>";/
- "<U0050><U006A><U0061><U0074><U006B>";/
- "<U0053><U006F><U0062><U006F><U0074><U0061>"
+ "<U0050><U00F3><U006E><U0064><U017A><U0065><U006C><U0061>";/
+ "<U0057><U0075><U0074><U006F><U0072><U0061>";/
+ "<U0053><U0072><U006A><U0065><U0064><U0061>";/
+ "<U0160><U0074><U0076><U00F3><U0072><U0074><U006B>";/
+ "<U0050><U006A><U0061><U0074><U006B>";/
+ "<U0053><U006F><U0062><U006F><U0074><U0061>"
abmon "<U004A><U0061><U006E>";"<U0046><U0065><U0062>";/
"<U004D><U011B><U0072>";"<U0041><U0070><U0072>";/
"<U004D><U0065><U006A>";"<U004A><U0075><U006E>";/
@@ -2172,6 +2172,10 @@
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
<U0025><U005A><U0020><U0025><U0059>"
+
+week 7;19971130;4
+first_weekday 2
+first_workday 2
END LC_TIME
LC_PAPER
Modified: fsf/glibc-2_11-branch/libc/localedata/locales/nl_NL
==============================================================================
--- fsf/glibc-2_11-branch/libc/localedata/locales/nl_NL (original)
+++ fsf/glibc-2_11-branch/libc/localedata/locales/nl_NL Sat Dec 5 00:05:32 2009
@@ -88,33 +88,33 @@
LC_TIME
abday "<U007A><U006F>";"<U006D><U0061>";"<U0064><U0069>";/
- "<U0077><U006F>";"<U0064><U006F>";"<U0076><U0072>";/
- "<U007A><U0061>"
+ "<U0077><U006F>";"<U0064><U006F>";"<U0076><U0072>";/
+ "<U007A><U0061>"
day "<U007A><U006F><U006E><U0064><U0061><U0067>";/
- "<U006D><U0061><U0061><U006E><U0064><U0061><U0067>";/
- "<U0064><U0069><U006E><U0073><U0064><U0061><U0067>";/
- "<U0077><U006F><U0065><U006E><U0073><U0064><U0061><U0067>";/
- "<U0064><U006F><U006E><U0064><U0065><U0072><U0064><U0061><U0067>";/
- "<U0076><U0072><U0069><U006A><U0064><U0061><U0067>";/
- "<U007A><U0061><U0074><U0065><U0072><U0064><U0061><U0067>"
+ "<U006D><U0061><U0061><U006E><U0064><U0061><U0067>";/
+ "<U0064><U0069><U006E><U0073><U0064><U0061><U0067>";/
+ "<U0077><U006F><U0065><U006E><U0073><U0064><U0061><U0067>";/
+ "<U0064><U006F><U006E><U0064><U0065><U0072><U0064><U0061><U0067>";/
+ "<U0076><U0072><U0069><U006A><U0064><U0061><U0067>";/
+ "<U007A><U0061><U0074><U0065><U0072><U0064><U0061><U0067>"
abmon "<U006A><U0061><U006E>";"<U0066><U0065><U0062>";/
- "<U006D><U0072><U0074>";"<U0061><U0070><U0072>";/
- "<U006D><U0065><U0069>";"<U006A><U0075><U006E>";/
- "<U006A><U0075><U006C>";"<U0061><U0075><U0067>";/
- "<U0073><U0065><U0070>";"<U006F><U006B><U0074>";/
- "<U006E><U006F><U0076>";"<U0064><U0065><U0063>"
+ "<U006D><U0072><U0074>";"<U0061><U0070><U0072>";/
+ "<U006D><U0065><U0069>";"<U006A><U0075><U006E>";/
+ "<U006A><U0075><U006C>";"<U0061><U0075><U0067>";/
+ "<U0073><U0065><U0070>";"<U006F><U006B><U0074>";/
+ "<U006E><U006F><U0076>";"<U0064><U0065><U0063>"
mon "<U006A><U0061><U006E><U0075><U0061><U0072><U0069>";/
- "<U0066><U0065><U0062><U0072><U0075><U0061><U0072><U0069>";/
- "<U006D><U0061><U0061><U0072><U0074>";/
- "<U0061><U0070><U0072><U0069><U006C>";/
- "<U006D><U0065><U0069>";/
- "<U006A><U0075><U006E><U0069>";/
- "<U006A><U0075><U006C><U0069>";/
- "<U0061><U0075><U0067><U0075><U0073><U0074><U0075><U0073>";/
- "<U0073><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
- "<U006F><U006B><U0074><U006F><U0062><U0065><U0072>";/
- "<U006E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
- "<U0064><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
+ "<U0066><U0065><U0062><U0072><U0075><U0061><U0072><U0069>";/
+ "<U006D><U0061><U0061><U0072><U0074>";/
+ "<U0061><U0070><U0072><U0069><U006C>";/
+ "<U006D><U0065><U0069>";/
+ "<U006A><U0075><U006E><U0069>";/
+ "<U006A><U0075><U006C><U0069>";/
+ "<U0061><U0075><U0067><U0075><U0073><U0074><U0075><U0073>";/
+ "<U0073><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
+ "<U006F><U006B><U0074><U006F><U0062><U0065><U0072>";/
+ "<U006E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
+ "<U0064><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
d_fmt "<U0025><U0064><U002D><U0025><U006D><U002D><U0025><U0079>"
t_fmt "<U0025><U0054>"
@@ -123,6 +123,10 @@
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
<U0025><U005A><U0020><U0025><U0059>"
+
+week 7;19971130;4
+first_weekday 2
+first_workday 2
END LC_TIME
LC_PAPER
Modified: fsf/glibc-2_11-branch/libc/login/programs/pt_chown.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/login/programs/pt_chown.c (original)
+++ fsf/glibc-2_11-branch/libc/login/programs/pt_chown.c Sat Dec 5 00:05:32 2009
@@ -154,8 +154,7 @@
# define ncap_list (sizeof (cap_list) / sizeof (cap_list[0]))
cap_t caps = cap_init ();
if (caps == NULL)
- error (FAIL_ENOMEM, errno,
- _("Failed to initialize drop of capabilities"));
+ return FAIL_ENOMEM;
/* There is no reason why these should not work. */
cap_set_flag (caps, CAP_PERMITTED, ncap_list, cap_list, CAP_SET);
@@ -166,7 +165,7 @@
cap_free (caps);
if (__builtin_expect (res != 0, 0))
- error (FAIL_EXEC, errno, _("cap_set_proc failed"));
+ return FAIL_EXEC;
}
#endif
Modified: fsf/glibc-2_11-branch/libc/nptl/ChangeLog
==============================================================================
--- fsf/glibc-2_11-branch/libc/nptl/ChangeLog (original)
+++ fsf/glibc-2_11-branch/libc/nptl/ChangeLog Sat Dec 5 00:05:32 2009
@@ -1,3 +1,8 @@
+2009-11-27 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/x86_64/cancellation.S: Reload
+ THREAD_SELF->cancelhandling after returning from futex call.
+
2009-11-03 Andreas Schwab <schwab@xxxxxxxxxxxxxx>
[BZ #4457]
Modified: fsf/glibc-2_11-branch/libc/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S
==============================================================================
--- fsf/glibc-2_11-branch/libc/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S (original)
+++ fsf/glibc-2_11-branch/libc/nptl/sysdeps/unix/sysv/linux/x86_64/cancellation.S Sat Dec 5 00:05:32 2009
@@ -96,8 +96,8 @@
cmpxchgl %r11d, %fs:CANCELHANDLING
jnz 2b
-3: movl %r11d, %eax
- andl $(TCB_CANCELING_BITMASK|TCB_CANCELED_BITMASK), %eax
+ movl %r11d, %eax
+3: andl $(TCB_CANCELING_BITMASK|TCB_CANCELED_BITMASK), %eax
cmpl $TCB_CANCELING_BITMASK, %eax
je 4f
1: ret
@@ -111,5 +111,6 @@
addq $CANCELHANDLING, %rdi
LOAD_PRIVATE_FUTEX_WAIT (%esi)
syscall
+ movl %fs:CANCELHANDLING, %eax
jmp 3b
END(__pthread_disable_asynccancel)
Modified: fsf/glibc-2_11-branch/libc/sunrpc/create_xid.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/sunrpc/create_xid.c (original)
+++ fsf/glibc-2_11-branch/libc/sunrpc/create_xid.c Sat Dec 5 00:05:32 2009
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2000, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@xxxxxxxxxxxxxxxxxxx>, 1998.
@@ -27,7 +27,7 @@
__libc_lock_define_initialized (static, createxid_lock)
-static int is_initialized;
+static pid_t is_initialized;
static struct drand48_data __rpc_lrand48_data;
unsigned long
@@ -37,13 +37,15 @@
__libc_lock_lock (createxid_lock);
- if (!is_initialized)
+ pid_t pid = getpid ();
+ if (is_initialized != pid)
{
struct timeval now;
__gettimeofday (&now, (struct timezone *) 0);
- __srand48_r (now.tv_sec ^ now.tv_usec, &__rpc_lrand48_data);
- is_initialized = 1;
+ __srand48_r (now.tv_sec ^ now.tv_usec ^ pid,
+ &__rpc_lrand48_data);
+ is_initialized = pid;
}
lrand48_r (&__rpc_lrand48_data, &res);
Modified: fsf/glibc-2_11-branch/libc/sysdeps/unix/grantpt.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/unix/grantpt.c (original)
+++ fsf/glibc-2_11-branch/libc/sysdeps/unix/grantpt.c Sat Dec 5 00:05:32 2009
@@ -190,6 +190,10 @@
if (__dup2 (fd, PTY_FILENO) < 0)
_exit (FAIL_EBADF);
+#ifdef CLOSE_ALL_FDS
+ CLOSE_ALL_FDS ();
+#endif
+
execle (_PATH_PT_CHOWN, basename (_PATH_PT_CHOWN), NULL, NULL);
_exit (FAIL_EXEC);
}
Added: fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/grantpt.c
==============================================================================
--- fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/grantpt.c (added)
+++ fsf/glibc-2_11-branch/libc/sysdeps/unix/sysv/linux/grantpt.c Sat Dec 5 00:05:32 2009
@@ -1,0 +1,42 @@
+#include <assert.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "not-cancel.h"
+#include "pty-private.h"
+
+
+/* Close all file descriptors except the one specified. */
+static void
+close_all_fds (void)
+{
+ DIR *dir = __opendir ("/proc/self/fd");
+ if (dir != NULL)
+ {
+ struct dirent64 *d;
+ while ((d = __readdir64 (dir)) != NULL)
+ if (isdigit (d->d_name[0]))
+ {
+ char *endp;
+ long int fd = strtol (d->d_name, &endp, 10);
+ if (*endp == '\0' && fd != PTY_FILENO && fd != dirfd (dir))
+ close_not_cancel_no_status (fd);
+ }
+
+ __closedir (dir);
+
+ int nullfd = open_not_cancel_2 (_PATH_DEVNULL, O_RDONLY);
+ assert (nullfd == STDIN_FILENO);
+ nullfd = open_not_cancel_2 (_PATH_DEVNULL, O_WRONLY);
+ assert (nullfd == STDOUT_FILENO);
+ __dup2 (STDOUT_FILENO, STDERR_FILENO);
+ }
+}
+#define CLOSE_ALL_FDS() close_all_fds()
+
+#include <sysdeps/unix/grantpt.c>