rpms/dietlibc/F-9 dietlibc-0.28-setpriority.patch, 1.1, 1.2 dietlibc-0.29-scall.patch, 1.1, 1.2 dietlibc-0.30-longdouble.patch, 1.1, 1.2 dietlibc-0.31-defpath.patch, 1.1, 1.2 dietlibc-0.31-implicitfunc.patch, 1.3, 1.4 dietlibc-0.31-lcctime.patch, 1.1, 1.2 dietlibc-0.31-noreturn.patch, 1.1, 1.2 dietlibc-0.31-pagesize.patch, 1.8, 1.9 dietlibc-0.31-printFG.patch, 1.5, 1.6 dietlibc-0.31-stacksmash-dyn.patch, 1.1, 1.2 dietlibc-0.31-stacksmash.patch, 1.1, 1.2 dietlibc-0.31-testsuite.patch, 1.4, 1.5 dietlibc-0.31.20080212-teststdout.patch, 1.1, 1.2 dietlibc-0.31-stat64.patch, 1.1, NONE

Enrico Scholz (ensc) fedora-extras-commits at redhat.com
Sat Jun 21 11:37:32 UTC 2008


Author: ensc

Update of /cvs/extras/rpms/dietlibc/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv5705

Modified Files:
	dietlibc-0.28-setpriority.patch dietlibc-0.29-scall.patch 
	dietlibc-0.30-longdouble.patch dietlibc-0.31-defpath.patch 
	dietlibc-0.31-implicitfunc.patch dietlibc-0.31-lcctime.patch 
	dietlibc-0.31-noreturn.patch dietlibc-0.31-pagesize.patch 
	dietlibc-0.31-printFG.patch dietlibc-0.31-stacksmash-dyn.patch 
	dietlibc-0.31-stacksmash.patch dietlibc-0.31-testsuite.patch 
	dietlibc-0.31.20080212-teststdout.patch 
Removed Files:
	dietlibc-0.31-stat64.patch 
Log Message:
use patches from git repository; rediffed against 20080517


dietlibc-0.28-setpriority.patch:

Index: dietlibc-0.28-setpriority.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.28-setpriority.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dietlibc-0.28-setpriority.patch	4 Mar 2005 21:44:44 -0000	1.1
+++ dietlibc-0.28-setpriority.patch	21 Jun 2008 11:36:34 -0000	1.2
@@ -1,5 +1,17 @@
---- dietlibc-0.28-unpatched/lib/__nice.c	2005-02-13 18:01:18.966469056 -0500
-+++ dietlibc-0.28/lib/__nice.c	2005-02-13 18:17:04.381744088 -0500
+From ab91f175a8c77f275c9fa917dfe7cbc9b6262e1c Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:49:05 +0200
+Subject: [PATCH] Return new nice value for nice(2)
+
+Changed nice(2) to return the new nice value instead of 0/-1.
+---
+ lib/__nice.c |    8 ++++++--
+ 1 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/lib/__nice.c b/lib/__nice.c
+index d751104..8e205c0 100644
+--- a/lib/__nice.c
++++ b/lib/__nice.c
 @@ -1,9 +1,13 @@
  #include "syscalls.h"
 -#include <sys/time.h>
@@ -16,3 +28,6 @@
 +  return getpriority(PRIO_PROCESS,0);
  }
  #endif
+-- 
+1.5.4.5
+

dietlibc-0.29-scall.patch:

Index: dietlibc-0.29-scall.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.29-scall.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dietlibc-0.29-scall.patch	24 May 2005 11:20:05 -0000	1.1
+++ dietlibc-0.29-scall.patch	21 Jun 2008 11:36:34 -0000	1.2
@@ -1,12 +1,20 @@
-2005-04-24  Enrico Scholz  <enrico.scholz at informatik.tu-chemnitz.de>
-	* libcompat/syscall.S: catch the case when syscall(2) is not
-	  implemented for the actual arch instead of jumping to the next
-	  function and executing the wrong code
+From 406e0419735c9e9c00290d437e9f42f88c3ae6d2 Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:50:24 +0200
+Subject: [PATCH] Sanity checks for syscall availability
 
---- dietlibc-0.29/libcompat/syscall.S.scall
-+++ dietlibc-0.29/libcompat/syscall.S
-@@ -120,6 +120,12 @@
- 	nop
+Catch the case when syscall(2) is not implemented for the actual arch
+instead of jumping to the next function and executing the wrong code
+---
+ libcompat/syscall.S |    8 +++++++-
+ 1 files changed, 7 insertions(+), 1 deletions(-)
+
+diff --git a/libcompat/syscall.S b/libcompat/syscall.S
+index c9f72bb..6b6a8aa 100644
+--- a/libcompat/syscall.S
++++ b/libcompat/syscall.S
+@@ -130,6 +130,12 @@ syscall:
+ 	b    __unified_syscall
  
  #else
 -		/* arch not implemented yet */
@@ -19,3 +27,6 @@
 +#endif
  #endif
  .size	syscall, . - syscall
+-- 
+1.5.4.5
+

dietlibc-0.30-longdouble.patch:

Index: dietlibc-0.30-longdouble.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.30-longdouble.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dietlibc-0.30-longdouble.patch	17 Jan 2007 00:45:12 -0000	1.1
+++ dietlibc-0.30-longdouble.patch	21 Jun 2008 11:36:34 -0000	1.2
@@ -1,6 +1,19 @@
---- dietlibc-0.30/libm/gamma.c~	2005-03-15 08:51:23.000000000 +0000
-+++ dietlibc-0.30/libm/gamma.c	2006-12-28 14:36:58.000000000 +0000
-@@ -33,19 +33,19 @@ Return value    gamma returns a value in
+From ba4e9f8557b25e4fbb6886e7c54a2ca75ca57368 Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:54:03 +0200
+Subject: [PATCH] Workaround PPC build issues
+
+Fixes https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182118 and
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27054
+---
+ libm/gamma.c |   26 +++++++++++++-------------
+ 1 files changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/libm/gamma.c b/libm/gamma.c
+index 9682f35..370bec6 100644
+--- a/libm/gamma.c
++++ b/libm/gamma.c
+@@ -33,19 +33,19 @@ Return value    gamma returns a value in range (-0.1208, +oo). For a input
  #include <stdlib.h>
  #include <math.h>
  
@@ -33,3 +46,6 @@
  
  static const double  coeff[] = { B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 };
  int                  signgam;
+-- 
+1.5.4.5
+

dietlibc-0.31-defpath.patch:

Index: dietlibc-0.31-defpath.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.31-defpath.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dietlibc-0.31-defpath.patch	1 Sep 2007 12:34:41 -0000	1.1
+++ dietlibc-0.31-defpath.patch	21 Jun 2008 11:36:34 -0000	1.2
@@ -1,6 +1,17 @@
-diff -up dietlibc-0.31/include/paths.h.~1~ dietlibc-0.31/include/paths.h
---- dietlibc-0.31/include/paths.h.defpath
-+++ dietlibc-0.31/include/paths.h
+From 66528a176d332bb8de4ddf324754089e59139424 Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 18:00:19 +0200
+Subject: [PATCH] Security fix for proper $PATH
+
+Removed '.' from the default $PATH.
+---
+ include/paths.h |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/include/paths.h b/include/paths.h
+index 553b4fa..9bf216f 100644
+--- a/include/paths.h
++++ b/include/paths.h
 @@ -2,7 +2,7 @@
  #define _PATHS_H
  
@@ -10,3 +21,6 @@
  
  #define _PATH_DEVNULL "/dev/null"
  
+-- 
+1.5.4.5
+

dietlibc-0.31-implicitfunc.patch:

Index: dietlibc-0.31-implicitfunc.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.31-implicitfunc.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dietlibc-0.31-implicitfunc.patch	18 May 2008 09:56:48 -0000	1.3
+++ dietlibc-0.31-implicitfunc.patch	21 Jun 2008 11:36:34 -0000	1.4
@@ -1,19 +1,41 @@
-diff -up dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc dietlibc-0.31.20080409/lib/signalfd.c
---- dietlibc-0.31.20080409/lib/signalfd.c.implicitfunc	2008-02-19 01:28:13.000000000 +0100
-+++ dietlibc-0.31.20080409/lib/signalfd.c	2008-04-13 22:52:10.000000000 +0200
-@@ -1,6 +1,9 @@
- #include <signal.h>
- #include <errno.h>
-+#include <sys/signalfd.h>
+From 5c0e868e1a9266d580c95411c3b2f0272dfa14ab Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:43:08 +0200
+Subject: [PATCH] Fixes for -Werror-no-implicit-functions
+
+Some fixes for issues preventing builds with
+'-Werror-implicit-function-declaration'.
+---
+ test/getservbyname.c     |    1 +
+ test/stdlib/testsort.c   |    2 ++
+ test/stdlib/tst-calloc.c |    2 ++
+ 3 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/test/getservbyname.c b/test/getservbyname.c
+index b70ca19..caf1c9f 100644
+--- a/test/getservbyname.c
++++ b/test/getservbyname.c
+@@ -1,5 +1,6 @@
+ #include <stdio.h>
+ #include <netdb.h>
++#include <arpa/inet.h>
  
