summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ypserv/Makefile
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1996-04-28 04:38:52 +0000
committerwpaul <wpaul@FreeBSD.org>1996-04-28 04:38:52 +0000
commit0f95e4e2267a1ba84724a850c3e16f8a4797df56 (patch)
tree8a812c67e9e63f836246125cbbd49d43a685fe54 /usr.sbin/ypserv/Makefile
parent7431f827c29811064979692b6ff8740ff529e54b (diff)
downloadFreeBSD-src-0f95e4e2267a1ba84724a850c3e16f8a4797df56.zip
FreeBSD-src-0f95e4e2267a1ba84724a850c3e16f8a4797df56.tar.gz
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.
Diffstat (limited to 'usr.sbin/ypserv/Makefile')
-rw-r--r--usr.sbin/ypserv/Makefile28
1 files changed, 18 insertions, 10 deletions
diff --git a/usr.sbin/ypserv/Makefile b/usr.sbin/ypserv/Makefile
index 6f0ca9b..340a4cc 100644
--- a/usr.sbin/ypserv/Makefile
+++ b/usr.sbin/ypserv/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.2 1995/12/16 23:01:04 bde Exp $
+# $Id: Makefile,v 1.3 1995/12/23 21:35:27 wpaul Exp $
PROG= ypserv
SRCS= yp_svc.c yp_server.c yp_dblookup.c yp_dnslookup.c \
@@ -6,32 +6,40 @@ SRCS= yp_svc.c yp_server.c yp_dblookup.c yp_dnslookup.c \
MAN8= ypserv.8
-CFLAGS+= -I.
+CFLAGS+= -I. -DDB_CACHE
CLEANFILES= yp_svc.c ypxfr_clnt.c yp.h
-RPCSRC= ${.DESTDIR}/usr/include/rpcsvc/yp.x
+RPCDIR= ${.CURDIR}/../../include/rpcsvc
+.PATH: ${RPCDIR}
+
RPCGEN= rpcgen -I -C
# We need to remove the 'static' keyword from _rpcsvcstate so that
# yp_main.c can see it.
-yp_svc.c: ${RPCSRC} yp.h
+yp_svc.c: yp.x yp.h
rm -f ${.TARGET}
- ${RPCGEN} -DYPSERV_ONLY -m ${RPCSRC} | \
+ ${RPCGEN} -DYPSERV_ONLY -m ${RPCDIR}/yp.x | \
sed s/"static int _rpcsvcstate"/"int _rpcsvcstate"/g > ${.TARGET}
-ypxfr_clnt.c: ${RPCSRC} yp.h
- ${RPCGEN} -DYPPUSH_ONLY -l -o ${.TARGET} ${RPCSRC}
+ypxfr_clnt.c: yp.x yp.h
+ ${RPCGEN} -DYPPUSH_ONLY -l -o ${.TARGET} ${RPCDIR}/yp.x
-yp.h: ${RPCSRC}
- ${RPCGEN} -h -o ${.TARGET} ${RPCSRC}
+yp.h: yp.x
+ ${RPCGEN} -h -o ${.TARGET} ${RPCDIR}/yp.x
afterinstall:
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 \
${.CURDIR}/Makefile.yp \
- ${DESTDIR}/var/yp/Makefile
+ ${DESTDIR}/var/yp/Makefile.dist
+ @if [ ! -f ${DESTDIR}/var/yp/Makefile.dist ]; then \
+ ln -s ${DESTDIR}/var/yp/Makefile.dist \
+ ${DESTDIR}/var/yp/Makefile; fi
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
${.CURDIR}/mknetid \
${DESTDIR}/usr/libexec/mknetid
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+ ${.CURDIR}/mkaliases \
+ ${DESTDIR}/usr/libexec/mkaliases
.include <bsd.prog.mk>
OpenPOWER on IntegriCloud