From: Michael Meffie Date: Wed, 2 Sep 2015 21:22:16 +0000 (-0400) Subject: util: remove util/softsig X-Git-Tag: openafs-stable-1_8_0pre1~126 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=ee1e344cef437dd43610cd421e80df2f21001b80 util: remove util/softsig Remove the old util/softsig implementation, which has been replaced by opr/softsig. Change-Id: Ie32f04129dd0b09a8baf9f6739abf53fbf1b98eb Reviewed-on: https://gerrit.openafs.org/11998 Reviewed-by: Perry Ruiter Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- diff --git a/src/util/Makefile.in b/src/util/Makefile.in index 9dd1dc0..f0dfcc8 100644 --- a/src/util/Makefile.in +++ b/src/util/Makefile.in @@ -19,7 +19,7 @@ LT_objs =$(LT_rpc_objs) \ hputil.lo kreltime.lo uuid.lo serverLog.lo \ dirpath.lo fileutil.lo flipbase64.lo fstab.lo \ afs_atomlist.lo afs_lhash.lo pthread_glock.lo tabular_output.lo \ - pthread_threadname.lo softsig.lo ${REGEX_OBJ} + pthread_threadname.lo ${REGEX_OBJ} LT_deps = $(top_builddir)/src/opr/liboafs_opr.la LT_libs = $(LIB_roken) $(MT_LIBS) @@ -36,7 +36,6 @@ includes = \ ${TOP_INCDIR}/afs/pthread_glock.h \ ${TOP_INCDIR}/afs/afs_atomlist.h \ ${TOP_INCDIR}/afs/afs_lhash.h \ - ${TOP_INCDIR}/afs/softsig.h \ ${TOP_INCDIR}/afs/work_queue.h \ ${TOP_INCDIR}/afs/work_queue_types.h \ ${TOP_INCDIR}/afs/thread_pool.h \ @@ -101,9 +100,6 @@ ${TOP_INCDIR}/afs/afs_atomlist.h: ${srcdir}/afs_atomlist.h ${TOP_INCDIR}/afs/afs_lhash.h: ${srcdir}/afs_lhash.h ${INSTALL_DATA} $? $@ -${TOP_INCDIR}/afs/softsig.h: ${srcdir}/softsig.h - ${INSTALL_DATA} $? $@ - ${TOP_INCDIR}/afs/work_queue.h: ${srcdir}/work_queue.h ${INSTALL_DATA} $? $@ @@ -174,7 +170,6 @@ install: dirpath.h util.a sys ${INSTALL_DATA} ${srcdir}/pthread_glock.h ${DESTDIR}${includedir}/afs/pthread_glock.h ${INSTALL_DATA} ${srcdir}/afs_atomlist.h ${DESTDIR}${includedir}/afs/afs_atomlist.h ${INSTALL_DATA} ${srcdir}/afs_lhash.h ${DESTDIR}${includedir}/afs/afs_lhash.h - ${INSTALL_DATA} ${srcdir}/softsig.h ${DESTDIR}${includedir}/afs/softsig.h ${INSTALL_DATA} ${srcdir}/work_queue.h ${DESTDIR}${includedir}/afs/work_queue.h ${INSTALL_DATA} ${srcdir}/work_queue_types.h ${DESTDIR}${includedir}/afs/work_queue_types.h ${INSTALL_DATA} ${srcdir}/thread_pool.h ${DESTDIR}${includedir}/afs/thread_pool.h @@ -199,7 +194,6 @@ dest: dirpath.h util.a sys ${INSTALL_DATA} ${srcdir}/pthread_glock.h ${DEST}/include/afs/pthread_glock.h ${INSTALL_DATA} ${srcdir}/afs_atomlist.h ${DEST}/include/afs/afs_atomlist.h ${INSTALL_DATA} ${srcdir}/afs_lhash.h ${DEST}/include/afs/afs_lhash.h - ${INSTALL_DATA} ${srcdir}/softsig.h ${DEST}/include/afs/softsig.h ${INSTALL_DATA} ${srcdir}/work_queue.h ${DEST}/include/afs/work_queue.h ${INSTALL_DATA} ${srcdir}/work_queue_types.h ${DEST}/include/afs/work_queue_types.h ${INSTALL_DATA} ${srcdir}/thread_pool.h ${DEST}/include/afs/thread_pool.h diff --git a/src/util/liboafs_util.la.sym b/src/util/liboafs_util.la.sym index c7249b2..d3a5793 100644 --- a/src/util/liboafs_util.la.sym +++ b/src/util/liboafs_util.la.sym @@ -43,8 +43,6 @@ pthread_recursive_mutex_unlock serverLogSyslog serverLogSyslogFacility serverLogSyslogTag -softsig_init -softsig_signal util_GetHumanInt32 util_GetInt32 util_GetInt64 diff --git a/src/util/softsig.c b/src/util/softsig.c deleted file mode 100644 index 79eb6dd..0000000 --- a/src/util/softsig.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2000, International Business Machines Corporation and others. - * All Rights Reserved. - * - * This software has been released under the terms of the IBM Public - * License. For details, see the LICENSE file in the top-level source - * directory or online at http://www.openafs.org/dl/license10.html - * - * Portions Copyright (c) 2003 Apple Computer, Inc. - */ - -#include -#include -#include /* Must be before roken.h */ - -#include -#include - -#include - -#include "pthread_nosigs.h" - -/*------------------------------------------------------------------------ - * Under Darwin 6.x (including 7.0), sigwait() is broken, so we use - * sigsuspend() instead. We also don't block signals we don't know - * about, so they should kill us, rather than us returning zero status. - *------------------------------------------------------------------------*/ - -static pthread_t softsig_tid; -static struct { - void (*handler) (int); - int pending; -#if !(defined(AFS_DARWIN_ENV) || (defined(AFS_NBSD_ENV) && !defined(AFS_NBSD50_ENV))) - int fatal; -#endif /* !defined(AFS_DARWIN_ENV) || !defined(AFS_NBSD_ENV) */ - int inited; -} softsig_sigs[NSIG]; - -static void * -softsig_thread(void *arg) -{ - sigset_t ss, os; - int i; - - sigemptyset(&ss); - /* get the list of signals _not_ blocked by AFS_SIGSET_CLEAR() */ - pthread_sigmask(SIG_BLOCK, &ss, &os); - pthread_sigmask(SIG_SETMASK, &os, NULL); - sigaddset(&ss, SIGUSR1); -#if defined(AFS_DARWIN_ENV) || (defined(AFS_NBSD_ENV) && !defined(AFS_NBSD50_ENV)) - pthread_sigmask (SIG_BLOCK, &ss, NULL); - sigdelset (&os, SIGUSR1); -#elif !defined(AFS_HPUX_ENV) - /* On HPUX, don't wait for 'critical' signals, as things such as - * SEGV won't cause a core, then. Some non-HPUX platforms may need - * this, though, since apparently if we wait on some signals but not - * e.g. SEGV, the softsig thread will still wait around when the - * other threads were killed by the SEGV. */ - for (i = 0; i < NSIG; i++) { - if (!sigismember(&os, i) && i != SIGSTOP && i != SIGKILL) { - sigaddset(&ss, i); - softsig_sigs[i].fatal = 1; - } - } -#endif /* defined(AFS_DARWIN_ENV) || defined(AFS_NBSD_ENV) */ - - while (1) { - void (*h) (int); -#if !defined(AFS_DARWIN_ENV) && (!defined(AFS_NBSD_ENV) || defined(AFS_NBSD50_ENV)) - int sigw; -#endif - - h = NULL; - - for (i = 0; i < NSIG; i++) { - if (softsig_sigs[i].handler && !softsig_sigs[i].inited) { - sigaddset(&ss, i); -#if defined(AFS_DARWIN_ENV) || (defined(AFS_NBSD_ENV) && !defined(AFS_NBSD50_ENV)) - pthread_sigmask (SIG_BLOCK, &ss, NULL); - sigdelset (&os, i); -#endif /* defined(AFS_DARWIN_ENV) || defined(AFS_NBSD_ENV) */ - softsig_sigs[i].inited = 1; - } - if (softsig_sigs[i].pending) { - softsig_sigs[i].pending = 0; - h = softsig_sigs[i].handler; - break; - } - } - if (i == NSIG) { -#if defined(AFS_DARWIN_ENV) || (defined(AFS_NBSD_ENV) && !defined(AFS_NBSD50_ENV)) - sigsuspend (&os); -#else /* !defined(AFS_DARWIN_ENV) && !defined(AFS_NBSD_ENV) */ - sigwait(&ss, &sigw); - if (sigw != SIGUSR1) { - if (softsig_sigs[sigw].fatal) - exit(0); - softsig_sigs[sigw].pending = 1; - } -#endif /* defined(AFS_DARWIN_ENV) || defined(AFS_NBSD_ENV) */ - } else if (h) - h(i); - } - return NULL; -} - -static void -softsig_usr1(int signo) -{ - signal (SIGUSR1, softsig_usr1); -} - -void -softsig_init(void) -{ - int rc; - AFS_SIGSET_DECL; - AFS_SIGSET_CLEAR(); - rc = pthread_create(&softsig_tid, NULL, &softsig_thread, NULL); - opr_Assert(0 == rc); - AFS_SIGSET_RESTORE(); - signal (SIGUSR1, softsig_usr1); -} - -static void -softsig_handler(int signo) -{ - signal(signo, softsig_handler); - softsig_sigs[signo].pending = 1; - pthread_kill(softsig_tid, SIGUSR1); -} - -void -softsig_signal(int signo, void (*handler) (int)) -{ - softsig_sigs[signo].handler = handler; - softsig_sigs[signo].inited = 0; - signal(signo, softsig_handler); - pthread_kill(softsig_tid, SIGUSR1); -} - -#if defined(TEST) -static void -print_foo(int signo) -{ - printf("foo, signo = %d, tid = %d\n", signo, pthread_self()); -} - -int -main(int argc, char **argv) -{ - softsig_init(); - softsig_signal(SIGINT, print_foo); - printf("main is tid %d\n", pthread_self()); - while (1) - sleep(60); -} -#endif diff --git a/src/util/softsig.h b/src/util/softsig.h deleted file mode 100644 index fec107b..0000000 --- a/src/util/softsig.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2000, International Business Machines Corporation and others. - * All Rights Reserved. - * - * This software has been released under the terms of the IBM Public - * License. For details, see the LICENSE file in the top-level source - * directory or online at http://www.openafs.org/dl/license10.html - */ - -#ifndef _SOFTSIG_H -#define _SOFTSIG_H - -void softsig_init(void); -void softsig_signal(int signo, void (*handler) (int)); - -#endif