Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jan 2004 21:02:14 -0500 (EST)
From:      Daniel Eischen <eischen@vigrid.com>
To:        David Xu <davidxu@freebsd.org>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: MINSIGSTKSZ and PTHREAD_STACK_MIN 
Message-ID:  <Pine.GSO.4.10.10401162100350.19917-100000@pcnet5.pcnet.com>
In-Reply-To: <40088F27.90609@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 17 Jan 2004, David Xu wrote:

> There is a conflict between MINSIGSTKSZ and PTHREAD_STACK_MIN,
> PTHREAD_STACK_MIN defined in pthread.h has a fixed value 1024,
> MINSIGSTKSZ is variable on per-architecture, on i386,  it is defined in
> sys/i386/include/signal.h:
> #define      MINSIGSTKSZ     (512 * 4)
> so on i386, makecontext is failed when user specifies PTHREAD_STACK_MIN
> for new thread,  result is we get following message in libkse:
> 
> Fatal error 'Thread has returned from _thread_switch' at line 1099 in file
>  /usr/home/davidxu/src/lib/libpthread/thread/thr_kern.c (errno = 0)
> 
> This becauses context is not fully initialized in pthread_create.
> 
> Either makecontext shouldn't check stacksize or we should synchoronize
> MINSIGSTKSZ and PTHREAD_STACK_MIN.

I think PTHREAD_STACK_MIN should also be per-architecture and be
>= MINSIGSTKSZ (otherwise threads wouldn't have enough stack to
handle signals).

-- 
Dan Eischen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10401162100350.19917-100000>