Merged changes from the 3.14 branch to revno 12658

This commit is contained in:
Andrew Johnson
2016-09-02 11:54:23 -05:00
24 changed files with 261 additions and 229 deletions

View File

@@ -3,9 +3,8 @@
# 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.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
# Cross compiler default definitions
@@ -27,6 +26,6 @@ CROSS_LDFLAGS = $(addprefix -L,$(GNU_TARGET_LIB_DIR))
CMPLR_PREFIX_CROSS=$(addsuffix -,$(GNU_TARGET))
CMPLR_PREFIX=$(CMPLR_PREFIX_$(BUILD_CLASS))
# All cross builds use the gnu compiler
# Cross builds usually use the gnu compiler
include $(CONFIG)/CONFIG.gnuCommon

View File

@@ -20,5 +20,5 @@ LOADABLE_SHRLIB_LDFLAGS = -shared \
# Don't link with gcc library
GNU_LDLIBS_YES =
# Link with winsock2
OP_SYS_LDLIBS = -lws2_32
# Link with system libraries
OP_SYS_LDLIBS = -lws2_32 -ladvapi32 -luser32 -lkernel32 -lwinmm

View File

@@ -1,7 +1,7 @@
# CONFIG.win32-x86-debug.Common
#
# Definitions for win32-x86 debug with debug compiler flags
# Sites may override these definitions in CONFIG_SITE.win32-x86-debug.Common
# Definitions for win32-x86-debug host arch
# Override these definitions in CONFIG_SITE.win32-x86-debug.Common
#-------------------------------------------------------
#Include definitions common to win32-x86 hosts

View File

@@ -1,9 +1,12 @@
# CONFIG.win32-x86-debug.win32-x86-debug
#
# Definitions for win32-x86 debug compiler host - win32-x86 debug compiler target builds
# Sites may override these definitions in CONFIG_SITE.win32-x86-debug.win32-x86-debug
# Definitions for win32-x86-debug host - win32-x86-debug target build
# Override these definitions in CONFIG_SITE.win32-x86-debug.win32-x86-debug
#-------------------------------------------------------
#Include definitions common to win32-x86 builds
include $(CONFIG)/os/CONFIG.win32-x86.win32-x86
-include $(CONFIG)/os/CONFIG_SITE.win32-x86.win32-x86
# Override CONFIG_SITE settings:
HOST_OPT=NO

View File

@@ -31,5 +31,5 @@ LOADABLE_SHRLIB_LDFLAGS = -shared \
# Don't link with gcc library
GNU_LDLIBS_YES =
# Link with winsock2
OP_SYS_LDLIBS = -lws2_32
# Link with system libraries
OP_SYS_LDLIBS = -lws2_32 -ladvapi32 -luser32 -lkernel32 -lwinmm

View File

@@ -1,10 +1,13 @@
# CONFIG.win32-x86-static.win32-x86.static
#
# Definitions for win32-x86-static target archs when host arch is win32-x86-static
# Sites may override these definitions in CONFIG_SITE.win32-x86-static.win32-x86-static
# Definitions for win32-x86-static host - win32-x86-static target build
# Override these definitions in CONFIG_SITE.win32-x86-static.win32-x86-static
#-------------------------------------------------------
#Include definitions common to win32-x86 builds
include $(CONFIG)/os/CONFIG.win32-x86.win32-x86
-include $(CONFIG)/os/CONFIG_SITE.win32-x86.win32-x86
# Override CONFIG_SITE settings:
SHARED_LIBRARIES = NO
STATIC_BUILD = YES

View File

@@ -1,7 +1,7 @@
# CONFIG.win32-x86.Common
#
# Definitions for win32-x86 host archs
# Sites may override these definitions in CONFIG_SITE.win32-x86.Common
# Override these definitions in CONFIG_SITE.win32-x86.Common
#-------------------------------------------------------
CP = $(PERL) -MExtUtils::Command -e cp

View File

