By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,234 Members | 2,010 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,234 IT Pros & Developers. It's quick & easy.

[maybe OT] signal( ) standard ?

P: n/a
Hi ! currently reading C docs, I think I'm reading docs about the stdc lib,
but I'm not shure.. it talks about signals, does *all* OS implement the
signal function, and use it well ? I mean.. I know Unixes do it, but what
about windows ? does it implements all SIG* signal promptly ?

Thanks !

-Eric Boutin
Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Eric Boutin" <er**@nic.nac.wdyn.de> wrote:
Hi ! currently reading C docs, I think I'm reading docs about the stdc lib,
but I'm not shure.. it talks about signals, does *all* OS implement the
signal function, and use it well ? I mean.. I know Unixes do it, but what
about windows ? does it implements all SIG* signal promptly ?


A conforming C implementation must provide signal handling. However,
signal handling in C has several implementation defined aspects, for
obvious reasons. Here's what the standard says about it:

ISO/IEC 9899:1999 7.14#3+4
The macros defined are [...] and distinct values that are the signal
numbers, each corresponding to the specified condition:
SIGABRT [...]
SIGFPE [...]
SIGILL [...]
SIGINT [...]
SIGSEGV [...]
SIGTERM [...]
An implementation need not generate any of these signals, except as
a result of explicit calls to the raise function. Additional signals
[...] may also be specified by the implementation. The complete set
of signals, their semantics, and their default handling is
implementation-defined; all signal numbers shall be positive.

HTH

Regards
--
Irrwahn
(ir*******@freenet.de)
Nov 13 '05 #2

P: n/a
On Thu, 27 Nov 2003 18:30:11 -0500, "Eric Boutin"
<er**@nic.nac.wdyn.de> wrote in comp.lang.c:
Hi ! currently reading C docs, I think I'm reading docs about the stdc lib,
but I'm not shure.. it talks about signals, does *all* OS implement the
signal function, and use it well ? I mean.. I know Unixes do it, but what
about windows ? does it implements all SIG* signal promptly ?

Thanks !

-Eric Boutin


The definition of signals in the C standard places no requirements at
all on the operating system. C defines what happens if signal
handlers are installed and the corresponding identifier is used in a
call to raise(). If a signal handler is invoked any other way, the C
standard does not define the results.

As to what signals are or are not supported by various operating
system, that is not a C language issue. Consult the documentation or
support groups for the operating systems of interest.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Nov 13 '05 #3

P: n/a
In <gp********************************@4ax.com> Jack Klein <ja*******@spamcop.net> writes:
The definition of signals in the C standard places no requirements at
all on the operating system. C defines what happens if signal
handlers are installed and the corresponding identifier is used in a
call to raise(). If a signal handler is invoked any other way, the C
standard does not define the results.


Bullshit! The C standard specifies what an asynchronously invoked
signal handler is allowed to do without invoking undefined behaviour.

5 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 storage duration 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, 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 value of
errno is indeterminate.

It's only the asynchronous delivery of *certain* signals (SIGFPE, SIGILL,
SIGSEGV) that renders the program's behaviour undefined if the signal
handler ever returns.

What the standard does not guarantee is that a signal handler will be
ever invoked asynchronously.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #4

P: n/a
In <5O*******************@weber.videotron.net> "Eric Boutin" <er**@nic.nac.wdyn.de> writes:
Hi ! currently reading C docs, I think I'm reading docs about the stdc lib,
but I'm not shure.. it talks about signals, does *all* OS implement the
signal function, and use it well ? I mean.. I know Unixes do it, but what
about windows ? does it implements all SIG* signal promptly ?


The C language allows perfectly useless implementations of signal(),
i.e. an implementation is not required to be able to invoke any signal
handler asynchronously.

And this is pretty much the case of Windows, except that console
applications can receive the SIGINT signal, but its handling is
performed in a non-standard conforming way (the handler is run in a
separate thread of its own, while the program execution continues).

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.