[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r8374 - in /fsf/trunk/libc: ./ locale/programs/ nptl/ nptl/sysdeps/i386/ nptl/sysdeps/x86_64/
- To: commits@xxxxxxxxxx
- Subject: [commits] r8374 - in /fsf/trunk/libc: ./ locale/programs/ nptl/ nptl/sysdeps/i386/ nptl/sysdeps/x86_64/
- From: eglibc@xxxxxxxxxx
- Date: Tue, 28 Apr 2009 07:04:49 -0000
Author: eglibc
Date: Tue Apr 28 00:04:48 2009
New Revision: 8374
Log:
Import glibc-mainline for 2009-04-28
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/locale/programs/locarchive.c
fsf/trunk/libc/nptl/ChangeLog
fsf/trunk/libc/nptl/cancellation.c
fsf/trunk/libc/nptl/libc-cancellation.c
fsf/trunk/libc/nptl/sysdeps/i386/tls.h
fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Apr 28 00:04:48 2009
@@ -1,3 +1,12 @@
+2009-04-27 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * locale/programs/locarchive.c (create_archive): Add MAP_PRIVATE
+ to MAP_ANON in PROT_NONE mmap64 call.
+ (open_archive): Likewise.
+ (file_data_available_p): Use mmap64 instead of mremap.
+ (enlarge_archive): Likewise. Update head if ah->addr changed.
+ Attempt to reserve address space after mmap64 region.
+
2009-04-26 Ulrich Drepper <drepper@xxxxxxxxxx>
* sysdeps/ieee754/dbl-64/s_expm1.c: Set errno for overflow.
Modified: fsf/trunk/libc/locale/programs/locarchive.c
==============================================================================
--- fsf/trunk/libc/locale/programs/locarchive.c (original)
+++ fsf/trunk/libc/locale/programs/locarchive.c Tue Apr 28 00:04:48 2009
@@ -134,8 +134,8 @@
size_t reserved = RESERVE_MMAP_SIZE;
int xflags = 0;
if (total < reserved
- && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_ANON, -1, 0))
- != MAP_FAILED))
+ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
xflags = MAP_FIXED;
else
{
@@ -259,10 +259,16 @@
if (st.st_size > ah->reserved)
return false;
- void *p = mremap (ah->addr, ah->mmaped, st.st_size,
- MREMAP_FIXED | MREMAP_MAYMOVE, ah->addr);
+ const size_t pagesz = getpagesize ();
+ size_t start = ah->mmaped & ~(pagesz - 1);
+ void *p = mmap64 (ah->addr + start, st.st_size - start,
+ PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
+ ah->fd, start);
if (p == MAP_FAILED)
- return false;
+ {
+ ah->mmaped = start;
+ return false;
+ }
ah->mmaped = st.st_size;
return true;
@@ -312,14 +318,15 @@
error (EXIT_FAILURE, errno, _("cannot map locale archive file"));
if (st.st_size < ah->reserved)
- ah->addr = mremap (ah->addr, ah->mmaped, st.st_size,
- MREMAP_MAYMOVE | MREMAP_FIXED, ah->addr);
+ ah->addr = mmap64 (ah->addr, st.st_size, PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_FIXED, ah->fd, 0);
else
{
munmap (ah->addr, ah->reserved);
ah->addr = mmap64 (NULL, st.st_size, PROT_READ | PROT_WRITE,
MAP_SHARED, ah->fd, 0);
ah->reserved = st.st_size;
+ head = ah->addr;
}
if (ah->addr == MAP_FAILED)
goto enomap;
@@ -384,8 +391,22 @@
error (EXIT_FAILURE, errval, _("cannot resize archive file"));
}
+ /* To prepare for enlargements of the mmaped area reserve some
+ address space. */
+ size_t reserved = RESERVE_MMAP_SIZE;
+ int xflags = 0;
+ if (total < reserved
+ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
+ xflags = MAP_FIXED;
+ else
+ {
+ p = NULL;
+ reserved = total;
+ }
+
/* Map the header and all the administration data structures. */
- p = mmap64 (NULL, total, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0);
if (p == MAP_FAILED)
{
int errval = errno;
@@ -404,7 +425,7 @@
new_ah.mmaped = total;
new_ah.addr = p;
new_ah.fd = fd;
- new_ah.reserved = total;
+ new_ah.reserved = reserved;
/* Walk through the hash name hash table to find out what data is
still referenced and transfer it into the new file. */
@@ -593,8 +614,8 @@
int xflags = 0;
void *p;
if (st.st_size < reserved
- && ((p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_ANON, -1, 0))
- != MAP_FAILED))
+ && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
+ -1, 0)) != MAP_FAILED))
xflags = MAP_FIXED;
else
{
Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Tue Apr 28 00:04:48 2009
@@ -1,3 +1,12 @@
+2009-04-27 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * cancellation.c (__pthread_disable_asynccancel): Use THREAD_ATOMIC_AND
+ is available.
+ * libc-cancellation.c (__libc_disable_asynccancel): Likewise.
+ * sysdeps/x86_64/tls.h: Define THREAD_ATOMIC_AND.
+ * sysdeps/i386/tls.h: Likewise.
+ (tcbhead_t): Add __private_tm member.
+
2009-04-26 Ulrich Drepper <drepper@xxxxxxxxxx>
* sem_open.c (sem_open): Rewrite initialization of initsem to
Modified: fsf/trunk/libc/nptl/cancellation.c
==============================================================================
--- fsf/trunk/libc/nptl/cancellation.c (original)
+++ fsf/trunk/libc/nptl/cancellation.c Tue Apr 28 00:04:48 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -70,6 +70,10 @@
return;
struct pthread *self = THREAD_SELF;
+
+#ifdef THREAD_ATOMIC_AND
+ THREAD_ATOMIC_AND (self, cancelhandling, ~CANCELTYPE_BITMASK);
+#else
int oldval = THREAD_GETMEM (self, cancelhandling);
while (1)
@@ -87,4 +91,5 @@
/* Prepare the next round. */
oldval = curval;
}
+#endif
}
Modified: fsf/trunk/libc/nptl/libc-cancellation.c
==============================================================================
--- fsf/trunk/libc/nptl/libc-cancellation.c (original)
+++ fsf/trunk/libc/nptl/libc-cancellation.c Tue Apr 28 00:04:48 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -86,6 +86,10 @@
return;
struct pthread *self = THREAD_SELF;
+
+#ifdef THREAD_ATOMIC_AND
+ THREAD_ATOMIC_AND (self, cancelhandling, ~CANCELTYPE_BITMASK);
+#else
int oldval = THREAD_GETMEM (self, cancelhandling);
while (1)
@@ -103,6 +107,7 @@
/* Prepare the next round. */
oldval = curval;
}
+#endif
}
Modified: fsf/trunk/libc/nptl/sysdeps/i386/tls.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/i386/tls.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/i386/tls.h Tue Apr 28 00:04:48 2009
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. nptl/i386 version.
- Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+ Copyright (C) 2002-2007, 2009 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
@@ -56,7 +56,11 @@
int gscope_flag;
#ifndef __ASSUME_PRIVATE_FUTEX
int private_futex;
-#endif
+#else
+ int __unused1;
+#endif
+ /* Reservation of some values for the TM ABI. */
+ void *__private_tm[5];
} tcbhead_t;
# define TLS_MULTIPLE_THREADS_IN_TCB 1
@@ -392,6 +396,17 @@
/* Not necessary for other sizes in the moment. */ \
abort (); \
__ret; })
+
+
+/* Atomic logical and. */
+#define THREAD_ATOMIC_AND(descr, member, val) \
+ (void) ({ if (sizeof ((descr)->member) == 4) \
+ asm volatile (LOCK_PREFIX "andl %1, %%gs:%P0" \
+ :: "i" (offsetof (struct pthread, member)), \
+ "ir" (val)); \
+ else \
+ /* Not necessary for other sizes in the moment. */ \
+ abort (); })
/* Atomic set bit. */
Modified: fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h Tue Apr 28 00:04:48 2009
@@ -1,5 +1,5 @@
/* Definition for thread-local data handling. nptl/x86_64 version.
- Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2002-2007, 2008, 2009 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
@@ -310,6 +310,17 @@
/* Not necessary for other sizes in the moment. */ \
abort (); \
__ret; })
+
+
+/* Atomic logical and. */
+#define THREAD_ATOMIC_AND(descr, member, val) \
+ (void) ({ if (sizeof ((descr)->member) == 4) \
+ asm volatile (LOCK_PREFIX "andl %1, %%fs:%P0" \
+ :: "i" (offsetof (struct pthread, member)), \
+ "ir" (val)); \
+ else \
+ /* Not necessary for other sizes in the moment. */ \
+ abort (); })
/* Atomic set bit. */