Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
sigaltstack(2)		      System Calls Manual		sigaltstack(2)

       sigaltstack - set and/or	get signal alternate stack context.

       The function allows a process to	define and examine the state of	an al-
       ternate stack for signal	handlers. Signals that	have  been  explicitly
       declared	to execute on the alternate stack will be delivered on the al-
       ternate stack.

       If ss is	not a null pointer, it points to a  structure  that  specifies
       the  alternate  signal stack that will take effect upon return from The
       ss_flags	member specifies the new stack state. If  it  is  set  to  the
       stack  is  disabled  and	 ss_sp	and ss_size are	ignored. Otherwise the
       stack will be enabled, and the ss_sp and	ss_size	 members  specify  the
       new address and size of the stack.

       The  range  of  addresses  starting  at	ss_sp, up to but not including
       ss_sp+ss_size, is  available to	the  implementation  for  use  as  the
       stack.  This  interface makes no	assumptions regarding which end	is the
       stack base and in which direction the stack grows as items are pushed.

       If oss is not a null pointer, on	successful completion it will point to
       a  structure  that specifies the	alternate signal stack that was	in ef-
       fect prior to the call to The ss_sp and ss_size members specify the ad-
       dress and size of that stack. The ss_flags member specifies the stack's
       state, and may contain one of the following values:

	      SS_ONSTACK	       The process is currently	 executing  on
				       the  alternate  signal stack.  Attempts
				       to modify the  alternate	 signal	 stack
				       while  the  process  is executing on it
				       fails. This flag	must not  be  modified
				       by processes.

	      SS_DISABLE	       The alternate signal stack is currently

       The value is a system default specifying	the number of bytes that would
       be  used	 to cover the usual case when manually allocating an alternate
       stack area. The value is	defined	to be the minimum  stack  size	for  a
       signal handler.	In computing an	alternate stack	size, a	program	should
       add that	amount to its stack requirements to allow for the  system  im-
       plementation overhead. The constants and	are defined in

       After a successful call to one of the functions,	there are no alternate
       signal stacks in	the new	process	image.

       Upon successful completion, returns 0. Otherwise,  it  returns  -1  and
       sets to indicate	the error.

       The function will fail if:

	      [EINVAL]		       The  ss argument	is not a null pointer,
				       and the ss_flags	member pointed	to  by
				       ss contains flags other than

	      [ENOMEM]		       The size	of the alternate stack area is
				       less than

	      [EPERM]		       An attempt was made to modify an	active

       At HP-UX	release	11i Version 1.6	and forward, use of in threads created
       with process contention scope will result in undefined behavior.	  This
       function	 will  continue	 to be reliable	in threads created with	system
       contention scope.

       The following code fragment illustrates a method	for allocating	memory
       for an alternate	stack:

       In  some	implementations, a signal (whether or not indicated to execute
       on the alternate	stack) will always execute on the alternate  stack  if
       it  is  delivered while another signal is being caught using the	alter-
       nate stack.

       On some implementations,	 stack	space  is  automatically  extended  as
       needed.	On those implementations, automatic extension is typically not
       available for an	alternate stack. If the	stack overflows, the  behavior
       is undefined.

   Threads Considerations
       Each thread may define an alternate signal handling stack.

   LWP (Light Weight Processes)	Considerations
       Each LWP	may define an alternate	signal handling	stack.

       sigaction(2), setjmp(3C), <signal.h>.

       First released in Issue 4, Version 2.



Want to link to this manual page? Use this URL:

home | help