From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 12 21:15:04 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2252E16A400 for ; Tue, 12 Jun 2007 21:15:04 +0000 (UTC) (envelope-from jimmy@mammothcheese.ca) Received: from smtp103.rog.mail.re2.yahoo.com (smtp103.rog.mail.re2.yahoo.com [206.190.36.81]) by mx1.freebsd.org (Postfix) with SMTP id BA7DB13C45B for ; Tue, 12 Jun 2007 21:15:03 +0000 (UTC) (envelope-from jimmy@mammothcheese.ca) Received: (qmail 16676 invoked from network); 12 Jun 2007 21:08:23 -0000 Received: from unknown (HELO ?74.110.53.6?) (jazzturk@rogers.com@74.110.53.6 with plain) by smtp103.rog.mail.re2.yahoo.com with SMTP; 12 Jun 2007 21:08:23 -0000 X-YMail-OSG: 8qElVRYVM1kwHoBXn0EGe8llHFP7h0S8OXxP4mbaflEOCbdcvXNNDSawBe0ev.GhMg-- Message-ID: <466F0B46.5060106@mammothcheese.ca> Date: Tue, 12 Jun 2007 17:08:22 -0400 From: James Bailie User-Agent: Thunderbird 2.0.0.0 (X11/20070609) MIME-Version: 1.0 To: cole@opteqint.net References: <20070612204525.9598C13C4AD@mx1.freebsd.org> In-Reply-To: <20070612204525.9598C13C4AD@mx1.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Kqueue queries X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2007 21:15:04 -0000 Cole wrote: > I wanted to know, what must be done when the sockets/file > descriptors close. Do I need to decrease number_events and > resort the events array so that all the active kevents are > sequential without any closed sockets still in that array? It occurs to me, you might be trying to use kqueue like select(), in that you are giving an input queue to every invocation of kevent(), in the same way that select needs descriptor map arguments for every invocation. If that's the case, you don't need to do this. You only need to set read events for a descriptor once. kevent() will keep returning read events while the descriptor is open and readable. -- James Bailie http://www.mammothcheese.ca