NetBSD-Bugs archive

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

kern/47625: sigtimedwait(2) blocks forever when passed a zero timeout



>Number:         47625
>Category:       kern
>Synopsis:       sigtimedwait(2) blocks forever when passed a zero timeout
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 06 09:55:00 +0000 2013
>Originator:     anthony mallet
>Release:        6.0.1
>Organization:
>Environment:
NetBSD fluffy64-netbsd6 6.0.1 NetBSD 6.0.1 (FLUFFY) #2: Sat Mar  2 20:12:01 CET 
2013  root@fluffy64-netbsd6:/usr/obj/sys/arch/amd64/compile/FLUFFY amd64

>Description:
sigtimedwait(2) blocks forever when passed a zero timeout.
This does not match the documented behaviour in the manual, nor the POSIX spec. 
The system call is expected to return immediately in case of a zero-valued 
timeout.

The problem is the same on a 6.99.16 -current, i386.

>How-To-Repeat:
/* Compile and run the following, it will block. */

#include <sys/time.h>

#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>

int
main()
{
  sigset_t block, dflt;
  struct timespec ts;
  siginfo_t info;
  int r;

  sigemptyset(&block);
  ts.tv_sec = 0;
  ts.tv_nsec = 0;
  r = sigtimedwait(&block, &info, &ts);
  printf("%d %s\n", r, strerror(errno));
  printf("%d\n", info.si_signo);
  return 0;
}

>Fix:



Home | Main Index | Thread Index | Old Index