I know how to catch the it using Signal.trap, the thing is that
I want to perform different action based on which process sent
the signal.
Not currently...
I know that in C there's a way to do it.
Maybe SA_SIGACTION is common enough nowadays that Ruby can use it;
at least for POSIX systems.
However it's still racy: there's the unlikely case where the original
sending PID could die and be recycled by a new process by the time the
receiver receives a signal (consider the receiver is suspended or
otherwise blocked for a while).
I know how to catch the it using Signal.trap, the thing is that
I want to perform different action based on which process sent
the signal.
In my case there's no relation between sender and receiver process
(they are not in parent-child relation).
I know that in C there's a way to do it.
I know of no way under Linux. When you intercept the signal (see man
signal) the function you provide just receives the signal type -
nothing else.
If you know a way under C/Posix I'd be curious to know about it.
Carlo
···
Subject: Upon receiving a signal, is it possible to know the PID of the sender?
Date: mer 01 lug 15 11:15:00 +0200
--
* Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
* di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
In any case in my particular set-up I think I'm safe cause I know how
the real sender will behave upon a USR2 signal.
thanks
···
On Wed, Jul 1, 2015 at 11:37 AM, Eric Wong <normalperson@yhbt.net> wrote:
"sickpig@gmail.com" <sickpig@gmail.com> wrote:
I know how to catch the it using Signal.trap, the thing is that
I want to perform different action based on which process sent
the signal.
Not currently...
I know that in C there's a way to do it.
Maybe SA_SIGACTION is common enough nowadays that Ruby can use it;
at least for POSIX systems.
However it's still racy: there's the unlikely case where the original
sending PID could die and be recycled by a new process by the time the
receiver receives a signal (consider the receiver is suspended or
otherwise blocked for a while).