diff --git a/src/libCom/osi/epicsSignal.h b/src/libCom/osi/epicsSignal.h index 98fa23083..2fd0e5839 100644 --- a/src/libCom/osi/epicsSignal.h +++ b/src/libCom/osi/epicsSignal.h @@ -1,13 +1,11 @@ - - /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. + * Copyright (c) 2002 The University of Chicago, as Operator of Argonne + * National Laboratory. + * Copyright (c) 2002 The Regents of the University of California, as + * Operator of Los Alamos National Laboratory. + * EPICS BASE Versions 3.13.7 + * and higher are distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. \*************************************************************************/ #ifdef __cplusplus @@ -23,6 +21,12 @@ extern "C" { struct epicsThreadOSD; +/* + * Required to avoid problems with soft IOCs getting SIGHUPs when a + * Channel Access client disconnects + */ +epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ); + /* * Required to avoid terminating a process which is blocking in a * socket send() call when the SIGPIPE signal is generated by the OS. diff --git a/src/libCom/osi/os/RTEMS/osdSignal.cpp b/src/libCom/osi/os/RTEMS/osdSignal.cpp index 620fc0353..08dfa023c 100644 --- a/src/libCom/osi/os/RTEMS/osdSignal.cpp +++ b/src/libCom/osi/os/RTEMS/osdSignal.cpp @@ -1,11 +1,11 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. + * Copyright (c) 2002 The University of Chicago, as Operator of Argonne + * National Laboratory. + * Copyright (c) 2002 The Regents of the University of California, as + * Operator of Los Alamos National Laboratory. + * EPICS BASE Versions 3.13.7 + * and higher are distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. \*************************************************************************/ #define epicsExportSharedSymbols @@ -14,6 +14,7 @@ /* * All NOOPs if the os isnt POSIX */ +epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadId */ ) {} diff --git a/src/libCom/osi/os/WIN32/osdSignal.cpp b/src/libCom/osi/os/WIN32/osdSignal.cpp index bcc7781e6..5f799273a 100644 --- a/src/libCom/osi/os/WIN32/osdSignal.cpp +++ b/src/libCom/osi/os/WIN32/osdSignal.cpp @@ -1,11 +1,11 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. + * Copyright (c) 2002 The University of Chicago, as Operator of Argonne + * National Laboratory. + * Copyright (c) 2002 The Regents of the University of California, as + * Operator of Los Alamos National Laboratory. + * EPICS BASE Versions 3.13.7 + * and higher are distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. \*************************************************************************/ #define epicsExportSharedSymbols @@ -14,6 +14,7 @@ /* * NOOP */ +epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadid */ ) {} diff --git a/src/libCom/osi/os/default/osdSignal.cpp b/src/libCom/osi/os/default/osdSignal.cpp index 620fc0353..08dfa023c 100644 --- a/src/libCom/osi/os/default/osdSignal.cpp +++ b/src/libCom/osi/os/default/osdSignal.cpp @@ -1,11 +1,11 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. + * Copyright (c) 2002 The University of Chicago, as Operator of Argonne + * National Laboratory. + * Copyright (c) 2002 The Regents of the University of California, as + * Operator of Los Alamos National Laboratory. + * EPICS BASE Versions 3.13.7 + * and higher are distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. \*************************************************************************/ #define epicsExportSharedSymbols @@ -14,6 +14,7 @@ /* * All NOOPs if the os isnt POSIX */ +epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadId */ ) {} diff --git a/src/libCom/osi/os/posix/osdSignal.cpp b/src/libCom/osi/os/posix/osdSignal.cpp index e0bd77e40..7e77d952e 100644 --- a/src/libCom/osi/os/posix/osdSignal.cpp +++ b/src/libCom/osi/os/posix/osdSignal.cpp @@ -1,11 +1,11 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. + * Copyright (c) 2002 The University of Chicago, as Operator of Argonne + * National Laboratory. + * Copyright (c) 2002 The Regents of the University of California, as + * Operator of Los Alamos National Laboratory. + * EPICS BASE Versions 3.13.7 + * and higher are distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -26,6 +26,7 @@ extern "C" { typedef void ( *pSigFunc ) ( int ); } +static pSigFunc pReplacedSigHupFunc = 0; static pSigFunc pReplacedSigPipeFunc = 0; static pSigFunc pReplacedSigAlarmFunc = 0; @@ -63,6 +64,22 @@ static void localInstallSigHandler ( int signalIn, pSigFunc pNewFunc, assert ( ! status ); } +/* + * ignoreSigHup () + */ +extern "C" { +static void ignoreSigHup ( int signal ) +{ + static volatile int reentered = 1; + + if (--reentered == 0) { + if ( pReplacedSigHupFunc ) { + ( *pReplacedSigHupFunc ) ( signal ); + } + } +} +} + /* * ignoreSigPipe () */ @@ -96,6 +113,15 @@ static void ignoreSigAlarm ( int signal ) } } +/* + * epicsSignalInstallSigHupIgnore () + */ +epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore (void) +{ + localInstallSigHandler ( SIGHUP, + ignoreSigHup, & pReplacedSigHupFunc ); +} + /* * epicsSignalInstallSigPipeIgnore () */ diff --git a/src/libCom/osi/os/vxWorks/osdSignal.cpp b/src/libCom/osi/os/vxWorks/osdSignal.cpp index 14ae0caab..1157854aa 100644 --- a/src/libCom/osi/os/vxWorks/osdSignal.cpp +++ b/src/libCom/osi/os/vxWorks/osdSignal.cpp @@ -1,11 +1,11 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne -* National Laboratory. -* Copyright (c) 2002 The Regents of the University of California, as -* Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. + * Copyright (c) 2002 The University of Chicago, as Operator of Argonne + * National Laboratory. + * Copyright (c) 2002 The Regents of the University of California, as + * Operator of Los Alamos National Laboratory. + * EPICS BASE Versions 3.13.7 + * and higher are distributed subject to a Software License Agreement found + * in file LICENSE that is included with this distribution. \*************************************************************************/ #define epicsExportSharedSymbols @@ -14,6 +14,7 @@ /* * NOOP */ +epicsShareFunc void epicsShareAPI epicsSignalInstallSigHupIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalInstallSigPipeIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalInstallSigAlarmIgnore ( void ) {} epicsShareFunc void epicsShareAPI epicsSignalRaiseSigAlarm ( struct epicsThreadOSD * /* threadId */ ) {}