From owner-freebsd-hackers Wed Sep 25 10:25: 8 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E6DDB37B401 for ; Wed, 25 Sep 2002 10:25:06 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 5131C43E6E for ; Wed, 25 Sep 2002 10:25:01 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 68822 invoked by uid 1000); 25 Sep 2002 17:24:52 -0000 Date: Wed, 25 Sep 2002 10:24:51 -0700 (PDT) From: Nate Lawson To: Michel Oosterhof Cc: hackers@freebsd.org Subject: Re: kqueue In-Reply-To: <20020925081253.GA98975@xs4all.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 25 Sep 2002, Michel Oosterhof wrote: > Hello. > > Recently I started looking into kqueue(2), and to get to know the > interface better I attempted to turn usr.sbin/moused into a kqueue > program (replacing the main select() loop that reads the mouse > device). > > Now I thought I understood the interface, I requested a kqueue, but > as soon as I add an event for monitoring I get an 'Operation not > permitted' error. Does anyone know if this is caused because > kqueue() only supports FFS? The mouse device is on devfs (I'm running > -CURRENT, btw). No, it's a device driver not fs deficiency. The serial/ps2/whatever drivers need to add a KNOTE when they have data ready. Check out sys/kern/tty.c for a driver that does this. This is not a difficult change -- KNOTE would go into psmintr() near the selwakeup. You also need to add kqfilter, attach, detach entries (see ttykqfilter, fil_ttyrdetach, etc.) > I've got one more question, actually a fact that surprises me, it > seems that tail(1) is the only place in the base system that actually > uses kqueue. Is there a reason for this? I read in most places > kqueue() is more efficient, scalable, etc. I'm sure code like ftpd > or other services would benefit. (And i'm sure Apache could use it > too). No time. -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message