NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/38770: sigpending(2) does not report expected signals

>Number:         38770
>Category:       kern
>Synopsis:       sigpending(2) does not report expected signals
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 27 13:05:00 +0000 2008
>Originator:     Nicolas Joly
>Release:        NetBSD 4.99.63
Biological Software and Databanks.
Institut Pasteur, Paris.
System: NetBSD 4.99.63 NetBSD 4.99.63 (LANFEUST) #14: 
Tue May 27 13:18:30 CEST 2008
Architecture: x86_64
Machine: amd64
I have some trouble with sigpending(2), which does not seems to report
expected pending signals.

The following testcase illustrate the problem:

njoly@lanfeust [emul/netbsd]> cat sigpending.c
#include <err.h>
#include <signal.h>
#include <unistd.h>

int main() {
  int res;
  sigset_t set, get;

  res = sigemptyset(&set);
  if (res == -1)
    err(1, "sigemptyset failed");

  res = sigaddset(&set, SIGUSR1);
  if (res == -1)
    err(1, "sigaddset failed");

  res = sigprocmask(SIG_SETMASK, &set, NULL);
  if (res == -1)
    err(1, "sigprocmask failed");

  res = raise(SIGUSR1);
  if (res == -1)
    err(1, "raise failed");

  res = sigpending(&get);
  if (res == -1)
    err(1, "sigpending failed");

  res = sigismember(&get, SIGUSR1);
  if (res != 1)
    errx(1, "sigpending missing signal");

  return 0; }
njoly@lanfeust [emul/netbsd]> cc -g -Wall -Werror -o sigpending sigpending.c 
njoly@lanfeust [emul/netbsd]> ./sigpending 
sigpending: sigpending missing signal

The same piece of code works as expected on some other systems: Tru64,
FreeBSD and Linux.
run the above testcase.

Home | Main Index | Thread Index | Old Index