From ad2bb0725db6eae63fb255883294533e6c78abca Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 23 Jun 2014 16:28:22 -0400 Subject: [PATCH] asShutdown --- src/ioc/as/asDbLib.c | 9 +++++++++ src/ioc/as/asDbLib.h | 1 + src/ioc/misc/iocInit.c | 1 + src/libCom/as/asLib.h | 1 + src/libCom/as/asLibRoutines.c | 3 +-- 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ioc/as/asDbLib.c b/src/ioc/as/asDbLib.c index 4c295018c..d0322bfd1 100644 --- a/src/ioc/as/asDbLib.c +++ b/src/ioc/as/asDbLib.c @@ -152,6 +152,15 @@ int asInit(void) return(asInitCommon()); } +int asShutdown(void) { + volatile ASBASE *pbase = pasbase; + pasbase = NULL; + firstTime = TRUE; + if(pbase) + asFreeAll((ASBASE*)pbase); + return 0; +} + static void wdCallback(void *arg) { ASDBCALLBACK *pcallback = (ASDBCALLBACK *)arg; diff --git a/src/ioc/as/asDbLib.h b/src/ioc/as/asDbLib.h index 04e35611f..b0c3516f6 100644 --- a/src/ioc/as/asDbLib.h +++ b/src/ioc/as/asDbLib.h @@ -32,6 +32,7 @@ epicsShareFunc int asSetFilename(const char *acf); epicsShareFunc int asSetSubstitutions(const char *substitutions); epicsShareFunc int asInit(void); epicsShareFunc int asInitAsyn(ASDBCALLBACK *pcallback); +epicsShareFunc int asShutdown(void); epicsShareFunc int asDbGetAsl(struct dbChannel *chan); epicsShareFunc void * asDbGetMemberPvt(struct dbChannel *chan); epicsShareFunc int asdbdump(void); diff --git a/src/ioc/misc/iocInit.c b/src/ioc/misc/iocInit.c index da32bf67c..0268801cb 100644 --- a/src/ioc/misc/iocInit.c +++ b/src/ioc/misc/iocInit.c @@ -658,6 +658,7 @@ int iocShutdown(void) scanShutdown(); callbackShutdown(); iterateRecords(doFreeRecord, NULL); + asShutdown(); iocState = iocStopped; return 0; } diff --git a/src/libCom/as/asLib.h b/src/libCom/as/asLib.h index b3da2f836..af8e0dc30 100644 --- a/src/libCom/as/asLib.h +++ b/src/libCom/as/asLib.h @@ -222,6 +222,7 @@ epicsShareFunc long epicsShareAPI asComputeAsg(ASG *pasg); /*following is "friend" function*/ epicsShareFunc void * epicsShareAPI asCalloc(size_t nobj,size_t size); epicsShareFunc char * epicsShareAPI asStrdup(unsigned char *str); +epicsShareFunc void asFreeAll(ASBASE *pasbase); #ifdef __cplusplus } #endif diff --git a/src/libCom/as/asLibRoutines.c b/src/libCom/as/asLibRoutines.c index 83f6629e6..c8046ebce 100644 --- a/src/libCom/as/asLibRoutines.c +++ b/src/libCom/as/asLibRoutines.c @@ -51,7 +51,6 @@ static long asAddMemberPvt(ASMEMBERPVT *pasMemberPvt,const char *asgName); static long asComputeAllAsgPvt(void); static long asComputeAsgPvt(ASG *pasg); static long asComputePvt(ASCLIENTPVT asClientPvt); -static void asFreeAll(ASBASE *pasbase); static UAG *asUagAdd(const char *uagName); static long asUagAddUser(UAG *puag,const char *user); static HAG *asHagAdd(const char *hagName); @@ -1015,7 +1014,7 @@ next_rule: return(0); } -static void asFreeAll(ASBASE *pasbase) +void asFreeAll(ASBASE *pasbase) { UAG *puag; UAGNAME *puagname;