From: Michael Meffie Date: Thu, 31 Mar 2016 20:40:40 +0000 (-0400) Subject: viced: convert the fileserver to opr softsig X-Git-Tag: openafs-stable-1_8_0pre1~130 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=093fdd6c4cdaeb31a2d9078bd0db5b2e1030b335 viced: convert the fileserver to opr softsig Convert the fileserver from the obsolete softsig routines to the modern opr softsig routines for pthreaded programs. Change-Id: I9e98e402f73ebca05fcaf0f852055b9a5ad93632 Reviewed-on: https://gerrit.openafs.org/11994 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- diff --git a/src/viced/viced.c b/src/viced/viced.c index 936cdaa..989ad8e 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -46,6 +46,8 @@ #include #include #include +#include +#include /* must come after softsig.h */ #include #include #include @@ -69,9 +71,6 @@ #include #include #include -#ifndef AFS_NT40_ENV -# include -#endif #include "viced_prototypes.h" #include "viced.h" #include "host.h" @@ -85,8 +84,6 @@ extern int etext; static void ClearXStatValues(void); static void PrintCounters(void); -static void ResetCheckDescriptors(void); -static void ResetCheckSignal(void); static afs_int32 Do_VLRegisterRPC(void); @@ -239,10 +236,10 @@ static int fs_stateInit(void) */ /* DEBUG HACK */ +#ifndef AFS_NT40_ENV void CheckDescriptors_Signal(int signo) { -#ifndef AFS_NT40_ENV struct afs_stat status; int tsize = getdtablesize(); int i; @@ -256,10 +253,17 @@ CheckDescriptors_Signal(int signo) } } fflush(stdout); - ResetCheckDescriptors(); -#endif } +#endif +/* Signal number for dumping debug info is platform dependent. */ +#if defined(AFS_HPUX_ENV) +# define AFS_SIG_CHECK SIGPOLL +#elif defined(AFS_NT40_ENV) +# define AFS_SIG_CHECK SIGUSR2 +#else +# define AFS_SIG_CHECK SIGXCPU +#endif void CheckSignal_Signal(int x) { @@ -274,7 +278,6 @@ CheckSignal_Signal(int x) h_PrintClients(); DumpCallBackState(); PrintCounters(); - ResetCheckSignal(); } void @@ -309,34 +312,6 @@ fs_IsLocalRealmMatch(void *rock, char *name, char *inst, char *cell) return islocal; } -static void -ResetCheckSignal(void) -{ - int signo; - -#if defined(AFS_HPUX_ENV) - signo = SIGPOLL; -#elif defined(AFS_NT40_ENV) - signo = SIGUSR2; -#else - signo = SIGXCPU; -#endif - -#if !defined(AFS_NT40_ENV) - softsig_signal(signo, CheckSignal_Signal); -#else - signal(signo, CheckSignal_Signal); -#endif -} - -static void -ResetCheckDescriptors(void) -{ -#ifndef AFS_NT40_ENV - softsig_signal(SIGTERM, CheckDescriptors_Signal); -#endif -} - #ifndef AFS_NT40_ENV int viced_syscall(afs_uint32 a3, afs_uint32 a4, void *a5) @@ -1864,22 +1839,20 @@ main(int argc, char *argv[]) serverLogSyslogTag = "fileserver"; #endif OpenLog(logFile); - SetupLogSignals(); LogCommandLine(argc, argv, "starting", "", "File server", FSLog); if (afsconf_GetLatestKey(confDir, NULL, NULL) == 0) { LogDesWarning(); } -#if !defined(AFS_NT40_ENV) /* initialize the pthread soft signal handler thread */ - softsig_init(); + opr_softsig_Init(); + SetupLogSoftSignals(); + opr_softsig_Register(AFS_SIG_CHECK, CheckSignal_Signal); +#ifndef AFS_NT40_ENV + opr_softsig_Register(SIGTERM, CheckDescriptors_Signal); #endif - /* install signal handlers for controlling the fileserver process */ - ResetCheckSignal(); /* set CheckSignal_Signal() sig handler */ - ResetCheckDescriptors(); /* set CheckDescriptors_Signal() sig handler */ - #if defined(AFS_SGI_ENV) /* give this guy a non-degrading priority so help busy servers */ schedctl(NDPRI, 0, NDPNORMMAX); @@ -2121,11 +2094,7 @@ main(int argc, char *argv[]) /* Install handler to catch the shutdown signal; * bosserver assumes SIGQUIT shutdown */ -#if !defined(AFS_NT40_ENV) - softsig_signal(SIGQUIT, ShutDown_Signal); -#else - (void)signal(SIGQUIT, ShutDown_Signal); -#endif + opr_softsig_Register(SIGQUIT, ShutDown_Signal); if (VInitAttachVolumes(fileServer)) { ViceLog(0,