* [LTP] question about signal handling in tst_sig()
@ 2016-03-14 8:19 Han Pingtian
2016-03-14 13:28 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Han Pingtian @ 2016-03-14 8:19 UTC (permalink / raw)
To: ltp
Hi there,
Looks like in tst_sig(), if _SC_SIGRT_MIN defined, all realtime signals
won't be set an handler:
125 #ifdef _SC_SIGRT_MIN
126 if (sig >= sigrtmin && sig <= sigrtmax)
127 continue;
128 #endif
but, if it wasn't defined, then all realtime signals will be set an
handler:
134 #if !defined(_SC_SIGRT_MIN) && defined(__SIGRTMIN) &&
defined(__SIGRTMAX)
135 /* Ignore all real-time signals */
136 case __SIGRTMIN:
137 case __SIGRTMIN + 1:
...
is that correct, or I missed something here?
Thanks in advance!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] question about signal handling in tst_sig()
2016-03-14 8:19 [LTP] question about signal handling in tst_sig() Han Pingtian
@ 2016-03-14 13:28 ` Cyril Hrubis
2016-03-14 13:43 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2016-03-14 13:28 UTC (permalink / raw)
To: ltp
Hi!
> Looks like in tst_sig(), if _SC_SIGRT_MIN defined, all realtime signals
> won't be set an handler:
>
> 125 #ifdef _SC_SIGRT_MIN
> 126 if (sig >= sigrtmin && sig <= sigrtmax)
> 127 continue;
> 128 #endif
>
> but, if it wasn't defined, then all realtime signals will be set an
> handler:
>
> 134 #if !defined(_SC_SIGRT_MIN) && defined(__SIGRTMIN) &&
> defined(__SIGRTMAX)
> 135 /* Ignore all real-time signals */
> 136 case __SIGRTMIN:
> 137 case __SIGRTMIN + 1:
> ...
>
> is that correct, or I missed something here?
The loop goes over signal numbers from 1 to NSIG (which is defined in
system headers). Supposedly when _SC_SIGRT_MIN is not defined the system
does not support realtime signals and the NSIG has value of the highest
allocated (non-realtime) signal number.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] question about signal handling in tst_sig()
2016-03-14 13:28 ` Cyril Hrubis
@ 2016-03-14 13:43 ` Cyril Hrubis
2016-03-15 1:28 ` Han Pingtian
0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2016-03-14 13:43 UTC (permalink / raw)
To: ltp
Hi!
> > Looks like in tst_sig(), if _SC_SIGRT_MIN defined, all realtime signals
> > won't be set an handler:
> >
> > 125 #ifdef _SC_SIGRT_MIN
> > 126 if (sig >= sigrtmin && sig <= sigrtmax)
> > 127 continue;
> > 128 #endif
> >
> > but, if it wasn't defined, then all realtime signals will be set an
> > handler:
> >
> > 134 #if !defined(_SC_SIGRT_MIN) && defined(__SIGRTMIN) &&
> > defined(__SIGRTMAX)
> > 135 /* Ignore all real-time signals */
> > 136 case __SIGRTMIN:
> > 137 case __SIGRTMIN + 1:
> > ...
And also there is a break down after the long list of cases.
So it looks like:
* if _SC_SIGRT_MIN is defined we have a POSIX compilant system
and we skip realtime signals in the if at line 125.
* Otherwise if system is not POSIX compilant but __SIGRTMIN and
__SIGRTMAX is defined, we skip them in the hack in the switch()
this is possibly workaround for old glibc without _SC_SIGRT_MIN
support
> > is that correct, or I missed something here?
>
> The loop goes over signal numbers from 1 to NSIG (which is defined in
> system headers). Supposedly when _SC_SIGRT_MIN is not defined the system
> does not support realtime signals and the NSIG has value of the highest
> allocated (non-realtime) signal number.
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
> --
> Mailing list info: http://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] question about signal handling in tst_sig()
2016-03-14 13:43 ` Cyril Hrubis
@ 2016-03-15 1:28 ` Han Pingtian
0 siblings, 0 replies; 4+ messages in thread
From: Han Pingtian @ 2016-03-15 1:28 UTC (permalink / raw)
To: ltp
On Mon, Mar 14, 2016 at 02:43:21PM +0100, Cyril Hrubis wrote:
> Hi!
> > > Looks like in tst_sig(), if _SC_SIGRT_MIN defined, all realtime signals
> > > won't be set an handler:
> > >
> > > 125 #ifdef _SC_SIGRT_MIN
> > > 126 if (sig >= sigrtmin && sig <= sigrtmax)
> > > 127 continue;
> > > 128 #endif
> > >
> > > but, if it wasn't defined, then all realtime signals will be set an
> > > handler:
> > >
> > > 134 #if !defined(_SC_SIGRT_MIN) && defined(__SIGRTMIN) &&
> > > defined(__SIGRTMAX)
> > > 135 /* Ignore all real-time signals */
> > > 136 case __SIGRTMIN:
> > > 137 case __SIGRTMIN + 1:
> > > ...
>
> And also there is a break down after the long list of cases.
>
>
> So it looks like:
>
> * if _SC_SIGRT_MIN is defined we have a POSIX compilant system
> and we skip realtime signals in the if at line 125.
>
> * Otherwise if system is not POSIX compilant but __SIGRTMIN and
> __SIGRTMAX is defined, we skip them in the hack in the switch()
>
Thanks so much, I just noticed that there is a "break;" at line 206 ...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-15 1:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-14 8:19 [LTP] question about signal handling in tst_sig() Han Pingtian
2016-03-14 13:28 ` Cyril Hrubis
2016-03-14 13:43 ` Cyril Hrubis
2016-03-15 1:28 ` Han Pingtian
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.