Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Nov 2002 14:33:54 +0100
From:      Boris Nikolaus <boris@cs.tu-berlin.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/45291: kevent(2) ignores timeout if nevents == 0
Message-ID:  <20021114133354.GA13558@fiesta.cs.tu-berlin.de>

next in thread | raw e-mail | index | archive | help

>Number:         45291
>Category:       kern
>Synopsis:       kevent(2) ignores timeout if nevents == 0
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 14 05:40:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Boris Nikolaus
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
>Environment:
System: FreeBSD XXXXX 4.7-STABLE FreeBSD 4.7-STABLE #43: Tue Oct 22 20:25:44 CEST 2002     root@XXXXXX:/usr/src/sys/compile/BORIS  i386
>Description:
kevent(2) returns immediatly (ignoring the given timeout) if the "nevents"
parameter is 0. I would expect that it sleeps the time (similar to
poll(2)/select(2)).
>How-To-Repeat:
This program terminates immediately instead of sleeping for 10 seconds:

#include <stdio.h>
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>

int main() {
    int qfd;
    struct timespec ts;
    int ret;

    qfd = kqueue();
    ts.tv_sec = 10;
    ts.tv_nsec = 0;
    ret = kevent(qfd, NULL, 0, NULL, 0, &ts);
    printf("kevent returned %d\n", ret);

    return 0;
}
>Fix:
Problem can be circumvented by calling "nanosleep(&ts, NULL)" if the nevents
parameter would be 0.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021114133354.GA13558>