Chaining signals

"Daniel." <[email protected]> Tue, 6 Sep 2016 15:35:06 -0300
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <CAF3SDA5U-JgzWPMww=yNjXkPeaLOvrTSr8HjchyZdj-LFqdreg@mail.gmail.com>
Hi everybody.

I'm dealing with a library that may be used by JNI/Java code. That
library setup some signals. The problem is that the JVM set some
signals too.

If the JVM signal handlers are setted before my, I want to be sure
that they are called after my handler. I'm using sigaction() function,
passing a static struct sigaction to the third parameter and in my
handler I call oldsigaction.sa_sigaction(1th, 2th, 3th) where 1th 2th
and 3th are the parameters that my handler received? Is that right!?
Is that safe? Here is some sample code:

PS: Doesn't take the backtrace stuff too serious, remember is just an
example, focus on sigaction calling.

http://pastebin.com/ejmYM4T6

The other option is, if my handler is setted after JVM's handler, so
that I need to be sure that JVM will chain its signals to me. I'm
willing to use libjsig.so as said here:
http://www.oracle.com/technetwork/java/javase/signals-139944.html


-- 
"Do or do not. There is no try"
  Yoda Master