Return to BSD News archive
Path: sserve!manuel.anu.edu.au!munnari.oz.au!constellation!convex!convex!cs.utexas.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!agate!agate.berkeley.edu!cgd From: cgd@eden.CS.Berkeley.EDU (Chris G. Demetriou) Newsgroups: comp.os.386bsd.bugs Subject: Re: cvs 1.3 bugfix Date: 4 Mar 93 17:08:21 Organization: Kernel Hackers 'r' Us Lines: 100 Message-ID: <CGD.93Mar4170821@eden.CS.Berkeley.EDU> References: <RICH.93Mar3114046@omicron.Rice.edu> <SOMMERFELD.93Mar3180839@blatt.apollo.hp.com> <RICH.93Mar3233616@omicron.Rice.edu> NNTP-Posting-Host: eden.cs.berkeley.edu In-reply-to: rich@Rice.edu's message of Thu, 4 Mar 1993 05:36:16 GMT In article <RICH.93Mar3233616@omicron.Rice.edu> rich@Rice.edu (Richard Murphey) writes: >Yep, the posix spec claims sigismember() should return -1 if signo is >out of range. Perhaps this would be sufficient. Rich actually, i just got into a too- long and heated discussion w/ keith bostic about this... enclosed at the bottom is the transcribed section from posix. it turns out that the macro is fine just the way it was; the error (in input) *does not* _have_ to be detected by the function, but if it is, -1 should be returned, and errno should be set. the only way to do this w/a non-contiguous signal numbering space is a (hacked!) function. (note that when _POSIX_SOURCE is defined, the 386bsd signal numbers *are* non-contiguous... also note that your macro doesn't set errno appropriately... Keith made a convincing argument for the macro as-it-stands -- if a programmer wants to rely on a contiguous signal numbering space, or do something otherwise stupid, it's their fault, and their problem. CVS should be fixed... chris ============= section 3.3.3 of posix.1 (all typos are mine... 8-): 3.3.3 Manipulate Signal Sets Functions sigemptyset(), sigfillset(), sigaddset(), sigdelset(), sigismember() 3.3.3.1 Synopsis #include <signal.h> int sigemptyset(sigset_t *set); int sigfillset(sigset_t *set); int sigaddset(sigset_t *set, int signo); int sigdelset(sigset_t *set, int signo); int sigismember(const sigset_t *set, int signo); 3.3.3.2 Description The sigsetops primitives manipulate sets of signals. They operate on data objects addressable by the application, not on any set of signals known to the system, such as the set blocked from delivery to a process or the set pending for a process (see 3.3.1). The sigemptyset() function initializes the signal set pointed to by the argument _set_, such that all signals defined in this part of ISO/IEC 9945 are excluded. The sigfillset() function initializes the signal set pointed to by the argument _set_, such that all signals defined in this part of ISO/IEC 9945 are included. Applications shall call either sigemptyset() or sigfillset() at least once for each object of type sigset_t prior to any use of that object. If such an object is not initialized in this way, but is nonetheless supplied as an argument to any of the sigaddset(), sigdelset(), sigismember(), sigaction(), sigprocmask(), sigpending(), or sigsuspend() functions, the results are undefined. The sigaddset() and sigdelset() functions respectively add or delete the individual signal specified by the value of the argument _signo_ to or from the signal set pointed to by the argument _set_. The sigismember() function tests whether the signal specified by the value of the argument _signo_ is a member of the set pointed to by the argument _set_. 3.3.3.3 Returns Upon successful completion, the sigismember() function returns a value of one if the specified signal is a member of a specified set, or a value of zero if it is not. Upon successful completion, the other functions return a value of zero. For all of the above functions, if an error is detected, a value of -1 is returned, and _errno_ is set to indicate the error. 3.3.3.4 Errors For each of the following conditions, if the condition is detected, the sigaddset(), sigdelset(), and sigismember() functions shall return -1 and set _errno_ to the corresponding value: [ EINVAL ] The value of the _signo_ argument is an invalid or unsupported signal number. 3.3.3.5 Cross-References sigaction(), 3.3.4; <signal.h>, 3.3.1; sigpending(), 3.3.6; sigprocmask(), 3.3.5; sigsuspend(), 3.3.7. -- Chris G. Demetriou cgd@cs.berkeley.edu MENTALLY CONTAMINATED and proud of it!