New environment to disallow 2 iocs on the same computer

This commit is contained in:
zimoch
2013-03-11 15:49:19 +00:00
parent 8a55d65e0a
commit 38100e7c49

View File

@@ -110,6 +110,13 @@ static void req_server (void *pParm)
status = bind ( IOC_sock, (struct sockaddr *) &serverAddr, sizeof ( serverAddr ) );
if ( status < 0 ) {
if ( SOCKERRNO == SOCK_EADDRINUSE ) {
const char* multiple_iocs = getenv("EPICS_ALLOW_MULTIPLE_IOCS");
if (multiple_iocs && strcasecmp(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);
}
/*
* enable assignment of a default port
* (so the getsockname() call below will