From 447e03c99406fee23d5486347e12fb7baed2099a Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Tue, 31 Aug 2004 12:42:28 +0000 Subject: [PATCH] atReboot is new --- src/libCom/osi/os/vxWorks/atReboot.cpp | 57 ++++++++++++++++++++++++++ src/libCom/osi/os/vxWorks/osdThread.c | 3 ++ 2 files changed, 60 insertions(+) create mode 100644 src/libCom/osi/os/vxWorks/atReboot.cpp diff --git a/src/libCom/osi/os/vxWorks/atReboot.cpp b/src/libCom/osi/os/vxWorks/atReboot.cpp new file mode 100644 index 000000000..3d589c5c8 --- /dev/null +++ b/src/libCom/osi/os/vxWorks/atReboot.cpp @@ -0,0 +1,57 @@ +/*************************************************************************\ +* 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. +\*************************************************************************/ +/* atReboot.cpp */ + +/* Author: Marty Kraimer Date: 30AUG2003 */ + +#include + +#include "epicsDynLink.h" +#include "epicsExit.h" + +/* osdThread references atRebootExtern just to make this module load*/ +int atRebootExtern; + +typedef int (*sysAtReboot)(void(func)(void)); + +extern "C" { +static void atReboot(void) +{ + epicsExit(0); +} + +} /* extern "C" */ + +class atRebootRegister { +public: + atRebootRegister(); +}; + +atRebootRegister::atRebootRegister() +{ + STATUS status; + sysAtReboot func; + SYM_TYPE type; + + status = symFindByNameEPICS(sysSymTbl,"_sysAtReboot",(char **)&func,&type); + if(status==OK) { + status = func(atReboot); + if(status!=OK) { + printf("atReboot: sysAtReboot error why?\n"); + } else { + printf("epicsExit will be called by reboot.\n"); + } + } else { + printf("sysAtReboot not found. " + "epicsExit will not be called by reboot.\n"); + } +} + +static atRebootRegister atRebootRegisterObj; diff --git a/src/libCom/osi/os/vxWorks/osdThread.c b/src/libCom/osi/os/vxWorks/osdThread.c index 5ab6c8eb6..260343fdb 100644 --- a/src/libCom/osi/os/vxWorks/osdThread.c +++ b/src/libCom/osi/os/vxWorks/osdThread.c @@ -40,6 +40,9 @@ static const unsigned stackSizeTable[epicsThreadStackBig+1] = {4000*ARCH_STACK_FACTOR, 6000*ARCH_STACK_FACTOR, 11000*ARCH_STACK_FACTOR}; +/*The following is just to force atReboot to be loaded*/ +extern int atRebootExtern; +static int *patRebootExtern = &atRebootExtern; /* definitions for implementation of epicsThreadPrivate */ static void **papTSD = 0;