freebsd-src/usr.sbin/ypserv
Bill Paul b2264be812 Performance enhancements (I hope) and new stuff:
yp_dblookup.c:

- Implement database handle caching. What this means is that instead
  of opening and closing map databases for each request, we open a
  database and save the handle (and, if requested, the key index)
  in an array. This saves a bit of overhead on things like repeated
  YPPROC_NEXT calls, such as you'd get from getpwent(). Normally,
  each YPPROC_NEXT would require open()ing the database, seeking
  to the location supplied by the caller (which is time consuming with
  hash databases as the R_CURSOR flag doesn't work), reading the
  data, close()ing the database and then shipping the data off to
  the caller. The system call overhead is prohibitive, especially
  with very large maps. By caching the handle to an open database,
  we elimitate at least the open()/close() system calls, as well
  as the associated DB setup and tear-down operations, for a large
  percentage of the time. This improves performance substantially at
  the cost of consuming a little more memory than before.

  Note that all the caching support is surrounded by #ifdef DB_CACHE
  so that this same source module can still be used by other programs
  that don't need it.

- Make yp_open_db() call yp_validdomain(). Doing it here saves cycles
  when caching is enabled since a hit on the map cache list by
  definition means that the domain being referenced is valid.

- Also make yp_open_db() check for exhaustion of file descriptors,
  just in case.

yp_server.c:

- Reorganize things a little to take advantage of the database
  handle caching. Add a call to yp_flush_all() in ypproc_clear_2_svc().

- Remove calls to yp_validdomain() from some of the service procedures.
  yp_validdomain() is called inside yp_open_db() now, so procedures that
  call into the database package don't need to use yp_validdomain()
  themselves.

- Fix a bogosity in ypproc_maplist_2_svc(): don't summarily initiallize
  the result.maps pointer to NULL. This causes yp_maplist_free()
  to fail and leaks memory.

- Make ypproc_master_2_svc() copy the string it gets from the database
  package into a private static buffer before trying to NUL terminate it.
  This is necessary with the DB handle caching: stuffing a NUL into the
  data returned by DB package will goof it up internally.

yp_main.c:

- Stuff for DB handle caching: call yp_init_dbs() to clear the
  handle array and add call to yp_flush_all() to the SIGHUP
  signal handler.

Makefile.yp:

- Reorganize to deal with database caching. yp_mkdb(8) can now be used
  to send a YPPROC_CLEAR signal to ypserv(8). Call it after each map
  is created to refresh ypserv's cache.

- Add support for mail.alias map.
  Contributed by Mike Murphy (mrm@sceard.com).

- Make default location for the netgroups source file be /var/yp/netgroup
  instead of /etc/netgroup.

mkaliases:

- New file: script to generate mail.alias map.
  Contributed by Mike Murphy (mrm@sceard.com).

Makefile:

- Install Makefile.yp as /var/yp/Makefile.dist and link it to
  /var/yp/Makefile only if /var/yp/Makefile doesn't already exist.
  Suggested by Peter Wemm.

- Install new mkaliases script in /usr/libexec along with mknetid.

- Use somewhat saner approach to generating rpcgen-dependent files
  as suggested by Garrett Wollman.
1996-04-28 04:38:52 +00:00
..
Makefile Performance enhancements (I hope) and new stuff: 1996-04-28 04:38:52 +00:00
Makefile.yp Performance enhancements (I hope) and new stuff: 1996-04-28 04:38:52 +00:00
mkaliases Performance enhancements (I hope) and new stuff: 1996-04-28 04:38:52 +00:00
mknetid Import the new, non-GPL ypserv, written by yours truly. Functionally 1995-12-16 20:54:17 +00:00
yp_access.c Performance enhancements (I hope) and new stuff: 1996-04-28 04:38:52 +00:00
yp_dblookup.c Performance enhancements (I hope) and new stuff: 1996-04-28 04:38:52 +00:00
yp_dnslookup.c Import the new, non-GPL ypserv, written by yours truly. Functionally 1995-12-16 20:54:17 +00:00
yp_error.c Change private version of verr() to __verr() and make it static to 1996-01-26 18:20:56 +00:00
yp_extern.h Performance enhancements (I hope) and new stuff: 1996-04-28 04:38:52 +00:00
yp_main.c Performance enhancements (I hope) and new stuff: 1996-04-28 04:38:52 +00:00
yp_server.c Performance enhancements (I hope) and new stuff: 1996-04-28 04:38:52 +00:00
ypserv.8 Correct some man page cross references and file location references. 1996-04-07 00:06:21 +00:00