This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
MIPS N64 RLIM_INFINITY fix
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: libc-ports at sourceware dot org
- Date: Fri, 26 May 2006 19:00:41 +0000 (UTC)
- Subject: MIPS N64 RLIM_INFINITY fix
The value of RLIM_INFINITY in sysdeps/unix/sysv/linux/mips/bits/resource.h
does not reflect that used by the kernel in N64 mode (0xffffffffffffffff).
The N32 and O32 syscalls, however, do use 0x7fffffff. This confuses N64
NPTL when computing the size of stack to allocate when run with unlimited
stack, since getrlimit returns a stack limit bigger than the incorrect
RLIM_INFINITY. (make 3.81 unlimits the stack, so "make check" run with
make 3.81 shows up the problem.)
In this patch, I made N64 use the correct value as used by the kernel. I
did not change the value used for 64-bit getrlimit for N32 or O32
(although I made it unsigned to match the rlim_t type); that value is
simply a glibc convention rather than anything seen by the kernel, so we
may as well stay compatible with existing O32 and N32 binaries built with
_FILE_OFFSET_BITS=64 and linked with the shared libc. N64 binaries that
care about RLIM_INFINITY are currently broken because of the
incompatibility with the kernel, so I don't think changing the value for
them is a problem.
2006-05-26 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/bits/resource.h (RLIM_INFINITY,
RLIM64_INFINITY): Define appropriately for N64. Use unsigned
types.
Index: sysdeps/unix/sysv/linux/mips/bits/resource.h
===================================================================
RCS file: /cvs/glibc/ports/sysdeps/unix/sysv/linux/mips/bits/resource.h,v
retrieving revision 1.9
diff -u -r1.9 resource.h
--- sysdeps/unix/sysv/linux/mips/bits/resource.h 28 Mar 2006 04:13:22 -0000 1.9
+++ sysdeps/unix/sysv/linux/mips/bits/resource.h 25 May 2006 16:59:53 -0000
@@ -107,14 +107,22 @@
};
/* Value to indicate that there is no limit. */
-#ifndef __USE_FILE_OFFSET64
-# define RLIM_INFINITY ((long int)(~0UL >> 1))
+#if _MIPS_SIM == _ABI64
+/* The N64 syscall uses this value. */
+# define RLIM_INFINITY 0xffffffffffffffffUL
+# ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0xffffffffffffffffUL
+# endif
#else
-# define RLIM_INFINITY 0x7fffffffffffffffLL
-#endif
-
-#ifdef __USE_LARGEFILE64
-# define RLIM64_INFINITY 0x7fffffffffffffffLL
+/* The O32 and N32 syscalls use 0x7fffffff. */
+# ifndef __USE_FILE_OFFSET64
+# define RLIM_INFINITY ((long int)(~0UL >> 1))
+# else
+# define RLIM_INFINITY 0x7fffffffffffffffULL
+# endif
+# ifdef __USE_LARGEFILE64
+# define RLIM64_INFINITY 0x7fffffffffffffffULL
+# endif
#endif
/* We can represent all limits. */
--
Joseph S. Myers
joseph@codesourcery.com