www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/05/06/07:46:58

From: cgf AT cygnus DOT com (Christopher Faylor)
Subject: sigaddset, sigdelset, sigmasks "wrong" in cygwin32
6 May 1998 07:46:58 -0700 :
Message-ID: <199805061417.KAA11982.cygnus.cygwin32.developers@kramden.cygnus.com>
To: gnu-win32-local AT cygnus DOT com
Cc: cygwin32-developers AT cygnus DOT com

A net user has just brought to my attention the fact that there is,
for some reason, macros in /usr/include/sys/signal.h which implement
sigaddset and sigdelset.  This is clearly wrong as there are library
routines to handle this and the macro does no bounds checking.

I told the user to comment out the macros and use the library functions.
He then discovered that all of the mask operations in cygwin32 are
"off by one", i.e., the mask is set like this:

	mask |= 1<<sig;

rather than

	mask |= 1<<(sig - 1);

That means that we essentially allow signal 0 to be masked; which is pretty
worthless, IMHO.  FWIW, the equivalent routines in newlib, which cygwin32
does not use, do the right thing.

I have a patch that fixes this behavior which is throughout cygwin32.
This will have ramifications with people who are using the newlib macro
but I think that it is important to make this operate more like UNIX.

I'd like to remove the macros in signal.h and remove the comments around
the function declarations.  Is there any reason why I shouldn't do so?
Btw, this is all under a CYGWIN32 #ifdef so I shouldn't be affecting
any other code.

cgf

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019