From 937ec63685f69f55eb0a6ce39ab94dc475eb5fe6 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Wed, 26 Mar 2003 09:10:59 +0000 Subject: [PATCH] linux-rxk-listener-shutdown-cleanup-20030323 get rid of need for sys_kill --- src/afs/LINUX/osi_machdep.h | 40 +------------------------------------ src/afs/LINUX/osi_misc.c | 8 -------- src/afs/LINUX/osi_module.c | 8 +------- src/afs/afs_osi.c | 3 --- src/rx/LINUX/rx_knet.c | 12 +++++++++-- 5 files changed, 12 insertions(+), 59 deletions(-) diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index f26db090b7..97cb32290c 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -31,45 +31,7 @@ #endif #ifdef RECALC_SIGPENDING_TAKES_VOID -/* Principal of maximum uselessness says we need to provide this */ -static inline int _has_pending_signals(sigset_t *signal, sigset_t *blocked) -{ - unsigned long ready; - long i; - - switch (_NSIG_WORDS) { - default: - for (i = _NSIG_WORDS, ready = 0; --i >= 0 ;) - ready |= signal->sig[i] &~ blocked->sig[i]; - break; - - case 4: ready = signal->sig[3] &~ blocked->sig[3]; - ready |= signal->sig[2] &~ blocked->sig[2]; - ready |= signal->sig[1] &~ blocked->sig[1]; - ready |= signal->sig[0] &~ blocked->sig[0]; - break; - - case 2: ready = signal->sig[1] &~ blocked->sig[1]; - ready |= signal->sig[0] &~ blocked->sig[0]; - break; - - case 1: ready = signal->sig[0] &~ blocked->sig[0]; - } - return ready != 0; -} - -#define PENDING(p,b) _has_pending_signals(&(p)->signal, (b)) -static inline void _recalc_sigpending_tsk(struct task_struct *t) -{ - t->sigpending = PENDING(&t->pending, &t->blocked) || -#ifdef STRUCT_TASK_STRUCT_HAS_SIG - PENDING(&t->sig->shared_pending, &t->blocked); -#else - PENDING(&t->signal->shared_pending, &t->blocked); -#endif -} - -#define RECALC_SIGPENDING(X) _recalc_sigpending_tsk(X) +#define RECALC_SIGPENDING(X) recalc_sigpending() #else #define RECALC_SIGPENDING(X) recalc_sigpending(X) #endif diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 13499d152f..c81a71d757 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -451,14 +451,6 @@ void osi_linux_mask(void) SIG_UNLOCK(current); } -void osi_linux_unmask() { - SIG_LOCK(rxk_ListenerTask); - sigemptyset(&rxk_ListenerTask->blocked); - flush_signals(rxk_ListenerTask); - RECALC_SIGPENDING(rxk_ListenerTask); - SIG_UNLOCK(rxk_ListenerTask); -} - void osi_linux_rxkreg(void) { rxk_ListenerTask = current; diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index 4d5227d7ad..5564f36413 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -38,7 +38,6 @@ RCSID("$Header$"); #endif asmlinkage int (*sys_settimeofdayp)(struct timeval *tv, struct timezone *tz); -asmlinkage int (*sys_killp)(int pid, int signal); asmlinkage long (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist); #ifdef EXPORTED_SYS_CALL_TABLE @@ -193,7 +192,7 @@ int init_module(void) { #if defined(AFS_IA64_LINUX20_ENV) unsigned long kernel_gp; - static struct fptr sys_kill, sys_settimeofday, sys_setgroups; + static struct fptr sys_settimeofday, sys_setgroups; #endif extern int afs_syscall(); extern long afs_xsetgroups(); @@ -319,18 +318,13 @@ int init_module(void) kernel_gp = ((struct fptr *)printk)->gp; sys_settimeofdayp = (void *) &sys_settimeofday; - sys_killp = (void *) &sys_kill; ((struct fptr *)sys_settimeofdayp)->ip = SYSCALL2POINTER sys_call_table[__NR_settimeofday - 1024]; ((struct fptr *)sys_settimeofdayp)->gp = kernel_gp; - ((struct fptr *)sys_killp)->ip = - SYSCALL2POINTER sys_call_table[__NR_kill - 1024]; - ((struct fptr *)sys_killp)->gp = kernel_gp; #else /* !AFS_IA64_LINUX20_ENV */ sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday]; - sys_killp = SYSCALL2POINTER sys_call_table[__NR_kill]; #endif /* AFS_IA64_LINUX20_ENV */ /* setup AFS entry point. */ diff --git a/src/afs/afs_osi.c b/src/afs/afs_osi.c index e4f9ae1a6c..b4c84587c3 100644 --- a/src/afs/afs_osi.c +++ b/src/afs/afs_osi.c @@ -282,9 +282,6 @@ void afs_osi_MaskSignals(void) /* unmask signals in rxk listener */ void afs_osi_UnmaskRxkSignals(void) { -#ifdef AFS_LINUX22_ENV - osi_linux_unmask(); -#endif } /* register rxk listener proc info */ diff --git a/src/rx/LINUX/rx_knet.c b/src/rx/LINUX/rx_knet.c index d6a91f9108..b5f011fe9c 100644 --- a/src/rx/LINUX/rx_knet.c +++ b/src/rx/LINUX/rx_knet.c @@ -17,6 +17,7 @@ RCSID("$Header$"); +#include #ifdef AFS_LINUX22_ENV #include "rx/rx_kcommon.h" #if defined(AFS_LINUX24_ENV) @@ -174,11 +175,18 @@ int osi_NetReceive(osi_socket so, struct sockaddr_in *from, void osi_StopListener(void) { - extern int (*sys_killp)(); + struct task_struct *listener; extern int rxk_ListenerPid; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + read_lock(&tasklist_lock); +#endif + listener = find_task_by_pid(rxk_ListenerPid); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) + read_unlock(&tasklist_lock); +#endif while (rxk_ListenerPid) { - (void) (*sys_killp)(rxk_ListenerPid, SIGKILL); + force_sig(SIGKILL, listener); afs_osi_Sleep(&rxk_ListenerPid); } sock_release(rx_socket);