@@ -1,7 +1,7 @@
# CONFIG.win32-x86.win32-x86
#
# Definitions for win32-x86 target archs when host arch is win32-x86
# Sites may override these definitions in CONFIG_SITE.win32-x86.win32-x86
# Definitions for win32-x86 host - win32-x86 target build
# Override these definitions in CONFIG_SITE.win32-x86.win32-x86
#-------------------------------------------------------
# Win32 valid build types and include directory suffixes
@@ -22,16 +22,21 @@ ARCMD = lib -nologo -verbose -out:$@ $(LIB_OPT_LDFLAGS) $(LIBRARY_LD_OBJS)
# Configure OS vendor C compiler
CC = cl
# Override CONFIG.gnuCommon for cross builds.
# Override CONFIG.gnuCommon settings for cross builds.
GNU = NO
HDEPENDS_METHOD = MKMF
# Compiler flags for C files (C++ is below)
#
# -W<N> use warning level N
# (maximum (lint type) warnings at level 4)
# -w44355 set "'this' used in the base initializer list" to be level 4
WARN_CFLAGS_YES = -W3 -w44355
WARN_CFLAGS_NO = -W1
# -W<d> display warnings at level d
# -W4 is for maximum (lint type) warnings
# -W3 is for production quality warnings
# -W2 displays significant warnings
# -W1 is the default and shows severe warnings only
# -w<d><n> Set warning C<n> to be shown at level <d>
WARN_CFLAGS_YES = -W3
WARN_CFLAGS_NO = -W1
#
# -Ox maximum optimizations
@@ -66,7 +71,7 @@ STATIC_CFLAGS_YES= -MT$(VISC_CFLAGS_DEBUG) $(BUILD_DLL_CFLAGS)
STATIC_CFLAGS_NO= -MD$(VISC_CFLAGS_DEBUG) $(BUILD_DLL_CFLAGS) -DEPICS_CALL_DLL
# OS vendor c preprocessor
CPP = cl -C -E
CPP = cl -nologo -C -E
# Configure OS vendor C++ compiler
#
@@ -82,11 +87,15 @@ CCC = cl -EHsc -GR
CODE_CPPFLAGS += -nologo -D__STDC__=0
CODE_CPPFLAGS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
# Compiler flags for C++ files
#
# -W<N> use warning level N
# (maximum lint level warnings at level 4)
# -w44355 set "'this' used in the base initializer list" to be level 4
WARN_CXXFLAGS_YES = -W3 -w44355
# -w44344 "behavior change: use of explicit template arguments results in ..."
WARN_CXXFLAGS_YES = -W3 -w44355 -w44344
WARN_CXXFLAGS_NO = -W1
#

View File

@@ -1,17 +1,15 @@
# CONFIG.win32-x86.win32-x86-debug
#
# Definitions for win32-x86 host - win32-x86-debug target build
# Sites may override these definitions in CONFIG_SITE.win32-x86.win32-x86-debug
# Override these definitions in CONFIG_SITE.win32-x86.win32-x86-debug
#-------------------------------------------------------
-include $(CONFIG)/os/CONFIG.Common.win32-x86
-include $(CONFIG)/os/CONFIG.win32-x86.win32-x86
-include $(CONFIG)/os/CONFIG_SITE.Common.win32-x86
#Include definitions common to win32-x86 builds
include $(CONFIG)/os/CONFIG.win32-x86.win32-x86
-include $(CONFIG)/os/CONFIG_SITE.win32-x86.win32-x86
GNU = NO
HDEPENDS_METHOD = MKMF
# Override CONFIG.CrossCommon settings:
BUILD_CLASS = HOST
# Override CONFIG_SITE settings:
HOST_OPT = NO

View File

@@ -1,11 +1,16 @@
# CONFIG.win32-x86.win32-x86-static
#
# Definitions for win32-x86-static target archs when host arch is win32-x86
# Sites may override these definitions in CONFIG_SITE.win32-x86.win32-x86-static
# Definitions for win32-x86 host - win32-x86-static target build
# Override these definitions in CONFIG_SITE.win32-x86.win32-x86-static
#-------------------------------------------------------
#Include definitions common to win32-x86 builds
include $(CONFIG)/os/CONFIG.win32-x86.win32-x86
-include $(CONFIG)/os/CONFIG_SITE.win32-x86.win32-x86
# Override CONFIG.CrossCommon settings:
BUILD_CLASS = HOST
# Override CONFIG_SITE settings:
SHARED_LIBRARIES = NO
STATIC_BUILD = YES

