X-MimeOLE: Produced By Microsoft Exchange V6.5
Received: by onstor-exch02.onstor.net 
	id <01C88EE4.FEFD3228@onstor-exch02.onstor.net>; Tue, 25 Mar 2008 18:59:16 -0700
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C88EE4.FEFD3228"
Content-class: urn:content-classes:message
Subject: RE: Debian Linux signal that was use..
Date: Tue, 25 Mar 2008 18:59:16 -0700
Message-ID: <BB375AF679D4A34E9CA8DFA650E2B04E07A8DAFA@onstor-exch02.onstor.net>
In-Reply-To: <BB375AF679D4A34E9CA8DFA650E2B04E056C94EF@onstor-exch02.onstor.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Debian Linux signal that was use..
Thread-Index: AciO5G86PyolAZeeRfO0Iohfvo41igAAHbaA
From: "Mike Lee" <mike.lee@onstor.com>
To: "Larry Scheer" <larry.scheer@onstor.com>,
	"Tim Gardner" <tim.gardner@onstor.com>
Cc: "Svati Chandra" <schandra@onstor.com>,
	"Andy Sharp" <andy.sharp@onstor.com>

This is a multi-part message in MIME format.

------_=_NextPart_001_01C88EE4.FEFD3228
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Larry:
Thanks for the research.
I guess there is no weaseling my way out of this code review now...  :)
-Mike

>  -----Original Message-----
> From: 	Larry Scheer =20
> Sent:	Tuesday, March 25, 2008 5:55 PM
> To:	Tim Gardner
> Cc:	Mike Lee; Svati Chandra; Andy Sharp
> Subject:	Debian Linux signal that was use..
>=20
> Tim, Mike,
>     There is no bsd/signal.h in our debian packages because, if you
> believe the man pages, it follows the BSD behavior. We are using the
> glibc2 library.
> Here is what the man page says about the signal we are using:
>=20
> Svati, this is not complete confirmation but it is another indication
> that what we use would follow  the "BSD behavior."
>=20
> PORTABILITY
>        The original Unix signal() would reset the handler to SIG_DFL,
> and Sys-
>        tem  V  (and the Linux kernel and libc4,5) does the same.  On
> the other
>        hand, BSD does not reset the handler, but blocks new instances
> of  this
>        signal from occurring during a call of the handler.  The glibc2
> library
>        follows the BSD behaviour.
>=20
>        If one on a libc5 system includes <bsd/signal.h> instead of
> <signal.h>
>        then  signal()  is  redefined  as  __bsd_signal  and signal has
> the BSD
>        semantics.  This is not recommended.
>=20
>        If one on a  glibc2  system  defines  a  feature  test  macro
> such  as
>        _XOPEN_SOURCE  or  uses  a  separate  sysv_signal function, one
> obtains
>        classical behaviour.  This is not recommended.
>=20
>        Trying to change the semantics of this call using defines and
> includes
>        is not a good idea.  It is better to avoid signal() altogether,
> and use
>        sigaction(2) instead.
>=20
> NOTES
>        The effects of this call in a multi-threaded process are
> unspecified.
>=20
>        The routine handler must be very careful,  since  processing
> elsewhere
>        was interrupted at some arbitrary point. POSIX has the concept
> of "safe
>        function".  If a signal interrupts  an  unsafe  function,  and
> handler
>        calls  an  unsafe  function, then the behavior is undefined.
> Safe func-
>        tions are listed explicitly in the various standards.  The
> POSIX.1-2003
>        list is [qute extensive read the rest of the man page here:
> <http://ripper/cgi-bin/man/man2html/usr/share/man/man2/signal.2.gz> ]
>=20

------_=_NextPart_001_01C88EE4.FEFD3228
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7653.38">
<TITLE>RE: Debian Linux signal that was use..</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Larry:</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Thanks for the =
research.</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">I guess there is no =
weaseling my way out of this code review now...&nbsp; :)</FONT>

