* Signal() Implementation
@ 2023-05-11 13:44 Firas Cheaib
2023-05-11 14:18 ` Joe Simmons-Talbott
0 siblings, 1 reply; 2+ messages in thread
From: Firas Cheaib @ 2023-05-11 13:44 UTC (permalink / raw)
To: libc-help
[-- Attachment #1: Type: text/plain, Size: 534 bytes --]
Under signal/signal.c the comment header states the following:
/* Set the handler for the signal SIG to HANDLER,
returning the old handler, or SIG_ERR on error. */
Yet the function doesn't return the old handler at any point, it only returns SIG_ERR.
Is my understanding correct? If so, is the comment wrong and should be corrected?
I understand that using signal() is to be avoided and I should use sigaction instead.
__sighandler_t
signal (int sig, __sighandler_t handler)
{
__set_errno (ENOSYS);
return SIG_ERR;}
Thanks,
-Firas
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Signal() Implementation
2023-05-11 13:44 Signal() Implementation Firas Cheaib
@ 2023-05-11 14:18 ` Joe Simmons-Talbott
0 siblings, 0 replies; 2+ messages in thread
From: Joe Simmons-Talbott @ 2023-05-11 14:18 UTC (permalink / raw)
To: Firas Cheaib; +Cc: libc-help
On Thu, May 11, 2023 at 01:44:48PM +0000, Firas Cheaib wrote:
> Under signal/signal.c the comment header states the following:
>
> /* Set the handler for the signal SIG to HANDLER,
> returning the old handler, or SIG_ERR on error. */
>
> Yet the function doesn't return the old handler at any point, it only returns SIG_ERR.
> Is my understanding correct? If so, is the comment wrong and should be corrected?
> I understand that using signal() is to be avoided and I should use sigaction instead.
>
> __sighandler_t
> signal (int sig, __sighandler_t handler)
> {
> __set_errno (ENOSYS);
> return SIG_ERR;}
This is a stub function the actual implementation is elsewhere. It
looks like it is __sysv_signal() in sysdeps/posix/sysv_signal.c. Both
have the same comment which seems to be a clue as to the requirements in
signal/signal.c
Thanks,
Joe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-11 14:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11 13:44 Signal() Implementation Firas Cheaib
2023-05-11 14:18 ` Joe Simmons-Talbott
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).