From owner-freebsd-hackers Thu Jul 22 14:12:24 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (Postfix) with ESMTP id 54EB614C10 for ; Thu, 22 Jul 1999 14:12:21 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.3/8.9.1) id OAA87754; Thu, 22 Jul 1999 14:09:32 -0700 (PDT) (envelope-from dillon) Date: Thu, 22 Jul 1999 14:09:32 -0700 (PDT) From: Matthew Dillon Message-Id: <199907222109.OAA87754@apollo.backplane.com> To: "John W. DeBoskey" Cc: jeremyp@gsmx07.alcatel.com.au (Peter Jeremy), freebsd-hackers@FreeBSD.ORG Subject: Re: Proposal for new syscall to close files References: <199907220123.VAA32548@bb01f39.unx.sas.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :Hi, : : I like this approach. I have a number of often spawned daemon :processes that could benefit from this. One of the last process :we debugged where we had unwanted open filedescriptors was in :programs invoked by the cvs loginfo script. : : For naming convention considerations, I might suggest 'closeall' :or 'closefdset' or something similar... at least have 'close' in :name... :-) Well, when I weight the benefit of the savings in overhead for a single syscall verses a close() loop, and when I weigh the seriousness of introducing a syscall that would not be portable to other operating systems, and if I also take into account the work required to deal with descriptors after forking a daemon.... well, I don't think that adding a new syscall would be worth the relatively minor benefit nor do I think the improvement in performance would be noticeable. The benefit isn't great enough to warrent a new syscall in my view. I've written a number of forking daemons, most noteable my web server and my Diablo news transit system. I just don't think the reduced overhead would be noticeable over simply calling close(), and I didn't have any problems keeping track of which file descriptors to close in Diablo (and there could be 100+ descriptors). Keep in mind that after a fork these descriptors have a ref count > 1, meaning that the close() syscall is almost free. If you assume 5uS/close you are still talking quite a bit less then a millisecond to close a hundred descriptors. And that's pretty much the worst case I can think of. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message