Common signal handler system call

Bernd Petrovitsch bernd at petrovitsch.priv.at
Sat Mar 19 07:31:07 EDT 2011


On Sam, 2011-03-19 at 02:42 +0530, mohit verma wrote: 
> On Sat, Mar 19, 2011 at 2:00 AM, Manish Katiyar <mkatiyar at gmail.com>
> wrote:
>         On Fri, Mar 18, 2011 at 1:11 PM, mohit verma
>         <mohit89mlnc at gmail.com> wrote:
>         > Hi  folks,
>         > AFAIK there is not particular system call in Linux  systems
>         that can
>         > register a number of signals (signal numbers) at once and
>         provide a common
>         > signal handler for all of the assembled signals.
>         
>         
>         Did you try giving a common signal handler for two different
>         signals ? 
> Yes i did. 
>         
>         > I know doing this may be
>         > hardly required in practice.
>         
>         
>         Why not....for example... I want to print "quitting...." error
>         msg if
>         I get SIGINT or SIGQUIT. 

Call sigaction() two times ....

> Ok. i think these messages are for debugging purpose. But anyway let
>  it be common. :) 

That's the problem: It is not common. And if the set of signals is
probably different for all these cases.

What's the drawback of the current situation?
It you you have the (IMHO) uncommon situation where you want to use the
same signal handler for different signals, you can easily call
sigaction() for all of them separately and be done. This is usually done
one per application so there is no point in speeding it up.

And just adding one system-call to cope with a rarely used operation
which can easily be simulated with other existing ones is a waste of
time for development and RAM on each host.

>         > But i think this type of system call should be
>         > in Linux systems which can serve handler functionality on
>         some of signals.
>         > Please tell me the flaws proposing something like this. i
>         want to work on
>         > this tiny problem. :)

What is the semantic of an error?
At least one signal registration fails or all failed or some failed?

And what is the application expected to do if it actually failed (for
whatever reason).

But feel free to implement it and play around!

Bernd
-- 
Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
                     LUGA : http://www.luga.at




More information about the Kernelnewbies mailing list