Hello everybody! I have a small doubt about signals which hope can find an answer here! What I need is just a confirmation or denial of my understanding of what follows...

In general, when we define a signal handler, we have to declare the function as:

Code:
void sig_hand(int signo)
{
}
and register the function for a given signal using the following statement:

Code:
struct sigaction sa={sa_handler=sig_hand}
sigaction(SIGUSR1,&sa,0); //example for SIGUSR1
This means that every time a registered signal is received by the process who executed the sigaction, sig_hand is executed and after that the control is given back to the process' code. If I want the process to behave in a certain way according to the signal received (Eg SIGUSR1 or SIGUSR2) I have to embed the behaviour directly in the sig_hand, isn't it?
In general, a process can be aware of the signal it received only by means of the handler function, isn't it?
For example, if a process is designed as receiver of several differen signals and I want it to print "I received a SIGXXX" every time it gets a signal, the only solution I can see is to embed the printf in the various sig_handXXX...
In the case of 2 clone processes (with roles signal sender and receiver) another possibility I considered was to use a volatile int global variabile which is set with the signo and then checked by the receiving clone, but this would not work in the case of multiple sender/receivers...
Are there other/better ways to face the problem?

Thanks!
bye