Patch #: 91 Type: operational change Priority: none Modification: AUFS re-reads system volumes file on USR1 signal Submitted: Eugene Bogaart Archived: munnari.OZ.AU mac/cap.patches/cap60.patch091 Application: 'cd cap60; patch -p < cap60.patches/cap60.patch091' Summary: add signal handler for USR1 File: cap60/Configure File: cap60/applications/aufs/aufs.c File: cap60/applications/aufs/afpvols.c *** Configure.orig Sat Feb 22 01:29:47 1992 --- Configure Sat Feb 22 01:37:59 1992 *************** *** 1,7 **** #!/bin/sh ! # $Author: djh $ $Date: 1992/02/20 11:00:58 $ ! # $Header: /mac/src/cap60/RCS/Configure,v 2.33 1992/02/20 11:00:58 djh Rel djh $ ! # $Revision: 2.33 $ # CAP configuration shell script. This ain't perfect, but it's a start. # Execute with /bin/sh Configure if your system won't run it (ksh is okay too) # --- 1,7 ---- #!/bin/sh ! # $Author: djh $ $Date: 1992/02/21 14:37:42 $ ! # $Header: /mac/src/cap60/RCS/Configure,v 2.35 1992/02/21 14:37:42 djh Rel djh $ ! # $Revision: 2.35 $ # CAP configuration shell script. This ain't perfect, but it's a start. # Execute with /bin/sh Configure if your system won't run it (ksh is okay too) # *************** *** 572,577 **** --- 572,580 ---- # # + AUFS_IDLE_TIMEOUT will disconnect idle AUFS sessions (-[i|I] period) # define(`specialcflags',concat(specialcflags,` -DAUFS_IDLE_TIMEOUT')) + # + # + REREAD_AFPVOLS kill -USR1 will make parent aufs re-read system vols file + # define(`specialcflags',concat(specialcflags,` -DREREAD_AFPVOLS')) # # # *** applications/aufs/aufs.c.orig Thu Feb 20 21:31:21 1992 --- applications/aufs/aufs.c Sat Feb 22 01:27:14 1992 *************** *** 1,7 **** /* ! * $Author: djh $ $Date: 1992/02/20 10:31:11 $ ! * $Header: /mac/src/cap60/applications/aufs/RCS/aufs.c,v 2.10 1992/02/20 10:31:11 djh Rel djh $ ! * $Revision: 2.10 $ */ /* --- 1,7 ---- /* ! * $Author: djh $ $Date: 1992/02/21 14:27:02 $ ! * $Header: /mac/src/cap60/applications/aufs/RCS/aufs.c,v 2.11 1992/02/21 14:27:02 djh Rel djh $ ! * $Revision: 2.11 $ */ /* *************** *** 81,86 **** --- 81,89 ---- private char *passwdlookaside = NULL; /* local password file??? */ private char *guestid = NULL; /* any guest ids? */ private char *coredir = NULL; /* place to put coredumps */ + #ifdef REREAD_AFPVOLS + private int readafpvols = FALSE;/* set by USR1 signal */ + #endif REREAD_AFPVOLS #ifdef LWSRV_AUFS_SECURITY export char *userlogindir = NULL; /* budd -- name of userlogin file */ #endif LWSRV_AUFS_SECURITY *************** *** 379,384 **** --- 382,391 ---- { int timedout(); void inferiordone(), dienow(), dying(); + #ifdef REREAD_AFPVOLS + void setreadafpvols(); + void dorereadafpvols(); + #endif REREAD_AFPVOLS #ifndef NOSHUTDOWNCODE void killnow(), killin5(), diein5(); #endif NOSHUTDOWNCODE; *************** *** 600,605 **** --- 607,615 ---- signal(SIGHUP, killnow); /* kill -HUP -- Immediate shutdown */ signal(SIGTERM, killin5); /* kill -TERM -- Timed (5 min) shutdown */ #endif NOSHUTDOWNCODE; + #ifdef REREAD_AFPVOLS + signal(SIGUSR1, setreadafpvols); /* kill -USR1 -- force afpvols re-read */ + #endif REREAD_AFPVOLS do { pid = -1; /* make sure zero at start */ *************** *** 609,614 **** --- 619,628 ---- /* won't wait if we set comp above */ while (comp > 0) { abSleep(sectotick(5),TRUE); + #ifdef REREAD_AFPVOLS + if (readafpvols == TRUE) + dorereadafpvols(); + #endif REREAD_AFPVOLS gcinferior(); } if (comp == NoMoreSessions) { *************** *** 698,703 **** --- 712,720 ---- signal(SIGHUP, dienow); /* superior signaled us to shutdown */ mypid = getpid(); #ifndef NOSHUTDOWNCODE + #ifdef REREAD_AFPVOLS + signal(SIGUSR1, SIG_DFL);/* ignore in inferior */ + #endif REREAD_AFPVOLS # ifndef NOPGRP setpgrp(0, parent_pid); /* set our process group */ # endif NOPGRP *************** *** 1252,1257 **** --- 1269,1277 ---- { void killinn(); + #ifdef REREAD_AFPVOLS + signal(SIGUSR1, SIG_IGN); + #endif REREAD_AFPVOLS signal (SIGTERM, SIG_IGN); logit(0,"Shutdown by time -- initiating 5 minute shutdown"); killpg (parent_pid, SIGTERM); *************** *** 1279,1284 **** --- 1299,1335 ---- #endif /* NOSHUTDOWNCODE */ + + #ifdef REREAD_AFPVOLS + /* + * a SIGUSR1 sets the 'readafpvols' flag which causes + * dorereadafpvols() to be called next time through the loop + * + */ + + void + setreadafpvols() + { + signal(SIGUSR1, SIG_IGN); + readafpvols = TRUE; + signal(SIGUSR1, setreadafpvols); + } + + void + dorereadafpvols() + { + FILE *fd, *fopen(); + + readafpvols = FALSE; + if (sysvolfile != NULL) { + if ((fd = fopen(sysvolfile, "r")) == NULL) + logit(0, "aufs: system volumes file %s disappeared", sysvolfile); + else + if (!VRRdVFile(fd)) + logit(0, "aufs: bad format system volumes file %s", sysvolfile); + } + } + #endif REREAD_AFPVOLS #ifdef notdef /* *** applications/aufs/afpvols.c.orig Wed Mar 20 17:31:00 1991 --- applications/aufs/afpvols.c Sat Feb 22 01:28:12 1992 *************** *** 1,7 **** /* ! * $Author: djh $ $Date: 91/03/20 17:30:37 $ ! * $Header: afpvols.c,v 2.3 91/03/20 17:30:37 djh Exp $ ! * $Revision: 2.3 $ */ /* --- 1,7 ---- /* ! * $Author: djh $ $Date: 1992/02/21 14:28:02 $ ! * $Header: /mac/src/cap60/applications/aufs/RCS/afpvols.c,v 2.4 1992/02/21 14:28:02 djh Rel djh $ ! * $Revision: 2.4 $ */ /* *************** *** 195,200 **** --- 195,223 ---- fclose(fd); /* close file */ return(VolCnt != origVolCnt); /* return true if found any entries */ } + + #ifdef REREAD_AFPVOLS + /* + * VRRdVFile(FILE *fd) + * + * VRRdVFile() is called after a USR1 signal to the aufs process. + * We delete contents of current VolTbl and call VRdVFile() again. + * + */ + + VRRdVFile(fd) + FILE *fd; + { + int i; + + for (i = 0; i < VolCnt; i++) + free(VolTbl[i]); + + VolCnt = 0; + + return(VRdVFile(fd)); + } + #endif REREAD_AFPVOLS /* * void VInit(char *usr,char *home) *** README.orig Sat Feb 22 01:28:40 1992 --- README Sat Feb 22 01:29:12 1992 *************** *** 3,9 **** (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 90, February 1992 Introduction ------------ --- 3,9 ---- (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 91, February 1992 Introduction ------------