Date: Fri, 17 Apr 1998 19:32:48 +0000 From: Niall Smart <rotel@indigo.ie> To: James Raynard <fhackers@jraynard.demon.co.uk>, rotel@indigo.ie Cc: joelh@gnu.org, freebsd-hackers@FreeBSD.ORG Subject: Re: PR kern/1144 Message-ID: <199804171832.TAA02993@indigo.ie> In-Reply-To: James Raynard <fhackers@jraynard.demon.co.uk> "Re: PR kern/1144" (Apr 15, 8:49pm)
next in thread | previous in thread | raw e-mail | index | archive | help
On Apr 15, 8:49pm, James Raynard wrote: } Subject: Re: PR kern/1144 > On Wed, Apr 15, 1998 at 02:03:43AM +0000, Niall Smart wrote: > > On Apr 1n, 9:17pm, James Raynard wrote: > > > > > > In his reply to my original PR, bde posted a macro that did what you > > > suggest for integer arguments (is this not in the PR database?). > > > > Nope. Still got it? > > Yep. Note there's a followup as well. Thanks for the information. I noticed you closed off the PR... given that OpenBSD, NetBSD, Solaris, glibc and IRIX are all POSIX compliant in this regard, do we really want to break ranks? I don't think saving a few microseconds is worth it. I've appended patches in case I can convince you to change your mind. :) Thanks, Niall *** /usr/src/lib/libc/gen/sigsetops.c Mon Jan 5 00:11:29 1998 --- sigsetops.c Fri Apr 17 19:15:19 1998 *************** *** 38,43 **** --- 38,47 ---- #endif /* LIBC_SCCS and not lint */ #include <signal.h> + #include <errno.h> + + /* These functions used to be defined as macro's, undef them here in case + someone ends up pulling in an old /usr/include/signal.h */ #undef sigemptyset #undef sigfillset *************** *** 66,71 **** --- 70,80 ---- sigset_t *set; int signo; { + if (signo <= 0 || signo >= NSIG) { + errno = EINVAL; + return -1; + } + *set |= sigmask(signo); return (0); } *************** *** 75,80 **** --- 84,94 ---- sigset_t *set; int signo; { + if (signo <= 0 || signo >= NSIG) { + errno = EINVAL; + return -1; + } + *set &= ~sigmask(signo); return (0); } *************** *** 84,88 **** --- 98,107 ---- const sigset_t *set; int signo; { + if (signo <= 0 || signo >= NSIG) { + errno = EINVAL; + return -1; + } + return ((*set & sigmask(signo)) != 0); } *** /usr/src/include/signal.h Fri Jun 28 05:27:04 1996 --- signal.h Thu Apr 16 12:26:15 1998 *************** *** 73,85 **** #endif /* !_ANSI_SOURCE */ __END_DECLS - #ifndef _ANSI_SOURCE - /* List definitions after function declarations, or Reiser cpp gets upset. */ - #define sigaddset(set, signo) (*(set) |= 1 << ((signo) - 1), 0) - #define sigdelset(set, signo) (*(set) &= ~(1 << ((signo) - 1)), 0) - #define sigemptyset(set) (*(set) = 0, 0) - #define sigfillset(set) (*(set) = ~(sigset_t)0, 0) - #define sigismember(set, signo) ((*(set) & (1 << ((signo) - 1))) != 0) - #endif /* !_ANSI_SOURCE */ - #endif /* !_SIGNAL_H_ */ --- 73,76 ---- *** /usr/src/lib/libc/gen/sigsetops.3 Tue Feb 17 16:38:15 1998 --- sigsetops.3 Fri Apr 17 19:23:37 1998 *************** *** 89,109 **** function returns whether a specified signal .Fa signo is contained in the signal set. - .Pp - These functions - are provided as macros in the include file <signal.h>. - Actual functions are available - if their names are undefined (with #undef - .Em name ) . .Sh RETURN VALUES The .Fn sigismember ! function returns 1 ! if the signal is a member of the set, ! 0 otherwise. ! The other functions return 0. .Sh ERRORS ! Currently no errors are detected. .Sh SEE ALSO .Xr kill 2 , .Xr sigaction 2 , --- 89,120 ---- function returns whether a specified signal .Fa signo is contained in the signal set. .Sh RETURN VALUES The + .Fn sigfillset + and + .Fn sigemptyset + functions return 0. + The functions + .Fn sigaddset + and + .Fn sigdelset + return -1 and set + .Va errno + on failure or return 0 on success. + The .Fn sigismember ! function returns -1 and sets ! .Va errno ! on failure, otherwise it returns 1 if the signal is a member of the set, ! or 0 if it is not. .Sh ERRORS ! .Bl -tag -width Er ! .It Bq Er EINVAL ! The specified signal ! .Fa signo ! is not a valid signal number. ! .El .Sh SEE ALSO .Xr kill 2 , .Xr sigaction 2 , -- Niall Smart. finger njs3@doc.ic.ac.uk for PGP key FreeBSD: Turning PC's into Workstations. www.freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804171832.TAA02993>