<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">-Mike</FONT>
</P>
<UL>
<P><FONT FACE=3D"Arial"><SPAN LANG=3D"en-us"></SPAN></FONT><SPAN =
LANG=3D"en-us">&nbsp;<FONT SIZE=3D1 FACE=3D"Tahoma">-----Original =
Message-----</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><B><FONT SIZE=3D1 FACE=3D"Tahoma">From: =
&nbsp;</FONT></B> <FONT SIZE=3D1 FACE=3D"Tahoma">Larry Scheer&nbsp; =
</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">Sent:&nbsp;&nbsp;</FONT></B> <FONT SIZE=3D1 =
FACE=3D"Tahoma">Tuesday, March 25, 2008 5:55 PM</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">To:&nbsp;&nbsp;&nbsp;&nbsp;</FONT></B> <FONT SIZE=3D1 =
FACE=3D"Tahoma">Tim Gardner</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">Cc:&nbsp;&nbsp;&nbsp;&nbsp;</FONT></B> <FONT SIZE=3D1 =
FACE=3D"Tahoma">Mike Lee; Svati Chandra; Andy Sharp</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><B><FONT SIZE=3D1 =
FACE=3D"Tahoma">Subject:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT>=
</B> <FONT SIZE=3D1 FACE=3D"Tahoma">Debian Linux signal that was =
use..</FONT></SPAN>
</P>

<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Arial">Tim, =
Mike,</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp; There is no bsd/signal.h in our debian =
packages because, if you believe the man pages, it follows the BSD =
behavior. We are using the glibc2 library.</FONT></SPAN></P>

<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Arial">Here is what the =
man page says about the signal we are using:</FONT></SPAN>
</P>

<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Arial">Svati, this is not =
complete confirmation but it is another indication that what we use =
would follow&nbsp; the &#8220;BSD behavior.&#8221;</FONT></SPAN></P>

<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">PORTABILITY</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The original Unix =
signal() would reset the handler to SIG_DFL, and Sys-</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tem&nbsp; V&nbsp; =
(and the Linux kernel and libc4,5) does the same.&nbsp; On the =
other</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hand, BSD does not =
reset the handler, but blocks new instances of&nbsp; this</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; signal from =
occurring during a call of the handler.&nbsp; The glibc2 =
library</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; follows the BSD =
behaviour.</FONT></SPAN>
</P>

<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If one on a libc5 =
system includes &lt;bsd/signal.h&gt; instead of&nbsp; =
&lt;signal.h&gt;</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then&nbsp; =
signal()&nbsp; is&nbsp; redefined&nbsp; as&nbsp; __bsd_signal&nbsp; and =
signal has the BSD</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; semantics.&nbsp; =
This is not recommended.</FONT></SPAN>
</P>

<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If one on a&nbsp; =
glibc2&nbsp; system&nbsp; defines&nbsp; a&nbsp; feature&nbsp; test&nbsp; =
macro&nbsp; such&nbsp; as</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _XOPEN_SOURCE&nbsp; =
or&nbsp; uses&nbsp; a&nbsp; separate&nbsp; sysv_signal function, one =
obtains</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; classical =
behaviour.&nbsp; This is not recommended.</FONT></SPAN>
</P>

<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Trying to change the =
semantics of this call using defines and&nbsp; includes</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; is not a good =
idea.&nbsp; It is better to avoid signal() altogether, and =
use</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sigaction(2) =
instead.</FONT></SPAN>
</P>

<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">NOTES</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The effects of this =
call in a multi-threaded process are unspecified.</FONT></SPAN>
</P>

<P><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The routine handler =
must be very careful,&nbsp; since&nbsp; processing&nbsp; =
elsewhere</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; was interrupted at =
some arbitrary point. POSIX has the concept of &quot;safe</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
function&quot;.&nbsp; If a signal interrupts&nbsp; an&nbsp; unsafe&nbsp; =
function,&nbsp; and&nbsp; handler</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; calls&nbsp; an&nbsp; =
unsafe&nbsp; function, then the behavior is undefined. Safe =
func-</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tions are listed =
explicitly in the various standards.&nbsp; The =
POSIX.1-2003</FONT></SPAN>

<BR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; list is [qute =
extensive read the rest of the man page here:<U> </U></FONT><U><FONT =
COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">&lt;<A =
HREF=3D"http://ripper/cgi-bin/man/man2html/usr/share/man/man2/signal.2.gz=
">http://ripper/cgi-bin/man/man2html/usr/share/man/man2/signal.2.gz</A>&g=
t;</FONT></U><FONT SIZE=3D2 FACE=3D"Arial"> ]</FONT></SPAN></P>
</UL>
</BODY>
</HTML>
------_=_NextPart_001_01C88EE4.FEFD3228--
