From fe1beb4f3e69f4ae2dbec60902b60cd601674d15 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 13 Jun 2002 20:35:28 +0000 Subject: [PATCH] revert-dont-spawn-kernel-thread-for-rxk-listener-20020426 in some cases this causes shutdowns to hang forever. notably shutdown -i0 -g6 -y works while reboot does not --- src/rx/rx_kcommon.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/rx/rx_kcommon.c b/src/rx/rx_kcommon.c index 97284b5a3c..da117bd3ce 100644 --- a/src/rx/rx_kcommon.c +++ b/src/rx/rx_kcommon.c @@ -1000,7 +1000,22 @@ int rxk_ReadPacket(osi_socket so, struct rx_packet *p, int *host, int *port) */ int rxk_ListenerPid; /* Used to signal process to wakeup at shutdown */ +#ifdef AFS_SUN5_ENV +/* + * Run the listener as a kernel process. + */ void rxk_Listener(void) +{ + extern id_t syscid; + void rxk_ListenerProc(void); + if (newproc(rxk_ListenerProc, syscid, 59)) + osi_Panic("rxk_Listener: failed to fork listener process!\n"); +} + +void rxk_ListenerProc(void) +#else /* AFS_SUN5_ENV */ +void rxk_Listener(void) +#endif /* AFS_SUN5_ENV */ { struct rx_packet *rxp = NULL; int code; @@ -1018,9 +1033,9 @@ void rxk_Listener(void) #if defined(AFS_DARWIN_ENV) rxk_ListenerPid = current_proc()->p_pid; #endif -#if defined(RX_ENABLE_LOCKS) +#if defined(RX_ENABLE_LOCKS) && !defined(AFS_SUN5_ENV) AFS_GUNLOCK(); -#endif /* RX_ENABLE_LOCKS */ +#endif /* RX_ENABLE_LOCKS && !AFS_SUN5_ENV */ while (afs_termState != AFSOP_STOP_RXK_LISTENER) { if (rxp) { @@ -1049,6 +1064,14 @@ void rxk_Listener(void) #if defined(AFS_LINUX22_ENV) || defined(AFS_SUN5_ENV) afs_osi_Wakeup(&rxk_ListenerPid); #endif +#ifdef AFS_SUN5_ENV + AFS_GUNLOCK(); +#ifdef HAVE_P_COREFILE + if (!curproc->p_corefile) /* newproc doesn't set it, but exit frees it */ + curproc->p_corefile = refstr_alloc("core"); +#endif + exit(CLD_EXITED, 0); +#endif /* AFS_SUN5_ENV */ } #if !defined(AFS_LINUX20_ENV) && !defined(AFS_SUN5_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)