View File

@@ -1,15 +0,0 @@
# CONFIG.win-x86.windows-x64
#
# Definitions for windows-x64 target archs when host arch is win32-x86
# Sites may override these definitions in CONFIG_SITE.win32-x86.windows-x64
#-------------------------------------------------------
-include $(CONFIG)/os/CONFIG.Common.win32-x86
-include $(CONFIG)/os/CONFIG.win32-x86.win32-x86
OPT_LDFLAGS += /MACHINE:X64
# /MACHINE:X64
# /MACHINE:IA64 (Itanium)
# /MACHINE:X86

View File

@@ -1,7 +1,7 @@
# CONFIG.windows-x64-debug.Common
#
# Definitions for windows-x64 debug with debug compiler flags
# Sites may override these definitions in CONFIG_SITE.windows-x64-debug.Common
# Definitions for windows-x64-debug host arch
# Override these definitions in CONFIG_SITE.windows-x64-debug.Common
#-------------------------------------------------------
#Include definitions common to windows-x64 hosts

View File

@@ -1,8 +1,9 @@
# CONFIG.windows-x64-static.Common
#
# Definitions for windows-x64-static host archs
# Sites may override these definitions in CONFIG_SITE.windows-x64-static.Common
# Override these definitions in CONFIG_SITE.windows-x64-static.Common
#-------------------------------------------------------
#Include definitions common to windows-x64 hosts
include $(CONFIG)/os/CONFIG.windows-x64.Common

View File

@@ -1,10 +1,12 @@
# CONFIG.windows-x64-static.windows-x64-static
#
# Definitions for windows-x64-static target archs when host arch is windows-x64-static
# Sites may override these definitions in CONFIG_SITE.windows-x64-static.windows-x64-static
# Definitions for windows-x64-static host - windows-x64-static target build
# Override these definitions in CONFIG_SITE.windows-x64-static.windows-x64-static
#-------------------------------------------------------
#Include definitions common to windows-x64 builds
include $(CONFIG)/os/CONFIG.windows-x64.windows-x64
# Override CONFIG_SITE settings:
SHARED_LIBRARIES = NO
STATIC_BUILD= YES

View File

@@ -1,10 +1,9 @@
# CONFIG.windows-x64.Common
#
# Definitions for windows-x64 host archs
# Sites may override these definitions in CONFIG_SITE.windows-x64.Common
# Definitions for windows-x64 host arch
# Override these definitions in CONFIG_SITE.windows-x64.Common
#-------------------------------------------------------
-include $(CONFIG)/os/CONFIG.win32-x86.Common
WIND_HOST_TYPE = x86-win32
#Include definitions common to win32-x86 hosts
include $(CONFIG)/os/CONFIG.win32-x86.Common

View File

@@ -1,13 +1,14 @@
# CONFIG.windows-x64.windows-x64
#
# Definitions for windows-x64 target archs when host arch is windows-x64
# Sites may override these definitions in CONFIG_SITE.windows-x64.windows-x64
# Definitions for windows-x64 host - windows-x64 target build
# Override these definitions in CONFIG_SITE.windows-x64.windows-x64
#-------------------------------------------------------
-include $(CONFIG)/os/CONFIG.win32-x86.win32-x86
#Include definitions common to win32-x86 builds
include $(CONFIG)/os/CONFIG.win32-x86.win32-x86
-include $(CONFIG)/os/CONFIG_SITE.win32-x86.win32-x86
OPT_LDFLAGS += /MACHINE:X64
# /MACHINE:X64
# /MACHINE:IA64 (Itanium)
# /MACHINE:X86

View File

