[arch-commits] CVS update of arch/build/base/glibc (2 files)

Jan de Groot jgc at archlinux.org
Tue May 22 17:01:57 UTC 2007


    Date: Tuesday, May 22, 2007 @ 13:01:57
  Author: jgc
    Path: /home/cvs-arch/arch/build/base/glibc

   Added: glibc-2.6-malloc-fixes.patch (1.1)
Modified: PKGBUILD (1.61 -> 1.62)

upgpkg: glibc 2.6-2
Add post-2.6 malloc fixes, fixes segmentation fault in glibc when starting emacs


------------------------------+
 PKGBUILD                     |   19 
 glibc-2.6-malloc-fixes.patch |  952 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 969 insertions(+), 2 deletions(-)


Index: arch/build/base/glibc/PKGBUILD
diff -u arch/build/base/glibc/PKGBUILD:1.61 arch/build/base/glibc/PKGBUILD:1.62
--- arch/build/base/glibc/PKGBUILD:1.61	Sun May 20 09:01:55 2007
+++ arch/build/base/glibc/PKGBUILD	Tue May 22 13:01:57 2007
@@ -1,8 +1,8 @@
-# $Id: PKGBUILD,v 1.61 2007/05/20 13:01:55 jgc Exp $
+# $Id: PKGBUILD,v 1.62 2007/05/22 17:01:57 jgc Exp $
 # Maintainer: Jan de Groot <jgc at archlinux.org>
 pkgname=glibc
 pkgver=2.6
-pkgrel=1
+pkgrel=2
 _tzdata=2007f
 install=glibc.install
 backup=(etc/locale.gen)
@@ -15,6 +15,7 @@
 	http://ftp.gnu.org/gnu/glibc/glibc-libidn-${pkgver}.tar.bz2
 	ftp://elsie.nci.nih.gov/pub/tzdata${_tzdata}.tar.gz
 	glibc-2.5-localedef_segfault-1.patch
+	glibc-2.6-malloc-fixes.patch
 	locales-fr.diff
 	locales_GB.diff
 	fix-C-first_weekday.diff
@@ -22,6 +23,19 @@
 	nscd
 	locale.gen
 	locale-gen)
