Re: OT: Windows (Was: Re: Open Source does not mean easily

Liste des Groupes 
Sujet : Re: OT: Windows (Was: Re: Open Source does not mean easily
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.unix.programmer
Date : 06. Jan 2025, 18:42:48
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vlh4mo$1nccc$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Mozilla Thunderbird
On 1/6/25 11:46, Scott Lurndal wrote:
Muttley@DastardlyHQ.org writes:
...
Unix signals should only be used to set flags that are then read later.
 
You're opinion is not widely shared.   Note that the POSIX specification
carefully notes which interfaces are not signal-safe.

What precisely does "signal-safe" mean? As I understand it, it is
supposed to be safe for a signal to interrupt standard library routines,
but that it's not safe for a signal handler to call most of those
functions. There's just a few exceptions, described below.

The C standard says the following about signal handlers:
"The functions in the standard library are not guaranteed to be
reentrant and may modify objects with static or thread storage duration.
239)" (7.1.4p4)
Footnote 239 says "Thus, a signal handler cannot, in general, call
standard library functions."

"If the signal occurs other than as the result of calling the abort or
raise function, the behavior is undefined if the signal handler refers
to any object with static or thread storage duration that is not a
lock-free atomic object and that is not declared with the constexpr
storage-class specifier other than by assigning a value to an object
declared as volatile sig_atomic_t, or the signal handler calls any
function in the standard library other than
— the abort function,
— the _Exit function,
— the quick_exit function,
— the functions in <stdatomic.h> (except where explicitly stated
otherwise) when the atomic arguments are lock-free,
— the atomic_is_lock_free function with any atomic argument, or
— the signal function with the first argument equal to the signal number
corresponding to the signal that caused the invocation of the handler.
Furthermore, if such a call to the signal function results in a SIG_ERR
return, the object designated by errno has an indeterminate
representation.310)" (7.14.1.1p5)
Footnote 310 says "If any signal is generated by an asynchronous signal
handler, the behavior is undefined."

"If a signal occurs other than as the result of calling the abort or
raise functions, the behavior is undefined if the signal handler reads
or modifies an atomic object that has an indeterminate representation."
(7.17.2p2)

"If a signal occurs other than as the result of calling the abort or
raise functions, the behavior is undefined if the signal handler calls
the atomic_init generic function." (7.17.2.1p4)

The POSIX standard claims that its version of <signal.h> conforms to the
C standard, and as far as I can see, the POSIX standard doesn't say
anything to define the behavior that is undefined by the C standard.

Could you demonstrate how, within the above restrictions, a signal
handler that doesn't cause the program to exit in one fashion or another
could do anything useful other than "set flags that are read later"?
I'm not saying it cannot be done. I claim no expertise in this kind of
programming - I never needed to write signal handlers. However, the last
time I considered the matter carefully (which was two or three versions
of the C standard ago) I couldn't figure out how to do much more than
that. At that time I did not consider how POSIX affects the issue, and I
don't know enough about POSIX signals to evaluate that issue.

