Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 May 1996 21:40:46 -0700 (PDT)
From:      Bill Paul <wpaul>
To:        CVS-committers, cvs-all, cvs-lib
Subject:   cvs commit:  src/lib/libc/net getservbyname.c getservbyport.c getservent.c
Message-ID:  <199606010440.VAA08217@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
wpaul       96/05/31 21:40:45

  Modified:    lib/libc/net  getservbyname.c getservbyport.c getservent.c
  Log:
  Improve NIS performace of getservbyname() and getservbyport(). Both these
  functions are implimented as wrappers around getservent(), which means it's
  up to getservent() to do all the work. The NIS support in getservent()
  only allows it to scan through the services.byname map one entry at a
  time until it finds the requested service name/port. This can be painfully
  slow due to the overhead involved (lots and lots of successive RPCs).
  
  To fix this, we allow getservbyname() and getservbyport() to signal
  getservent() that if NIS is turned on (there's a '+' in /etc/services),
  the usual yp_first()/yp_next() linear search should be abandoned and
  yp_match() used instead. This causes getservent() to immediately
  locate the requested entry instead of wasting time groping through the
  whole map.
  
  The downside is that this trick is accomplished by exporting a couple of
  pointers from getservent.c which getservbyname.c and getservbyport.c can
  preset in order to tell getservent() what to do. If all three functions
  were in the same source module, then the extra cruft could be delcared
  static to avoid poluting the global symbol space. Maybe they should be
  combined anyway. For now I've settled on prepending lots of underscores.
  
  Revision  Changes    Path
  1.2       +14 -0     src/lib/libc/net/getservbyname.c
  1.2       +14 -0     src/lib/libc/net/getservbyport.c
  1.4       +95 -7     src/lib/libc/net/getservent.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606010440.VAA08217>