All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] [PATCH] Do not overwrite pre-existing SIGDEBUG handler in xeno_skin_bind
@ 2013-03-13 14:53 Jan Kiszka
  2013-03-13 20:53 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2013-03-13 14:53 UTC (permalink / raw)
  To: Xenomai

In case the application already set a SIGDEBUG handler, let that one
handle any potential SIGDEBUG_NOMLOCK events and keep our handler
(xeno_handle_mlock_alert) out of the loop. This helps in scenarios where
skin libraries are loaded belatedly via dlopen.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Anything that speaks against this? We ran into that issue with a large
application, and that can be one way to solve but should even make
sense in general.

 include/asm-generic/bits/bind.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/bits/bind.h b/include/asm-generic/bits/bind.h
index 269be95..f39c853 100644
--- a/include/asm-generic/bits/bind.h
+++ b/include/asm-generic/bits/bind.h
@@ -23,6 +23,11 @@ xeno_bind_skin(unsigned skin_magic, const char *skin, const char *module)
 		exit(EXIT_FAILURE);
 	}
 
+	/* do not overwrite an already installed SIGDEBUG handler */
+	sigaction(SIGXCPU, NULL, &sa);
+	if (sa.sa_handler != SIG_DFL)
+		return muxid;
+
 	sa.sa_sigaction = xeno_handle_mlock_alert;
 	sigemptyset(&sa.sa_mask);
 	sa.sa_flags = SA_SIGINFO;
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Xenomai] [PATCH] Do not overwrite pre-existing SIGDEBUG handler in xeno_skin_bind
  2013-03-13 14:53 [Xenomai] [PATCH] Do not overwrite pre-existing SIGDEBUG handler in xeno_skin_bind Jan Kiszka
@ 2013-03-13 20:53 ` Gilles Chanteperdrix
  2013-03-14 12:09   ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Gilles Chanteperdrix @ 2013-03-13 20:53 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai

On 03/13/2013 03:53 PM, Jan Kiszka wrote:

> In case the application already set a SIGDEBUG handler, let that one
> handle any potential SIGDEBUG_NOMLOCK events and keep our handler
> (xeno_handle_mlock_alert) out of the loop. This helps in scenarios where
> skin libraries are loaded belatedly via dlopen.


Another option would be to save the previous handler, and call it when
we detect the signal is not due to an mlock alert.

-- 
                                                                Gilles.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai] [PATCH] Do not overwrite pre-existing SIGDEBUG handler in xeno_skin_bind
  2013-03-13 20:53 ` Gilles Chanteperdrix
@ 2013-03-14 12:09   ` Jan Kiszka
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2013-03-14 12:09 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai

On 2013-03-13 21:53, Gilles Chanteperdrix wrote:
> On 03/13/2013 03:53 PM, Jan Kiszka wrote:
> 
>> In case the application already set a SIGDEBUG handler, let that one
>> handle any potential SIGDEBUG_NOMLOCK events and keep our handler
>> (xeno_handle_mlock_alert) out of the loop. This helps in scenarios where
>> skin libraries are loaded belatedly via dlopen.
> 
> 
> Another option would be to save the previous handler, and call it when
> we detect the signal is not due to an mlock alert.

I've no preference. Pushed that variant now into my queue.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-14 12:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13 14:53 [Xenomai] [PATCH] Do not overwrite pre-existing SIGDEBUG handler in xeno_skin_bind Jan Kiszka
2013-03-13 20:53 ` Gilles Chanteperdrix
2013-03-14 12:09   ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.