Merge branch '3.15' of git+ssh://git.launchpad.net/epics-base into bit_operations
This commit is contained in:
@@ -730,9 +730,18 @@ int dbLoadDatabase(const char *file, const char *path, const char *subs)
|
||||
int dbLoadRecords(const char* file, const char* subs)
|
||||
{
|
||||
int status = dbReadDatabase(&pdbbase, file, 0, subs);
|
||||
|
||||
if (!status && dbLoadRecordsHook)
|
||||
dbLoadRecordsHook(file, subs);
|
||||
switch(status)
|
||||
{
|
||||
case 0:
|
||||
if(dbLoadRecordsHook)
|
||||
dbLoadRecordsHook(file, subs);
|
||||
break;
|
||||
case -2:
|
||||
errlogPrintf("dbLoadRecords: failed to load %s - cannot load records after running iocBuild!\n", file);
|
||||
break;
|
||||
default:
|
||||
errlogPrintf("dbLoadRecords: failed to load %s\n", file);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "epicsExport.h"
|
||||
#include "link.h"
|
||||
#include "special.h"
|
||||
#include "iocInit.h"
|
||||
|
||||
|
||||
|
||||
@@ -215,6 +216,9 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp,
|
||||
char *penv;
|
||||
char **macPairs;
|
||||
|
||||
if(getIocState() != iocVirgin)
|
||||
return -2;
|
||||
|
||||
if(*ppdbbase == 0) *ppdbbase = dbAllocBase();
|
||||
pdbbase = *ppdbbase;
|
||||
if(path && strlen(path)>0) {
|
||||
|
||||
@@ -70,9 +70,7 @@
|
||||
#include "registryRecordType.h"
|
||||
#include "rsrv.h"
|
||||
|
||||
static enum {
|
||||
iocVirgin, iocBuilding, iocBuilt, iocRunning, iocPaused, iocStopped
|
||||
} iocState = iocVirgin;
|
||||
static enum iocStateEnum iocState = iocVirgin;
|
||||
static enum {
|
||||
buildRSRV, buildIsolated
|
||||
} iocBuildMode;
|
||||
@@ -91,6 +89,11 @@ static void exitDatabase(void *dummy);
|
||||
int dbThreadRealtimeLock = 1;
|
||||
epicsExportAddress(int, dbThreadRealtimeLock);
|
||||
|
||||
enum iocStateEnum getIocState(void)
|
||||
{
|
||||
return iocState;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize EPICS on the IOC.
|
||||
*/
|
||||
|
||||
@@ -13,10 +13,15 @@
|
||||
|
||||
#include "shareLib.h"
|
||||
|
||||
enum iocStateEnum {
|
||||
iocVirgin, iocBuilding, iocBuilt, iocRunning, iocPaused, iocStopped
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
epicsShareFunc enum iocStateEnum getIocState(void);
|
||||
epicsShareFunc int iocInit(void);
|
||||
epicsShareFunc int iocBuild(void);
|
||||
epicsShareFunc int iocBuildIsolated(void);
|
||||
|
||||
@@ -66,17 +66,6 @@ static void req_server (void *pParm)
|
||||
|
||||
IOC_sock = conf->tcp;
|
||||
|
||||
/* listen and accept new connections */
|
||||
if ( listen ( IOC_sock, 20 ) < 0 ) {
|
||||
char sockErrBuf[64];
|
||||
epicsSocketConvertErrnoToString (
|
||||
sockErrBuf, sizeof ( sockErrBuf ) );
|
||||
errlogPrintf ( "CAS: Listen error: %s\n",
|
||||
sockErrBuf );
|
||||
epicsSocketDestroy (IOC_sock);
|
||||
epicsThreadSuspendSelf ();
|
||||
}
|
||||
|
||||
epicsEventSignal(castcp_startStopEvent);
|
||||
|
||||
while (TRUE) {
|
||||
@@ -194,7 +183,7 @@ SOCKET* rsrv_grab_tcp(unsigned short *port)
|
||||
|
||||
epicsSocketEnableAddressReuseDuringTimeWaitState ( tcpsock );
|
||||
|
||||
if(bind(tcpsock, &scratch.sa, sizeof(scratch))==0) {
|
||||
if(bind(tcpsock, &scratch.sa, sizeof(scratch))==0 && listen(tcpsock, 20)==0) {
|
||||
if(scratch.ia.sin_port==0) {
|
||||
/* use first socket to pick a random port */
|
||||
osiSocklen_t alen = sizeof(ifaceAddr);
|
||||
|
||||
@@ -106,10 +106,11 @@ static long init_record(eventRecord *prec, int pass)
|
||||
recGblInitConstantLink(&prec->siol,DBF_STRING,&prec->sval);
|
||||
}
|
||||
|
||||
prec->epvt = eventNameToHandle(prec->val);
|
||||
|
||||
if( (pdset=(struct eventdset *)(prec->dset)) && (pdset->init_record) )
|
||||
status=(*pdset->init_record)(prec);
|
||||
|
||||
prec->epvt = eventNameToHandle(prec->val);
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user