@@ -1,9 +1,14 @@
# CONFIG.windows-x64.windows-x64-debug
#
# Definitions for windows-x64 compiler host - windows-x64 debug compiler target builds
# Sites may override these definitions in CONFIG_SITE.windows-x64.windows-x64-debug
# Definitions for windows-x64 host - windows-x64-debug target build
# Override these definitions in CONFIG_SITE.windows-x64.windows-x64-debug
#-------------------------------------------------------
#Include definitions common to windows-x64 builds
include $(CONFIG)/os/CONFIG.windows-x64.windows-x64
# Override CONFIG.CrossCommon settings:
BUILD_CLASS = HOST
# Override CONFIG_SITE settings:
HOST_OPT=NO

View File

@@ -1,11 +1,15 @@
# CONFIG.windows-x86.windows-x86-static
# CONFIG.windows-x64.windows-x64-static
#
# Definitions for windows-x64-static target archs when host arch is windows-x64
# Sites may override these definitions in CONFIG_SITE.windows-x64.windows-x64-static
# Definitions for windows-x64 host - windows-x64-static target build
# Override these definitions in CONFIG_SITE.windows-x64.windows-x64-static
#-------------------------------------------------------
#Include definitions common to windows-x64 builds
include $(CONFIG)/os/CONFIG.windows-x64.windows-x64
# Override CONFIG.CrossCommon settings:
BUILD_CLASS = HOST
# Override CONFIG_SITE settings:
SHARED_LIBRARIES = NO
STATIC_BUILD = YES

View File

@@ -3,15 +3,21 @@
# Site specific definitions for darwin builds
#-------------------------------------------------------
# Uncomment the following two definitions to enable the use of DarwinPorts packages.
#
# Note the dir/firstword/wildcard functions below are used
# to avoid warnings about missing directories.
# Mix-and-match of different package systems is probably not advisable,
# but you can try that if you like...
# Uncomment these definitions when using Homebrew packages:
#OP_SYS_INCLUDES += -I/usr/local/include
#OP_SYS_LDFLAGS += $(addprefix -L,$(dir $(firstword $(wildcard /usr/local/lib/*))))
# Uncomment these definitions when using DarwinPorts packages:
#OP_SYS_INCLUDES += -I/opt/local/include
# dir/firstword/wildcard used to avoid warning -L: directory name (...) does not exist
#OP_SYS_LDFLAGS += $(addprefix -L,$(dir $(firstword $(wildcard /opt/local/lib/*))))
#OP_SYS_LDFLAGS += $(addprefix -L,$(dir $(firstword $(wildcard /opt/local/lib/*))))
# Uncomment the following two definitions to enable the use of Fink packages.
#
# Uncomment these definitions when using Fink packages:
#OP_SYS_INCLUDES += -I/sw/include
# dir/firstword/wildcard used to avoid warning -L: directory name (...) does not exist
#OP_SYS_LDFLAGS += $(addprefix -L,$(dir $(firstword $(wildcard /sw/lib/*))))
#OP_SYS_LDFLAGS += $(addprefix -L,$(dir $(firstword $(wildcard /sw/lib/*))))

View File

@@ -1,16 +0,0 @@
# If you have Visual C++ 6.0, uncomment the following override lines
# This will to eliminate warnings about unknown options /GL, /LTCG, and /w44355.
#OPT_CFLAGS_YES = /Ox
#OPT_CXXFLAGS_YES = /Ox
#OPT_CFLAGS_NO = /Zi
#OPT_CXXFLAGS_NO = /Zi
#LINK_OPT_FLAGS_YES = /incremental:no /opt:ref /release $(PROD_VERSION:%=/version:%)
#WARN_CFLAGS_YES = /W3
#WARN_CXXFLAGS_YES = /W3
# If you have Visual C++ 8.0 or 8.0 express, uncomment the following override.
# This will eliminate warnings about /GX being deprecated.
#CCC = cl /nologo /EHsc /GR

View File

