Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Carlos O'Donell <carlos@baldric.uwo.ca>
To: Jakub Jelinek <jakub@redhat.com>
Cc: libc-alpha <libc-alpha@sources.redhat.com>,
	parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] Re: [PATCH] _STACK_GROWS_UP fixes.
Date: Sat, 18 Oct 2003 18:55:47 -0400	[thread overview]
Message-ID: <20031018225547.GE8642@systemhalted> (raw)
In-Reply-To: <20031015053431.GE12344@sunsite.ms.mff.cuni.cz>

On Wed, Oct 15, 2003 at 07:34:31AM +0200, Jakub Jelinek wrote:
> On Sun, Oct 12, 2003 at 05:37:34PM -0400, Carlos O'Donell wrote:
> > 2003-10-06  Carlos O'Donell <carlos@baldric.uwo.ca>
> > 
> > 	* pthread.c (__pthread_self_stack): _STACK_GROWS_UP case added.
> > 	(__pthread_find_self): Likewise.
> > 	* manager.c (thread_segment): _STACK_GROWS_UP case added.
> 
> You need to look at linuxthreads/attr.c (__pthread_attr_getstack) too
> (the recent code which parses /proc/self/maps and finds stack VMA in there).

Jakub,

What do you think of something like this? Would it not also be valid to
do something like "to - from" for the _STACK_GROWS_DOWN case?

I'm building with this patch right now.

c.

---
2003-10-18  Carlos O'Donell  <carlos@baldric.uwo.ca>

	* attr.c (pthread_getattr_np): Add _STACK_GROWS_UP case when
	converting /proc/self/maps entry to __stackaddr and __stacksize.

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	18 Oct 2003 22:34:03 -0000
@@ -455,12 +455,19 @@ int pthread_getattr_np (pthread_t thread
 		{
 		  /* Found the entry.  Now we have the info we need.  */
 		  attr->__stacksize = rl.rlim_cur;
+#ifdef _STACK_GROWS_DOWN
 		  attr->__stackaddr = (void *) to;
-
+#else
+                  attr->__stackaddr = (void *) from;
+#endif
 		  /* 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)
+#ifdef _STACK_GROWS_DOWN
 		    attr->__stacksize = (size_t) attr->__stackaddr;
+#else
+                    attr->__stacksize = (size_t)(to - from);
+#endif
 
 		  /* We succeed and no need to look further.  */
 		  ret = 0;

  parent reply	other threads:[~2003-10-18 22:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-12 21:37 [parisc-linux] [PATCH] _STACK_GROWS_UP fixes Carlos O'Donell
2003-10-15  5:34 ` [parisc-linux] " Jakub Jelinek
2003-10-15  5:34 ` Jakub Jelinek
2003-10-15 16:40   ` Carlos O'Donell
2003-10-15 16:40   ` Carlos O'Donell
2003-10-18 22:55   ` Carlos O'Donell
2003-10-18 22:55   ` Carlos O'Donell [this message]
2003-10-15  5:53 ` Ulrich Drepper
2003-10-15  5:53 ` Ulrich Drepper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031018225547.GE8642@systemhalted \
    --to=carlos@baldric.uwo.ca \
    --cc=jakub@redhat.com \
    --cc=libc-alpha@sources.redhat.com \
    --cc=parisc-linux@lists.parisc-linux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox