Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 06 Jun 2010 20:04:38 -0400
From:      "James Bailie" <jimmy@mammothcheese.ca>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/147604: kqueue timer events are not deleted when associated descriptor is closed
Message-ID:  <730490.56672.qm@smtp105.rog.mail.re2.yahoo.com>
Resent-Message-ID: <201006070010.o570A27K087288@freefall.freebsd.org>

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

>Number:         147604
>Category:       kern
>Synopsis:       kqueue timer events are not deleted when associated descriptor is closed
>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:   Mon Jun 07 00:10:02 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     James Bailie
>Release:        FreeBSD 8.1-PRERELEASE amd64
>Organization:
>Environment:
System: FreeBSD localhost 8.1-PRERELEASE FreeBSD 8.1-PRERELEASE #20: Sat May 29 13:36:02 EDT 2010 root@localhost:/usr/obj/usr/src/sys/LOCAL amd64


	
>Description:
Timer events set with kevent() do not get deleted when the associated descriptor is
closed.  If this behavior is intentional, then the manual page should be modified to
reflect this. 

>How-To-Repeat:
--- test.c begins here ---
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>

int main( int argc, char **argv )
{
   struct kevent inqueue[ 1 ], outqueue[ 1 ];
   int kq, inq;

   if (( kq = kqueue()) < 0 )
   {
      fprintf( stderr, "kqueue(): %s", strerror( errno ));
      exit( 1 );
   }

   inqueue[ 0 ].ident = 0;
   inqueue[ 0 ].filter = EVFILT_TIMER;
   inqueue[ 0 ].fflags = 0;
   inqueue[ 0 ].data = 1000;
   inqueue[ 0 ].flags = EV_ADD | EV_ENABLE;
   inqueue[ 0 ].udata = NULL;

   for( inq = 1; ; inq = 0 )
   {
      if ( kevent( kq, inqueue, inq, outqueue, 1, NULL ) > 0 &&
           outqueue[ 0 ].filter == EVFILT_TIMER )
      {
         write( 1, "TIMEOUT\n", 8 );

         if ( inq )
            close( 0 );
      }
   }
}
--- test.c ends here ---
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:



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