Re: [PATCH 1/2] sigaltstack: implement SS_AUTODISARM flag

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

 



05.03.2016 10:39, Stas Sergeev пишет:
05.03.2016 01:22, Andy Lutomirski пишет:
On Mon, Feb 29, 2016 at 1:29 PM, Stas Sergeev <stsp@xxxxxxx> wrote:
This patch implements the SS_AUTODISARM flag that can be ORed with
SS_ONSTACK when forming ss_flags.
When this flag is set, sigaltstack will be disabled when entering
the signal handler; more precisely, after saving sas to uc_stack.
When leaving the signal handler, the sigaltstack is restored by
uc_stack.
When this flag is used, it is safe to switch from sighandler with
swapcontext(). Without this flag, the subsequent signal will corrupt
the state of the switched-away sighandler.

This looks reasonable to me with one exception: how does a user
program detect the presence of this feature?
Compile-time detection:
#ifdef SS_AUTODISARM
  # I have this feature
  ...
#endif

Run-time detection:
int err = sigaltstack(SS_ONSTACK | SS_AUTODISARM);
if (err == EINVAL) {
I guess I mean here
if (err && errno == EINVAL)
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux