Re: [PATCH] Replace error prone signal() with sigaction()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 8 Feb 2022 09:52:03 +0100
Paul Menzel <pmenzel@xxxxxxxxxxxxx> wrote:

> Dear Lukasz,
> 
> 
> Am 08.02.22 um 16:29 schrieb Lukasz Florczak:
> > Up to this date signal() was used which is deprecated [1].
> > Sigaction() call is preferred. This commit introduces replacement
> > from signal() to sigaction() by the use of signal_s() wrapper.
> > Also remove redundant signal.h header includes.
> 
> signal(2) also says:
> 
> >        * By  default, in glibc 2 and later, the signal() wrapper
> > function does not invoke the kernel system call.  Instead,  it
> > calls  sigaction(2) using flags that supply BSD semantics.  This
> > default behavior is pro‐ vided  as  long  as  a  suitable  feature
> > test  macro  is   defined: _BSD_SOURCE  on  glibc  2.19  and
> > earlier or _DEFAULT_SOURCE in glibc 2.19 and later.  (By default,
> > these  macros  are  defined;  see  fea‐ ture_test_macros(7)  for
> > details.)   If such a feature test macro is not defined, then
> > signal() provides System V semantics.
> 
> Does that mean, it should still be replaced?
Hi Paul,

Both ways are correct. signal() is not deprecated but the behavior may
vary. It can be avoided by sigaction(), so it is better to use
sigaction() then. Do you agree?

Thanks,
Mariusz




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux