From 92a11b8721591f8d9069a6681722a87289e82e08 Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Wed, 3 Apr 1996 03:24:03 +0000 Subject: [PATCH] yppush_main.c: - Remove unused 'pid' member from the jobs structure. (This was left over from an earlier incarnation of the program that used multiple processes.) - Remove #ifdef'ed longjmp() stuff. - Print warning message if the 'pushing' host is not the master for a map being pushed but don't bail out. (While yppush should only be used on an NIS master, using it elsewhere is not an unpardonable sin.) yppush.8: - Fix a couple of mind-os. Makefile - Change format to hopefully ease bootstrapping. (Suggested by wollman.) Other Makefiles should follow. --- usr.sbin/yppush/Makefile | 24 ++++++++++--------- usr.sbin/yppush/yppush.8 | 6 ++--- usr.sbin/yppush/yppush_main.c | 44 +++++------------------------------ 3 files changed, 22 insertions(+), 52 deletions(-) diff --git a/usr.sbin/yppush/Makefile b/usr.sbin/yppush/Makefile index e8aaea6ce380..67a8116d44ea 100644 --- a/usr.sbin/yppush/Makefile +++ b/usr.sbin/yppush/Makefile @@ -4,23 +4,25 @@ PROG= yppush SRCS= yp_clnt.c ypxfr_getmap.c yp_dblookup.c yppush_svc.c \ yp_error.c ypxfr_misc.c yppush_main.c -.PATH: ${.CURDIR}/../ypserv ${.CURDIR}/../../libexec/ypxfr - MAN8= yppush.8 + CFLAGS+=-I. -I${.CURDIR}/../../libexec/ypxfr +RPCDIR= ${.CURDIR}/../../include/rpcsvc +RPCGEN= rpcgen -C + +.PATH: ${RPCDIR} ${.CURDIR}/../../usr.sbin/ypserv \ + ${.CURDIR}/../../libexec/ypxfr + CLEANFILES= yp.h yp_clnt.c yppush_svc.c -RPCSRC= ${.DESTDIR}/usr/include/rpcsvc/yp.x -RPCGEN= rpcgen -C +yppush_svc.c: yp.x yp.h + ${RPCGEN} -DYPPUSH_ONLY -m -o ${.TARGET} ${RPCDIR}/yp.x -yppush_svc.c: ${RPCSRC} yp.h - ${RPCGEN} -DYPPUSH_ONLY -m -o ${.TARGET} ${RPCSRC} +yp_clnt.c: yp.x yp.h + ${RPCGEN} -DYPSERV_ONLY -l -o ${.TARGET} ${RPCDIR}/yp.x -yp_clnt.c: ${RPCSRC} yp.h - ${RPCGEN} -DYPSERV_ONLY -l -o ${.TARGET} ${RPCSRC} - -yp.h: ${RPCSRC} - ${RPCGEN} -h -o ${.TARGET} ${RPCSRC} +yp.h: yp.x + ${RPCGEN} -h -o ${.TARGET} ${RPCDIR}/yp.x .include diff --git a/usr.sbin/yppush/yppush.8 b/usr.sbin/yppush/yppush.8 index 46b718bdd7fe..0551c7d9c750 100644 --- a/usr.sbin/yppush/yppush.8 +++ b/usr.sbin/yppush/yppush.8 @@ -29,7 +29,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: yppush.8,v 1.2 1996/01/30 13:52:45 mpp Exp $ +.\" $Id: yppush.8,v 1.3 1996/02/11 22:38:02 mpp Exp $ .\" .Dd February 5, 1995 .Dt YPPUSH 8 @@ -149,7 +149,7 @@ the system administrator decides to store the NIS maps somewhere else. .It Fl v Verbose mode: causes .Nm yppush -to print debugging messages as it runs. Note specifying this flag twice +to print debugging messages as it runs. Specifying this flag twice makes .Nm yppush even more verbose. @@ -165,7 +165,7 @@ a particular NIS domain. .Xr ypxfr 8 .Sh BUGS The mechanism for transferring NIS maps in NIS v1 is different -that that in NIS version 2. This version of +than that in NIS version 2. This version of .Nm yppush has support for transferring maps to NIS v2 systems only. .Sh AUTHOR diff --git a/usr.sbin/yppush/yppush_main.c b/usr.sbin/yppush/yppush_main.c index c96bed40868d..b596e1ac47fe 100644 --- a/usr.sbin/yppush/yppush_main.c +++ b/usr.sbin/yppush/yppush_main.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: yppush_main.c,v 1.25 1996/01/27 19:44:48 wpaul Exp $ + * $Id: yppush_main.c,v 1.26 1996/04/03 00:27:53 wpaul Exp wpaul $ */ #include @@ -37,9 +37,6 @@ #include #include #include -#ifdef LONGJMP -#include -#endif #include #include #include @@ -56,7 +53,7 @@ struct dom_binding {}; #include "yppush_extern.h" #ifndef lint -static const char rcsid[] = "$Id: yppush_main.c,v 1.25 1996/01/27 19:44:48 wpaul Exp $"; +static const char rcsid[] = "$Id: yppush_main.c,v 1.26 1996/04/03 00:27:53 wpaul Exp wpaul $"; #endif char *progname = "yppush"; @@ -72,16 +69,11 @@ unsigned long yppush_transid = 0; int yppush_timeout = 80; /* Default timeout. */ int yppush_jobs = 0; /* Number of allowed concurrent jobs. */ int yppush_running_jobs = 0; /* Number of currently running jobs. */ -#ifdef LONGJMP -int yppush_pausing = 0; /* Flag set when longjmp()s are allowed. */ -jmp_buf env; -#endif int yppush_alarm_tripped = 0; /* Structure for holding information about a running job. */ struct jobs { unsigned long tid; - int pid; int sock; int port; ypxfrstat stat; @@ -159,10 +151,6 @@ static void yppush_exit(now) /* Let all the information trickle in. */ while(!now && still_pending) { -#ifdef LONGJMP - yppush_pausing++; - setjmp(env); /* more magic */ -#endif jptr = yppush_joblist; still_pending = 0; while (jptr) { @@ -186,9 +174,6 @@ static void yppush_exit(now) yppush_alarm_tripped = 0; alarm(YPPUSH_RESPONSE_TIMEOUT); pause(); -#ifdef LONGJMP - yppush_pausing = 0; -#endif alarm(0); if (yppush_alarm_tripped == 1) { yp_error("timed out"); @@ -287,10 +272,6 @@ static void async_handler(sig) alarm(0); yppush_alarm_tripped++; kill(getpid(), SIGALRM); -#ifdef LONGJMP - if (yppush_pausing) - longjmp(env, 1); -#endif return; } @@ -511,37 +492,21 @@ int yppush_foreach(status, key, keylen, val, vallen, data) * wait for one of them to finish so we can reuse its slot. */ if (yppush_jobs <= 1) { -#ifdef LONGJMP - yppush_pausing++; - while (!setjmp(env) && yppush_running_jobs) { -#else yppush_alarm_tripped = 0; while (!yppush_alarm_tripped && yppush_running_jobs) { -#endif alarm(yppush_timeout); yppush_alarm_tripped = 0; pause(); alarm(0); } -#ifdef LONGJMP - yppush_pausing = 0; -#endif } else { -#ifdef LONGJMP - yppush_pausing++; - while (!setjmp(env) && yppush_running_jobs >= yppush_jobs) { -#else yppush_alarm_tripped = 0; while (!yppush_alarm_tripped && yppush_running_jobs >= yppush_jobs) { -#endif alarm(yppush_timeout); yppush_alarm_tripped = 0; pause(); alarm(0); } -#ifdef LONGJMP - yppush_pausing = 0; -#endif } /* Cleared for takeoff: set everything in motion. */ @@ -656,8 +621,11 @@ main(argc,argv) } if (strncmp(myname, data.data, data.size)) { - yp_error("this host is not the master for %s",yppush_mapname); + yp_error("warning: this host is not the master for %s", + yppush_mapname); +#ifdef NITPICKY yppush_exit(1); +#endif } yppush_master = strdup(data.data);