add EPICS_ALLOW_MULTIPLE_IOCS to prevent starting more than one IOC on one machine

This commit is contained in:
2018-02-28 16:53:35 +01:00
parent a2bf0f3c66
commit 6a75f3258b

View File

@@ -34,6 +34,8 @@
#include "dbEvent.h"
#include "dbCommon.h"
#include "epicsStdioRedirect.h"
#include "epicsExit.h"
#include "epicsString.h"
#define epicsExportSharedSymbols
#include "rsrv.h"
@@ -108,6 +110,15 @@ static void req_server (void *pParm)
if ( status < 0 ) {
if ( SOCKERRNO == SOCK_EADDRINUSE ||
SOCKERRNO == SOCK_EACCES ) {
#ifndef vxWorks
const char* multiple_iocs = getenv("EPICS_ALLOW_MULTIPLE_IOCS");
if (multiple_iocs && epicsStrCaseCmp(multiple_iocs, "NO") == 0)
{
errlogPrintf ( "CAS: Default server port %d unavailable.\n" ,ca_server_port);
errlogPrintf ( "CAS: Probably already running an IOC on this computer.\n");
epicsExit(1);
}
#endif
/*
* enable assignment of a default port
* (so the getsockname() call below will