-+extern int __signalfd(int fd, const sigset_t *mask, size_t flags);
+ int main(int argc,char *argv[]) {
+   struct servent* se;
+diff --git a/test/stdlib/testsort.c b/test/stdlib/testsort.c
+index aa4332a..5a92bc0 100644
+--- a/test/stdlib/testsort.c
++++ b/test/stdlib/testsort.c
+@@ -1,3 +1,5 @@
++#define _BSD_SOURCE
 +
- int signalfd(int fd,const sigset_t* mask,int flags) {
-   if (flags) {	/* bizarre glibc bullshit */
-     errno=EINVAL;
-diff -up dietlibc-0.31.20080409/test/stdlib/tst-calloc.c.implicitfunc dietlibc-0.31.20080409/test/stdlib/tst-calloc.c
---- dietlibc-0.31.20080409/test/stdlib/tst-calloc.c.implicitfunc	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/stdlib/tst-calloc.c	2008-04-13 22:52:10.000000000 +0200
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+diff --git a/test/stdlib/tst-calloc.c b/test/stdlib/tst-calloc.c
+index a9b9e2a..049117b 100644
+--- a/test/stdlib/tst-calloc.c
++++ b/test/stdlib/tst-calloc.c
 @@ -17,6 +17,8 @@
     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     02111-1307 USA.  */
@@ -23,22 +45,6 @@
  #include <errno.h>
  #include <limits.h>
  #include <malloc.h>
-diff -up dietlibc-0.31.20080409/test/stdlib/testsort.c.implicitfunc dietlibc-0.31.20080409/test/stdlib/testsort.c
---- dietlibc-0.31.20080409/test/stdlib/testsort.c.implicitfunc	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/stdlib/testsort.c	2008-04-13 22:52:10.000000000 +0200
-@@ -1,3 +1,5 @@
-+#define _BSD_SOURCE
-+
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
-diff -up dietlibc-0.31.20080409/test/getservbyname.c.implicitfunc dietlibc-0.31.20080409/test/getservbyname.c
---- dietlibc-0.31.20080409/test/getservbyname.c.implicitfunc	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/getservbyname.c	2008-04-13 22:53:38.000000000 +0200
-@@ -1,5 +1,6 @@
- #include <stdio.h>
- #include <netdb.h>
-+#include <arpa/inet.h>
- 
- int main(int argc,char *argv[]) {
-   struct servent* se;
+-- 
+1.5.4.5
+

dietlibc-0.31-lcctime.patch:

Index: dietlibc-0.31-lcctime.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.31-lcctime.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dietlibc-0.31-lcctime.patch	13 Apr 2008 13:45:58 -0000	1.1
+++ dietlibc-0.31-lcctime.patch	21 Jun 2008 11:36:34 -0000	1.2
@@ -1,6 +1,20 @@
-diff -up dietlibc-0.31.20080409/libugly/strftime.c.lcctime dietlibc-0.31.20080409/libugly/strftime.c
---- dietlibc-0.31.20080409/libugly/strftime.c.lcctime	2006-08-15 18:07:15.000000000 +0200
-+++ dietlibc-0.31.20080409/libugly/strftime.c	2008-04-13 13:20:41.000000000 +0200
+From aac35698d1b84f6370d37860c9e889c34cd6a21c Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:42:20 +0200
+Subject: [PATCH] Fixes/enhancements in str?time() functions
+
+This patch changes the used format for %x and %X specifiers in
+strptime(3) to match these specified by SUSv2.  It adds support
+for '%F' in strftime(3) too.
+---
+ libugly/strftime.c |    1 +
+ libugly/strptime.c |    5 +++--
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/libugly/strftime.c b/libugly/strftime.c
+index 56ae082..cf16f37 100644
+--- a/libugly/strftime.c
++++ b/libugly/strftime.c
 @@ -55,6 +55,7 @@ again:
  	    case 'x': src = "%b %a %d";   			 goto _strf;
  	    case 'X': src = "%k:%M:%S";   			 goto _strf;
@@ -9,10 +23,11 @@
  	    case 'T': src = "%H:%M:%S";
  	       _strf: p  += strftime (p, (size_t)(dst+max-p), src, tm); 	 break;
  	    case 'a': src = sweekdays [tm->tm_wday]; 		 goto _str;
-diff -up dietlibc-0.31.20080409/libugly/strptime.c.lcctime dietlibc-0.31.20080409/libugly/strptime.c
---- dietlibc-0.31.20080409/libugly/strptime.c.lcctime	2007-08-03 22:58:33.000000000 +0200
-+++ dietlibc-0.31.20080409/libugly/strptime.c	2008-04-13 13:13:12.000000000 +0200
-@@ -119,10 +119,11 @@ char* strptime(const char* s,const char*
+diff --git a/libugly/strptime.c b/libugly/strptime.c
+index 6ac5340..32dc2a7 100644
+--- a/libugly/strptime.c
++++ b/libugly/strptime.c
+@@ -119,10 +119,11 @@ char* strptime(const char* s,const char* format, struct tm* tm) {
  	++s;
  	break;
        case 'x':
@@ -26,3 +41,6 @@
  	break;
        case 'y':
  	i=getint(&s,2);
+-- 
+1.5.4.5
+

dietlibc-0.31-noreturn.patch:

Index: dietlibc-0.31-noreturn.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.31-noreturn.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dietlibc-0.31-noreturn.patch	13 Apr 2008 21:20:45 -0000	1.1
+++ dietlibc-0.31-noreturn.patch	21 Jun 2008 11:36:34 -0000	1.2
@@ -1,6 +1,22 @@
-diff -up dietlibc-0.31.20080409/include/stdlib.h.noreturn dietlibc-0.31.20080409/include/stdlib.h
---- dietlibc-0.31.20080409/include/stdlib.h.noreturn	2008-04-13 22:56:59.000000000 +0200
-+++ dietlibc-0.31.20080409/include/stdlib.h	2008-04-13 22:57:54.000000000 +0200
+From e96b03324e5395ff3c0041c249bfed9aa1bdb8b5 Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:43:42 +0200
+Subject: [PATCH] __noreturn__ annotation for abort(3)
+
+SUSv2 says about abort(3):
+
+  The abort() function shall not return.
+
+Hence, an '__attribute__((__noreturn__))' should be added to the
+abort(3) declaration.
+---
+ include/stdlib.h |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/include/stdlib.h b/include/stdlib.h
+index 34f3a7f..0cea604 100644
+--- a/include/stdlib.h
++++ b/include/stdlib.h
 @@ -47,7 +47,7 @@ double atof(const char *nptr) __THROW;
  __extension__ long long int atoll(const char *nptr);
  
@@ -10,3 +26,6 @@
  
  extern int rand(void) __THROW;
  extern int rand_r(unsigned int *seed) __THROW;
+-- 
+1.5.4.5
+

dietlibc-0.31-pagesize.patch:

Index: dietlibc-0.31-pagesize.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.31-pagesize.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- dietlibc-0.31-pagesize.patch	19 Apr 2008 17:14:18 -0000	1.8
+++ dietlibc-0.31-pagesize.patch	21 Jun 2008 11:36:34 -0000	1.9
@@ -1,152 +1,208 @@
---- dietlibc-0.31.20080409/lib/mmap64.c.pagesize
-+++ dietlibc-0.31.20080409/lib/mmap64.c
-@@ -4,16 +4,18 @@
- #include <syscalls.h>
- #include <errno.h>
- 
-+#include "../dietpagesize.h"
-+
- #ifdef __NR_mmap2
- void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t pgoffset);
- 
- void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset);
- void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) {
--  if (offset&(PAGE_SIZE-1)) {
-+  if (offset&(__DIET_PAGE_SIZE)) {
-     errno=-EINVAL;
-     return MAP_FAILED;
-   }
--  return __mmap2(addr,len,prot,flags,fd,offset>>PAGE_SHIFT);
-+  return __mmap2(addr,len,prot,flags,fd,offset>>__DIET_PAGE_SHIFT);
- }
+From bbeb245bbb5bc919f8f4d2049ba463ed349ef759 Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:35:14 +0200
+Subject: [PATCH] Support for dynamic PAGE_SIZE
+
+This patch adds support for dynamic PAGE_SIZE values. It
+is a little bit invasive in several aspects:
+
+* it modifies the startup code. We need to know the position of
+  the elf-info auxilary table which is located after 'environ'.
+  We can not use 'environ' directly because it might be modified
+  by the application.
+
+  Hence, an additional __elfinfo variable is placed into .bss and
+  filled in the startup code. Depending on platform, this adds
+  4-8 instructions and an additional pointer to .bss.
+
+  I tested only the i386 and x86_64 modifications; it would be
+  nice when people with corresponding hardware would test the
+  other ones. I am especially uncertain regarding the parisc
+  changes.
+
+  The elf-info stuff (which might be interesting e.g. for dynamic
+  linking or sysconf(_SC_CLK_TCK)) can be enabled without the
+  dynamic pagesize too.
+
+* it removes the 'PAGE_SIZE' macro from <sys/shm.h>; this will
+  break compilation of existing userspace application which are
+  using this deprecated macro
+
+* I added a new internal 'dietpagesize.h' header which defines
+
+  | __DIET_PAGE_SIZE
+  | __DIET_PAGE_SHIFT
+
+  macros. These return either builtin constants (when
+  WANT_DYN_PAGESIZE is not selected), or values derived from
+  __libc_getpagesize().
+
+  Every usage of PAGE_SIZE in dietlibc code was replaced by these
+  macros.
+
+* due to the previous point, the internal 'struct __dirstream'
+  was modified. I replaced
+
+  | getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1);
+
+  with
+
+  | getdents64(d->fd,(struct dirent64*)d->buf,  __DIRSTREAM_BUF_SIZE-1);
+
+  literally but I am not sure where the '-1' is coming from.
+  There is one hunk, where this '-1' is missing so I think the
+  '-1' should be removed from all calls to getdents64().
+
+* changes affect the *alloc() functions too; on x86_64 around 64
+  bytes were added to .text of alloc.o
+
+* the new testprogramm requires a 'getconf' binary which returns
+  the correct values for PAGE_SIZE and CLK_TCK
+
+Patch seems to work fine on i386, x86_64, ppc and ppc64.  Things
+went a little bit complicated with linux 2.6.25; previous kernels
+exported a elf_addr_t type in <linux/elf.h> which is used in the
+auxilary elf-info table. Now, this is not available anymore and I
+use a type derived from __WORD_SIZE.
+---
+ alpha/start.S                  |    9 ++++
+ arm/start.S                    |   12 ++++--
+ dietdirent.h                   |    6 ++-
+ dietelfinfo.h                  |   20 ++++++++++
+ dietfeatures.h                 |   14 +++++++
+ dietpagesize.h                 |   31 +++++++++++++++
+ dynlinker/ldso_start.S         |    9 ++++
+ i386/start.S                   |    7 +++
+ ia64/start.S                   |   10 +++++
+ include/sys/shm.h              |    9 ----
+ lib/alloc.c                    |    9 ++--
+ lib/closedir.c                 |    4 +-
+ lib/mmap64.c                   |    6 ++-
+ lib/opendir.c                  |    4 +-
+ lib/readdir.c                  |    2 +-
+ lib/readdir64.c                |    6 +-
+ libcruft/__get_elf_aux_value.c |   14 +++++++
+ libcruft/getpagesize.c         |   20 +++++++---
+ libcruft/sysconf.c             |   17 ++++++--
+ mips/start.S                   |    9 ++++
+ parisc/start.S                 |   10 +++++
+ ppc/start.S                    |    9 ++++
+ ppc64/start.S                  |    9 ++++
+ s390/start.S                   |   11 +++++
+ s390x/start.S                  |   11 +++++
+ sparc/shmat.c                  |    8 +--
+ sparc/start.S                  |   11 +++++
+ sparc64/start.S                |   11 +++++
+ syscalls.s/environ.S           |   20 ++++++++++
+ test/Makefile                  |    2 +-
+ test/runtests.sh               |    2 +-
+ test/sysconf.c                 |   80 ++++++++++++++++++++++++++++++++++++++++
+ x86_64/start.S                 |   16 ++++++++
+ 33 files changed, 374 insertions(+), 44 deletions(-)
+ create mode 100644 dietelfinfo.h
+ create mode 100644 dietpagesize.h
+ create mode 100644 libcruft/__get_elf_aux_value.c
+ create mode 100644 test/sysconf.c
+
+diff --git a/alpha/start.S b/alpha/start.S
+index 7e7cf9b..e5e64a1 100644
+--- a/alpha/start.S
++++ b/alpha/start.S
+@@ -24,6 +24,15 @@ _start:
  
- void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset)
---- dietlibc-0.31.20080409/lib/readdir64.c.pagesize
-+++ dietlibc-0.31.20080409/lib/readdir64.c
-@@ -14,7 +14,7 @@
- #ifndef WANT_LARGEFILE_BACKCOMPAT
- struct dirent64* readdir64(DIR *d) {
-   if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) {
--    int res=getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1);
-+    int res=getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1);
-     if (res<=0) return 0;
-     d->num=res; d->cur=0;
-   }
-@@ -32,7 +32,7 @@ again:
-   if (!trygetdents64) {
- #endif
-     if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) {
--      int res=getdents(d->fd,(struct dirent*)d->buf, sizeof (d->buf)-1);
-+      int res=getdents(d->fd,(struct dirent*)d->buf, __DIRSTREAM_BUF_SIZE-1);
-       if (res<=0) return 0;
-       d->num=res; d->cur=0;
-     }
-@@ -46,7 +46,7 @@ again:
- #ifdef __NR_getdents64
-   }
-   if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) {
--    int res=getdents64(d->fd,(struct dirent64*)d->buf,sizeof (d->buf));
-+    int res=getdents64(d->fd,(struct dirent64*)d->buf,__DIRSTREAM_BUF_SIZE);
-     if (res<=0) {
-       if (errno==ENOSYS) {
- 	trygetdents64=0;
---- dietlibc-0.31.20080409/lib/opendir.c.pagesize
-+++ dietlibc-0.31.20080409/lib/opendir.c
-@@ -5,6 +5,8 @@
- #include <stdlib.h>
- #include <fcntl.h>
+ 	stq	$18, environ
  
-+#include "../dietpagesize.h"
++#ifdef WANT_ELFINFO
++#  error "MAKE ME alpha ASSEMBLER!"
++1:	ldq	$19, $18	; load *envp into $19
++	addq	$18,  1,  $18	; increment *envp
++	orr	$19, $19, $19
++	jne	1b
++	stq	$18, __elfinfo
++#endif
 +
- DIR*  opendir ( const char* name ) {
-   int   fd = open (name, O_RDONLY | O_DIRECTORY);
-   DIR*  t  = NULL;
-@@ -12,7 +14,7 @@ DIR*  opendir ( const char* name ) {
-   if ( fd >= 0 ) {
-     if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
-       goto lose;
--    t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, 
-+    t = (DIR *) mmap (NULL, __DIET_PAGE_SIZE, PROT_READ | PROT_WRITE, 
- 		MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-     if (t == MAP_FAILED)
- lose:
---- dietlibc-0.31.20080409/lib/readdir.c.pagesize
-+++ dietlibc-0.31.20080409/lib/readdir.c
-@@ -5,7 +5,7 @@
- 
- struct dirent* readdir(DIR *d) {
-   if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) {
--    int res=getdents(d->fd,(struct dirent*)d->buf,sizeof (d->buf)-1);
-+    int res=getdents(d->fd,(struct dirent*)d->buf,__DIRSTREAM_BUF_SIZE-1);
-     if (res<=0) return 0;
-     d->num=res; d->cur=0;
-   }
---- dietlibc-0.31.20080409/lib/closedir.c.pagesize
-+++ dietlibc-0.31.20080409/lib/closedir.c
-@@ -4,8 +4,10 @@
- #include <dirent.h>
- #include <stdlib.h>
+ #ifdef WANT_DYNAMIC
+ /* in v0 ($0) is the ld.so _fini pointer */
+ 	mov	 $0, $19	/* mov v0(dynload) to a3 */
+diff --git a/arm/start.S b/arm/start.S
+index fcd3d7c..e7e3be7 100644
+--- a/arm/start.S
++++ b/arm/start.S
+@@ -23,11 +23,18 @@ _start:
+ #ifdef __DYN_LIB
+ 	ldr	sl, .L4
+ 1:	add	sl, pc, sl
+-	str	a3, [sl, ip]		@ environ = envp
++	str	a3, [ip, sl]!		@ environ = envp; ip = GOT(environ)
+ #else
+ 	str	a3, [ip, #0]		@ environ = envp
+ #endif
  
-+#include "../dietpagesize.h"
++#ifdef WANT_ELFINFO
++1:	ldr	r5, [a3], #4		@ load *envp and increment it
++	orr	r5, r5, r5		@ read value==0?
++	bne	1b
++	str	a3, [ip, #4]		@ __elfinfo = envp
++#endif
 +
- int closedir (DIR* d) {
-   int res=close(d->fd);
--  munmap (d, PAGE_SIZE);
-+  munmap (d, __DIET_PAGE_SIZE);
-   return res;
- }
---- dietlibc-0.31.20080409/lib/alloc.c.pagesize
-+++ dietlibc-0.31.20080409/lib/alloc.c
-@@ -18,8 +18,7 @@
- #include <stdlib.h>
- #include <string.h>
- 
--#include <sys/shm.h>	/* for PAGE_SIZE */
+ #ifdef PROFILING
+ 	stmdb	sp!, { r0 - r3 }
+ 	ldr	r0, .L5
+@@ -70,6 +77,3 @@ _exit:
+ .L5:	.word	.text
+ .L6:	.word	_etext
+ #endif
 -
-+#include "../dietpagesize.h"
- 
- /* -- HELPER CODE --------------------------------------------------------- */
- 
-@@ -39,7 +38,7 @@ typedef struct {
- #define BLOCK_START(b)	(((void*)(b))-sizeof(__alloc_t))
- #define BLOCK_RET(b)	(((void*)(b))+sizeof(__alloc_t))
- 
--#define MEM_BLOCK_SIZE	PAGE_SIZE
-+#define MEM_BLOCK_SIZE	__DIET_PAGE_SIZE
- #define PAGE_ALIGN(s)	(((s)+MEM_BLOCK_SIZE-1)&(unsigned long)(~(MEM_BLOCK_SIZE-1)))
- 
- /* a simple mmap :) */
-@@ -66,7 +65,9 @@ static __alloc_t* __small_mem[8];
- 
- #define FIRST_SMALL(p)		(((unsigned long)(p))&(~(MEM_BLOCK_SIZE-1)))
- 
--static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; }
-+static inline int __ind_shift() {
-+	return __DIET_PAGE_SHIFT - sizeof(__small_mem)/sizeof(__small_mem[0]);
-+}
- 
- static size_t REGPARM(1) get_index(size_t _size) {
-   register size_t idx=0;
---- dietlibc-0.31.20080409/ppc/start.S.pagesize
-+++ dietlibc-0.31.20080409/ppc/start.S
-@@ -31,6 +31,15 @@ _start:
- 	lis	14,environ at ha
- 	stw	5,environ at l(14)
+-
+-
+diff --git a/dietdirent.h b/dietdirent.h
+index dbd7206..c9c7127 100644
+--- a/dietdirent.h
++++ b/dietdirent.h
+@@ -1,8 +1,12 @@
+ #include <sys/shm.h>
  
++#include "dietpagesize.h"
++
+ struct __dirstream {
+   int fd;
+-  char buf[PAGE_SIZE-(sizeof (int)*3)];
+   unsigned int num;
+   unsigned int cur;
++  char buf[];
+ };				/* stream data from opendir() */
++
++#define __DIRSTREAM_BUF_SIZE	(__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf))
+diff --git a/dietelfinfo.h b/dietelfinfo.h
+new file mode 100644
+index 0000000..f18627b
+--- /dev/null
++++ b/dietelfinfo.h
+@@ -0,0 +1,20 @@
++#include "dietfeatures.h"
++
 +#ifdef WANT_ELFINFO
-+1:	lwzu	15,0(5)
-+	addi	5, 5, 4
-+	cmpwi	15,0
-+	bne	1b
-+	
-+	stw	5,__elfinfo at l(14)
++#include <elf.h>
++#include <endian.h>
++#include <stdint.h>
++
++/* TODO: exported interface from <linux/elf.h> has been changed in 2.6.25 so
++ * the 'elf_addr_t' type is not available anymore. Hence, derive it from
++ * __WORDSIZE__. */
++
++#if __WORDSIZE == 64
++typedef uint64_t	__diet_elf_addr_t;
++#elif __WORDSIZE == 32
++typedef uint32_t	__diet_elf_addr_t;
 +#endif
 +
- #ifdef WANT_DYNAMIC
- 	mr	6,7
- 	bl	_dyn_start
---- dietlibc-0.31.20080409/dietfeatures.h.pagesize
-+++ dietlibc-0.31.20080409/dietfeatures.h
++__diet_elf_addr_t *	__get_elf_aux_value(unsigned int tag)
++	__attribute__((__visibility__("hidden"),__const__)) __pure;
++#endif
+diff --git a/dietfeatures.h b/dietfeatures.h
+index 5ad8f38..2993b9e 100644
+--- a/dietfeatures.h
++++ b/dietfeatures.h
 @@ -126,6 +126,16 @@
  /* #define WANT_SSP_XOR */
  
@@ -173,172 +229,268 @@
 +#endif
 +
  #endif
---- dietlibc-0.31.20080409/test/Makefile.pagesize
-+++ dietlibc-0.31.20080409/test/Makefile
-@@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_name
- memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest \
- protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent siglist \
- speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \
--strstr strtol sysenter ungetc waitpid
-+strstr strtol sysconf sysenter ungetc waitpid
- 
- test: $(TESTPROGRAMS)
- 
+diff --git a/dietpagesize.h b/dietpagesize.h
+new file mode 100644
+index 0000000..8ce6ce7
 --- /dev/null
-+++ dietlibc-0.31.20080409/test/sysconf.c
-@@ -0,0 +1,80 @@
-+#include <unistd.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <assert.h>
-+#include <sys/wait.h>
-+
-+#include "../dietpagesize.h"
-+
-+static long exec_getconf(char const *var)
-+{
-+  char	buf[128];
-+  pid_t	pid;
-+  int	fd[2];
-+  int	status;
-+  ssize_t	l;
++++ b/dietpagesize.h
+@@ -0,0 +1,31 @@
++#ifndef H_DIETLIBC_DIETPAGESIZE_H
++#define H_DIETLIBC_DIETPAGESIZE_H
 +
-+  if (pipe(fd)<0 || (pid = fork())<0)
-+    abort();
++#include <strings.h>
++#include "dietfeatures.h"
 +
-+  if (pid==0) {
-+    close(fd[0]);
++extern size_t __libc_getpagesize(void) __attribute__((__const__)) __pure;
 +
-+    if (fd[1]!=1) {
-+      dup2(fd[1], 1);
-+      close(fd[1]);
-+    }
++#if defined(WANT_STATIC_PAGESIZE)
++#  define __DIET_PAGE_SIZE_PREDEF	(WANT_STATIC_PAGESIZE)
++#  define __DIET_PAGE_SHIFT_PREDEF	(ffs(__DIET_PAGE_SIZE_PREDEF)-1)
++#elif defined(__alpha__) || defined(__sparc__)
++#  define __DIET_PAGE_SIZE_PREDEF	(8192UL)
++#  define __DIET_PAGE_SHIFT_PREDEF	(13)
++#elif defined(__powerpc64__)
++#  define __DIET_PAGE_SIZE_PREDEF	(65536UL)
++#  define __DIET_PAGE_SHIFT_PREDEF	(16)
++#else
++#  define __DIET_PAGE_SIZE_PREDEF	(4096UL)
++#  define __DIET_PAGE_SHIFT_PREDEF	(12)
++#endif
 +
-+    execlp("getconf", "getconf", var, NULL);
-+    _exit(1);
-+  }
++#ifdef WANT_DYN_PAGESIZE
++#  define __DIET_PAGE_SIZE	(__libc_getpagesize())
++#  define __DIET_PAGE_SHIFT	(ffs(__DIET_PAGE_SIZE)-1)
++#else
++#  define __DIET_PAGE_SIZE	__DIET_PAGE_SIZE_PREDEF
++#  define __DIET_PAGE_SHIFT	__DIET_PAGE_SHIFT_PREDEF
++#endif
 +
-+  close(fd[1]);
-+  l = read(fd[0], buf, sizeof(buf)-1);
-+  if (l<0) {
-+    perror("read()");
-+    goto err;
-+  } else if (l==sizeof(buf)-1)
-+    goto err;
-+  close(fd[0]);
-+
-+  buf[l] = '\0';
-+
-+  if (waitpid(pid, &status, 0)<0)
-+    goto err;
-+
-+  if (!WIFEXITED(status) || WEXITSTATUS(status)!=0)
-+    goto err;
-+
-+  return strtol(buf, NULL, 10);
-+
-+ err:
-+  kill(pid, SIGKILL);
-+  abort();
-+}
-+
-+static unsigned int do_check(char const *var, long exp)
-+{
-+  long	cur = exec_getconf(var);
-+
-+  if (cur!=exp) {
-+    fprintf(stderr, "%s mismatch: got %ld, expected %ld\n",
-+	    var, cur, exp);
-+    return 1;
-+  }
-+
-+  return 0;
-+}
-+
-+int main(int argc, char *argv[])
-+{
-+  unsigned int	err = 0;
-+
-+  assert(sysconf(_SC_PAGESIZE) == __DIET_PAGE_SIZE);
-+  assert(__DIET_PAGE_SIZE == (1<<__DIET_PAGE_SHIFT));
-+
-+  err += do_check("PAGE_SIZE", sysconf(_SC_PAGESIZE));
-+  err += do_check("CLK_TCK",   sysconf(_SC_CLK_TCK));
-+
-+  return err;
-+}
---- dietlibc-0.31.20080409/test/runtests.sh.pagesize
-+++ dietlibc-0.31.20080409/test/runtests.sh
-@@ -1,6 +1,6 @@
- SUBDIRS="dirent inet stdio string stdlib time"
++#endif	/* H_DIETLIBC_DIETPAGESIZE_H */
+diff --git a/dynlinker/ldso_start.S b/dynlinker/ldso_start.S
+index ca278d7..7234f69 100644
+--- a/dynlinker/ldso_start.S
++++ b/dynlinker/ldso_start.S
+@@ -86,6 +86,15 @@ __environ:
+ 	.long 0
+ #endif
  
--TESTPROGRAMS="adjtime argv atexit bsearch byteswap calloc confstr empty flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysenter ungetc waitpid"
-+TESTPROGRAMS="adjtime argv atexit bsearch byteswap calloc confstr empty flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysconf sysenter ungetc waitpid"
++/* __elfinfo must follow __environ immediately */	
++.global __elfinfo
++__elfinfo:
++#if __WORDSIZE == 64
++	.quad 0
++#else
++	.long 0
++#endif
++
+ .global fini_entry
+ fini_entry:
+ 	.long 0
+diff --git a/i386/start.S b/i386/start.S
+index 94a4f73..0c2c71d 100644
+--- a/i386/start.S
++++ b/i386/start.S
+@@ -25,6 +25,13 @@ _start:
+ 	PIC_INIT			/* non-PIC: this is an empty line */
+ 	PUT_VAR %eax, environ, %ecx	/* non-PIC: movl %eax,environ */
  
- STDIN="read1"
- PASS="getpass" 
---- dietlibc-0.31.20080409/sparc64/start.S.pagesize
-+++ dietlibc-0.31.20080409/sparc64/start.S
-@@ -25,6 +25,17 @@ _start:
- 	or	%o3, %lo(environ), %o3
- 	stx	%o2, [%o3]
++#ifdef WANT_ELFINFO
++1:	add	$4, %eax		/* increment envp */
++	cmpl	$0, -4(%eax)		/* load envp[-1] */
++	jne	1b			/* ... until envp[-1]==NULL */
++        PUT_VAR %eax, __elfinfo, %ecx
++#endif
++
+ #ifdef PROFILING
+ 	pushl	$_etext
+ 	pushl	$.text
+diff --git a/ia64/start.S b/ia64/start.S
+index 50fd015..bac10cb 100644
+--- a/ia64/start.S
++++ b/ia64/start.S
+@@ -40,6 +40,16 @@ _start:
+ 	;;
+ 	st8  [r14] = out2           /* store envp in environ */
  
 +#ifdef WANT_ELFINFO
-+#  error "VERIFY ME!"
-+1:	add	%o2, %o2, 8
-+	ldx	[%o2-8], %o4
-+	orcc	%o4, %o4, %o4
++#  error "MAKE ME IE64 CODE!"
++1:	ld8	r9 = [out2], 8	    /* load *envp and increment it */
++	orr	r9 = r9, r9	    /* test for NULL */ 
 +	bne	1b
 +
-+	add	%o3, %o3, 8
-+	stx	%o2, [%o3]
++	adds r14 = 8, r14	    /* __elfinfo = environ + 8 */ 
++	st8  [r14] = out2           /* store envp in __elfinfo */
 +#endif
 +
- /* When starting a binary via the dynamic linker, %g1 contains the
-    address of the shared library termination function, which will be
-    registered with atexit(). If we are statically linked, this will
---- dietlibc-0.31.20080409/libcruft/sysconf.c.pagesize
-+++ dietlibc-0.31.20080409/libcruft/sysconf.c
-@@ -3,6 +3,9 @@
- #include <limits.h>
- #include <sys/resource.h>
+ #ifdef WANT_DYNAMIC
+ /* FIXME: dl_init parameter ??? */
+ 	br.call.sptk.few rp = _dyn_start
+diff --git a/include/sys/shm.h b/include/sys/shm.h
+index 9b2d04d..70bb17e 100644
+--- a/include/sys/shm.h
++++ b/include/sys/shm.h
+@@ -60,15 +60,6 @@ struct shm_info {
+   unsigned long swap_successes;
+ };
  
-+#include "dietelfinfo.h"
-+#include "dietpagesize.h"
+-#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(__powerpc__) || defined (__powerpc64__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__)
+-#define PAGE_SIZE 4096UL
+-#define PAGE_SHIFT 12
+-#elif defined(__alpha__) || defined(__sparc__)
+-/* sun4* has 4k except sun4 architecture, sparc64 has 8k */
+-#define PAGE_SIZE 8192UL
+-#define PAGE_SHIFT 13
+-#endif
+-
+ extern int shmget(key_t key, int size, int shmflg) __THROW;
+ extern void *shmat(int shmid, const void *shmaddr, int shmflg) __THROW;
+ extern int shmdt (const void *shmaddr) __THROW;
+diff --git a/lib/alloc.c b/lib/alloc.c
+index 9690565..3f0cedb 100644
+--- a/lib/alloc.c
++++ b/lib/alloc.c
+@@ -18,8 +18,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ 
+-#include <sys/shm.h>	/* for PAGE_SIZE */
+-
++#include "../dietpagesize.h"
+ 
+ /* -- HELPER CODE --------------------------------------------------------- */
+ 
+@@ -39,7 +38,7 @@ typedef struct {
+ #define BLOCK_START(b)	(((void*)(b))-sizeof(__alloc_t))
+ #define BLOCK_RET(b)	(((void*)(b))+sizeof(__alloc_t))
+ 
+-#define MEM_BLOCK_SIZE	PAGE_SIZE
++#define MEM_BLOCK_SIZE	__DIET_PAGE_SIZE
+ #define PAGE_ALIGN(s)	(((s)+MEM_BLOCK_SIZE-1)&(unsigned long)(~(MEM_BLOCK_SIZE-1)))
+ 
+ /* a simple mmap :) */
+@@ -66,7 +65,9 @@ static __alloc_t* __small_mem[8];
+ 
+ #define FIRST_SMALL(p)		(((unsigned long)(p))&(~(MEM_BLOCK_SIZE-1)))
+ 
+-static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; }
++static inline int __ind_shift() {
++	return __DIET_PAGE_SHIFT - sizeof(__small_mem)/sizeof(__small_mem[0]);
++}
+ 
+ static size_t REGPARM(1) get_index(size_t _size) {
+   register size_t idx=0;
+diff --git a/lib/closedir.c b/lib/closedir.c
+index 3aade81..21de234 100644
+--- a/lib/closedir.c
++++ b/lib/closedir.c
+@@ -4,8 +4,10 @@
+ #include <dirent.h>
+ #include <stdlib.h>
+ 
++#include "../dietpagesize.h"
 +
- extern int __sc_nr_cpus();
+ int closedir (DIR* d) {
+   int res=close(d->fd);
+-  munmap (d, PAGE_SIZE);
++  munmap (d, __DIET_PAGE_SIZE);
+   return res;
+ }
+diff --git a/lib/mmap64.c b/lib/mmap64.c
+index 0ab29a6..5012394 100644
+--- a/lib/mmap64.c
++++ b/lib/mmap64.c
+@@ -4,16 +4,18 @@
+ #include <syscalls.h>
+ #include <errno.h>
  
- long sysconf(int name)
-@@ -16,6 +19,14 @@ long sysconf(int name)
-       return limit.rlim_cur;
-     }
-   case _SC_CLK_TCK:
-+#ifdef WANT_ELFINFO
-+    {
-+      __diet_elf_addr_t	*v = __get_elf_aux_value(AT_CLKTCK);
-+      if (v)
-+	return *v;
-+    }
-+#endif
++#include "../dietpagesize.h"
 +
- #ifdef __alpha__
-     return 1024;
- #else
-@@ -23,11 +34,7 @@ long sysconf(int name)
- #endif
+ #ifdef __NR_mmap2
+ void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t pgoffset);
  
-   case _SC_PAGESIZE:
--#if ( defined(__alpha__) || defined(__sparc__) )
--    return 8192;
--#else
--    return 4096;
--#endif
-+    return __libc_getpagesize();
+ void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset);
+ void*__libc_mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset) {
+-  if (offset&(PAGE_SIZE-1)) {
++  if (offset&(__DIET_PAGE_SIZE)) {
+     errno=-EINVAL;
+     return MAP_FAILED;
+   }
+-  return __mmap2(addr,len,prot,flags,fd,offset>>PAGE_SHIFT);
++  return __mmap2(addr,len,prot,flags,fd,offset>>__DIET_PAGE_SHIFT);
+ }
  
-   case _SC_ARG_MAX:
-     return ARG_MAX;
+ void*mmap64(void*addr,size_t len,int prot,int flags,int fd,off64_t offset)
+diff --git a/lib/opendir.c b/lib/opendir.c
+index 2530d1a..0b49638 100644
+--- a/lib/opendir.c
++++ b/lib/opendir.c
+@@ -5,6 +5,8 @@
+ #include <stdlib.h>
+ #include <fcntl.h>
+ 
++#include "../dietpagesize.h"
++
+ DIR*  opendir ( const char* name ) {
+   int   fd = open (name, O_RDONLY | O_DIRECTORY);
+   DIR*  t  = NULL;
+@@ -12,7 +14,7 @@ DIR*  opendir ( const char* name ) {
+   if ( fd >= 0 ) {
+     if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
+       goto lose;
+-    t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, 
++    t = (DIR *) mmap (NULL, __DIET_PAGE_SIZE, PROT_READ | PROT_WRITE, 
+ 		MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+     if (t == MAP_FAILED)
+ lose:
+diff --git a/lib/readdir.c b/lib/readdir.c
+index ed885a5..d80a406 100644
+--- a/lib/readdir.c
++++ b/lib/readdir.c
+@@ -5,7 +5,7 @@
+ 
+ struct dirent* readdir(DIR *d) {
+   if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) {
+-    int res=getdents(d->fd,(struct dirent*)d->buf,sizeof (d->buf)-1);
++    int res=getdents(d->fd,(struct dirent*)d->buf,__DIRSTREAM_BUF_SIZE-1);
+     if (res<=0) return 0;
+     d->num=res; d->cur=0;
+   }
+diff --git a/lib/readdir64.c b/lib/readdir64.c
+index 924f0a8..06d073b 100644
+--- a/lib/readdir64.c
++++ b/lib/readdir64.c
+@@ -14,7 +14,7 @@
+ #ifndef WANT_LARGEFILE_BACKCOMPAT
+ struct dirent64* readdir64(DIR *d) {
+   if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) {
+-    int res=getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1);
++    int res=getdents64(d->fd,(struct dirent64*)d->buf, __DIRSTREAM_BUF_SIZE-1);
+     if (res<=0) return 0;
+     d->num=res; d->cur=0;
+   }
+@@ -32,7 +32,7 @@ again:
+   if (!trygetdents64) {
+ #endif
+     if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) {
+-      int res=getdents(d->fd,(struct dirent*)d->buf, sizeof (d->buf)-1);
++      int res=getdents(d->fd,(struct dirent*)d->buf, __DIRSTREAM_BUF_SIZE-1);
+       if (res<=0) return 0;
+       d->num=res; d->cur=0;
+     }
+@@ -46,7 +46,7 @@ again:
+ #ifdef __NR_getdents64
+   }
+   if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) {
+-    int res=getdents64(d->fd,(struct dirent64*)d->buf,sizeof (d->buf));
++    int res=getdents64(d->fd,(struct dirent64*)d->buf,__DIRSTREAM_BUF_SIZE);
+     if (res<=0) {
+       if (errno==ENOSYS) {
+ 	trygetdents64=0;
+diff --git a/libcruft/__get_elf_aux_value.c b/libcruft/__get_elf_aux_value.c
+new file mode 100644
+index 0000000..6ddddb4
 --- /dev/null
-+++ dietlibc-0.31.20080409/libcruft/__get_elf_aux_value.c
++++ b/libcruft/__get_elf_aux_value.c
 @@ -0,0 +1,14 @@
 +#include <stdlib.h>
 +#include "../dietelfinfo.h"
@@ -354,8 +506,10 @@
 +
 +  return NULL;
 +}
---- dietlibc-0.31.20080409/libcruft/getpagesize.c.pagesize
-+++ dietlibc-0.31.20080409/libcruft/getpagesize.c
+diff --git a/libcruft/getpagesize.c b/libcruft/getpagesize.c
+index 536d3dc..80f476b 100644
+--- a/libcruft/getpagesize.c
++++ b/libcruft/getpagesize.c
 @@ -2,14 +2,22 @@
  #include <sys/ipc.h>
  #include <sys/shm.h>
@@ -385,42 +539,155 @@
  
  size_t getpagesize(void)       __attribute__((weak,alias("__libc_getpagesize")));
 -
---- /dev/null
-+++ dietlibc-0.31.20080409/dietpagesize.h
-@@ -0,0 +1,31 @@
-+#ifndef H_DIETLIBC_DIETPAGESIZE_H
-+#define H_DIETLIBC_DIETPAGESIZE_H
+diff --git a/libcruft/sysconf.c b/libcruft/sysconf.c
+index e9c15cb..b98195c 100644
+--- a/libcruft/sysconf.c
++++ b/libcruft/sysconf.c
+@@ -3,6 +3,9 @@
+ #include <limits.h>
+ #include <sys/resource.h>
+ 
++#include "dietelfinfo.h"
++#include "dietpagesize.h"
 +
-+#include <strings.h>
-+#include "dietfeatures.h"
+ extern int __sc_nr_cpus();
+ 
+ long sysconf(int name)
+@@ -16,6 +19,14 @@ long sysconf(int name)
+       return limit.rlim_cur;
+     }
+   case _SC_CLK_TCK:
++#ifdef WANT_ELFINFO
++    {
++      __diet_elf_addr_t	*v = __get_elf_aux_value(AT_CLKTCK);
++      if (v)
++	return *v;
++    }
++#endif
 +
-+extern size_t __libc_getpagesize(void) __attribute__((__const__)) __pure;
+ #ifdef __alpha__
+     return 1024;
+ #else
+@@ -23,11 +34,7 @@ long sysconf(int name)
+ #endif
+ 
+   case _SC_PAGESIZE:
+-#if ( defined(__alpha__) || defined(__sparc__) )
+-    return 8192;
+-#else
+-    return 4096;
+-#endif
++    return __libc_getpagesize();
+ 
+   case _SC_ARG_MAX:
+     return ARG_MAX;
+diff --git a/mips/start.S b/mips/start.S
+index 57144b3..002fcf8 100644
+--- a/mips/start.S
++++ b/mips/start.S
+@@ -47,6 +47,15 @@ __start:
+ #endif
+ 	add	$a2, $a2, $a1
+ 	sw	$a2, environ
++#ifdef WANT_ELFINFO
++#  error "MAKE ME MIPS CODE!"
++1:	addu	$a2, $a2, 4	/* increment envp */
++	lw	$4, -4($a2)     /* load envp[-1]; TODO: is $4 a proper 
++				   temporary register? */
++	bnz	1b		/* ... until envp[-1]==NULL 
++				   TODO: use proper 'bnz' operation */
++	sw	$a2, __elfinfo
++#endif
+ 	jalr	$25
+ 	la	$25, exit
+ 	move	$4,$2
+diff --git a/parisc/start.S b/parisc/start.S
+index 69d9cce..0f064be 100644
+--- a/parisc/start.S
++++ b/parisc/start.S
+@@ -34,6 +34,16 @@ _start:
+ 	ldil LP%environ, %r19
+ 	ldo RP%environ(%r19), %r19
+ 
++#ifdef WANT_ELFINFO
++#  error "MAKE ME PARISC CODE!"
++1:	add %r20, %r19, %r19		; envp += 4
++	ldw -4(0,%r19), %r21		; load envp[-4] into %r21
++	comibf =,0, 0,%21,1b		; compare %21 with 0 without nullification
++ 
++	ldil LP%__elfinfo, %r19
++	ldo RP%__elfinfo(%r19), %r19
++#endif	
 +
-+#if defined(WANT_STATIC_PAGESIZE)
-+#  define __DIET_PAGE_SIZE_PREDEF	(WANT_STATIC_PAGESIZE)
-+#  define __DIET_PAGE_SHIFT_PREDEF	(ffs(__DIET_PAGE_SIZE_PREDEF)-1)
-+#elif defined(__alpha__) || defined(__sparc__)
-+#  define __DIET_PAGE_SIZE_PREDEF	(8192UL)
-+#  define __DIET_PAGE_SHIFT_PREDEF	(13)
-+#elif defined(__powerpc64__)
-+#  define __DIET_PAGE_SIZE_PREDEF	(65536UL)
-+#  define __DIET_PAGE_SHIFT_PREDEF	(16)
-+#else
-+#  define __DIET_PAGE_SIZE_PREDEF	(4096UL)
-+#  define __DIET_PAGE_SHIFT_PREDEF	(12)
+ 	/* Expand the stack to store the 5th through 7th args */
+ 	ldo 64(%sp), %sp
+ 
+diff --git a/ppc/start.S b/ppc/start.S
+index 771f1ad..eb62efb 100644
+--- a/ppc/start.S
++++ b/ppc/start.S
+@@ -31,6 +31,15 @@ _start:
+ 	lis	14,environ at ha
+ 	stw	5,environ at l(14)
+ 
++#ifdef WANT_ELFINFO
++1:	lwzu	15,0(5)
++	addi	5, 5, 4
++	cmpwi	15,0
++	bne	1b
++	
++	stw	5,__elfinfo at l(14)
 +#endif
 +
-+#ifdef WANT_DYN_PAGESIZE
-+#  define __DIET_PAGE_SIZE	(__libc_getpagesize())
-+#  define __DIET_PAGE_SHIFT	(ffs(__DIET_PAGE_SIZE)-1)
-+#else
-+#  define __DIET_PAGE_SIZE	__DIET_PAGE_SIZE_PREDEF
-+#  define __DIET_PAGE_SHIFT	__DIET_PAGE_SHIFT_PREDEF
+ #ifdef WANT_DYNAMIC
+ 	mr	6,7
+ 	bl	_dyn_start
+diff --git a/ppc64/start.S b/ppc64/start.S
+index a9208ff..46b4bf0 100644
+--- a/ppc64/start.S
++++ b/ppc64/start.S
+@@ -58,6 +58,15 @@ _start:
+ 	oris	14,14,environ at ha
+ 	std	5,environ at l(14)
+ 
++#ifdef WANT_ELFINFO
++1:	ldu	15,0(5)
++	addi	5, 5, 8
++	cmpdi	15,0
++	bne	1b
++
++	std	5,__elfinfo at l(14)
 +#endif
 +
-+#endif	/* H_DIETLIBC_DIETPAGESIZE_H */
---- dietlibc-0.31.20080409/s390x/start.S.pagesize
-+++ dietlibc-0.31.20080409/s390x/start.S
+ #ifdef WANT_DYNAMIC
+ /* #warning dynamic */
+ 	mr	6,7
+diff --git a/s390/start.S b/s390/start.S
+index c0f971f..d071564 100644
+--- a/s390/start.S
++++ b/s390/start.S
+@@ -30,6 +30,17 @@ _start:
+ 	l	%r1,8(%r13)
+ 	st	%r4,0(%r1)
+ 
++#ifdef WANT_ELFINFO
++#  error "VERIFY ME!"
++1:	ahi	%r4, 4		# increment envp
++	l	%r12, -4(0,%r4)	# load envp[-1] into %r12
++	or	%r12, %r12	# test %r12 for NULL
++	brc	1, 1b
++  
++	ahi	%r1, 4
++	st	%r4,0(%r1)
++#endif
++
+ /* call main or _dyn_start */
+ 	l	%r1,0(%r13)
+ 	basr	%r14,%r1
+diff --git a/s390x/start.S b/s390x/start.S
+index 25895a6..db71fc9 100644
+--- a/s390x/start.S
++++ b/s390x/start.S
 @@ -26,6 +26,17 @@ _start:
  	larl	%r13,environ
  	stg	%r4,0(%r13)
@@ -439,100 +706,79 @@
  /* call main or _dyn_start */
  #ifdef WANT_DYNAMIC
  	brasl	%r14,_dyn_start
---- /dev/null
-+++ dietlibc-0.31.20080409/dietelfinfo.h
-@@ -0,0 +1,20 @@
-+#include "dietfeatures.h"
-+
-+#ifdef WANT_ELFINFO
-+#include <elf.h>
-+#include <endian.h>
-+#include <stdint.h>
-+
-+/* TODO: exported interface from <linux/elf.h> has been changed in 2.6.25 so
-+ * the 'elf_addr_t' type is not available anymore. Hence, derive it from
-+ * __WORDSIZE__. */
-+
-+#if __WORDSIZE == 64
-+typedef uint64_t	__diet_elf_addr_t;
-+#elif __WORDSIZE == 32
-+typedef uint32_t	__diet_elf_addr_t;
-+#endif
-+
-+__diet_elf_addr_t *	__get_elf_aux_value(unsigned int tag)
-+	__attribute__((__visibility__("hidden"),__const__)) __pure;
-+#endif
---- dietlibc-0.31.20080409/ia64/start.S.pagesize
-+++ dietlibc-0.31.20080409/ia64/start.S
-@@ -40,6 +40,16 @@ _start:
- 	;;
- 	st8  [r14] = out2           /* store envp in environ */
+diff --git a/sparc/shmat.c b/sparc/shmat.c
+index b7dce2e..ce3bfcb 100644
+--- a/sparc/shmat.c
++++ b/sparc/shmat.c
+@@ -3,17 +3,15 @@
+ #include <sys/shm.h>
+ #include <unistd.h>
+ 
+-extern void* __ipc();
++#include "../dietpagesize.h"
+ 
+-#ifndef PAGE_SIZE
+-#define PAGE_SIZE 4096
+-#endif
++extern void* __ipc();
+ 
+ void* shmat(int shmid,const void* shmaddr,int shmflg) {
+   void* raddr;
+   register void* result;
+   result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr);
+-  if ((unsigned long)result <= -(unsigned long)PAGE_SIZE)
++  if ((unsigned long)result <= -(unsigned long)__DIET_PAGE_SIZE)
+     result=raddr;
+   return result;
+ }
+diff --git a/sparc/start.S b/sparc/start.S
+index a7841e3..6037eae 100644
+--- a/sparc/start.S
++++ b/sparc/start.S
+@@ -25,6 +25,17 @@ _start:
+ 	or	%o3, %lo(environ), %o3
+ 	st	%o2, [%o3]
  
 +#ifdef WANT_ELFINFO
-+#  error "MAKE ME IE64 CODE!"
-+1:	ld8	r9 = [out2], 8	    /* load *envp and increment it */
-+	orr	r9 = r9, r9	    /* test for NULL */ 
++#  error "VERIFY ME!"
++1:	add	%o2, %o2, 4
++	ld	[%o2-4], %o4
++	orcc	%o4, %o4, %o4
 +	bne	1b
 +
-+	adds r14 = 8, r14	    /* __elfinfo = environ + 8 */ 
-+	st8  [r14] = out2           /* store envp in __elfinfo */
-+#endif
-+
- #ifdef WANT_DYNAMIC
- /* FIXME: dl_init parameter ??? */
- 	br.call.sptk.few rp = _dyn_start
---- dietlibc-0.31.20080409/i386/start.S.pagesize
-+++ dietlibc-0.31.20080409/i386/start.S
-@@ -25,6 +25,13 @@ _start:
- 	PIC_INIT			/* non-PIC: this is an empty line */
- 	PUT_VAR %eax, environ, %ecx	/* non-PIC: movl %eax,environ */
- 
-+#ifdef WANT_ELFINFO
-+1:	add	$4, %eax		/* increment envp */
-+	cmpl	$0, -4(%eax)		/* load envp[-1] */
-+	jne	1b			/* ... until envp[-1]==NULL */
-+        PUT_VAR %eax, __elfinfo, %ecx
++	add	%o3, %o3, 4
++	st	%o2, [%o3]
 +#endif
 +
- #ifdef PROFILING
- 	pushl	$_etext
- 	pushl	$.text
---- dietlibc-0.31.20080409/dietdirent.h.pagesize
-+++ dietlibc-0.31.20080409/dietdirent.h
-@@ -1,8 +1,12 @@
- #include <sys/shm.h>
- 
-+#include "dietpagesize.h"
-+
- struct __dirstream {
-   int fd;
--  char buf[PAGE_SIZE-(sizeof (int)*3)];
-   unsigned int num;
-   unsigned int cur;
-+  char buf[];
- };				/* stream data from opendir() */
-+
-+#define __DIRSTREAM_BUF_SIZE	(__DIET_PAGE_SIZE - offsetof(struct __dirstream, buf))
---- dietlibc-0.31.20080409/alpha/start.S.pagesize
-+++ dietlibc-0.31.20080409/alpha/start.S
-@@ -24,6 +24,15 @@ _start:
- 
- 	stq	$18, environ
+ /* When starting a binary via the dynamic linker, %g1 contains the
+    address of the shared library termination function, which will be
+    registered with atexit(). If we are statically linked, this will
+diff --git a/sparc64/start.S b/sparc64/start.S
+index a79c4e7..f0e7d82 100644
+--- a/sparc64/start.S
++++ b/sparc64/start.S
+@@ -25,6 +25,17 @@ _start:
+ 	or	%o3, %lo(environ), %o3
+ 	stx	%o2, [%o3]
  
 +#ifdef WANT_ELFINFO
-+#  error "MAKE ME alpha ASSEMBLER!"
-+1:	ldq	$19, $18	; load *envp into $19
-+	addq	$18,  1,  $18	; increment *envp
-+	orr	$19, $19, $19
-+	jne	1b
-+	stq	$18, __elfinfo
++#  error "VERIFY ME!"
++1:	add	%o2, %o2, 8
++	ldx	[%o2-8], %o4
++	orcc	%o4, %o4, %o4
++	bne	1b
++
++	add	%o3, %o3, 8
++	stx	%o2, [%o3]
 +#endif
 +
- #ifdef WANT_DYNAMIC
- /* in v0 ($0) is the ld.so _fini pointer */
- 	mov	 $0, $19	/* mov v0(dynload) to a3 */
---- dietlibc-0.31.20080409/syscalls.s/environ.S.pagesize
-+++ dietlibc-0.31.20080409/syscalls.s/environ.S
+ /* When starting a binary via the dynamic linker, %g1 contains the
+    address of the shared library termination function, which will be
+    registered with atexit(). If we are statically linked, this will
+diff --git a/syscalls.s/environ.S b/syscalls.s/environ.S
+index a4dd95e..78a17de 100644
+--- a/syscalls.s/environ.S
++++ b/syscalls.s/environ.S
 @@ -1,6 +1,7 @@
  .section ".bss"
  .align 8
@@ -564,135 +810,121 @@
 +#endif
 +.size __elfinfo,.-__elfinfo
 +#endif
---- dietlibc-0.31.20080409/arm/start.S.pagesize
-+++ dietlibc-0.31.20080409/arm/start.S
-@@ -23,11 +23,18 @@ _start:
- #ifdef __DYN_LIB
- 	ldr	sl, .L4
- 1:	add	sl, pc, sl
--	str	a3, [sl, ip]		@ environ = envp
-+	str	a3, [ip, sl]!		@ environ = envp; ip = GOT(environ)
- #else
- 	str	a3, [ip, #0]		@ environ = envp
- #endif
- 
-+#ifdef WANT_ELFINFO
-+1:	ldr	r5, [a3], #4		@ load *envp and increment it
-+	orr	r5, r5, r5		@ read value==0?
-+	bne	1b
-+	str	a3, [ip, #4]		@ __elfinfo = envp
-+#endif
-+
- #ifdef PROFILING
- 	stmdb	sp!, { r0 - r3 }
- 	ldr	r0, .L5
-@@ -70,6 +77,3 @@ _exit:
- .L5:	.word	.text
- .L6:	.word	_etext
- #endif
--
--
--
---- dietlibc-0.31.20080409/parisc/start.S.pagesize
-+++ dietlibc-0.31.20080409/parisc/start.S
-@@ -34,6 +34,16 @@ _start:
- 	ldil LP%environ, %r19
- 	ldo RP%environ(%r19), %r19
+diff --git a/test/Makefile b/test/Makefile
+index eea0075..ff416cf 100644
+--- a/test/Makefile
++++ b/test/Makefile
+@@ -14,7 +14,7 @@ glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testhar
+ memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest \
+ protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent siglist \
+ speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \
+-strstr strtol sysenter ungetc waitpid
++strstr strtol sysconf sysenter ungetc waitpid
  
-+#ifdef WANT_ELFINFO
-+#  error "MAKE ME PARISC CODE!"
-+1:	add %r20, %r19, %r19		; envp += 4
-+	ldw -4(0,%r19), %r21		; load envp[-4] into %r21
-+	comibf =,0, 0,%21,1b		; compare %21 with 0 without nullification
-+ 
-+	ldil LP%__elfinfo, %r19
-+	ldo RP%__elfinfo(%r19), %r19
-+#endif	
-+
- 	/* Expand the stack to store the 5th through 7th args */
- 	ldo 64(%sp), %sp
+ test: $(TESTPROGRAMS)
  
---- dietlibc-0.31.20080409/include/sys/shm.h.pagesize
-+++ dietlibc-0.31.20080409/include/sys/shm.h
-@@ -60,15 +60,6 @@ struct shm_info {
-   unsigned long swap_successes;
- };
+diff --git a/test/runtests.sh b/test/runtests.sh
+index 6d89efb..908caa5 100644
+--- a/test/runtests.sh
++++ b/test/runtests.sh
+@@ -1,6 +1,6 @@
+ SUBDIRS="dirent inet stdio string stdlib time"
  
--#if defined(__i386__) || defined(__mips__) || defined(__arm__) || defined(__powerpc__) || defined (__powerpc64__) || defined(__s390__) || defined(__hppa__) || defined(__x86_64__) || defined(__ia64__)
--#define PAGE_SIZE 4096UL
--#define PAGE_SHIFT 12
--#elif defined(__alpha__) || defined(__sparc__)
--/* sun4* has 4k except sun4 architecture, sparc64 has 8k */
--#define PAGE_SIZE 8192UL
--#define PAGE_SHIFT 13
--#endif
--
- extern int shmget(key_t key, int size, int shmflg) __THROW;
- extern void *shmat(int shmid, const void *shmaddr, int shmflg) __THROW;
- extern int shmdt (const void *shmaddr) __THROW;
---- dietlibc-0.31.20080409/sparc/start.S.pagesize
-+++ dietlibc-0.31.20080409/sparc/start.S
-@@ -25,6 +25,17 @@ _start:
- 	or	%o3, %lo(environ), %o3
- 	st	%o2, [%o3]
+-TESTPROGRAMS="adjtime argv atexit bsearch byteswap calloc confstr empty flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysenter ungetc waitpid"
++TESTPROGRAMS="adjtime argv atexit bsearch byteswap calloc confstr empty flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysconf sysenter ungetc waitpid"
  
-+#ifdef WANT_ELFINFO
-+#  error "VERIFY ME!"
-+1:	add	%o2, %o2, 4
-+	ld	[%o2-4], %o4
-+	orcc	%o4, %o4, %o4
-+	bne	1b
-+
-+	add	%o3, %o3, 4
-+	st	%o2, [%o3]
-+#endif
+ STDIN="read1"
+ PASS="getpass" 
+diff --git a/test/sysconf.c b/test/sysconf.c
+new file mode 100644
+index 0000000..32263a5
+--- /dev/null
++++ b/test/sysconf.c
+@@ -0,0 +1,80 @@
++#include <unistd.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <assert.h>
++#include <sys/wait.h>
 +
- /* When starting a binary via the dynamic linker, %g1 contains the
-    address of the shared library termination function, which will be
-    registered with atexit(). If we are statically linked, this will
---- dietlibc-0.31.20080409/sparc/shmat.c.pagesize
-+++ dietlibc-0.31.20080409/sparc/shmat.c
-@@ -3,17 +3,15 @@
- #include <sys/shm.h>
- #include <unistd.h>
- 
--extern void* __ipc();
 +#include "../dietpagesize.h"
- 
--#ifndef PAGE_SIZE
--#define PAGE_SIZE 4096
--#endif
-+extern void* __ipc();
- 
- void* shmat(int shmid,const void* shmaddr,int shmflg) {
-   void* raddr;
-   register void* result;
-   result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr);
--  if ((unsigned long)result <= -(unsigned long)PAGE_SIZE)
-+  if ((unsigned long)result <= -(unsigned long)__DIET_PAGE_SIZE)
-     result=raddr;
-   return result;
- }
---- dietlibc-0.31.20080409/ppc64/start.S.pagesize
-+++ dietlibc-0.31.20080409/ppc64/start.S
-@@ -58,6 +58,15 @@ _start:
- 	oris	14,14,environ at ha
- 	std	5,environ at l(14)
- 
-+#ifdef WANT_ELFINFO
-+1:	ldu	15,0(5)
-+	addi	5, 5, 8
-+	cmpdi	15,0
-+	bne	1b
 +
-+	std	5,__elfinfo at l(14)
-+#endif
++static long exec_getconf(char const *var)
++{
++  char	buf[128];
++  pid_t	pid;
++  int	fd[2];
++  int	status;
++  ssize_t	l;
 +
- #ifdef WANT_DYNAMIC
- /* #warning dynamic */
- 	mr	6,7
---- dietlibc-0.31.20080409/x86_64/start.S.pagesize
-+++ dietlibc-0.31.20080409/x86_64/start.S
++  if (pipe(fd)<0 || (pid = fork())<0)
++    abort();
++
++  if (pid==0) {
++    close(fd[0]);
++
++    if (fd[1]!=1) {
++      dup2(fd[1], 1);
++      close(fd[1]);
++    }
++
++    execlp("getconf", "getconf", var, NULL);
++    _exit(1);
++  }
++
++  close(fd[1]);
++  l = read(fd[0], buf, sizeof(buf)-1);
++  if (l<0) {
++    perror("read()");
++    goto err;
++  } else if (l==sizeof(buf)-1)
++    goto err;
++  close(fd[0]);
++
++  buf[l] = '\0';
++
++  if (waitpid(pid, &status, 0)<0)
++    goto err;
++
++  if (!WIFEXITED(status) || WEXITSTATUS(status)!=0)
++    goto err;
++
++  return strtol(buf, NULL, 10);
++
++ err:
++  kill(pid, SIGKILL);
++  abort();
++}
++
++static unsigned int do_check(char const *var, long exp)
++{
++  long	cur = exec_getconf(var);
++
++  if (cur!=exp) {
++    fprintf(stderr, "%s mismatch: got %ld, expected %ld\n",
++	    var, cur, exp);
++    return 1;
++  }
++
++  return 0;
++}
++
++int main(int argc, char *argv[])
++{
++  unsigned int	err = 0;
++
++  assert(sysconf(_SC_PAGESIZE) == __DIET_PAGE_SIZE);
++  assert(__DIET_PAGE_SIZE == (1<<__DIET_PAGE_SHIFT));
++
++  err += do_check("PAGE_SIZE", sysconf(_SC_PAGESIZE));
++  err += do_check("CLK_TCK",   sysconf(_SC_CLK_TCK));
++
++  return err;
++}
+diff --git a/x86_64/start.S b/x86_64/start.S
+index adc461a..3915e33 100644
+--- a/x86_64/start.S
++++ b/x86_64/start.S
 @@ -12,12 +12,28 @@ _start:
  	
  	leaq	8(%rsi,%rdi,8),%rdx	/* %rdx = envp = (8*rdi)+%rsi+8 */
@@ -722,59 +954,6 @@
  
  #ifdef PROFILING
  	pushq	%rdi			/* save reg args */
---- dietlibc-0.31.20080409/s390/start.S.pagesize
-+++ dietlibc-0.31.20080409/s390/start.S
-@@ -30,6 +30,17 @@ _start:
- 	l	%r1,8(%r13)
- 	st	%r4,0(%r1)
- 
-+#ifdef WANT_ELFINFO
-+#  error "VERIFY ME!"
-+1:	ahi	%r4, 4		# increment envp
-+	l	%r12, -4(0,%r4)	# load envp[-1] into %r12
-+	or	%r12, %r12	# test %r12 for NULL
-+	brc	1, 1b
-+  
-+	ahi	%r1, 4
-+	st	%r4,0(%r1)
-+#endif
-+
- /* call main or _dyn_start */
- 	l	%r1,0(%r13)
- 	basr	%r14,%r1
---- dietlibc-0.31.20080409/dynlinker/ldso_start.S.pagesize
-+++ dietlibc-0.31.20080409/dynlinker/ldso_start.S
-@@ -86,6 +86,15 @@ __environ:
- 	.long 0
- #endif
- 
-+/* __elfinfo must follow __environ immediately */	
-+.global __elfinfo
-+__elfinfo:
-+#if __WORDSIZE == 64
-+	.quad 0
-+#else
-+	.long 0
-+#endif
-+
- .global fini_entry
- fini_entry:
- 	.long 0
---- dietlibc-0.31.20080409/mips/start.S.pagesize
-+++ dietlibc-0.31.20080409/mips/start.S
-@@ -47,6 +47,15 @@ __start:
- #endif
- 	add	$a2, $a2, $a1
- 	sw	$a2, environ
-+#ifdef WANT_ELFINFO
-+#  error "MAKE ME MIPS CODE!"
-+1:	addu	$a2, $a2, 4	/* increment envp */
-+	lw	$4, -4($a2)     /* load envp[-1]; TODO: is $4 a proper 
-+				   temporary register? */
-+	bnz	1b		/* ... until envp[-1]==NULL 
-+				   TODO: use proper 'bnz' operation */
-+	sw	$a2, __elfinfo
-+#endif
- 	jalr	$25
- 	la	$25, exit
- 	move	$4,$2
+-- 
+1.5.4.5
+

dietlibc-0.31-printFG.patch:

Index: dietlibc-0.31-printFG.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.31-printFG.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- dietlibc-0.31-printFG.patch	13 Apr 2008 22:52:24 -0000	1.5
+++ dietlibc-0.31-printFG.patch	21 Jun 2008 11:36:34 -0000	1.6
@@ -1,6 +1,58 @@
-diff -up dietlibc-0.31.20080409/lib/__dtostr.c.printFG dietlibc-0.31.20080409/lib/__dtostr.c
---- dietlibc-0.31.20080409/lib/__dtostr.c.printFG	2006-07-04 05:33:02.000000000 +0200
-+++ dietlibc-0.31.20080409/lib/__dtostr.c	2008-04-14 00:36:10.000000000 +0200
+From 313a9b41133ca631890de99f979ee01074d0c0be Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:39:23 +0200
+Subject: [PATCH] Fixes/enhancements for INF/NAN handling in printf()
+
+This patch adds support for uppercase 'F' and 'G' printf format
+specifiers.  It fixes handling of -INF values in __dtostr() too;
+previously, there was
+
+| unsigned int i;
+| if ((i=isinf(d))) return copystring(buf,maxlen,i>0?"inf":"-inf");
+                                                 ~~~
+which evaluated to true everytime. The copystring() function
+worked for 3-letter words only but not for '-inf'.
+
+The last argument of __dtostr() was changed from a boolean flag to
+a bitmask. Bit 0 encodes 'g' or 'f', and bit 1 lower-/uppercase.
+There should be probably added some macros for them; for now,
+these values are used directly.
+
+Please note that this might affect other applications (liblowfat?)
+too which are using __dtostr().
+
+'isinf(3)' is a builtin with gcc 4.3 and does not give a hint
+about the signess of the infinity anymore. Hence, this patch uses
+a more portable way where needed.
+---
+ include/stdlib.h |    6 ++++-
+ lib/__dtostr.c   |   18 +++++++++++-----
+ lib/__v_printf.c |   59 +++++++++++++++++++++++++++++------------------------
+ test/printf.c    |   44 +++++++++++++++++++++++++++++++++++----
+ 4 files changed, 88 insertions(+), 39 deletions(-)
+
+diff --git a/include/stdlib.h b/include/stdlib.h
+index d1e1569..34f3a7f 100644
+--- a/include/stdlib.h
++++ b/include/stdlib.h
+@@ -28,8 +28,12 @@ long double strtold(const char *nptr, char **endptr) __THROW;
+ long int strtol(const char *nptr, char **endptr, int base) __THROW;
+ unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW;
+ 
++/* HACK: used flags in __dtostr
++     0x01 ... 'g'
++     0x02 ... uppercase
++   Define some constants somewhere... */
+ extern int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase) __THROW;
+-extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int g) __THROW;
++extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int flags) __THROW;
+ 
+ #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L
+ __extension__ long long int strtoll(const char *nptr, char **endptr, int base) __THROW;
+diff --git a/lib/__dtostr.c b/lib/__dtostr.c
+index 1d082e3..bc61200 100644
+--- a/lib/__dtostr.c
++++ b/lib/__dtostr.c
 @@ -5,13 +5,15 @@
  
  static int copystring(char* buf,int maxlen, const char* s) {
@@ -20,7 +72,7 @@
  #if 1
    union {
      unsigned long long l;
-@@ -35,8 +37,12 @@ int __dtostr(double d,char *buf,unsigned
+@@ -35,8 +37,12 @@ int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned i
    double tmp;
    char *oldbuf=buf;
  
@@ -35,7 +87,7 @@
    e10=1+(long)(e*0.30102999566398119802); /* log10(2) */
    /* Wir iterieren von Links bis wir bei 0 sind oder maxlen erreicht
     * ist.  Wenn maxlen erreicht ist, machen wir das nochmal in
-@@ -126,7 +132,7 @@ int __dtostr(double d,char *buf,unsigned
+@@ -126,7 +132,7 @@ int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned i
    if (prec2 || prec>(unsigned int)(buf-oldbuf)+1) {	/* more digits wanted */
      if (!maxlen) return 0; --maxlen;
      *buf='.'; ++buf;
@@ -44,9 +96,10 @@
        if (prec2) prec=prec2;
        prec-=buf-oldbuf-1;
      } else {
-diff -up dietlibc-0.31.20080409/lib/__v_printf.c.printFG dietlibc-0.31.20080409/lib/__v_printf.c
---- dietlibc-0.31.20080409/lib/__v_printf.c.printFG	2008-02-19 01:28:13.000000000 +0100
-+++ dietlibc-0.31.20080409/lib/__v_printf.c	2008-04-14 00:36:10.000000000 +0200
+diff --git a/lib/__v_printf.c b/lib/__v_printf.c
+index 36202f5..964c005 100644
+--- a/lib/__v_printf.c
++++ b/lib/__v_printf.c
 @@ -4,6 +4,7 @@
  #include <stdlib.h>
  #include <string.h>
@@ -72,8 +125,7 @@
  	  if (flag_sign || d < +0.0) flag_in_sign=1;
  
 -	  sz=__dtostr(d,s,sizeof(buf)-1,width,preci,g);
-+	  sz=__dtostr(d,s,sizeof(buf)-1,width,preci,flags);
- 
+-
 -	  if (flag_dot) {
 -	    char *tmp;
 -	    if ((tmp=strchr(s,'.'))) {
@@ -83,6 +135,8 @@
 -	    } else if (flag_hash) {
 -	      s[sz]='.';
 -	      s[++sz]='\0';
++	  sz=__dtostr(d,s,sizeof(buf)-1,width,preci,flags);
++
 +	  if (!isnan(d) && !isinf(d)) {		/* skip NaN + INF values */
 +	    if (flag_dot) {
 +	      char *tmp;
@@ -131,9 +185,10 @@
  	  }
  	  
  	  sz=strlen(s);
-diff -up dietlibc-0.31.20080409/test/printf.c.printFG dietlibc-0.31.20080409/test/printf.c
---- dietlibc-0.31.20080409/test/printf.c.printFG	2008-02-19 01:28:13.000000000 +0100
-+++ dietlibc-0.31.20080409/test/printf.c	2008-04-14 00:36:10.000000000 +0200
+diff --git a/test/printf.c b/test/printf.c
+index 719461a..ef6050d 100644
+--- a/test/printf.c
++++ b/test/printf.c
 @@ -2,11 +2,26 @@
  #include <string.h>
  #include <stdlib.h>
@@ -215,20 +270,6 @@
 +
    return EXIT_SUCCESS;
  }
-diff -up dietlibc-0.31.20080409/include/stdlib.h.printFG dietlibc-0.31.20080409/include/stdlib.h
---- dietlibc-0.31.20080409/include/stdlib.h.printFG	2007-09-20 20:51:18.000000000 +0200
-+++ dietlibc-0.31.20080409/include/stdlib.h	2008-04-14 00:36:10.000000000 +0200
-@@ -28,8 +28,12 @@ long double strtold(const char *nptr, ch
- long int strtol(const char *nptr, char **endptr, int base) __THROW;
- unsigned long int strtoul(const char *nptr, char **endptr, int base) __THROW;
- 
-+/* HACK: used flags in __dtostr
-+     0x01 ... 'g'
-+     0x02 ... uppercase
-+   Define some constants somewhere... */
- extern int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase) __THROW;
--extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int g) __THROW;
-+extern int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2,int flags) __THROW;
- 
- #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L
- __extension__ long long int strtoll(const char *nptr, char **endptr, int base) __THROW;
+-- 
+1.5.4.5
+

dietlibc-0.31-stacksmash-dyn.patch:

Index: dietlibc-0.31-stacksmash-dyn.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.31-stacksmash-dyn.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dietlibc-0.31-stacksmash-dyn.patch	1 Sep 2007 12:34:41 -0000	1.1
+++ dietlibc-0.31-stacksmash-dyn.patch	21 Jun 2008 11:36:34 -0000	1.2
@@ -1,6 +1,18 @@
-diff -up dietlibc-0.31/lib/stack_smash_handler2.c.~1~ dietlibc-0.31/lib/stack_smash_handler2.c
---- dietlibc-0.31/lib/stack_smash_handler2.c.~1~	2007-09-01 14:13:21.000000000 +0200
-+++ dietlibc-0.31/lib/stack_smash_handler2.c	2007-09-01 14:13:40.000000000 +0200
+From 4bd1b2d53138ab594a6b73c938daf1b7c2195367 Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:57:09 +0200
+Subject: [PATCH] __stack_chk_fail_local function
+
+Added __stack_chk_fail_local() function as an alias for __stack_chk_fail().
+This is required for dynamic linking.
+---
+ lib/stack_smash_handler2.c |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/lib/stack_smash_handler2.c b/lib/stack_smash_handler2.c
+index ecefeb8..b03c0d5 100644
+--- a/lib/stack_smash_handler2.c
++++ b/lib/stack_smash_handler2.c
 @@ -2,6 +2,7 @@
  #include <write12.h>
  
@@ -9,3 +21,6 @@
  
  /* earlier versions of ProPolice actually gave the address and function
   * name as arguments to the handler, so it could print some useful
+-- 
+1.5.4.5
+

dietlibc-0.31-stacksmash.patch:

Index: dietlibc-0.31-stacksmash.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.31-stacksmash.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dietlibc-0.31-stacksmash.patch	1 Sep 2007 12:34:41 -0000	1.1
+++ dietlibc-0.31-stacksmash.patch	21 Jun 2008 11:36:34 -0000	1.2
@@ -1,14 +1,39 @@
-2007-09-01  Enrico Scholz  <enrico.scholz at informatik.tu-chemnitz.de>
-	* lib/stack_smash_handler2: modified __stack_chk_fail() to trigger
-	a segfault by accessing address 0x0. Every system with an MMU
-	known by me, segfaults by dereferencing a NULL pointer
+From 9fb58ca3604cb1426e94689fab57ab5c127c8c55 Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:56:07 +0200
+Subject: [PATCH] Enhanced __stack_chk_fail
 
-	* Makefile: added hack to compile stack_smash_handler2 with
-	'--fno-omit-frame-pointer'.
+* modified __stack_chk_fail() to trigger a segfault by accessing
+  address 0x0. Every system with an MMU known by me, segfaults
+  by dereferencing a NULL pointer.
 
-diff -up dietlibc-0.31/lib/stack_smash_handler2.c.~1~ dietlibc-0.31/lib/stack_smash_handler2.c
---- dietlibc-0.31/lib/stack_smash_handler2.c.stacksmash
-+++ dietlibc-0.31/lib/stack_smash_handler2.c
+* added hack to compile stack_smash_handler2 with
+  '--fno-omit-frame-pointer'.
+---
+ Makefile                   |    3 ++-
+ lib/stack_smash_handler2.c |   10 +++++++++-
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index adc2779..0cd0105 100644
+--- a/Makefile
++++ b/Makefile
+@@ -172,9 +172,10 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h
+ $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c
+ 	$(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@
+ 	$(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@
++$(OBJDIR)/stack_smash_handler2.o:	XCFLAGS:=-fno-omit-frame-pointer
+ 
+ $(OBJDIR)/%.o: %.c
+-	$(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__
++	$(CROSS)$(CC) $(INC) $(CFLAGS) $(XCFLAGS) -c $< -o $@ -D__dietlibc__
+ 	$(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@
+ endif
+ 
+diff --git a/lib/stack_smash_handler2.c b/lib/stack_smash_handler2.c
+index 9e85099..ecefeb8 100644
+--- a/lib/stack_smash_handler2.c
++++ b/lib/stack_smash_handler2.c
 @@ -8,5 +8,13 @@ void __stack_chk_fail(void);
   * diagnostics.  No more. :-( */
  void __stack_chk_fail(void) {
@@ -24,17 +49,6 @@
 +  while (1)
 +	  *(char *)0 = 0;
  }
---- dietlibc-0.31/Makefile.stacksmash
-+++ dietlibc-0.31/Makefile
-@@ -172,9 +172,10 @@ $(OBJDIR)/%.o: %.S $(ARCH)/syscalls.h
- $(OBJDIR)/pthread_%.o: libpthread/pthread_%.c
- 	$(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@
- 	$(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@
-+$(OBJDIR)/stack_smash_handler2.o:	XCFLAGS:=-fno-omit-frame-pointer
- 
- $(OBJDIR)/%.o: %.c
--	$(CROSS)$(CC) $(INC) $(CFLAGS) -c $< -o $@ -D__dietlibc__
-+	$(CROSS)$(CC) $(INC) $(CFLAGS) $(XCFLAGS) -c $< -o $@ -D__dietlibc__
- 	$(COMMENT) -$(CROSS)strip -x -R .comment -R .note $@
- endif
- 
+-- 
+1.5.4.5
+

dietlibc-0.31-testsuite.patch:

Index: dietlibc-0.31-testsuite.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.31-testsuite.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- dietlibc-0.31-testsuite.patch	13 Apr 2008 22:55:07 -0000	1.4
+++ dietlibc-0.31-testsuite.patch	21 Jun 2008 11:36:34 -0000	1.5
@@ -1,53 +1,101 @@
-diff -up dietlibc-0.31.20080409/test/getmntent.c.testsuite dietlibc-0.31.20080409/test/getmntent.c
---- dietlibc-0.31.20080409/test/getmntent.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/getmntent.c	2008-04-14 00:41:17.000000000 +0200
-@@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) {
- 
-  printf("closing /etc/fstab\n");
-  assert ( 1 == endmntent(fstab));
-- printf("closing /etc/fstab again\n");
-- assert ( 1 == endmntent(fstab)); /* endmntent must always return 1 */
-- printf("entmntent(0)\n");
-- assert ( 1 == endmntent(0)); /* causes a segfault with diet libc */
-+
-  return 0;
- }
--
-diff -up dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite dietlibc-0.31.20080409/test/stdio/tst-fphex.c
---- dietlibc-0.31.20080409/test/stdio/tst-fphex.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/stdio/tst-fphex.c	2008-04-14 00:41:17.000000000 +0200
-@@ -37,7 +37,7 @@ int main (int argc, char **argv) {
-       int n = snprintf (buf, sizeof buf, t->fmt, t->value);
-       if (n != strlen (t->expect) || strcmp (buf, t->expect) != 0)
- 	{
--	  printf ("%s\tExpected \"%s\" (%u)\n\tGot      \"%s\" (%d, %u)\n",
-+	  printf ("%s\tExpected \"%s\" (%zu)\n\tGot      \"%s\" (%d, %zu)\n",
- 		  t->fmt, t->expect, strlen (t->expect), buf, n, strlen (buf));
- 	  result = 1;
- 	}
-diff -up dietlibc-0.31.20080409/test/stdio/tstscanf.c.testsuite dietlibc-0.31.20080409/test/stdio/tstscanf.c
---- dietlibc-0.31.20080409/test/stdio/tstscanf.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/stdio/tstscanf.c	2008-04-14 00:47:36.000000000 +0200
-@@ -338,14 +338,14 @@ main (int argc, char **argv)
-     int res;
+From ca5319e550e6e64e803a46fbb80d9436d8348567 Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:41:23 +0200
+Subject: [PATCH] Several testsuite fixes/enhancments
+
+* test/getmntent.c: I removed the checks which called endmntent()
+  multiple times resp. with a NULL pointer.  Behavior in first
+  case is undefined and latter causes a segfault (I could not
+  find documentation that this is allowed).  Hence, it does not
+  make sense to test this.
+
+* test/stdlib/tst-malloc.c: test 'malloc(0)' only, when
+  WANT_MALLOC_ZERO is set
+
+* test/time/tst-strftime.c: the '%Zu' printf format specifier is
+  bogus (from libc5 ages). I replaced it with the '%zu' one.
+
+  Please note, that this test still fails because it uses glibc
+  specific features.
+
+* test/time/tst-strptime.c: removed tests which set a non-C
+  locale. Broken usage of 'strptime()' result was fixed too.
+  This test should succeed now.
+
+* test/math.c: this test was added while working on the '%F/%G'
+  patch and verifies the isinf() + isnan() functions.
+
+* fixes lot of broken printf() format specifiers
+
+* fixes tests using isinf(); the math.c test checks the dietlibc
+  implementation of isinf() (which differs between positive and
+  negative inf). All other tests use boolean retval only and test
+  for the signess of the values
+---
+ test/Makefile            |    2 +-
+ test/asprintf.c          |    2 +-
+ test/bsearch.c           |    2 +-
+ test/byteswap.c          |    8 ++++----
+ test/cycles.c            |    2 +-
+ test/getmntent.c         |    6 +-----
+ test/math.c              |   29 +++++++++++++++++++++++++++++
+ test/mktime.c            |    6 +++---
+ test/printftest.c        |    6 +++---
+ test/rand48.c            |   12 ++++++------
+ test/runtests.sh         |    2 +-
+ test/speed.c             |    4 ++--
+ test/stdio/tstscanf.c    |    4 ++--
+ test/stdlib/tst-malloc.c |    6 +++++-
+ test/stdlib/tst-strtod.c |    4 ++--
+ test/sysenter.c          |    6 +++---
+ test/time/tst-strftime.c |    6 +++---
+ test/time/tst-strptime.c |   23 ++++++++++++++++++++---
+ 18 files changed, 88 insertions(+), 42 deletions(-)
+ create mode 100644 test/math.c
+
+diff --git a/test/Makefile b/test/Makefile
+index ff416cf..537b32f 100644
+--- a/test/Makefile
++++ b/test/Makefile
+@@ -10,7 +10,7 @@ LCOMPAT=-lcompat
+ TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty flush fnmatch \
+ fputc ftw fwrite getaddrinfo getenv getgrnam gethostbyaddr gethostbyname \
+ gethostbyname_r getmntent getopt getpass getpwnam getservbyname getservbyport getusershell \
+-glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness \
++glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger math md5_testharness \
+ memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest \
+ protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent siglist \
+ speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \
+diff --git a/test/asprintf.c b/test/asprintf.c
+index 996a5aa..0d4f2eb 100644
+--- a/test/asprintf.c
++++ b/test/asprintf.c
+@@ -13,7 +13,7 @@ int main(int argc, char **argv) {
+  assert(strlen(path) == asprintlen);
+ 	     
+  printf("%s\n", path);
+- asprintlen=asprintf(&path, "/proc" "/%d/stat", strlen(argv[1]));
++ asprintlen=asprintf(&path, "/proc" "/%zu/stat", strlen(argv[1]));
+  assert(strlen(path) == asprintlen);
+  printf("%s\n", path);
  
-     res = sscanf ("-InF", "%f", &value);
--    if (res != 1 || isinf (value) != -1)
-+    if (res != 1 || !isinf (value) || !(value<0))
-       {
- 	fputs ("test failed!\n", stdout);
- 	result = 1;
+diff --git a/test/bsearch.c b/test/bsearch.c
+index 961ad35..ede4c88 100644
+--- a/test/bsearch.c
++++ b/test/bsearch.c
+@@ -35,7 +35,7 @@ int main() {
+ 	die("bsearch returned NULL\n");
        }
- 
-     res = sscanf ("+InfiNiTY", "%f", &value);
--    if (res != 1 || isinf (value) != 1)
-+    if (res != 1 || !isinf (value) || !(value>0))
-       {
- 	fputs ("test failed!\n", stdout);
- 	result = 1;
-diff -up dietlibc-0.31.20080409/test/byteswap.c.testsuite dietlibc-0.31.20080409/test/byteswap.c
---- dietlibc-0.31.20080409/test/byteswap.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/byteswap.c	2008-04-14 00:41:17.000000000 +0200
+       if (k != array+i) die("bsearch found wrong element\n");
+-      printf("%d\n",k-array);
++      printf("%ld\n",k-array);
+     }
+   }
+   return 0;
+diff --git a/test/byteswap.c b/test/byteswap.c
+index 19239dd..6f43c25 100644
+--- a/test/byteswap.c
++++ b/test/byteswap.c
 @@ -9,12 +9,12 @@ int main() {
    snprintf(buf,100,"%x %x", bswap_16(0x1234), bswap_16(0x5678));
    assert(strcmp(buf, "3412 7856") == 0);
@@ -65,20 +113,10 @@
    assert(strcmp(buf, "efcdab8967452301") == 0);
    return 0; 
  }
-diff -up dietlibc-0.31.20080409/test/runtests.sh.testsuite dietlibc-0.31.20080409/test/runtests.sh
---- dietlibc-0.31.20080409/test/runtests.sh.testsuite	2008-04-14 00:41:17.000000000 +0200
-+++ dietlibc-0.31.20080409/test/runtests.sh	2008-04-14 00:41:17.000000000 +0200
-@@ -1,6 +1,6 @@
- SUBDIRS="dirent inet stdio string stdlib time"
- 
--TESTPROGRAMS="adjtime argv atexit bsearch byteswap calloc confstr empty flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysconf sysenter ungetc waitpid"
-+TESTPROGRAMS="adjtime argv atexit bsearch byteswap calloc confstr empty flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger math md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysconf sysenter ungetc waitpid"
- 
- STDIN="read1"
- PASS="getpass" 
-diff -up dietlibc-0.31.20080409/test/cycles.c.testsuite dietlibc-0.31.20080409/test/cycles.c
---- dietlibc-0.31.20080409/test/cycles.c.testsuite	2004-08-24 12:10:48.000000000 +0200
-+++ dietlibc-0.31.20080409/test/cycles.c	2008-04-14 00:41:17.000000000 +0200
+diff --git a/test/cycles.c b/test/cycles.c
+index 35547f8..a4cb8c8 100644
+--- a/test/cycles.c
++++ b/test/cycles.c
 @@ -24,7 +24,7 @@ int main(int argc,char* argv[]) {
    if (!fork()) { execve(argv[1],argv+1,environ); exit(1); }
    wait(0);
@@ -88,51 +126,84 @@
  
    return 0;
  }
-diff -up dietlibc-0.31.20080409/test/sysenter.c.testsuite dietlibc-0.31.20080409/test/sysenter.c
---- dietlibc-0.31.20080409/test/sysenter.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/sysenter.c	2008-04-14 00:41:17.000000000 +0200
-@@ -11,11 +11,11 @@ int main() {
-   int i;
-   for (i=0; environ[i]; ++i) ;
-   for (x=(struct elf_aux*)(environ+i+1); x->type; ++x) {
--    printf("%d %x\n",x->type,x->value);
-+    printf("%ld %lx\n",x->type,x->value);
-     if (x->type==AT_PAGESZ)
--      printf("pagesize %d\n",x->value);
-+      printf("pagesize %ld\n",x->value);
-     else if (x->type==AT_SYSINFO)
--      printf("vsyscall %p\n",x->value);
-+      printf("vsyscall %p\n",(void *)x->value);
-   }
-   return 0;
+diff --git a/test/getmntent.c b/test/getmntent.c
+index fc17a83..1039d06 100644
+--- a/test/getmntent.c
++++ b/test/getmntent.c
+@@ -33,10 +33,6 @@ while ((e = getmntent(fstab))) {
+ 
+  printf("closing /etc/fstab\n");
+  assert ( 1 == endmntent(fstab));
+- printf("closing /etc/fstab again\n");
+- assert ( 1 == endmntent(fstab)); /* endmntent must always return 1 */
+- printf("entmntent(0)\n");
+- assert ( 1 == endmntent(0)); /* causes a segfault with diet libc */
++
+  return 0;
  }
-diff -up dietlibc-0.31.20080409/test/Makefile.testsuite dietlibc-0.31.20080409/test/Makefile
---- dietlibc-0.31.20080409/test/Makefile.testsuite	2008-04-14 00:41:17.000000000 +0200
-+++ dietlibc-0.31.20080409/test/Makefile	2008-04-14 00:41:17.000000000 +0200
-@@ -10,7 +10,7 @@ LCOMPAT=-lcompat
- TESTPROGRAMS=adjtime argv asprintf atexit bsearch byteswap calloc confstr cycles empty flush fnmatch \
- fputc ftw fwrite getaddrinfo getenv getgrnam gethostbyaddr gethostbyname \
- gethostbyname_r getmntent getopt getpass getpwnam getservbyname getservbyport getusershell \
--glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness \
-+glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger math md5_testharness \
- memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest \
- protoent prototypes putenv pwent rand48 read1 readdir regex select sendfile servent siglist \
- speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr \
-diff -up dietlibc-0.31.20080409/test/bsearch.c.testsuite dietlibc-0.31.20080409/test/bsearch.c
---- dietlibc-0.31.20080409/test/bsearch.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/bsearch.c	2008-04-14 00:41:17.000000000 +0200
-@@ -35,7 +35,7 @@ int main() {
- 	die("bsearch returned NULL\n");
-       }
-       if (k != array+i) die("bsearch found wrong element\n");
--      printf("%d\n",k-array);
-+      printf("%ld\n",k-array);
-     }
-   }
+-
+diff --git a/test/math.c b/test/math.c
+new file mode 100644
+index 0000000..687103c
+--- /dev/null
++++ b/test/math.c
+@@ -0,0 +1,29 @@
++#include <math.h>
++#include <float.h>
++#include <assert.h>
++
++int main()
++{
++  extern int __isinf(double d);
++  extern int __isnan(double d);
++
++#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))
++  assert(__isinf(__builtin_inff())  == +1);
++  assert(__isinf(-__builtin_inff()) == -1);
++
++  assert(__isinf(__builtin_inf())   == +1);
++  assert(__isinf(-__builtin_inf())  == -1);
++
++  assert(__isnan(__builtin_nan("")));
++#endif
++
++  assert(__isinf((DBL_MAX * DBL_MAX))  == +1);
++  assert(__isinf(-(DBL_MAX * DBL_MAX)) == -1);
++
++  assert(isinf((DBL_MAX * DBL_MAX)));
++  assert(isinf(-(DBL_MAX * DBL_MAX)));
++
++  //assert(isnan(nan("")));
++
++  return 0;
++}
+diff --git a/test/mktime.c b/test/mktime.c
+index 5e9e65c..9b4bd5e 100644
+--- a/test/mktime.c
++++ b/test/mktime.c
+@@ -9,15 +9,15 @@ int main() {
+   t.tm_mday=29;
+   t.tm_mon=2;
+   t.tm_year=100;
+-  printf("%d\n",mktime(&t));
++  printf("%ld\n",(long)mktime(&t));
+   t.tm_mday=1;
+   t.tm_mon=3;
+   t.tm_year=102;
+-  printf("%d\n",mktime(&t));
++  printf("%ld\n",(long)mktime(&t));
+   t.tm_mday=1;
+   t.tm_mon=6;
+   t.tm_year=102;
+-  printf("%d\n",mktime(&t));
++  printf("%ld\n",(long)mktime(&t));
    return 0;
-diff -up dietlibc-0.31.20080409/test/printftest.c.testsuite dietlibc-0.31.20080409/test/printftest.c
---- dietlibc-0.31.20080409/test/printftest.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/printftest.c	2008-04-14 00:41:17.000000000 +0200
+ }
+ 
+diff --git a/test/printftest.c b/test/printftest.c
+index 4743279..47d9580 100644
+--- a/test/printftest.c
++++ b/test/printftest.c
 @@ -101,8 +101,8 @@ int main()
    printf("#%i#\n",18);
    printf("#%d#\n",18);
@@ -153,9 +224,87 @@
      
      printf ("snprintf (\"%%.999999u\", 10) == %d\n",
      	    snprintf(buf2, sizeof(buf2), "%.999999u", 10));
-diff -up dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-malloc.c
---- dietlibc-0.31.20080409/test/stdlib/tst-malloc.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/stdlib/tst-malloc.c	2008-04-14 00:41:17.000000000 +0200
+diff --git a/test/rand48.c b/test/rand48.c
+index 4f5b08f..1e67632 100644
+--- a/test/rand48.c
++++ b/test/rand48.c
+@@ -6,16 +6,16 @@ main (void)
+ {
+   static unsigned short  data[7] = { 1, 2, 3, 4, 5, 6, 7 };
+ 
+-  printf ("one   %X\n", mrand48 ());
+-  printf ("two   %X\n", mrand48 ());
+-  printf ("three %X\n", mrand48 ());
++  printf ("one   %lX\n", mrand48 ());
++  printf ("two   %lX\n", mrand48 ());
++  printf ("three %lX\n", mrand48 ());
+ 
+   lcong48 (data);
+   printf ("after lcong48:\n");
+ 
+-  printf ("one   %X\n", mrand48 ());
+-  printf ("two   %X\n", mrand48 ());
+-  printf ("three %X\n", mrand48 ());
++  printf ("one   %lX\n", mrand48 ());
++  printf ("two   %lX\n", mrand48 ());
++  printf ("three %lX\n", mrand48 ());
+ 
+   return 0;
+ }
+diff --git a/test/runtests.sh b/test/runtests.sh
+index 908caa5..fcd3202 100644
+--- a/test/runtests.sh
++++ b/test/runtests.sh
+@@ -1,6 +1,6 @@
+ SUBDIRS="dirent inet stdio string stdlib time"
+ 
+-TESTPROGRAMS="adjtime argv atexit bsearch byteswap calloc confstr empty flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysconf sysenter ungetc waitpid"
++TESTPROGRAMS="adjtime argv atexit bsearch byteswap calloc confstr empty flush fputc ffs fnmatch ftw fwrite getaddrinfo getenv getdelim getgrnam gethostbyaddr gethostbyname gethostbyname_r getmntent getopt getpwnam getservbyname getservbyport getusershell glob grent hasmntopt hello iconv if_nameindex ltostr malloc-debugger math md5_testharness memccpy memchr memcmp memrchr memusage mktime mmap_test pipe printf printftest protoent prototypes putenv pwent rand48 readdir regex select sendfile servent siglist speed spent sprintf sscanf stdarg strcasecmp strcmp strncat strncpy strptime strrchr strstr strtol sysconf sysenter ungetc waitpid"
+ 
+ STDIN="read1"
+ PASS="getpass" 
+diff --git a/test/speed.c b/test/speed.c
+index 674b9a8..22249a7 100644
+--- a/test/speed.c
++++ b/test/speed.c
+@@ -7,10 +7,10 @@ int main() {
+   int i;
+   time_t t;
+   
+-  printf("%d\n", time(0));
++  printf("%ld\n", (long)time(0));
+   for (i=0; i<10000000; ++i)
+     t=time(0);
+ 
+- printf("%d\n", time(0));
++  printf("%ld\n", (long)time(0));
+  return 0;   
+ }
+diff --git a/test/stdio/tstscanf.c b/test/stdio/tstscanf.c
+index 44ddf49..0f55c3c 100644
+--- a/test/stdio/tstscanf.c
++++ b/test/stdio/tstscanf.c
+@@ -338,14 +338,14 @@ main (int argc, char **argv)
+     int res;
+ 
+     res = sscanf ("-InF", "%f", &value);
+-    if (res != 1 || isinf (value) != -1)
++    if (res != 1 || !isinf (value) || !(value<0))
+       {
+ 	fputs ("test failed!\n", stdout);
+ 	result = 1;
+       }
+ 
+     res = sscanf ("+InfiNiTY", "%f", &value);
+-    if (res != 1 || isinf (value) != 1)
++    if (res != 1 || !isinf (value) || !(value>0))
+       {
+ 	fputs ("test failed!\n", stdout);
+ 	result = 1;
+diff --git a/test/stdlib/tst-malloc.c b/test/stdlib/tst-malloc.c
+index 09fbb1f..4a491d9 100644
+--- a/test/stdlib/tst-malloc.c
++++ b/test/stdlib/tst-malloc.c
 @@ -21,13 +21,15 @@
  #include <stdlib.h>
  #include <stdio.h>
@@ -185,9 +334,10 @@
  
    p = realloc (p, 0);
    if (p != NULL)
-diff -up dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite dietlibc-0.31.20080409/test/stdlib/tst-strtod.c
---- dietlibc-0.31.20080409/test/stdlib/tst-strtod.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/stdlib/tst-strtod.c	2008-04-14 00:41:17.000000000 +0200
+diff --git a/test/stdlib/tst-strtod.c b/test/stdlib/tst-strtod.c
+index 630a8fc..bacdca7 100644
+--- a/test/stdlib/tst-strtod.c
++++ b/test/stdlib/tst-strtod.c
 @@ -149,10 +149,10 @@ main (int argc, char ** argv)
      }
  
@@ -201,35 +351,29 @@
        status = 1;
      }
  
-diff -up dietlibc-0.31.20080409/test/rand48.c.testsuite dietlibc-0.31.20080409/test/rand48.c
---- dietlibc-0.31.20080409/test/rand48.c.testsuite	2002-05-29 15:20:40.000000000 +0200
-+++ dietlibc-0.31.20080409/test/rand48.c	2008-04-14 00:41:17.000000000 +0200
-@@ -6,16 +6,16 @@ main (void)
- {
-   static unsigned short  data[7] = { 1, 2, 3, 4, 5, 6, 7 };
- 
--  printf ("one   %X\n", mrand48 ());
--  printf ("two   %X\n", mrand48 ());
--  printf ("three %X\n", mrand48 ());
-+  printf ("one   %lX\n", mrand48 ());
-+  printf ("two   %lX\n", mrand48 ());
-+  printf ("three %lX\n", mrand48 ());
- 
-   lcong48 (data);
-   printf ("after lcong48:\n");
- 
--  printf ("one   %X\n", mrand48 ());
--  printf ("two   %X\n", mrand48 ());
--  printf ("three %X\n", mrand48 ());
-+  printf ("one   %lX\n", mrand48 ());
-+  printf ("two   %lX\n", mrand48 ());
-+  printf ("three %lX\n", mrand48 ());
- 
+diff --git a/test/sysenter.c b/test/sysenter.c
+index a8fa3a8..3d85916 100644
+--- a/test/sysenter.c
++++ b/test/sysenter.c
+@@ -11,11 +11,11 @@ int main() {
+   int i;
+   for (i=0; environ[i]; ++i) ;
+   for (x=(struct elf_aux*)(environ+i+1); x->type; ++x) {
+-    printf("%d %x\n",x->type,x->value);
++    printf("%ld %lx\n",x->type,x->value);
+     if (x->type==AT_PAGESZ)
+-      printf("pagesize %d\n",x->value);
++      printf("pagesize %ld\n",x->value);
+     else if (x->type==AT_SYSINFO)
+-      printf("vsyscall %p\n",x->value);
++      printf("vsyscall %p\n",(void *)x->value);
+   }
    return 0;
  }
-diff -up dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strftime.c
---- dietlibc-0.31.20080409/test/time/tst-strftime.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/time/tst-strftime.c	2008-04-14 00:41:17.000000000 +0200
+diff --git a/test/time/tst-strftime.c b/test/time/tst-strftime.c
+index e092e93..27db9a4 100644
+--- a/test/time/tst-strftime.c
++++ b/test/time/tst-strftime.c
 @@ -49,18 +49,18 @@ int main (void) {
  
        if (res == 0)
@@ -252,9 +396,10 @@
  
        free (buf);
      }
-diff -up dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite dietlibc-0.31.20080409/test/time/tst-strptime.c
---- dietlibc-0.31.20080409/test/time/tst-strptime.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/time/tst-strptime.c	2008-04-14 00:41:17.000000000 +0200
+diff --git a/test/time/tst-strptime.c b/test/time/tst-strptime.c
+index 6277ea6..2773180 100644
+--- a/test/time/tst-strptime.c
++++ b/test/time/tst-strptime.c
 @@ -41,10 +41,12 @@ static const struct
    { "C", "03/03/00", "%D", 5, 62, 2, 3 },
    { "C", "9/9/99", "%x", 4, 251, 8, 9 },
@@ -311,86 +456,6 @@
  	{
  	  printf ("not all of `%s' read\n", day_tests[i].input);
  	  result = 1;
-diff -up dietlibc-0.31.20080409/test/mktime.c.testsuite dietlibc-0.31.20080409/test/mktime.c
---- dietlibc-0.31.20080409/test/mktime.c.testsuite	2004-03-27 01:47:00.000000000 +0100
-+++ dietlibc-0.31.20080409/test/mktime.c	2008-04-14 00:41:17.000000000 +0200
-@@ -9,15 +9,15 @@ int main() {
-   t.tm_mday=29;
-   t.tm_mon=2;
-   t.tm_year=100;
--  printf("%d\n",mktime(&t));
-+  printf("%ld\n",(long)mktime(&t));
-   t.tm_mday=1;
-   t.tm_mon=3;
-   t.tm_year=102;
--  printf("%d\n",mktime(&t));
-+  printf("%ld\n",(long)mktime(&t));
-   t.tm_mday=1;
-   t.tm_mon=6;
-   t.tm_year=102;
--  printf("%d\n",mktime(&t));
-+  printf("%ld\n",(long)mktime(&t));
-   return 0;
- }
- 
-diff -up dietlibc-0.31.20080409/test/asprintf.c.testsuite dietlibc-0.31.20080409/test/asprintf.c
---- dietlibc-0.31.20080409/test/asprintf.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/asprintf.c	2008-04-14 00:41:17.000000000 +0200
-@@ -13,7 +13,7 @@ int main(int argc, char **argv) {
-  assert(strlen(path) == asprintlen);
- 	     
-  printf("%s\n", path);
-- asprintlen=asprintf(&path, "/proc" "/%d/stat", strlen(argv[1]));
-+ asprintlen=asprintf(&path, "/proc" "/%zu/stat", strlen(argv[1]));
-  assert(strlen(path) == asprintlen);
-  printf("%s\n", path);
- 
-diff -up /dev/null dietlibc-0.31.20080409/test/math.c
---- /dev/null	2008-03-18 07:40:22.289057188 +0100
-+++ dietlibc-0.31.20080409/test/math.c	2008-04-14 00:46:45.000000000 +0200
-@@ -0,0 +1,29 @@
-+#include <math.h>
-+#include <float.h>
-+#include <assert.h>
-+
-+int main()
-+{
-+  extern int __isinf(double d);
-+  extern int __isnan(double d);
-+
-+#if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))
-+  assert(__isinf(__builtin_inff())  == +1);
-+  assert(__isinf(-__builtin_inff()) == -1);
-+
-+  assert(__isinf(__builtin_inf())   == +1);
-+  assert(__isinf(-__builtin_inf())  == -1);
-+
-+  assert(__isnan(__builtin_nan("")));
-+#endif
-+
-+  assert(__isinf((DBL_MAX * DBL_MAX))  == +1);
-+  assert(__isinf(-(DBL_MAX * DBL_MAX)) == -1);
-+
-+  assert(isinf((DBL_MAX * DBL_MAX)));
-+  assert(isinf(-(DBL_MAX * DBL_MAX)));
-+
-+  //assert(isnan(nan("")));
-+
-+  return 0;
-+}
-diff -up dietlibc-0.31.20080409/test/speed.c.testsuite dietlibc-0.31.20080409/test/speed.c
---- dietlibc-0.31.20080409/test/speed.c.testsuite	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080409/test/speed.c	2008-04-14 00:41:17.000000000 +0200
-@@ -7,10 +7,10 @@ int main() {
-   int i;
-   time_t t;
-   
--  printf("%d\n", time(0));
-+  printf("%ld\n", (long)time(0));
-   for (i=0; i<10000000; ++i)
-     t=time(0);
- 
-- printf("%d\n", time(0));
-+  printf("%ld\n", (long)time(0));
-  return 0;   
- }
+-- 
+1.5.4.5
+

dietlibc-0.31.20080212-teststdout.patch:

Index: dietlibc-0.31.20080212-teststdout.patch
===================================================================
RCS file: /cvs/extras/rpms/dietlibc/F-9/dietlibc-0.31.20080212-teststdout.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dietlibc-0.31.20080212-teststdout.patch	13 Feb 2008 17:52:03 -0000	1.1
+++ dietlibc-0.31.20080212-teststdout.patch	21 Jun 2008 11:36:34 -0000	1.2
@@ -1,6 +1,21 @@
-diff -up dietlibc-0.31.20080212/test/atexit.c.~1~ dietlibc-0.31.20080212/test/atexit.c
---- dietlibc-0.31.20080212/test/atexit.c.~1~	2003-02-20 16:57:12.000000000 +0100
-+++ dietlibc-0.31.20080212/test/atexit.c	2008-02-13 18:34:12.000000000 +0100
+From b8de58754249c7f43c5959dc72c62e13851d45cb Mon Sep 17 00:00:00 2001
+From: Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+Date: Sat, 19 Apr 2008 17:45:11 +0200
+Subject: [PATCH] Use stdout instead of stderr in testsuite
+
+This patches uses stdout instead stderr when giving out normal status
+messages in the testsuite.
+---
+ test/atexit.c          |    2 +-
+ test/malloc-debugger.c |    2 +-
+ test/sendfile.c        |    2 +-
+ test/waitpid.c         |    2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/test/atexit.c b/test/atexit.c
+index 709a3e4..79ee392 100644
+--- a/test/atexit.c
++++ b/test/atexit.c
 @@ -2,7 +2,7 @@
  #include <unistd.h>
  
@@ -10,19 +25,10 @@
  }
  
  int main() {
-diff -up dietlibc-0.31.20080212/test/sendfile.c.~1~ dietlibc-0.31.20080212/test/sendfile.c
---- dietlibc-0.31.20080212/test/sendfile.c.~1~	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080212/test/sendfile.c	2008-02-13 18:35:34.000000000 +0100
-@@ -11,5 +11,5 @@ int main() {
- 
-   printf("sendfile returned %d\n",ret);
- 
--return 0;    
-+  return ret<0 ? 1 : 0;
- }
-diff -up dietlibc-0.31.20080212/test/malloc-debugger.c.~1~ dietlibc-0.31.20080212/test/malloc-debugger.c
---- dietlibc-0.31.20080212/test/malloc-debugger.c.~1~	2003-02-20 16:57:13.000000000 +0100
-+++ dietlibc-0.31.20080212/test/malloc-debugger.c	2008-02-13 18:34:27.000000000 +0100
+diff --git a/test/malloc-debugger.c b/test/malloc-debugger.c
+index 040196e..058807e 100644
+--- a/test/malloc-debugger.c
++++ b/test/malloc-debugger.c
 @@ -4,7 +4,7 @@
  int main() {
    char* c=malloc(13);
@@ -32,9 +38,21 @@
    c[0]=14;
  //  c[15]=0;
    tmp=realloc(c,12345);
-diff -up dietlibc-0.31.20080212/test/waitpid.c.~1~ dietlibc-0.31.20080212/test/waitpid.c
---- dietlibc-0.31.20080212/test/waitpid.c.~1~	2003-12-15 14:07:42.000000000 +0100
-+++ dietlibc-0.31.20080212/test/waitpid.c	2008-02-13 18:35:57.000000000 +0100
+diff --git a/test/sendfile.c b/test/sendfile.c
+index d43cdd2..28b3af5 100644
+--- a/test/sendfile.c
++++ b/test/sendfile.c
+@@ -11,5 +11,5 @@ int main() {
+ 
+   printf("sendfile returned %d\n",ret);
+ 
+-return 0;    
++  return ret<0 ? 1 : 0;
+ }
+diff --git a/test/waitpid.c b/test/waitpid.c
+index fe2cb5b..92c0b0e 100644
+--- a/test/waitpid.c
++++ b/test/waitpid.c
 @@ -11,7 +11,7 @@ int main() {
      perror("fork");
      _exit(1);
@@ -44,3 +62,6 @@
      sleep(1);
      _exit(23);
    }
+-- 
+1.5.4.5
+


--- dietlibc-0.31-stat64.patch DELETED ---




More information about the fedora-extras-commits mailing list