Re: SA_RESETHAND questions

2016-11-04 Thread Geoff Clare
FELLIN, JEFF K (JEFF)  wrote, on 04 Nov 2016:
>
> I'm trying to verify my understanding of the signal specifications.
> 
> On the signal.h man page SA_RESETHAND is defined as:
> Causes signal dispositions to be set to SIG_DFL on entry to signal handlers
> On the sigaction() man page action of SA_RESETHAND is defined:
> If set, the disposition of the signal shall be reset to SIG_DFL and the 
> SA_SIGINFO flag shall be cleared on entry to the signal handler.
> 
> My questions are:
> 
> 1) When using a signal handler defined by sa_handler should signal(2) 
> return SIG_DFL for the old signal value?
> 
> 2) When using a signal handler defined by sa_handler or sa_sigaction 
> should the signal handler value returned  in oact by the call sigaction(sig, 
> NULL, ) be set to SIG_DFL?
> 
> 3) When using a handler defined by sa_sigaction should the sa_flags value 
> returned in oact by the call: sigaction(sig, NULL, ) not have SA_SIGINFO 
> set?
> 

The answer to all three is "Yes, except for SIGILL and SIGTRAP".

> My tests on different versions of UNIX indicate
> 
> 1) SIG_DFL is not always set on entry to signal handlers when the 
> SA_RESETHAND flag is set via sigaction(2)
> 

If the cases where it was not set were SIGILL and SIGTRAP, that's what
the standard requires.  Otherwise, it's a non-conformance of the systems
you tested.  There should not be any certified systems that don't conform
here, as this is covered by the test suites.

> 2) The SA_SIGINFO flag is not cleared when returned by sigaction(2) when 
> used in the signal handler.
> 

Again, this is expected for SIGILL and SIGTRAP, but is a non-conformance
in other cases.  It's possible that some certified systems might not
conform, because there was a bug in the test for this, which I only fixed
back in May of this year. (I assumed that what prompted me to fix the bug
was a discussion on this mailing list, but if so, I can't find it in my
archive.)

-- 
Geoff Clare 
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England



SA_RESETHAND questions

2016-11-04 Thread FELLIN, JEFF K (JEFF)
I'm trying to verify my understanding of the signal specifications.

On the signal.h man page SA_RESETHAND is defined as:
Causes signal dispositions to be set to SIG_DFL on entry to signal handlers
On the sigaction() man page action of SA_RESETHAND is defined:
If set, the disposition of the signal shall be reset to SIG_DFL and the 
SA_SIGINFO flag shall be cleared on entry to the signal handler.

My questions are:

1) When using a signal handler defined by sa_handler should signal(2) 
return SIG_DFL for the old signal value?

2) When using a signal handler defined by sa_handler or sa_sigaction should 
the signal handler value returned  in oact by the call sigaction(sig, NULL, 
) be set to SIG_DFL?

3) When using a handler defined by sa_sigaction should the sa_flags value 
returned in oact by the call: sigaction(sig, NULL, ) not have SA_SIGINFO 
set?

My tests on different versions of UNIX indicate

1) SIG_DFL is not always set on entry to signal handlers when the 
SA_RESETHAND flag is set via sigaction(2)

2) The SA_SIGINFO flag is not cleared when returned by sigaction(2) when 
used in the signal handler.

Thank you for clarifying my understanding of the specification.