This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sigdelset


Timo Weggen wrote:
Jeff Johnston wrote:

Timo Weggen wrote:

Hello,

(first post). I am using newlib 1.14.0. I discovered that on the nosys platform "sigaddset" is defined (via preprocessor), but sigdelset is not defined. What is the desired policy for the signal set family of functions? Are they beyond scope of newlib? I just want know wether I should modify newlib (for me) here to add them in for the nosys configuration, or this in some way is the application's responsibility.

TIA, hope that wasn't convered before,
Timo.


Posix signal handling is not part of vanilla newlib. Some systems like Cygwin, RTEMS, and Linux do add support, but you can't expect it by default.


Now, that said, there are some default macros in libc/include/sys/signal.h defining a rudimentary sigaddset and sigemptyset. Offhand, there is no reason sigdelset, sigfillset, or sigismember could not be added in the same vein. I will check in a patch shortly. If you need the actual signal handling functions, then you will have some work to do.

-- Jeff J.


Thank you, it was just the macros I was curious about. I did not want to mess up the include files.

The attached patch has been checked into CVS.


-- Jeff J.
Index: libc/include/sys/signal.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/signal.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -p -r1.17 -r1.18
--- libc/include/sys/signal.h	28 Oct 2004 15:06:47 -0000	1.17
+++ libc/include/sys/signal.h	18 Apr 2006 20:06:09 -0000	1.18
@@ -125,8 +125,11 @@ struct sigaction 
 /* These depend upon the type of sigset_t, which right now 
    is always a long.. They're in the POSIX namespace, but
    are not ANSI. */
-#define sigaddset(what,sig) (*(what) |= (1<<(sig)))
-#define sigemptyset(what)   (*(what) = 0)
+#define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
+#define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0)
+#define sigemptyset(what)   (*(what) = 0, 0)
+#define sigfillset(what)    (*(what) = ~(0), 0)
+#define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
 
 int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
 
@@ -137,7 +140,10 @@ int _EXFUN(pthread_sigmask, (int how, co
 /* protos for functions found in winsup sources for CYGWIN */
 #if defined(__CYGWIN__) || defined(__rtems__)
 #undef sigaddset
+#undef sigdelset
 #undef sigemptyset
+#undef sigfillset
+#undef sigismember
 /* The first argument to kill should be pid_t.  Right now
    <sys/types.h> always defines pid_t to be int.  If that ever
    changes, then we will need to do something else, perhaps along the

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]