+md5sums=('0f471d7cb29dd07786082ad23f787949'
+         'ed20ad629986c2746c77cda46fb0602c'
+         '799ca289ee9e2f22ce6e3f9fb9c5f847'
+         '879fcc4d60526a4796e5d99d5839de38'
+         '191a7027649961ef4a5e9081bf5cdee5'
+         '78ee499ba48ceeff0b4bbbb953682517'
+         '159b30fffda57b38c825bac36d6a9818'
+         '8810a53b0b1ebb0480dbe6d7604a11d1'
+         '16145f6005953c3baa627aa44010bbc1'
+         'b587ee3a70c9b3713099295609afde49'
+         'de51529a06d0d39b4e1cd23b5edec554'
+         '476e9113489f93b348b21e144b6a8fcf')
+
 build() {
   cd ${startdir}/src/glibc-${pkgver}
   mv ../glibc-libidn-${pkgver} ./libidn
@@ -30,6 +44,7 @@
   popd
 
   patch -Np1 -i ${startdir}/src/glibc-2.5-localedef_segfault-1.patch || return 1
+  patch -Np0 -i ${startdir}/src/glibc-2.6-malloc-fixes.patch || return 1
   patch -Np0 -i ${startdir}/src/locales_GB.diff || return 1
   patch -Np1 -i ${startdir}/src/locales-fr.diff || return 1
   patch -Np0 -i ${startdir}/src/first_weekday.diff || return 1
Index: arch/build/base/glibc/glibc-2.6-malloc-fixes.patch
diff -u /dev/null arch/build/base/glibc/glibc-2.6-malloc-fixes.patch:1.1
--- /dev/null	Tue May 22 13:01:57 2007
+++ arch/build/base/glibc/glibc-2.6-malloc-fixes.patch	Tue May 22 13:01:57 2007
@@ -0,0 +1,952 @@
+Index: ChangeLog
+===================================================================
+RCS file: /cvs/glibc/libc/ChangeLog,v
+retrieving revision 1.8782.2.244
+retrieving revision 1.8782.2.245
+diff -u -r1.8782.2.244 -r1.8782.2.245
+--- ChangeLog	15 May 2007 20:34:27 -0000	1.8782.2.244
++++ ChangeLog	21 May 2007 20:00:48 -0000	1.8782.2.245
+@@ -1,3 +1,58 @@
++2007-05-21  Ulrich Drepper  <drepper at redhat.com>
++
++	* sysdeps/unix/sysv/linux/i386/epoll_pwait.S: New file.
++
++2007-05-21  Jakub Jelinek  <jakub at redhat.com>
++
++	[BZ #4525]
++	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add epoll_pwait.
++	* sysdeps/unix/sysv/linux/epoll_pwait.c: New file.
++	* sysdeps/unix/sysv/linux/syscalls.list (epoll_pwait): Remove.
++
++	* sysdeps/unix/sysv/linux/x86_64/sys/epoll.h (epoll_pwait): Declare.
++
++	[BZ #4514]
++	* stdio-common/vfprintf.c (vfprintf): Don't shadow workstart variable,
++	reinitialize workend at the start of each do_positional format spec
++	loop, free workstart before do_positional loops.
++	(printf_unknown): Fix size of work_buffer.
++	* stdio-common/tst-sprintf.c (main): Add 3 new testcases.
++
++	* malloc/hooks.c (MALLOC_STATE_VERSION): Bump.
++	(public_sET_STATe): If ms->version < 3, put all chunks into
++	unsorted chunks and clear {fd,bk}_nextsize fields of largebin
++	chunks.
++
++	* malloc/malloc.c [MALLOC_DEBUG]: Revert 2007-05-13 changes.
++	* malloc/hooks.c: Likewise.
++	* malloc/arena.c: Likewise.
++	* malloc/malloc.c (do_check_malloc_state): Don't assert
++	n_mmaps is not greater than n_mmaps_max.  This removes the need
++	for the previous change.
++
++	* malloc/Makefile (CFLAGS-malloc.c): Revert accidental
++	2007-05-07 commit.
++
++2007-05-18  Ulrich Drepper  <drepper at redhat.com>
++
++	* malloc/malloc.c (do_check_chunk): Correct check for mmaped block
++	not overlapping with arena.
++
++	* malloc/mcheck.c (reallochook): If size==0, free the block.
++
++	* rt/tst-shm.c: Use fstat64 instead of fstat.
++
++	* sysdeps/unix/sysv/linux/i386/sync_file_range.S: Fix case where
++	__NR_sync_file_range is not defined.
++
++2007-05-17  Ulrich Drepper  <drepper at redhat.com>
++
++	Dummy files to prevent stub versions from being used.
++	* sysdeps/x86_64/fpu/k_cosl.c: New file.
++	* sysdeps/x86_64/fpu/k_rem_pio2l.c: New file.
++	* sysdeps/x86_64/fpu/k_sinl.c: New file.
++	* sysdeps/x86_64/fpu/k_tanl.c: New file.
++
+ 2007-05-14  Ulrich Drepper  <drepper at redhat.com>
+ 
+ 	* version.h (VERSION): Define to 6.
+Index: malloc/Makefile
+===================================================================
+RCS file: /cvs/glibc/libc/malloc/Makefile,v
+retrieving revision 1.47.2.7
+retrieving revision 1.47.2.8
+diff -u -r1.47.2.7 -r1.47.2.8
+--- malloc/Makefile	10 May 2007 06:44:27 -0000	1.47.2.7
++++ malloc/Makefile	21 May 2007 20:01:05 -0000	1.47.2.8
+@@ -104,7 +104,6 @@
+ include ../Rules
+ 
+ CFLAGS-mcheck-init.c = $(PIC-ccflag)
+-CFLAGS-malloc.c += -DMALLOC_DEBUG
+ 
+ $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
+ 	-rm -f $@
+Index: malloc/arena.c
+===================================================================
+RCS file: /cvs/glibc/libc/malloc/arena.c,v
+retrieving revision 1.8.2.19
+retrieving revision 1.8.2.20
+diff -u -r1.8.2.19 -r1.8.2.20
+--- malloc/arena.c	15 May 2007 20:34:29 -0000	1.8.2.19
++++ malloc/arena.c	21 May 2007 20:01:06 -0000	1.8.2.20
+@@ -370,9 +370,6 @@
+   mp_.top_pad        = DEFAULT_TOP_PAD;
+ #endif
+   mp_.n_mmaps_max    = DEFAULT_MMAP_MAX;
+-#if MALLOC_DEBUG
+-  mp_.n_mmaps_cmax   = DEFAULT_MMAP_MAX;
+-#endif
+   mp_.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
+   mp_.trim_threshold = DEFAULT_TRIM_THRESHOLD;
+   mp_.pagesize       = malloc_getpagesize;
+Index: malloc/hooks.c
+===================================================================
+RCS file: /cvs/glibc/libc/malloc/hooks.c,v
+retrieving revision 1.15.2.6
+retrieving revision 1.15.2.7
+diff -u -r1.15.2.6 -r1.15.2.7
+--- malloc/hooks.c	15 May 2007 20:34:29 -0000	1.15.2.6
++++ malloc/hooks.c	21 May 2007 20:01:06 -0000	1.15.2.7
+@@ -496,7 +496,7 @@
+    then the hooks are reset to 0.  */
+ 
+ #define MALLOC_STATE_MAGIC   0x444c4541l
+-#define MALLOC_STATE_VERSION (0*0x100l + 2l) /* major*0x100 + minor */
++#define MALLOC_STATE_VERSION (0*0x100l + 3l) /* major*0x100 + minor */
+ 
+ struct malloc_save_state {
+   long          magic;
+@@ -507,9 +507,6 @@
+   unsigned long trim_threshold;
+   unsigned long top_pad;
+   unsigned int  n_mmaps_max;
+-#if MALLOC_DEBUG
+-  unsigned int  n_mmaps_cmax;
+-#endif
+   unsigned long mmap_threshold;
+   int           check_action;
+   unsigned long max_sbrked_mem;
+@@ -553,9 +550,6 @@
+   ms->trim_threshold = mp_.trim_threshold;
+   ms->top_pad = mp_.top_pad;
+   ms->n_mmaps_max = mp_.n_mmaps_max;
+-#if MALLOC_DEBUG
+-  ms->n_mmaps_cmax = mp_.n_mmaps_cmax;
+-#endif
+   ms->mmap_threshold = mp_.mmap_threshold;
+   ms->check_action = check_action;
+   ms->max_sbrked_mem = main_arena.max_system_mem;
+@@ -601,8 +595,9 @@
+       assert(ms->av[2*i+3] == 0);
+       first(b) = last(b) = b;
+     } else {
+-      if(i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i &&
+-			  largebin_index(chunksize(ms->av[2*i+3]))==i)) {
++      if(ms->version >= 3 &&
++	 (i<NSMALLBINS || (largebin_index(chunksize(ms->av[2*i+2]))==i &&
++			   largebin_index(chunksize(ms->av[2*i+3]))==i))) {
+ 	first(b) = ms->av[2*i+2];
+ 	last(b) = ms->av[2*i+3];
+ 	/* Make sure the links to the bins within the heap are correct.  */
+@@ -622,14 +617,22 @@
+       }
+     }
+   }
++  if (ms->version < 3) {
++    /* Clear fd_nextsize and bk_nextsize fields.  */
++    b = unsorted_chunks(&main_arena)->fd;
++    while (b != unsorted_chunks(&main_arena)) {
++      if (!in_smallbin_range(chunksize(b))) {
++	b->fd_nextsize = NULL;
++	b->bk_nextsize = NULL;
++      }
++      b = b->fd;
++    }
++  }
+   mp_.sbrk_base = ms->sbrk_base;
+   main_arena.system_mem = ms->sbrked_mem_bytes;
+   mp_.trim_threshold = ms->trim_threshold;
+   mp_.top_pad = ms->top_pad;
+   mp_.n_mmaps_max = ms->n_mmaps_max;
+-#if MALLOC_DEBUG
+-  mp_.n_mmaps_cmax = ms->n_mmaps_cmax;
+-#endif
+   mp_.mmap_threshold = ms->mmap_threshold;
+   check_action = ms->check_action;
+   main_arena.max_system_mem = ms->max_sbrked_mem;
+Index: malloc/malloc.c
+===================================================================
+RCS file: /cvs/glibc/libc/malloc/malloc.c,v
+retrieving revision 1.127.2.36
+retrieving revision 1.127.2.37
+diff -u -r1.127.2.36 -r1.127.2.37
+--- malloc/malloc.c	15 May 2007 20:34:29 -0000	1.127.2.36
++++ malloc/malloc.c	21 May 2007 20:01:08 -0000	1.127.2.37
+@@ -2358,9 +2358,6 @@
+   /* Memory map support */
+   int              n_mmaps;
+   int              n_mmaps_max;
+-#if MALLOC_DEBUG
+-  int              n_mmaps_cmax;
+-#endif
+   int              max_n_mmaps;
+   /* the mmap_threshold is dynamic, until the user sets
+      it manually, at which point we need to disable any
+@@ -2572,7 +2569,7 @@
+ #if HAVE_MMAP
+     /* address is outside main heap  */
+     if (contiguous(av) && av->top != initial_top(av)) {
+-      assert(((char*)p) < min_address || ((char*)p) > max_address);
++      assert(((char*)p) < min_address || ((char*)p) >= max_address);
+     }
+     /* chunk is page-aligned */
+     assert(((p->prev_size + sz) & (mp_.pagesize-1)) == 0);
+@@ -2876,8 +2873,6 @@
+   assert(total <= (unsigned long)(mp_.max_total_mem));
+   assert(mp_.n_mmaps >= 0);
+ #endif
+-  assert(mp_.n_mmaps <= mp_.n_mmaps_cmax);
+-  assert(mp_.n_mmaps_max <= mp_.n_mmaps_cmax);
+   assert(mp_.n_mmaps <= mp_.max_n_mmaps);
+ 
+   assert((unsigned long)(av->system_mem) <=
+@@ -3475,13 +3470,6 @@
+     }
+ 
+   mp_.n_mmaps--;
+-#if MALLOC_DEBUG
+-  if (mp_.n_mmaps_cmax > mp_.n_mmaps_max)
+-    {
+-      assert (mp_.n_mmaps_cmax == mp_.n_mmaps + 1);
+-      mp_.n_mmaps_cmax = mp_.n_mmaps;
+-    }
+-#endif
+   mp_.mmapped_mem -= total_size;
+ 
+   int ret __attribute__ ((unused)) = munmap((char *)block, total_size);
+@@ -5397,9 +5385,6 @@
+   mp_.n_mmaps_max = 0;
+   mem = _int_malloc(av, size);
+   mp_.n_mmaps_max = mmx;   /* reset mmap */
+-#if MALLOC_DEBUG
+-  mp_.n_mmaps_cmax = mmx;
+-#endif
+   if (mem == 0)
+     return 0;
+ 
+@@ -5725,17 +5710,8 @@
+       res = 0;
+     else
+ #endif
+-      {
+-#if MALLOC_DEBUG
+-	if (mp_.n_mmaps <= value)
+-	  mp_.n_mmaps_cmax = value;
+-	else
+-	  mp_.n_mmaps_cmax = mp_.n_mmaps;
+-#endif
+-
+-	mp_.n_mmaps_max = value;
+-	mp_.no_dyn_threshold = 1;
+-      }
++      mp_.n_mmaps_max = value;
++      mp_.no_dyn_threshold = 1;
+     break;
+ 
+   case M_CHECK_ACTION:
+Index: malloc/mcheck.c
+===================================================================
+RCS file: /cvs/glibc/libc/malloc/mcheck.c,v
+retrieving revision 1.18.2.1
+retrieving revision 1.18.2.2
+diff -u -r1.18.2.1 -r1.18.2.2
+--- malloc/mcheck.c	20 Dec 2005 10:59:21 -0000	1.18.2.1
++++ malloc/mcheck.c	21 May 2007 20:01:08 -0000	1.18.2.2
+@@ -1,5 +1,5 @@
+ /* Standard debugging hooks for `malloc'.
+-   Copyright (C) 1990-1997,99,2000,01,02 Free Software Foundation, Inc.
++   Copyright (C) 1990-1997,1999,2000-2002,2007 Free Software Foundation, Inc.
+    This file is part of the GNU C Library.
+    Written May 1989 by Mike Haertel.
+ 
+@@ -280,6 +280,12 @@
+ static __ptr_t
+ reallochook (__ptr_t ptr, __malloc_size_t size, const __ptr_t caller)
+ {
++  if (size == 0)
++    {
++      freehook (ptr, caller);
++      return NULL;
++    }
++
+   struct hdr *hdr;
+   __malloc_size_t osize;
+ 
+Index: nptl/ChangeLog
+===================================================================
+RCS file: /cvs/glibc/libc/nptl/ChangeLog,v
+retrieving revision 1.706.2.124
+retrieving revision 1.706.2.125
+diff -u -r1.706.2.124 -r1.706.2.125
+--- nptl/ChangeLog	15 May 2007 20:34:29 -0000	1.706.2.124
++++ nptl/ChangeLog	21 May 2007 20:01:10 -0000	1.706.2.125
+@@ -1,3 +1,16 @@
++2007-05-17  Ulrich Drepper  <drepper at redhat.com>
++
++	[BZ #4512]
++	* pthread_mutex_lock.c: Preserve FUTEX_WAITERS bit when dead owner
++	is detected.
++	* pthread_mutex_timedlock.c: Likewise.
++	* pthread_mutex_trylock.c: Likewise.
++	Patch in part by Atsushi Nemoto <anemo at mba.ocn.ne.jp>.
++
++	* Makefile (tests): Add tst-robust9 and tst-robustpi9.
++	* tst-robust9.c: New file.
++	* tst-robustpi9.c: New file.
++
+ 2007-05-14  Ulrich Drepper  <drepper at redhat.com>
+ 
+ 	* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Remove unnecessary
+Index: nptl/Makefile
+===================================================================
+RCS file: /cvs/glibc/libc/nptl/Makefile,v
+retrieving revision 1.157.2.29
+retrieving revision 1.157.2.30
+diff -u -r1.157.2.29 -r1.157.2.30
+--- nptl/Makefile	28 Nov 2006 11:18:18 -0000	1.157.2.29
++++ nptl/Makefile	21 May 2007 20:01:10 -0000	1.157.2.30
+@@ -1,4 +1,4 @@
+-# Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
++# Copyright (C) 2002,2003,2004,2005,2006,2007 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
+@@ -209,9 +209,9 @@
+ 	tst-cond14 tst-cond15 tst-cond16 tst-cond17 tst-cond18 tst-cond19 \
+ 	tst-cond20 tst-cond21 tst-cond22 \
+ 	tst-robust1 tst-robust2 tst-robust3 tst-robust4 tst-robust5 \
+-	tst-robust6 tst-robust7 tst-robust8 \
+-	tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 \
+-	tst-robustpi5 tst-robustpi6 tst-robustpi7 tst-robustpi8 \
++	tst-robust6 tst-robust7 tst-robust8 tst-robust9 \
++	tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \
++	tst-robustpi6 tst-robustpi7 tst-robustpi8 tst-robustpi9 \
+ 	tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
+ 	tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
+ 	tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
+Index: nptl/pthread_mutex_lock.c
+===================================================================
+RCS file: /cvs/glibc/libc/nptl/pthread_mutex_lock.c,v
+retrieving revision 1.8.2.6
+retrieving revision 1.8.2.7
+diff -u -r1.8.2.6 -r1.8.2.7
+--- nptl/pthread_mutex_lock.c	15 Aug 2006 05:53:48 -0000	1.8.2.6
++++ nptl/pthread_mutex_lock.c	21 May 2007 20:01:11 -0000	1.8.2.7
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
++/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+    This file is part of the GNU C Library.
+    Contributed by Ulrich Drepper <drepper at redhat.com>, 2002.
+ 
+@@ -127,6 +127,8 @@
+ 	      int newval = id;
+ #ifdef NO_INCR
+ 	      newval |= FUTEX_WAITERS;
++#else
++	      newval |= (oldval & FUTEX_WAITERS);
+ #endif
+ 
+ 	      newval
+Index: nptl/pthread_mutex_timedlock.c
+===================================================================
+RCS file: /cvs/glibc/libc/nptl/pthread_mutex_timedlock.c,v
+retrieving revision 1.4.2.6
+retrieving revision 1.4.2.7
+diff -u -r1.4.2.6 -r1.4.2.7
+--- nptl/pthread_mutex_timedlock.c	15 Aug 2006 05:53:48 -0000	1.4.2.6
++++ nptl/pthread_mutex_timedlock.c	21 May 2007 20:01:11 -0000	1.4.2.7
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
++/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+    This file is part of the GNU C Library.
+    Contributed by Ulrich Drepper <drepper at redhat.com>, 2002.
+ 
+@@ -119,9 +119,11 @@
+ 	  if ((oldval & FUTEX_OWNER_DIED) != 0)
+ 	    {
+ 	      /* The previous owner died.  Try locking the mutex.  */
+-	      int newval
++	      int newval = id | (oldval & FUTEX_WAITERS);
++
++	      newval
+ 		= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
+-						       id, oldval);
++						       newval, oldval);
+ 	      if (newval != oldval)
+ 		{
+ 		  oldval = newval;
+Index: nptl/pthread_mutex_trylock.c
+===================================================================
+RCS file: /cvs/glibc/libc/nptl/pthread_mutex_trylock.c,v
+retrieving revision 1.5.2.6
+retrieving revision 1.5.2.7
+diff -u -r1.5.2.6 -r1.5.2.7
+--- nptl/pthread_mutex_trylock.c	4 May 2007 10:05:56 -0000	1.5.2.6
++++ nptl/pthread_mutex_trylock.c	21 May 2007 20:01:11 -0000	1.5.2.7
+@@ -84,9 +84,11 @@
+ 	  if ((oldval & FUTEX_OWNER_DIED) != 0)
+ 	    {
+ 	      /* The previous owner died.  Try locking the mutex.  */
+-	      int newval
++	      int newval = id | (oldval & FUTEX_WAITERS);
++
++	      newval
+ 		= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
+-						       id, oldval);
++						       newval, oldval);
+ 
+ 	      if (newval != oldval)
+ 		{
+Index: nptl/tst-robust9.c
+===================================================================
+RCS file: nptl/tst-robust9.c
+diff -N nptl/tst-robust9.c
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ nptl/tst-robust9.c	21 May 2007 20:01:11 -0000	1.1.2.1
+@@ -0,0 +1,87 @@
++#include <stdio.h>
++#include <stdlib.h>
++#include <errno.h>
++#include <pthread.h>
++#include <unistd.h>
++#include <sys/time.h>
++
++
++static pthread_mutex_t m;
++
++static void *
++tf (void *data)
++{
++  int err = pthread_mutex_lock (&m);
++  if (err == EOWNERDEAD)
++    {
++      err = pthread_mutex_consistent_np (&m);
++      if (err)
++	{
++	  puts ("pthread_mutex_consistent_np");
++	  exit (1);
++	}
++    }
++  else if (err)
++    {
++      puts ("pthread_mutex_lock");
++      exit (1);
++    }
++  printf ("thread%ld got the lock.\n", (long int) data);
++  sleep (1);
++  /* exit without unlock */
++  return NULL;
++}
++
++static int
++do_test (void)
++{
++  int err, i;
++  pthread_t t[3];
++  pthread_mutexattr_t ma;
++
++  pthread_mutexattr_init (&ma);
++  err = pthread_mutexattr_setrobust_np (&ma, PTHREAD_MUTEX_ROBUST_NP);
++  if (err)
++    {
++      puts ("pthread_mutexattr_setrobust_np");
++      return 1;
++    }
++#ifdef ENABLE_PI
++  if (pthread_mutexattr_setprotocol (&ma, PTHREAD_PRIO_INHERIT) != 0)
++    {
++      puts ("pthread_mutexattr_setprotocol failed");
++      return 1;
++    }
++#endif
++  err = pthread_mutex_init (&m, &ma);
++  if (err)
++    {
++      puts ("pthread_mutex_init");
++      return 1;
++    }
++
++  for (i = 0; i < sizeof (t) / sizeof (t[0]); i++)
++    {
++      err = pthread_create (&t[i], NULL, tf, (void *) (long int) i);
++      if (err)
++	{
++	  puts ("pthread_create");
++	  return 1;
++	}
++    }
++
++  for (i = 0; i < sizeof (t) / sizeof (t[0]); i++)
++    {
++      err = pthread_join (t[i], NULL);
++      if (err)
++	{
++	  puts ("pthread_join");
++	  return 1;
++	}
++    }
++  return 0;
++}
++
++#define TIMEOUT 5
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+Index: nptl/tst-robustpi9.c
+===================================================================
+RCS file: nptl/tst-robustpi9.c
+diff -N nptl/tst-robustpi9.c
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ nptl/tst-robustpi9.c	21 May 2007 20:01:11 -0000	1.1.2.1
+@@ -0,0 +1,2 @@
++#define ENABLE_PI 1
++#include "tst-robust9.c"
+Index: rt/tst-shm.c
+===================================================================
+RCS file: /cvs/glibc/libc/rt/tst-shm.c,v
+retrieving revision 1.5
+retrieving revision 1.5.2.1
+diff -u -r1.5 -r1.5.2.1
+--- rt/tst-shm.c	2 Apr 2002 23:51:07 -0000	1.5
++++ rt/tst-shm.c	21 May 2007 20:01:11 -0000	1.5.2.1
+@@ -60,7 +60,7 @@
+ worker (int write_now)
+ {
+   struct timespec ts;
+-  struct stat st;
++  struct stat64 st;
+   int i;
+   int fd = do_open ();
+   char *mem;
+@@ -68,8 +68,10 @@
+   if (fd == -1)
+     exit (fd);
+ 
+-  if (fstat (fd, &st) == -1 || st.st_size != 4000)
++  if (fstat64 (fd, &st) == -1)
+     error (EXIT_FAILURE, 0, "stat failed");
++  if (st.st_size != 4000)
++    error (EXIT_FAILURE, 0, "size incorrect");
+ 
+   mem = mmap (NULL, 4000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+   if (mem == NULL)
+@@ -131,7 +133,7 @@
+   pid_t pid2;
+   int status1;
+   int status2;
+-  struct stat st;
++  struct stat64 st;
+ 
+   /* Create the shared memory object.  */
+   fd = shm_open ("/shm-test", O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
+@@ -155,11 +157,16 @@
+       return 0;
+     }
+ 
+-  if (fstat (fd, &st) == -1 || st.st_size != 4000)
++  if (fstat64 (fd, &st) == -1)
+     {
+       shm_unlink ("/shm-test");
+       error (EXIT_FAILURE, 0, "initial stat failed");
+     }
++  if (st.st_size != 4000)
++    {
++      shm_unlink ("/shm-test");
++      error (EXIT_FAILURE, 0, "initial size not correct");
++    }
+ 
+   /* Spawn to processes which will do the work.  */
+   pid1 = fork ();
+Index: stdio-common/tst-sprintf.c
+===================================================================
+RCS file: /cvs/glibc/libc/stdio-common/tst-sprintf.c,v
+retrieving revision 1.3
+retrieving revision 1.3.2.1
+diff -u -r1.3 -r1.3.2.1
+--- stdio-common/tst-sprintf.c	25 Jun 2003 11:04:49 -0000	1.3
++++ stdio-common/tst-sprintf.c	21 May 2007 20:01:11 -0000	1.3.2.1
+@@ -37,5 +37,26 @@
+       free (dst);
+     }
+ 
++  if (sprintf (buf, "%1$d%3$.*2$s%4$d", 7, 67108863, "x", 8) != 3
++      || strcmp (buf, "7x8") != 0)
++    {
++      printf ("sprintf (buf, \"%%1$d%%3$.*2$s%%4$d\", 7, 67108863, \"x\", 8) produced `%s' output", buf);
++      result = 1;
++    }
++
++  if (sprintf (buf, "%67108863.16\"%d", 7) != 14
++      || strcmp (buf, "%67108863.16\"7") != 0)
++    {
++      printf ("sprintf (buf, \"%%67108863.16\\\"%%d\", 7) produced `%s' output", buf);
++      result = 1;
++    }
++
++  if (sprintf (buf, "%*\"%d", 0x3ffffff, 7) != 11
++      || strcmp (buf, "%67108863\"7") != 0)
++    {
++      printf ("sprintf (buf, \"%%*\\\"%%d\", 0x3ffffff, 7) produced `%s' output", buf);
++      result = 1;
++    }
++
+   return result;
+ }
+Index: stdio-common/vfprintf.c
+===================================================================
+RCS file: /cvs/glibc/libc/stdio-common/vfprintf.c,v
+retrieving revision 1.128.2.8
+retrieving revision 1.128.2.9
+diff -u -r1.128.2.8 -r1.128.2.9
+--- stdio-common/vfprintf.c	10 May 2007 06:44:28 -0000	1.128.2.8
++++ stdio-common/vfprintf.c	21 May 2007 20:01:11 -0000	1.128.2.9
+@@ -1627,6 +1627,8 @@
+     /* Just a counter.  */
+     size_t cnt;
+ 
++    free (workstart);
++    workstart = NULL;
+ 
+     if (grouping == (const char *) -1)
+       {
+@@ -1801,7 +1803,9 @@
+ 	int use_outdigits = specs[nspecs_done].info.i18n;
+ 	char pad = specs[nspecs_done].info.pad;
+ 	CHAR_T spec = specs[nspecs_done].info.spec;
+-	CHAR_T *workstart = NULL;
++
++	workstart = NULL;
++	workend = &work_buffer[sizeof (work_buffer) / sizeof (CHAR_T)];
+ 
+ 	/* Fill in last information.  */
+ 	if (specs[nspecs_done].width_arg != -1)
+@@ -1897,8 +1901,7 @@
+ 	    break;
+ 	  }
+ 
+-	if (__builtin_expect (workstart != NULL, 0))
+-	  free (workstart);
++	free (workstart);
+ 	workstart = NULL;
+ 
+ 	/* Write the following constant string.  */
+@@ -1926,7 +1929,7 @@
+ 
+ {
+   int done = 0;
+-  CHAR_T work_buffer[MAX (info->width, info->spec) + 32];
++  CHAR_T work_buffer[MAX (sizeof (info->width), sizeof (info->prec)) * 3];
+   CHAR_T *const workend
+     = &work_buffer[sizeof (work_buffer) / sizeof (CHAR_T)];
+   register CHAR_T *w;
+Index: sysdeps/unix/sysv/linux/Makefile
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/Makefile,v
+retrieving revision 1.142.2.9
+retrieving revision 1.142.2.10
+diff -u -r1.142.2.9 -r1.142.2.10
+--- sysdeps/unix/sysv/linux/Makefile	15 May 2007 20:34:30 -0000	1.142.2.9
++++ sysdeps/unix/sysv/linux/Makefile	21 May 2007 20:01:11 -0000	1.142.2.10
+@@ -13,7 +13,7 @@
+ 
+ ifeq ($(subdir),misc)
+ sysdep_routines += sysctl clone llseek umount umount2 readahead \
+-		   setfsuid setfsgid makedev
++		   setfsuid setfsgid makedev epoll_pwait
+ 
+ CFLAGS-gethostid.c = -fexceptions
+ 
+Index: sysdeps/unix/sysv/linux/epoll_pwait.c
+===================================================================
+RCS file: sysdeps/unix/sysv/linux/epoll_pwait.c
+diff -N sysdeps/unix/sysv/linux/epoll_pwait.c
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ sysdeps/unix/sysv/linux/epoll_pwait.c	21 May 2007 20:01:11 -0000	1.1.2.1
+@@ -0,0 +1,69 @@
++/* Copyright (C) 2007 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
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++#include <errno.h>
++#include <signal.h>
++#include <unistd.h>
++#include <sys/epoll.h>
++
++#include <sysdep-cancel.h>
++#include <sys/syscall.h>
++
++#ifdef __NR_epoll_pwait
++
++/* Wait for events on an epoll instance "epfd". Returns the number of
++   triggered events returned in "events" buffer. Or -1 in case of
++   error with the "errno" variable set to the specific error code. The
++   "events" parameter is a buffer that will contain triggered
++   events. The "maxevents" is the maximum number of events to be
++   returned ( usually size of "events" ). The "timeout" parameter
++   specifies the maximum wait time in milliseconds (-1 == infinite).
++   The thread's signal mask is temporarily and atomically replaced with
++   the one provided as parameter.  */
++
++int epoll_pwait (int epfd, struct epoll_event *events,
++		 int maxevents, int timeout,
++		 const sigset_t *set)
++{
++  if (SINGLE_THREAD_P)
++    return INLINE_SYSCALL (epoll_pwait, 6, epfd, events, maxevents, timeout,
++			   set, _NSIG / 8);
++
++  int oldtype = LIBC_CANCEL_ASYNC ();
++
++  int result = INLINE_SYSCALL (epoll_pwait, 6, epfd, events, maxevents,
++			       timeout, set, _NSIG / 8);
++
++  LIBC_CANCEL_RESET (oldtype);
++
++  return result;
++}
++
++#else
++
++int epoll_pwait (int epfd, struct epoll_event *events,
++		 int maxevents, int timeout,
++		 const sigset_t *set)
++{
++  __set_errno (ENOSYS);
++  return -1;
++}
++stub_warning (epoll_pwait)
++
++# include <stub-tag.h>
++#endif
+Index: sysdeps/unix/sysv/linux/syscalls.list
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/syscalls.list,v
+retrieving revision 1.114.2.14
+retrieving revision 1.114.2.15
+diff -u -r1.114.2.14 -r1.114.2.15
+--- sysdeps/unix/sysv/linux/syscalls.list	10 May 2007 06:44:29 -0000	1.114.2.14
++++ sysdeps/unix/sysv/linux/syscalls.list	21 May 2007 20:01:11 -0000	1.114.2.15
+@@ -10,7 +10,6 @@
+ epoll_create	EXTRA	epoll_create	i:i	epoll_create
+ epoll_ctl	EXTRA	epoll_ctl	i:iiip	epoll_ctl
+ epoll_wait	EXTRA	epoll_wait	Ci:ipii	epoll_wait
+-epoll_pwait	EXTRA	epoll_pwait	Ci:ipiipi	epoll_pwait
+ fdatasync	-	fdatasync	Ci:i	fdatasync
+ flock		-	flock		i:ii	__flock		flock
+ fork		-	fork		i:	__libc_fork	__fork fork
+Index: sysdeps/unix/sysv/linux/i386/epoll_pwait.S
+===================================================================
+RCS file: sysdeps/unix/sysv/linux/i386/epoll_pwait.S
+diff -N sysdeps/unix/sysv/linux/i386/epoll_pwait.S
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ sysdeps/unix/sysv/linux/i386/epoll_pwait.S	21 May 2007 20:01:11 -0000	1.2.2.1
+@@ -0,0 +1,80 @@
++/* Copyright (C) 2007 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
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library 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
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++#include <sysdep.h>
++#define _ERRNO_H
++#include <bits/errno.h>
++#define _SIGNAL_H
++#include <bits/signum.h>
++
++
++	.text
++ENTRY (epoll_pwait)
++
++#ifdef __NR_epoll_pwait
++
++	/* Save registers.  */
++	pushl %ebp
++	cfi_adjust_cfa_offset (4)
++	pushl %ebx
++	cfi_adjust_cfa_offset (4)
++	pushl %esi
++	cfi_adjust_cfa_offset (4)
++	pushl %edi
++	cfi_adjust_cfa_offset (4)
++	cfi_rel_offset (edi, 0)
++	cfi_rel_offset (esi, 4)
++	cfi_rel_offset (ebx, 8)
++	cfi_rel_offset (ebp, 12)
++
++	movl 20(%esp), %ebx
++	movl 24(%esp), %ecx
++	movl 28(%esp), %edx
++	movl 32(%esp), %esi
++	movl 36(%esp), %edi
++	movl $_NSIG/8, %ebp
++	movl $__NR_epoll_pwait, %eax
++
++	ENTER_KERNEL
++
++	/* Restore registers.  */
++	popl %edi
++	cfi_adjust_cfa_offset (-4)
++	cfi_restore (edi)
++	popl %esi
++	cfi_adjust_cfa_offset (-4)
++	cfi_restore (esi)
++	popl %ebx
++	cfi_adjust_cfa_offset (-4)
++	cfi_restore (ebx)
++	popl %ebp
++	cfi_adjust_cfa_offset (-4)
++	cfi_restore (ebp)
++
++	/* If 0 > %eax > -4096 there was an error.  */
++	cmpl $-4096, %eax
++	ja SYSCALL_ERROR_LABEL
++
++	/* Successful; return the syscall's value.  */
++#else
++	movl $-ENOSYS, %eax
++	jmp SYSCALL_ERROR_LABEL
++#endif
++L(pseudo_end):
++	ret
++PSEUDO_END (epoll_pwait)
+Index: sysdeps/unix/sysv/linux/i386/sync_file_range.S
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/i386/sync_file_range.S,v
+retrieving revision 1.1.2.1
+retrieving revision 1.1.2.2
+diff -u -r1.1.2.1 -r1.1.2.2
+--- sysdeps/unix/sysv/linux/i386/sync_file_range.S	24 Apr 2006 08:55:45 -0000	1.1.2.1
++++ sysdeps/unix/sysv/linux/i386/sync_file_range.S	21 May 2007 20:01:11 -0000	1.1.2.2
+@@ -1,5 +1,5 @@
+ /* Selective file content synch'ing.
+-   Copyright (C) 2006 Free Software Foundation, Inc.
++   Copyright (C) 2006, 2007 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
+@@ -63,10 +63,10 @@
+ 
+ 	cmpl	$-4095, %eax
+ 	jae	SYSCALL_ERROR_LABEL
+-L(pseudo_end):
+-	ret
+ #else
+ 	movl	$-ENOSYS, %eax
+ 	jmp	SYSCALL_ERROR_LABEL
+ #endif
++L(pseudo_end):
++	ret
+ PSEUDO_END (sync_file_range)
+Index: sysdeps/unix/sysv/linux/x86_64/sys/epoll.h
+===================================================================
+RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/x86_64/sys/epoll.h,v
+retrieving revision 1.2.2.1
+retrieving revision 1.2.2.2
+diff -u -r1.2.2.1 -r1.2.2.2
+--- sysdeps/unix/sysv/linux/x86_64/sys/epoll.h	1 Mar 2006 06:55:57 -0000	1.2.2.1
++++ sysdeps/unix/sysv/linux/x86_64/sys/epoll.h	21 May 2007 20:01:11 -0000	1.2.2.2
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
++/* Copyright (C) 2002,2003,2004,2005,2006,2007 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
+@@ -22,6 +22,14 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+ 
++/* Get __sigset_t.  */
++#include <bits/sigset.h>
++
++#ifndef __sigset_t_defined
++# define __sigset_t_defined
++typedef __sigset_t sigset_t;
++#endif
++
+ 
+ enum EPOLL_EVENTS
+   {
+@@ -105,6 +113,16 @@
+ extern int epoll_wait (int __epfd, struct epoll_event *__events,
+ 		       int __maxevents, int __timeout);
+ 
++
++/* Same as epoll_wait, but the thread's signal mask is temporarily
++   and atomically replaced with the one provided as parameter.
++
++   This function is a cancellation point and therefore not marked with
++   __THROW.  */
++extern int epoll_pwait (int __epfd, struct epoll_event *__events,
++			int __maxevents, int __timeout,
++			__const __sigset_t *__ss);
++
+ __END_DECLS
+ 
+ #endif /* sys/epoll.h */
+Index: sysdeps/x86_64/fpu/k_cosl.c
+===================================================================
+RCS file: sysdeps/x86_64/fpu/k_cosl.c
+diff -N sysdeps/x86_64/fpu/k_cosl.c
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ sysdeps/x86_64/fpu/k_cosl.c	21 May 2007 20:01:15 -0000	1.1.2.1
+@@ -0,0 +1 @@
++/*  Not needed.  */
+Index: sysdeps/x86_64/fpu/k_rem_pio2l.c
+===================================================================
+RCS file: sysdeps/x86_64/fpu/k_rem_pio2l.c
+diff -N sysdeps/x86_64/fpu/k_rem_pio2l.c
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ sysdeps/x86_64/fpu/k_rem_pio2l.c	21 May 2007 20:01:15 -0000	1.1.2.1
+@@ -0,0 +1 @@
++/*  Not needed.  */
+Index: sysdeps/x86_64/fpu/k_sinl.c
+===================================================================
+RCS file: sysdeps/x86_64/fpu/k_sinl.c
+diff -N sysdeps/x86_64/fpu/k_sinl.c
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ sysdeps/x86_64/fpu/k_sinl.c	21 May 2007 20:01:15 -0000	1.1.2.1
+@@ -0,0 +1 @@
++/*  Not needed.  */
+Index: sysdeps/x86_64/fpu/k_tanl.c
+===================================================================
+RCS file: sysdeps/x86_64/fpu/k_tanl.c
+diff -N sysdeps/x86_64/fpu/k_tanl.c
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ sysdeps/x86_64/fpu/k_tanl.c	21 May 2007 20:01:15 -0000	1.1.2.1
+@@ -0,0 +1 @@
++/*  Not needed.  */




More information about the arch-commits mailing list