[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r14299 - in /fsf/trunk/libc: ./ sysdeps/posix/ sysdeps/unix/sysv/linux/ sysdeps/unix/sysv/linux/bits/
- To: commits@xxxxxxxxxx
- Subject: [commits] r14299 - in /fsf/trunk/libc: ./ sysdeps/posix/ sysdeps/unix/sysv/linux/ sysdeps/unix/sysv/linux/bits/
- From: eglibc@xxxxxxxxxx
- Date: Thu, 23 Jun 2011 07:03:28 -0000
Author: eglibc
Date: Thu Jun 23 00:03:23 2011
New Revision: 14299
Log:
Import glibc-mainline for 2011-06-23
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/NEWS
fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sigcontext.h
fsf/trunk/libc/sysdeps/unix/sysv/linux/getsysstats.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Jun 23 00:03:23 2011
@@ -1,3 +1,27 @@
+2011-06-22 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ [BZ #12907]
+ * sysdeps/posix/getaddrinfo.c (getaddrinfo): Avoid calling __check_pf
+ until it is clear that the information is realy needed.
+ Patch mostly by David Hanisch <david.hanisch@xxxxxxx>.
+
+2011-06-22 Andreas Schwab <schwab@xxxxxxxxxx>
+
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Fix last change.
+
+2011-06-22 Ulrich Drepper <drepper@xxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Use
+ /sys/devices/system/cpu/online if it is usable.
+
+ * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Rate limit
+ reading the information from the /proc filesystem to once a second.
+
+2011-06-21 Andreas Jaeger <aj@xxxxxxx>
+
+ * sysdeps/unix/sysv/linux/bits/sigcontext.h: Fix definition of
+ NULL after inclusion of kernel headers.
+
2011-06-21 Ulrich Drepper <drepper@xxxxxxxxx>
* nss/nss_db/db-XXX.c (nss_db_setENT): Only set entidx for successful
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Thu Jun 23 00:03:23 2011
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2011-6-21
+GNU C Library NEWS -- history of user-visible changes. 2011-6-22
Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -9,7 +9,7 @@
* The following bugs are resolved with this release:
- 12885
+ 12885, 12907
* New program pldd to list loaded object of a process
Implemented by Ulrich Drepper.
Modified: fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/getaddrinfo.c (original)
+++ fsf/trunk/libc/sysdeps/posix/getaddrinfo.c Thu Jun 23 00:03:23 2011
@@ -894,7 +894,7 @@
pat = &((*pat)->next);
no_data = 0;
}
- else if ((*pat)->family == AF_UNSPEC
+ else if (req->ai_family == AF_UNSPEC
|| (*pat)->family == req->ai_family)
{
pat = &((*pat)->next);
@@ -2352,14 +2352,17 @@
size_t in6ailen = 0;
bool seen_ipv4 = false;
bool seen_ipv6 = false;
- /* We might need information about what interfaces are available.
- Also determine whether we have IPv4 or IPv6 interfaces or both. We
- cannot cache the results since new interfaces could be added at
- any time. */
- __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
+ bool check_pf_called = false;
if (hints->ai_flags & AI_ADDRCONFIG)
{
+ /* We might need information about what interfaces are available.
+ Also determine whether we have IPv4 or IPv6 interfaces or both. We
+ cannot cache the results since new interfaces could be added at
+ any time. */
+ __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
+ check_pf_called = true;
+
/* Now make a decision on what we return, if anything. */
if (hints->ai_family == PF_UNSPEC && (seen_ipv4 || seen_ipv6))
{
@@ -2440,6 +2443,10 @@
struct addrinfo *q;
struct addrinfo *last = NULL;
char *canonname = NULL;
+
+ /* Now we definitely need the interface information. */
+ if (! check_pf_called)
+ __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
/* If we have information about deprecated and temporary addresses
sort the array now. */
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sigcontext.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sigcontext.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/bits/sigcontext.h Thu Jun 23 00:03:23 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2011 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
@@ -26,4 +26,8 @@
# define sigcontext_struct sigcontext
# include <asm/sigcontext.h>
+
+/* The Linux kernel headers redefine NULL wrongly, so cleanup afterwards. */
+# define __need_NULL
+# include <stddef.h>
#endif
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/getsysstats.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/getsysstats.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/getsysstats.c Thu Jun 23 00:03:23 2011
@@ -1,5 +1,5 @@
/* Determine various system internal values, Linux version.
- Copyright (C) 1996-2003,2006,2007,2009,2010 Free Software Foundation, Inc.
+ Copyright (C) 1996-2003,2006,2007,2009,2010,2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
@@ -35,6 +35,16 @@
#include <atomic.h>
#include <not-cancel.h>
+#include <kernel-features.h>
+
+#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
+# undef INTERNAL_VSYSCALL
+# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
+# undef INLINE_VSYSCALL
+# define INLINE_VSYSCALL INLINE_SYSCALL
+#else
+# include <bits/libc-vdso.h>
+#endif
/* How we can determine the number of available processors depends on
@@ -128,6 +138,22 @@
int
__get_nprocs ()
{
+ static int cached_result;
+ static time_t timestamp;
+
+#ifdef __ASSUME_POSIX_TIMERS
+ struct timespec ts;
+ INTERNAL_SYSCALL_DECL (err);
+ INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts);
+#else
+ struct timeval ts;
+ gettimeofday (&ts, NULL);
+#endif
+ time_t prev = timestamp;
+ atomic_read_barrier ();
+ if (ts.tv_sec == prev)
+ return cached_result;
+
/* XXX Here will come a test for the new system call. */
const size_t buffer_size = __libc_use_alloca (8192) ? 8192 : 512;
@@ -135,20 +161,65 @@
char *buffer_end = buffer + buffer_size;
char *cp = buffer_end;
char *re = buffer_end;
- int result = 1;
#ifdef O_CLOEXEC
const int flags = O_RDONLY | O_CLOEXEC;
#else
const int flags = O_RDONLY;
#endif
+ int fd = open_not_cancel_2 ("/sys/devices/system/cpu/online", flags);
+ char *l;
+ int result = 0;
+ if (fd != -1)
+ {
+ l = next_line (fd, buffer, &cp, &re, buffer_end);
+ if (l != NULL)
+ do
+ {
+ char *endp;
+ unsigned long int n = strtoul (l, &endp, 10);
+ if (l == endp)
+ {
+ result = 0;
+ break;
+ }
+
+ unsigned long int m = n;
+ if (*endp == '-')
+ {
+ l = endp + 1;
+ m = strtoul (l, &endp, 10);
+ if (l == endp)
+ {
+ result = 0;
+ break;
+ }
+ }
+
+ result += m - n + 1;
+
+ l = endp;
+ while (l < re && isspace (*l))
+ ++l;
+ }
+ while (l < re);
+
+ close_not_cancel_no_status (fd);
+
+ if (result > 0)
+ goto out;
+ }
+
+ cp = buffer_end;
+ re = buffer_end;
+ result = 1;
+
/* The /proc/stat format is more uniform, use it by default. */
- int fd = open_not_cancel_2 ("/proc/stat", flags);
+ fd = open_not_cancel_2 ("/proc/stat", flags);
if (fd != -1)
{
result = 0;
- char *l;
while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
/* The current format of /proc/stat has all the cpu* entries
at the front. We assume here that stays this way. */
@@ -168,6 +239,11 @@
close_not_cancel_no_status (fd);
}
}
+
+ out:
+ cached_result = result;
+ atomic_write_barrier ();
+ timestamp = ts.tv_sec;
return result;
}