delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/05/05/13:09:58

From: cgf AT cygnus DOT com (Christopher G. Faylor)
Subject: Re: sigaddset() should return 0 or -1
5 May 1998 13:09:58 GMT :
Message-ID: <6in336$l3r$1@cronkite.cygnus.com>
References: <354f6e0e DOT 431563721 DOT cygnus DOT gnu-win32 AT 10 DOT 0 DOT 2 DOT 3>
X-Newsreader: trn 4.0-test63 (15 March 1998)

In article <354f6e0e DOT 431563721 DOT cygnus DOT gnu-win32 AT 10 DOT 0 DOT 2 DOT 3>,
Richard Hitt <rbh00 AT netcom DOT com> wrote:
>I'm porting an application that expects sigaddset() to return 0 if it
>worked.  But in the CDK, sigaddset is implemented by a macro that
>doesn't care what it returns.  The file is
>/cygnus/b19/H-i386-cygwin32/i386-cygwin32/include/sys/signal.h.
>The macro is
>#define sigaddset(what,sig) (*(what) |= (1<<(sig)))
>
>So I changed it to always return 0:
>#define sigaddset(what,sig) ((*(what) |= (1<<(sig))),0)
>
>and avoided an unpleasant hack in my application.  May I suggest that
>you consider incorporating this change in your signal.h?  Or, for all
>I know, there may be other considerations why the macro must be as it
>is.
>
>Thanks for a fine environment.

Actually, as far as I can tell, this is a bug.  sigaddset and sigemptyset
are proper functions, exported by cygwinb19.dll.  I'm going to remove the
defines in favor of the functions.  In my version of the tools, there
are actually declarations for sig{add,empty}set but they are commented out.
I'd suggest removing the macros and uncommenting these declarations.

That will probably work as you expect.
-- 
cgf AT cygnus DOT com             "Everything has a boolean value, if you stand
http://www.cygnus.com/      far enough away from it."  -- Galena Alyson Canada

- Raw text -


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