From owner-freebsd-net@FreeBSD.ORG Mon May 21 09:30:20 2007 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CCC9A16A421 for ; Mon, 21 May 2007 09:30:20 +0000 (UTC) (envelope-from citrin@citrin.ru) Received: from mail.classis.ru (classis.ru [213.248.60.120]) by mx1.freebsd.org (Postfix) with ESMTP id 8987913C455 for ; Mon, 21 May 2007 09:30:20 +0000 (UTC) (envelope-from citrin@citrin.ru) Received: from CITRIN (unknown [81.19.65.48]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: citrin.citrin.ru) by mail.classis.ru (Postfix) with ESMTP id AECE11227C1D; Mon, 21 May 2007 13:20:05 +0400 (MSD) Date: Mon, 21 May 2007 13:20:04 +0400 From: Anton Yuzhaninov X-Mailer: The Bat! (v3.62.14) Professional Organization: Rambler X-Priority: 3 (Normal) Message-ID: <1607720081.20070521132004@citrin.ru> To: Edwin Groothuis In-Reply-To: <20070521070938.GA48283@k7.mavetju> References: <20070521070938.GA48283@k7.mavetju> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org Subject: Re: faster /etc/services X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2007 09:30:20 -0000 Monday, May 21, 2007, 11:09:38 AM, Edwin Groothuis wrote: EG> - Instead of reading and parsing /etc/services every time, use a EG> hash or btree file a la the aliases database. A hash one (first EG> key, next key) could be a replacement to use with getservent(), EG> while a btree one could be be a replacement to use with getservbyname(). EG> This doesn't have the startup-penalty, but the sysadmin needs to EG> keep track of changes in /etc/services and needs to rebuild it. I think it will be better solution. /etc/services edited by sysadmin rarely and we can place comments in this file about hash. EG> - Instead of reading and parsing /etc/services every time, open a EG> socket and ask a daemon for the information. Which daemon is a EG> good question, but it can automatically re-read the /etc/services EG> file if it got changed. Connection to external daemon is additional overhead. Anyway, is there need to optimize getservbyname()? Is there any applications, which call getservbyname() on each connection/request? IMHO /etc/services can be kept in current state. -- WBR, Anton Yuzhaninov