[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


Be Specific Signal Handling

The Posix interface for signal handling functions isn't as useful as it could be. The standard indicates that only a single argument (the signal number) is passed to the signal handler. It is useful to have more information and the BeOS provides two extra arguments.

BeOS specific signal defines:

Macro
Description
SIGHUP  
hang-up -- tty is gone!  
SIGQUIT  
quit' special character typed in tty  
SIGCHLD  
child process exited  
SIGPIPE  
write to a pipe w/no readers  
SIGKILL  
kill a team (not catchable)  
SIGSTOP  
suspend a thread (not catchable)  
SIGCONT  
continue execution if suspended  
SIGTSTP  
stop' special character typed in tty  
SIGALRM  
an alarm has gone off (see alarm())  
SIGTTIN  
read of tty from bg process  
SIGTTOU  
write to tty from bg process  
SIGUSR1  
app defined signal 1  
SIGUSR2  
app defined signal 2  
SIGKILLTHR  
be specific: kill just the thread, not team  

"BeOS signal function handling arguments," describes the pre-defined BeOS signal handling macros.

BeOS signal function handling arguments:

Macro
Description
sigemptyset  
Empty set  
sigfillset  
Fill set  
sigaddset  
Add set  
sigdelset  
Delete set  
sigismember  
Is a member  

For BeOS we declare the sa_handler field of the sigaction struct as type __signal_func_ptr. That means you'll need to cast any function you assign to the sa_handler field.


NOTE

C++ member functions can not be signal handlers (because they expect a "this" pointer as the first argument).

The 3 arguments that the BeOS provides to signal handlers are as follows:

The vregs struct contains the contents of the volatile registers at the time the signal was delivered to your thread. You can change the fields of the structure. After your signal handler completes, the OS uses this struct to reload the registers for your thread (privileged registers are not loaded of course). The vregs struct is of course terribly machine dependent and is guaranteed to change, potentially even between different models of the PowerPC family. If you use it, you should expect to have to re-work your code when new processors come out. Nonetheless the ability to change the registers does open some interesting programming possibilities.


  struct sigaction {    __signal_func_ptr sa_handler;
   sigset_t sa_mask;
   int sa_flags;
   void *sa_userdata;
   /*passed to the signal handler*/
  };
BeOS signal flags:

Macro
Description
SIG_NOCLDSTOP  
for sa_flags  
SIG_BLOCK  
defines for the how arg of sigprocmask()  
SIG_UNBLOCK  
Unblock  
SIG_SETMASK  
Set mask  


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000