[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sigaltstack and pthreads



Ok, so I looked at the source and it says:

 * The "undefined behaviour" in this implementation is thus:
 * o if ss is *not* null return -1 with errno set to EINVAL
 * o if oss is *not* null fill it in with information about the
 *   current stack and return 0.

Sorry about the noise, though it doesn't help me.

On Fri, Mar 24, 2006 at 09:27:03PM +0100, Jon Olsson wrote:
> While porting erlang and HiPE (High Performance Erlang) I found this
> simple test case, that doesn't work when compiled with -pthread:
> 
> #include <sys/types.h>
> #include <signal.h>
> #include <err.h>
> 
> int main(int argc, char **argv) {
>     static unsigned long my_sigstack[SIGSTKSZ/sizeof(long)];
>     struct sigaltstack ss;
> 
>     ss.ss_sp    = &my_sigstack[0];
>     ss.ss_flags = SS_ONSTACK;
>     ss.ss_size  = sizeof(my_sigstack);
>     if(sigaltstack(&ss, NULL) < 0)
>         errx(1, "sigaltstack");
> }
> 
> 
> gonzo% gcc -pthread test.c   
> gonzo% ./a.out 
> a.out: sigaltstack
> gonzo% gcc  test.c        
> gonzo% ./a.out