@@ -15,12 +15,40 @@
<h2 align="center">Changes made on the 3.15 branch since 3.15.4</h2>
<!-- Insert new items immediately below here ... -->
<h2 align="center">Changes pulled from the 3.14 branch since 3.15.4</h2>
<h2 align="center">Changes from the 3.14 branch since 3.15.4</h2>
<!-- Insert inherited items immediately below here ... -->
<h3>Microsoft Visual Studio builds</h3>
<h2 align="center">Changes between 3.15.3 and 3.15.4</h2>
<p>The build configuration files for builds using the Microsoft compilers have
been updated, although there should be no noticable difference at most sites.
One extra compiler warning is now being suppressed for C++ code, <tt>C4344:
behavior change: use of explicit template arguments results in ...</tt> which is
gratuitous and was appearing frequently in builds of the EPICS V4 modules.</p>
<p>Cross-builds of the windows-x64 target from a win32-x86 host have been
removed as they don't actually work within the context of a single <tt>make</tt>
run. Significant changes to the build configuration files would be necessary for
these kinds of cross-builds to work properly, which could be done if someone
needs them (email Andrew Johnson before working on this, and see
<a href="http://stackoverflow.com/questions/5807647/how-do-you-compile-32-bit-and-64-bit-applications-at-the-same-time-in-visual-stu">
this stack-overflow answer</a> for a starting point).</p>
<h3>Bazaar keywords such as 'Revision-Id' removed</h3>
<p>In preparation for moving to git in place of the Bazaar revision control
system we have removed all the keywords from the Base source code.</p>
<h3>Linux systemd service file for CA Repeater</h3>
<p>Building this version of Base on a Linux system creates a systemd service
file suitable for starting the Channel Access Repeater under systemd. The file
will be installed into the target bin directory, from where it can be copied
into the appropriate systemd location and modified as necessary. Installation
instructions are included as comments in the file.</p>
<h2 align="center">Changes made between 3.15.3 and 3.15.4</h2>
<h3>New string input device support "getenv"</h3>
@@ -125,21 +153,7 @@ dbQuietMacroWarnings=1 <i>VxWorks</i>
541119</a>.</p>
<h2 align="center">Changes pulled from the 3.14 branch since 3.15.3</h2>
<!-- Insert inherited items immediately below here ... -->
<h3>Bazaar keywords such as 'Revision-Id' removed</h3>
<p>In preparation for moving to git in place of the Bazaar revision control
system we have removed all the keywords from the Base source code.</p>
<h3>Linux systemd service file for CA Repeater</h3>
<p>Building this version of Base on a Linux system creates a systemd service
file suitable for starting the Channel Access Repeater under systemd. The file
will be installed into the target bin directory, from where it can be copied
into the appropriate systemd location and modified as necessary. Installation
instructions are included as comments in the file.</p>
<h2 align="center">Changes from the 3.14 branch between 3.15.3 and 3.15.4</h2>
<h3>NTP Time Provider adjusts to OS tick rate changes</h3>
@@ -256,7 +270,7 @@ program added. The original versions do not report DST status properly. Fixes
<a href="https://bugs.launchpad.net/bugs/1528284">Launchpad bug 1528284</a>.</p>
<h2 align="center">Changes between 3.15.2 and 3.15.3</h2>
<h2 align="center">Changes made between 3.15.2 and 3.15.3</h2>
<h3>Make the NTP Time provider optional on VxWorks</h3>
@@ -297,7 +311,7 @@ code, and a structure definition for one of the original arguments to that
routine was defined in recGbl.h. Both of these have now been removed.</p>
<h2 align="center">Changes between 3.15.1 and 3.15.2</h2>
<h2 align="center">Changes made between 3.15.1 and 3.15.2</h2>
<h3>Raised limit on link field length in database files</h3>
@@ -416,7 +430,7 @@ use a modified version of msi must provide support for both the <tt>-D</tt> and
their applications' CONFIG_SITE files to that updated executable.</p>
<h2 align="center">Changes between 3.15.0.2 and 3.15.1</h2>
<h2 align="center">Changes made between 3.15.0.2 and 3.15.1</h2>
<h3>epicsStrnEscapedFromRaw() and epicsStrnRawFromEscaped()</h3>
@@ -480,7 +494,7 @@ in the context of the IOC's main thread, from either a static C++ constructor or
an EPICS registrar routine.</p>
<h2 align="center">Changes between 3.15.0.1 and 3.15.0.2</h2>
<h2 align="center">Changes made between 3.15.0.1 and 3.15.0.2</h2>
<h3>New iocshLoad command</h3>
@@ -926,7 +940,7 @@ result of record processing (i.e. when read through the SELL link).</p>
variables from Base, although they might get added to the Extensions build rules
for a while in case anyone still needs them.</p>
<h2 align="center">Changes between 3.14.x and 3.15.0.1</h2>
<h2 align="center">Changes made between 3.14.x and 3.15.0.1</h2>
<h3>Application clean rules</h3>

