-1

APUE says

What happens if more than one signal is ready to be delivered to a process? POSIX.1 does not specify the order in which the signals are delivered to the process. The Rationale for POSIX.1 does suggest, however, that signals related to the current state of the process be delivered before other signals. (SIGSEGV is one such signal.)

How is SIGSEGV an example of "signals related to the current state of the process be delivered before other signals"?

Thanks.

closed as unclear what you're asking by Stephen Harris, icarus, Rui F Ribeiro, Volker Siegel, msp9011 Dec 27 '18 at 6:35

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

3

SEGV is usually delivered when the state of a process is corrupt (memory is not mapped where it should be or is mapped with different permissions than expected, the program logic is trying to access memory that it shouldn't be accessing, etc).

In that case, it helps to dump core and die as soon as possible so that subsequent changes don't mess up everything further and render any post-mortem debugging futile.

  • Thanks. The question is how SIGSEGV is an example of "What happens if more than one signal is ready to be delivered to a process?" – Tim Dec 25 '18 at 19:16
  • 1
    @Tim I think you misquoted your own question. – undercat Dec 25 '18 at 19:34
  • Well you could just try it. Run sh -c 'echo $$; read f' in a terminal, stop it with ^Z, attach to it with strace -p <echoed pid>, and then from another window run kill -HUP <pid>; kill -INT <pid>; kill -SEGV <pid>; kill -CONT <pid> and see which of INT, HUP or SEGV will get it first. Does this make it an example? – Uncle Billy Dec 25 '18 at 19:50
  • @Tim. In case it isn't clear, SEGV will always be delivered before HUP, INT or WINCH, if all of them are pending. This is an example of ""signals related to the current state of the process (SEGV, BUS, ILL) be delivered before other signals (USR1, WINCH, INT, etc)" – Uncle Billy Dec 25 '18 at 20:19
  • Thanks. What are the reason and purpose that SEGV will always be delivered before HUP, INT or WINCH? – Tim Dec 26 '18 at 14:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.