Date Sujet#  Auteur
30 Sep 24 * Re: Command Languages Versus Programming Languages335Bozo User
30 Sep 24 +* Re: Command Languages Versus Programming Languages5Lawrence D'Oliveiro
1 Oct 24 i`* Re: Command Languages Versus Programming Languages4usuario
2 Oct 24 i `* Re: Command Languages Versus Programming Languages3Muttley
2 Oct 24 i  `* Re: Command Languages Versus Programming Languages2usuario
2 Oct 24 i   `- Re: Command Languages Versus Programming Languages1Muttley
9 Oct 24 `* Re: Command Languages Versus Programming Languages329Rainer Weikusat
10 Oct 24  `* Re: Command Languages Versus Programming Languages328Muttley
10 Oct 24   +* Re: Command Languages Versus Programming Languages87Rainer Weikusat
10 Oct 24   i+* Re: Command Languages Versus Programming Languages76Muttley
10 Oct 24   ii+* Re: Command Languages Versus Programming Languages74Rainer Weikusat
10 Oct 24   iii+* Re: Command Languages Versus Programming Languages69Kaz Kylheku
10 Oct 24   iiii`* Re: Command Languages Versus Programming Languages68Rainer Weikusat
11 Oct 24   iiii `* Re: Command Languages Versus Programming Languages67Bart
11 Oct 24   iiii  `* Re: Command Languages Versus Programming Languages66Rainer Weikusat
11 Oct 24   iiii   `* Re: Command Languages Versus Programming Languages65Muttley
11 Oct 24   iiii    +* Re: Command Languages Versus Programming Languages52Dan Cross
11 Oct 24   iiii    i`* Re: Command Languages Versus Programming Languages51Muttley
11 Oct 24   iiii    i +* Re: Command Languages Versus Programming Languages47Dan Cross
12 Oct 24   iiii    i i`* Re: Command Languages Versus Programming Languages46Muttley
12 Oct 24   iiii    i i `* Re: Command Languages Versus Programming Languages45Dan Cross
12 Oct 24   iiii    i i  `* Re: Command Languages Versus Programming Languages44Muttley
12 Oct 24   iiii    i i   +- Re: Command Languages Versus Programming Languages1Muttley
12 Oct 24   iiii    i i   `* Re: Command Languages Versus Programming Languages42Dan Cross
13 Oct 24   iiii    i i    `* Re: Command Languages Versus Programming Languages41Muttley
13 Oct 24   iiii    i i     +* Re: Command Languages Versus Programming Languages4Janis Papanagnou
13 Oct 24   iiii    i i     i`* Re: Command Languages Versus Programming Languages3Muttley
13 Oct 24   iiii    i i     i `* Re: Command Languages Versus Programming Languages2Janis Papanagnou
13 Oct 24   iiii    i i     i  `- Re: Command Languages Versus Programming Languages1Muttley
13 Oct 24   iiii    i i     `* Re: Command Languages Versus Programming Languages36Dan Cross
13 Oct 24   iiii    i i      +* Re: Command Languages Versus Programming Languages30Muttley
13 Oct 24   iiii    i i      i+- Re: Command Languages Versus Programming Languages1Janis Papanagnou
13 Oct 24   iiii    i i      i+* Re: Command Languages Versus Programming Languages27Dan Cross
13 Oct 24   iiii    i i      ii`* Re: Command Languages Versus Programming Languages26Muttley
13 Oct 24   iiii    i i      ii +* Re: Command Languages Versus Programming Languages17Janis Papanagnou
13 Oct 24   iiii    i i      ii i+* Re: Command Languages Versus Programming Languages9Lawrence D'Oliveiro
14 Oct 24   iiii    i i      ii ii`* Re: Command Languages Versus Programming Languages8Janis Papanagnou
14 Oct 24   iiii    i i      ii ii +* Re: Command Languages Versus Programming Languages2Lawrence D'Oliveiro
14 Oct 24   iiii    i i      ii ii i`- Re: Command Languages Versus Programming Languages1Janis Papanagnou
14 Oct 24   iiii    i i      ii ii `* Re: Command Languages Versus Programming Languages5Nicolas George
14 Oct 24   iiii    i i      ii ii  +* Re: Command Languages Versus Programming Languages2Janis Papanagnou
15 Oct 24   iiii    i i      ii ii  i`- Re: Command Languages Versus Programming Languages1Nicolas George
14 Oct 24   iiii    i i      ii ii  `* Re: Command Languages Versus Programming Languages2Lawrence D'Oliveiro
15 Oct 24   iiii    i i      ii ii   `- Re: Command Languages Versus Programming Languages1Nicolas George
14 Oct 24   iiii    i i      ii i`* Re: Command Languages Versus Programming Languages7Muttley
14 Oct 24   iiii    i i      ii i +- Re: Command Languages Versus Programming Languages1Janis Papanagnou
14 Oct 24   iiii    i i      ii i +- Re: Command Languages Versus Programming Languages1Muttley
14 Oct 24   iiii    i i      ii i +* Re: Command Languages Versus Programming Languages3Bart
15 Oct 24   iiii    i i      ii i i+- Re: Command Languages Versus Programming Languages1David Brown
15 Oct 24   iiii    i i      ii i i`- Re: Command Languages Versus Programming Languages1Dan Cross
14 Oct 24   iiii    i i      ii i `- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
13 Oct 24   iiii    i i      ii +* Re: Command Languages Versus Programming Languages7Dan Cross
14 Oct 24   iiii    i i      ii i`* Re: Command Languages Versus Programming Languages6Muttley
14 Oct 24   iiii    i i      ii i `* Re: Command Languages Versus Programming Languages5Dan Cross
14 Oct 24   iiii    i i      ii i  `* Re: Command Languages Versus Programming Languages4Muttley
14 Oct 24   iiii    i i      ii i   +* Re: Command Languages Versus Programming Languages2David Brown
14 Oct 24   iiii    i i      ii i   i`- Re: Command Languages Versus Programming Languages1Janis Papanagnou
14 Oct 24   iiii    i i      ii i   `- Re: Command Languages Versus Programming Languages1Janis Papanagnou
13 Oct 24   iiii    i i      ii `- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
13 Oct 24   iiii    i i      i`- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
13 Oct 24   iiii    i i      `* Re: Command Languages Versus Programming Languages5Dan Cross
13 Oct 24   iiii    i i       `* Re: Command Languages Versus Programming Languages4Bart
13 Oct 24   iiii    i i        `* Re: Command Languages Versus Programming Languages3Dan Cross
14 Oct 24   iiii    i i         `* Re: Command Languages Versus Programming Languages2Bart
14 Oct 24   iiii    i i          `- Re: On overly rigid definitions (was Re: Command Languages Versus Programming Languages)1Dan Cross
13 Oct 24   iiii    i `* Re: Command Languages Versus Programming Languages3Kaz Kylheku
13 Oct 24   iiii    i  +- Re: Command Languages Versus Programming Languages1Bart
13 Oct 24   iiii    i  `- Re: Command Languages Versus Programming Languages1Dan Cross
11 Oct 24   iiii    +* Re: Command Languages Versus Programming Languages2Rainer Weikusat
12 Oct 24   iiii    i`- Re: Command Languages Versus Programming Languages1Muttley
11 Oct 24   iiii    `* Re: Command Languages Versus Programming Languages10Lawrence D'Oliveiro
12 Oct 24   iiii     `* Re: Command Languages Versus Programming Languages9Muttley
12 Oct 24   iiii      +* Re: Command Languages Versus Programming Languages5Rainer Weikusat
12 Oct 24   iiii      i+* Re: Command Languages Versus Programming Languages3Christian Weisgerber
13 Oct 24   iiii      ii+- Re: Command Languages Versus Programming Languages1Muttley
13 Oct 24   iiii      ii`- Re: Command Languages Versus Programming Languages1Rainer Weikusat
12 Oct 24   iiii      i`- Re: Command Languages Versus Programming Languages1Bart
12 Oct 24   iiii      `* Re: Command Languages Versus Programming Languages3Lawrence D'Oliveiro
13 Oct 24   iiii       `* Re: Command Languages Versus Programming Languages2Muttley
13 Oct 24   iiii        `- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
11 Oct 24   iii+* Re: Command Languages Versus Programming Languages2Bart
11 Oct 24   iiii`- Re: Command Languages Versus Programming Languages1Rainer Weikusat
11 Oct 24   iii`* Re: Command Languages Versus Programming Languages2Muttley
11 Oct 24   iii `- Re: Command Languages Versus Programming Languages1Rainer Weikusat
11 Oct 24   ii`- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
12 Oct 24   i`* Re: Command Languages Versus Programming Languages10Eric Pozharski
13 Oct 24   i `* Re: Command Languages Versus Programming Languages9Muttley
13 Oct 24   i  +- Re: Command Languages Versus Programming Languages1Janis Papanagnou
13 Oct 24   i  +* Re: Command Languages Versus Programming Languages6Rainer Weikusat
14 Oct 24   i  i`* Re: Command Languages Versus Programming Languages5Muttley
14 Oct 24   i  i `* Re: Command Languages Versus Programming Languages4Rainer Weikusat
14 Oct 24   i  i  `* Re: Command Languages Versus Programming Languages3Muttley
14 Oct 24   i  i   `* Re: Command Languages Versus Programming Languages2Rainer Weikusat
14 Oct 24   i  i    `- Re: Command Languages Versus Programming Languages1Muttley
13 Oct 24   i  `- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
11 Nov 24   `* Re: Command Languages Versus Programming Languages240Sebastian
11 Nov 24    +* Re: Command Languages Versus Programming Languages11Muttley
11 Nov 24    i+* Re: Command Languages Versus Programming Languages2Wolfgang Agnes
11 Nov 24    ii`- Re: Command Languages Versus Programming Languages1Muttley
11 Nov 24    i+- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
12 Nov 24    i`* Re: Command Languages Versus Programming Languages7Janis Papanagnou
11 Nov 24    `* Re: Command Languages Versus Programming Languages228Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal