On Wed, 19 Jan 2000, Garrett Wollman wrote:
> <<On Wed, 19 Jan 2000 07:03:04 -0800 (PST), [EMAIL PROTECTED] (Satoshi Asami)
>said:
>
> > How do I test if sigset_t is empty in -current? The xview sources
> > have this macro:
>
> int
> sigisempty(sigset_t *my_sigset)
> {
> static sigset_t empty_ss;
> static int emptied;
>
> if (!emptied) {
> sigemptyset(&empty_ss);
> emptied++;
> }
>
> return (memcmp(my_sigset, &empty_ss, sizeof empty_ss) == 0);
> }
You should know better than to compare structs for equality. Even
the implementation can't do this in a machine-independent way. The
current implementation can do it machine-independently by comparing
each element of the __bits[] struct member with 0.
The correct answer seems to be "you can't do that" :-). Even checking
all signals from 1 to the maximum signal number is difficult because
the maximum signal number is difficult to determine and it may be
INT_MAX.
rcs has fought with variations of this problem. It now uses the following
method: keep track of the largest signal number of interest for the
current operation, and check all signals from that signal number down to 1.
See rcs/lib/rcsutil.c.
Bruce
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message