Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Dec 1996 20:46:54 -0700 (MST)
From:      Don Yuniskis <dgy@rtd.com>
To:        freebsd-hackers@freefall.FreeBSD.org (FreeBSD hackers), freebsd-ports@freefall.FreeBSD.org (FreeBSD ports)
Subject:   signal stack?
Message-ID:  <199612080346.UAA00214@seagull.rtd.com>

next in thread | raw e-mail | index | archive | help
Greetings!
     I'm digging through the gcl port and a bit stumped by
the role of sigaltstack(2) and the mechanisms by which the
stack is created and manipulated.  Some annotated code fragments...

     double estack_buf[SIG_STACK_SIZE];
Presumably, this is the actual stack space.  Apparently, it is
defined as an array of doubles (instead of chars) to force
alignment on 8 byte boundaries (or so the commentary indicates)?

     static sigaltstack estack;
     estack.ss_sp = estack_buf;
Aside from adding a cast to (char *) to silence pointer warning, why do
ports for *other* OS's (e.g., NetBSD) explicitly reference the *end* of the
"stack" in this assignment?  (e.g., &estack_buf[SIG_STACK_SIZE-1])
The sigaltstack(2) man page seems to imply that this is unnecessary.
Perhaps stacks are handled in a more rudimentary form in some of these
other ports?

     estack.ss_size = SIGSTKSZ;
Shouldn't this be sizeof(estack_buf)?  Or, SIGSTKSZ * sizeof(double)
as a hack...?

     estack.ss_flags = 0;
     if (sigaltstack(&estack, (struct sigaltstack *)0) < 0)...

Sorry if these seem like no-brainers.  Maybe Santa will bring
me a brain for XMAS!  :>

Thanx!
--don



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612080346.UAA00214>