This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] attr.c in _STACK_GROWS_UP case.
- From: Carlos O'Donell <carlos at baldric dot uwo dot ca>
- To: libc-alpha <libc-alpha at sources dot redhat dot com>
- Date: Sun, 28 Dec 2003 18:15:54 -0500
- Subject: [PATCH] attr.c in _STACK_GROWS_UP case.
libc-alpha,
I posted a patch for this a while ago, though now I've trimmed it down
to a minimal change that works. Works on i386 and hppa.
This reverses the logic in linuxthreads for _STACK_GROWS_UP when scanning
the /proc/self/maps entries looking for the stack. In the _S_G_U case we
consume memory from "from" upward, in the _S_G_D case we move from "to"
downward.
c.
2003-12-28 Carlos O'Donell <carlos@baldric.uwo.ca>
* attr.c (pthread_getattr_np): Add _STACK_GROWS_UP case.
Index: linuxthreads/attr.c
===================================================================
RCS file: /cvs/glibc/libc/linuxthreads/attr.c,v
retrieving revision 1.33
diff -u -p -r1.33 attr.c
--- linuxthreads/attr.c 23 Sep 2003 06:12:59 -0000 1.33
+++ linuxthreads/attr.c 28 Dec 2003 23:14:15 -0000
@@ -455,12 +455,17 @@ int pthread_getattr_np (pthread_t thread
{
/* Found the entry. Now we have the info we need. */
attr->__stacksize = rl.rlim_cur;
+#ifndef _STACK_GROWS_UP
attr->__stackaddr = (void *) to;
/* The limit might be too high. This is a bogus
situation but try to avoid making it worse. */
if ((size_t) attr->__stacksize > (size_t) attr->__stackaddr)
attr->__stacksize = (size_t) attr->__stackaddr;
+#else
+ /* Don't check to enforce a limit on the __stacksize */
+ attr->__stackaddr = (void *) from;
+#endif
/* We succeed and no need to look further. */
ret = 0;