View File

@@ -223,8 +223,9 @@ void casPVI::updateEnumStringTableAsyncCompletion ( const gdd & resp )
assert ( gdd_status == 0 );
//
// preallocate the correct amount
// clear and preallocate the correct amount
//
this->enumStrTbl.clear ();
this->enumStrTbl.reserve ( count );
if ( resp.primitiveType() == aitEnumString ) {
@@ -262,6 +263,18 @@ void casPVI::updateEnumStringTableAsyncCompletion ( const gdd & resp )
void casPVI::postEvent ( const casEventMask & select, const gdd & event )
{
epicsGuard < epicsMutex > guard ( this->mutex );
// if this is a DBE_PROPERTY event for an enum type
// update the enum string table
if ( (select & this->pCAS->propertyEventMask()).eventsSelected() ) {
const gdd *menu = NULL;
if ( event.applicationType() == gddAppType_dbr_gr_enum )
menu = event.getDD( gddAppTypeIndex_dbr_gr_enum_enums );
else if ( event.applicationType() == gddAppType_dbr_ctrl_enum )
menu = event.getDD( gddAppTypeIndex_dbr_ctrl_enum_enums );
if ( menu )
updateEnumStringTableAsyncCompletion( *menu );
}
if ( this->nMonAttached ) {
// we are paying some significant locking overhead for
// these diagnostic counters

View File

@@ -940,7 +940,9 @@ static void printBuffer(
}
else {
for (i = 0; i < no_elements; i+= MAXLINE - 5) {
sprintf(pmsg, " \"%.*s\"", MAXLINE - 5, (char *)pbuffer + i);
int width = no_elements - i;
if (width > MAXLINE - 5) width = MAXLINE - 5;
sprintf(pmsg, " \"%.*s\"", width, (char *)pbuffer + i);
if (i + MAXLINE - 5 < no_elements) strcat(pmsg, " +");
dbpr_msgOut(pMsgBuff, tab_size);
}

View File

@@ -3,16 +3,15 @@
* 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.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* WIN32 specific initialisation for bsd sockets,
* based on Chris Timossi's base/src/ca/windows_depend.c,
* WIN32 specific initialisation for bsd sockets,
* based on Chris Timossi's base/src/ca/windows_depend.c,
* and also further additions by Kay Kasemir when this was in
* dllmain.cc
* dllmain.cc
*
* 7-1-97 -joh-
*
@@ -45,74 +44,74 @@
*/
epicsShareFunc osiSockAddr epicsShareAPI osiLocalAddr ( SOCKET socket )
{
static osiSockAddr addr;
static char init;
int status;
INTERFACE_INFO *pIfinfo;
INTERFACE_INFO *pIfinfoList;
unsigned nelem;
DWORD numifs;
DWORD cbBytesReturned;
static osiSockAddr addr;
static char init;
int status;
INTERFACE_INFO *pIfinfo;
INTERFACE_INFO *pIfinfoList;
unsigned nelem;
DWORD numifs;
DWORD cbBytesReturned;
if (init) {
return addr;
}
if (init) {
return addr;
}
init = 1;
addr.sa.sa_family = AF_UNSPEC;
/* only valid for winsock 2 and above */
if ( wsaMajorVersion() < 2 ) {
return addr;
}
nelem = 10;
pIfinfoList = (INTERFACE_INFO *) calloc ( nelem, sizeof (INTERFACE_INFO) );
if (!pIfinfoList) {
errlogPrintf ("calloc failed\n");
return addr;
/* only valid for winsock 2 and above */
if ( wsaMajorVersion() < 2 ) {
return addr;
}
status = WSAIoctl (socket, SIO_GET_INTERFACE_LIST, NULL, 0,
(LPVOID)pIfinfoList, nelem*sizeof(INTERFACE_INFO),
&cbBytesReturned, NULL, NULL);
if (status != 0 || cbBytesReturned == 0) {
errlogPrintf ("WSAIoctl SIO_GET_INTERFACE_LIST failed %d\n",WSAGetLastError());
free (pIfinfoList);
return addr;
nelem = 100;
pIfinfoList = (INTERFACE_INFO *) calloc ( nelem, sizeof (INTERFACE_INFO) );
if (!pIfinfoList) {
errlogPrintf ("calloc failed\n");
return addr;
}
numifs = cbBytesReturned / sizeof(INTERFACE_INFO);
for (pIfinfo = pIfinfoList; pIfinfo < (pIfinfoList+numifs); pIfinfo++){
status = WSAIoctl (socket, SIO_GET_INTERFACE_LIST, NULL, 0,
(LPVOID) pIfinfoList, nelem * sizeof(INTERFACE_INFO),
&cbBytesReturned, NULL, NULL);
/*
* dont use interfaces that have been disabled
*/
if (!(pIfinfo->iiFlags & IFF_UP)) {
continue;
}
if (status != 0 || cbBytesReturned == 0) {
errlogPrintf ("WSAIoctl SIO_GET_INTERFACE_LIST failed %d\n",WSAGetLastError());
free (pIfinfoList);
return addr;
}
/*
* dont use the loop back interface
*/
if (pIfinfo->iiFlags & IFF_LOOPBACK) {
continue;
}
numifs = cbBytesReturned / sizeof(INTERFACE_INFO);
for (pIfinfo = pIfinfoList; pIfinfo < (pIfinfoList+numifs); pIfinfo++){
addr.sa = pIfinfo->iiAddress.Address;
/*
* dont use interfaces that have been disabled
*/
if (!(pIfinfo->iiFlags & IFF_UP)) {
continue;
}
/* Work around MS Winsock2 bugs */
/*
* dont use the loop back interface
*/
if (pIfinfo->iiFlags & IFF_LOOPBACK) {
continue;
}
addr.sa = pIfinfo->iiAddress.Address;
/* Work around MS Winsock2 bugs */
if (addr.sa.sa_family == 0) {
addr.sa.sa_family = AF_INET;
}
free (pIfinfoList);
free (pIfinfoList);
return addr;
}
}
free (pIfinfoList);
return addr;
return addr;
}
/*
@@ -121,12 +120,12 @@ epicsShareFunc osiSockAddr epicsShareAPI osiLocalAddr ( SOCKET socket )
epicsShareFunc void epicsShareAPI osiSockDiscoverBroadcastAddresses
(ELLLIST *pList, SOCKET socket, const osiSockAddr *pMatchAddr)
{
int status;
INTERFACE_INFO *pIfinfo;
INTERFACE_INFO *pIfinfoList;
unsigned nelem;
int numifs;
DWORD cbBytesReturned;
int status;
INTERFACE_INFO *pIfinfo;
INTERFACE_INFO *pIfinfoList;
unsigned nelem;
int numifs;
DWORD cbBytesReturned;
osiSockAddrNode *pNewNode;
if ( pMatchAddr->sa.sa_family == AF_INET ) {
@@ -143,56 +142,56 @@ epicsShareFunc void epicsShareAPI osiSockDiscoverBroadcastAddresses
}
}
/* only valid for winsock 2 and above */
if (wsaMajorVersion() < 2 ) {
fprintf(stderr, "Need to set EPICS_CA_AUTO_ADDR_LIST=NO for winsock 1\n");
return;
}
/* only valid for winsock 2 and above */
if (wsaMajorVersion() < 2 ) {
fprintf(stderr, "Need to set EPICS_CA_AUTO_ADDR_LIST=NO for winsock 1\n");
return;
}
nelem = 10;
pIfinfoList = (INTERFACE_INFO *) calloc(nelem, sizeof(INTERFACE_INFO));
if(!pIfinfoList){
return;
}
nelem = 100;
pIfinfoList = (INTERFACE_INFO *) calloc(nelem, sizeof(INTERFACE_INFO));
if(!pIfinfoList){
return;
}
status = WSAIoctl (socket, SIO_GET_INTERFACE_LIST,
NULL, 0,
(LPVOID)pIfinfoList, nelem*sizeof(INTERFACE_INFO),
&cbBytesReturned, NULL, NULL);
status = WSAIoctl (socket, SIO_GET_INTERFACE_LIST,
NULL, 0,
(LPVOID)pIfinfoList, nelem*sizeof(INTERFACE_INFO),
&cbBytesReturned, NULL, NULL);
if (status != 0 || cbBytesReturned == 0) {
fprintf(stderr, "WSAIoctl SIO_GET_INTERFACE_LIST failed %d\n",WSAGetLastError());
free(pIfinfoList);
return;
}
if (status != 0 || cbBytesReturned == 0) {
fprintf(stderr, "WSAIoctl SIO_GET_INTERFACE_LIST failed %d\n",WSAGetLastError());
free(pIfinfoList);
return;
}
numifs = cbBytesReturned/sizeof(INTERFACE_INFO);
for (pIfinfo = pIfinfoList; pIfinfo < (pIfinfoList+numifs); pIfinfo++){
numifs = cbBytesReturned/sizeof(INTERFACE_INFO);
for (pIfinfo = pIfinfoList; pIfinfo < (pIfinfoList+numifs); pIfinfo++){
/*
* dont bother with interfaces that have been disabled
*/
if (!(pIfinfo->iiFlags & IFF_UP)) {
continue;
}
if (pIfinfo->iiFlags & IFF_LOOPBACK) {
/*
* dont bother with interfaces that have been disabled
*/
if (!(pIfinfo->iiFlags & IFF_UP)) {
continue;
}
}
/*
* work around WS2 bug
*/
if (pIfinfo->iiAddress.Address.sa_family != AF_INET) {
if (pIfinfo->iiAddress.Address.sa_family == 0) {
pIfinfo->iiAddress.Address.sa_family = AF_INET;
}
}
if (pIfinfo->iiFlags & IFF_LOOPBACK) {
continue;
}
/*
* if it isnt a wildcarded interface then look for
* an exact match
*/
/*
* work around WS2 bug
*/
if (pIfinfo->iiAddress.Address.sa_family != AF_INET) {
if (pIfinfo->iiAddress.Address.sa_family == 0) {
pIfinfo->iiAddress.Address.sa_family = AF_INET;
}
}
/*
* if it isnt a wildcarded interface then look for
* an exact match
*/
if (pMatchAddr->sa.sa_family != AF_UNSPEC) {
if (pIfinfo->iiAddress.Address.sa_family != pMatchAddr->sa.sa_family) {
continue;
@@ -203,11 +202,11 @@ epicsShareFunc void epicsShareAPI osiSockDiscoverBroadcastAddresses
if (pMatchAddr->sa.sa_family != AF_INET) {
continue;
}
if (pMatchAddr->ia.sin_addr.s_addr != htonl(INADDR_ANY)) {
if (pIfinfo->iiAddress.AddressIn.sin_addr.s_addr != pMatchAddr->ia.sin_addr.s_addr) {
continue;
}
}
if (pMatchAddr->ia.sin_addr.s_addr != htonl(INADDR_ANY)) {
if (pIfinfo->iiAddress.AddressIn.sin_addr.s_addr != pMatchAddr->ia.sin_addr.s_addr) {
continue;
}
}
}
pNewNode = (osiSockAddrNode *) calloc (1, sizeof(*pNewNode));
@@ -230,11 +229,11 @@ epicsShareFunc void epicsShareAPI osiSockDiscoverBroadcastAddresses
pNewNode->addr.sa = pIfinfo->iiBroadcastAddress.Address;
}
/*
* LOCK applied externally
*/
/*
* LOCK applied externally
*/
ellAdd (pList, &pNewNode->node);
}
}
free (pIfinfoList);
free (pIfinfoList);
}