faster /etc/services
Anton Yuzhaninov
citrin at citrin.ru
Mon May 21 09:30:20 UTC 2007
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
More information about the freebsd-net
mailing list