MINSIGSTKSZ and PTHREAD_STACK_MIN

David Xu davidxu at freebsd.org
Fri Jan 16 17:26:18 PST 2004


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.

David Xu




More information about the freebsd-threads mailing list