Merged changes from 3.15 branch up to revno 12655

This commit is contained in:
Andrew Johnson
2015-03-11 17:20:40 -05:00
107 changed files with 1381 additions and 644 deletions
+6 -2
View File
@@ -56,6 +56,8 @@ include $(CONFIG)/CONFIG_BASE_VERSION
include $(CONFIG)/os/CONFIG.$(EPICS_HOST_ARCH).Common
-include $(CONFIG)/os/CONFIG_SITE.$(EPICS_HOST_ARCH).Common
RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops)
ifdef T_A
# Cross compile specific definitions
@@ -86,8 +88,10 @@ endif
# Include <top>/cfg/CONFIG* definitions from tops defined in RELEASE* files
#
ifneq ($(CONFIG),$(TOP)/configure)
RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops)
RELEASE_CFG_CONFIGS = $(foreach top, $(RELEASE_TOPS), $(wildcard $($(top))/cfg/CONFIG*))
RELEASE_TOPS_REVERSE := $(shell \
$(PERL) -e '$$,=" ";print reverse @ARGV' $(RELEASE_TOPS))
RELEASE_CFG_CONFIGS = $(foreach top, $(RELEASE_TOPS_REVERSE), \
$(wildcard $($(top))/cfg/CONFIG*))
ifneq ($(RELEASE_CFG_CONFIGS),)
include $(RELEASE_CFG_CONFIGS)
endif
-1
View File
@@ -26,7 +26,6 @@
# USR_CFLAGS C flags
# USR_CXXFLAGS C++ flags
# USR_CPPFLAGS c preprocesser flags
# INC include-files to install
# SRCS source files for building libraries and prods
# USR_SRCS source files for building libraries and prods
# PROD_SRCS source files for building prods
+21 -11
View File
@@ -1,25 +1,35 @@
export TOP
export IOCAPPS
#*************************************************************************
# Copyright (c) 2013 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in the file LICENSE that is included with this distribution.
#*************************************************************************
#
# $Revision-Id$
#
RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops)
export TOP
ifneq ($(RELEASE_TOPS),)
define RELEASE_FLAGS_template
export $(1)
$(1)_HOST_BIN = $$(strip $$($(1)))/bin/$$(EPICS_HOST_ARCH)
$(1)_HOST_LIB = $$(strip $$($(1)))/lib/$$(EPICS_HOST_ARCH)
$(1)_BIN = $$(wildcard $$(strip $$($(1)))/bin/$$(T_A))
$(1)_LIB = $$(wildcard $$(strip $$($(1)))/lib/$$(T_A))
$(1)_HOST_BIN = $$(strip $$($(1)))/bin/$(EPICS_HOST_ARCH)
$(1)_HOST_LIB = $$(strip $$($(1)))/lib/$(EPICS_HOST_ARCH)
$(1)_BIN = $$(wildcard $$(strip $$($(1)))/bin/$(T_A))
$(1)_LIB = $$(wildcard $$(strip $$($(1)))/lib/$(T_A))
SHRLIB_SEARCH_DIRS += $$($(1)_LIB)
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/compiler/$$(CMPLR_CLASS)))
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/os/$$(OS_CLASS)))
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/compiler/$(CMPLR_CLASS)))
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/os/$(OS_CLASS)))
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include))
RELEASE_DBD_DIRS += $$(wildcard $$(strip $$($(1)))/dbd)
RELEASE_DB_DIRS += $$(wildcard $$(strip $$($(1)))/db)
RELEASE_PERL_MODULE_DIRS += $$(wildcard $$($(1)_LIB)/perl)
RELEASE_PERL_MODULE_DIRS += $$(wildcard $$(strip $$($(1)))/lib/perl)
endef
$(foreach top, $(RELEASE_TOPS), $(eval $(call RELEASE_FLAGS_template,$(top)) ))
$(foreach top, $(RELEASE_TOPS), \
$(eval $(call RELEASE_FLAGS_template,$(top))))
endif
+3 -1
View File
@@ -53,8 +53,10 @@ BASE_CPPFLAGS += $(OSITHREAD_DEFAULT_STACK_FLAGS_$(OSITHREAD_USE_DEFAULT_STACK))
#---------------------------------------------------------------
# Where to find the installed build tools
# Windows does not like commands with relative paths starting ../
# but the Perl scripts in TOP/src/tools are OK
TOOLS = $(abspath $(EPICS_BASE_HOST_BIN))
FIND_TOOL = $(firstword $(wildcard $(TOOLS)/$(1) $(TOP)/src/tools/$(1)))
#---------------------------------------------------------------
# Epics base build tools and tool flags
@@ -64,7 +66,7 @@ DBEXPAND = $(PERL) $(TOOLS)/dbdExpand.pl
DBTORECORDTYPEH = $(PERL) $(TOOLS)/dbdToRecordtypeH.pl
DBTOMENUH = $(PERL) $(TOOLS)/dbdToMenuH.pl
REGISTERRECORDDEVICEDRIVER = $(PERL) $(TOOLS)/registerRecordDeviceDriver.pl
CONVERTRELEASE = $(PERL) $(TOOLS)/convertRelease.pl
CONVERTRELEASE = $(PERL) $(call FIND_TOOL,convertRelease.pl)
FULLPATHNAME = $(PERL) $(TOOLS)/fullPathName.pl
#-------------------------------------------------------
+31 -18
View File
@@ -214,6 +214,16 @@ USR_CPPFLAGS =
USR_DBDFLAGS =
USR_ARFLAGS =
# Variables to be set only on the command-line:
# CMD_INCLUDES =
# CMD_CFLAGS =
# CMD_CXXFLAGS =
# CMD_LDFLAGS =
# CMD_CPPFLAGS =
# CMD_DBFLAGS =
# CMD_DBDFLAGS =
# CMD_ARFLAGS =
# Debug specific options
DEBUG_CPPFLAGS =
DEBUG_CFLAGS =
@@ -272,32 +282,35 @@ RUNTIME_LDFLAGS += $(RUNTIME_LDFLAGS_$(COMMANDLINE_LIBRARY))
# Flags
INCLUDES = -I. $(SRC_INCLUDES) $(INSTALL_INCLUDES) $(RELEASE_INCLUDES)\
$(TARGET_INCLUDES) $(USR_INCLUDES) $(OP_SYS_INCLUDES) $($(BUILD_CLASS)_INCLUDES)
$(TARGET_INCLUDES) $(USR_INCLUDES) $(CMD_INCLUDES) $(OP_SYS_INCLUDES)\
$($(BUILD_CLASS)_INCLUDES)
CFLAGS = $($(BUILD_CLASS)_CFLAGS) $(POSIX_CFLAGS) $(OPT_CFLAGS) $(DEBUG_CFLAGS)\
$(PIPE_CFLAGS) $(WARN_CFLAGS) $(TARGET_CFLAGS) $(USR_CFLAGS) $(ARCH_DEP_CFLAGS)\
$(CODE_CFLAGS) $(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS)
CFLAGS = $($(BUILD_CLASS)_CFLAGS) $(POSIX_CFLAGS) $(OPT_CFLAGS)\
$(DEBUG_CFLAGS) $(PIPE_CFLAGS) $(WARN_CFLAGS) $(TARGET_CFLAGS)\
$(USR_CFLAGS) $(CMD_CFLAGS) $(ARCH_DEP_CFLAGS) $(CODE_CFLAGS)\
$(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS)
CXXFLAGS = $($(BUILD_CLASS)_CXXFLAGS) $(POSIX_CXXFLAGS) $(OPT_CXXFLAGS) $(DEBUG_CXXFLAGS)\
$(PIPE_CFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS) $(USR_CXXFLAGS) $(ARCH_DEP_CXXFLAGS)\
$(CODE_CXXFLAGS) $(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS) $(LIBRARY_SRC_CFLAGS)
CXXFLAGS = $($(BUILD_CLASS)_CXXFLAGS) $(POSIX_CXXFLAGS) $(OPT_CXXFLAGS)\
$(DEBUG_CXXFLAGS) $(PIPE_CFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS)\
$(USR_CXXFLAGS) $(CMD_CXXFLAGS) $(ARCH_DEP_CXXFLAGS) $(CODE_CXXFLAGS)\
$(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS) $(LIBRARY_SRC_CFLAGS)
LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(POSIX_LDFLAGS) \
$(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS) $($(BUILD_CLASS)_LDFLAGS)\
$(RUNTIME_LDFLAGS) $(CODE_LDFLAGS)
LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(CMD_LDFLAGS)\
$(POSIX_LDFLAGS) $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS)\
$($(BUILD_CLASS)_LDFLAGS) $(RUNTIME_LDFLAGS) $(CODE_LDFLAGS)
LDLIBS = \
$(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(DEBUG_LDLIBS) $(OP_SYS_LDLIBS) $(GNU_LDLIBS_$(GNU))
LDLIBS = $(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(DEBUG_LDLIBS) $(OP_SYS_LDLIBS)\
$(GNU_LDLIBS_$(GNU))
CPPFLAGS += $($(BUILD_CLASS)_CPPFLAGS) $(POSIX_CPPFLAGS)\
$(OPT_CPPFLAGS) $(DEBUG_CPPFLAGS) $(WARN_CPPFLAGS)\
$(BASE_CPPFLAGS) $(TARGET_CPPFLAGS) $(USR_CPPFLAGS) $(ARCH_DEP_CPPFLAGS)\
$(OP_SYS_CPPFLAGS) $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)
CPPFLAGS = $($(BUILD_CLASS)_CPPFLAGS) $(POSIX_CPPFLAGS) $(OPT_CPPFLAGS)\
$(DEBUG_CPPFLAGS) $(WARN_CPPFLAGS) $(BASE_CPPFLAGS) $(TARGET_CPPFLAGS)\
$(USR_CPPFLAGS) $(CMD_CPPFLAGS) $(ARCH_DEP_CPPFLAGS) $(OP_SYS_CPPFLAGS)\
$(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)
#--------------------------------------------------
# ar definition default
ARFLAGS =
ARCMD = $(AR) $(ARFLAGS) $(USR_ARFLAGS) $@ $(LIBRARY_LD_OBJS)
ARCMD = $(AR) $(ARFLAGS) $(USR_ARFLAGS) $(CMD_ARFLAGS) $@ $(LIBRARY_LD_OBJS)
#--------------------------------------------------
# 'Munch' link-edit
@@ -326,7 +339,7 @@ PREPROCESS.cpp = $(CPP) $(CPPFLAGS) $(INCLUDES) $< > $@
HDEPENDS_METHOD = MKMF
HDEPENDS_MKMFFLAGS = -m $*$(DEP) $(subst -I,,$(INCLUDES)) $@
HDEPENDS_MKMFFLAGS = -m $*$(DEP) $(INCLUDES) $@
HDEPENDS_MKMF.c = $(MKMF) $(HDEPENDS_FLAGS) $(HDEPENDS_MKMFFLAGS)
HDEPENDS_MKMF.cpp = $(MKMF) $(HDEPENDS_FLAGS) $(HDEPENDS_MKMFFLAGS)
+9 -4
View File
@@ -23,6 +23,7 @@
# darwin-x86 (Intel based Apple running OSX)
# freebsd-x86 (GNU compiler used for host builds)
# freebsd-x86_64 (GNU compiler used for host builds)
# linux-arm (GNU compiler used for host builds)
# linux-ppc (GNU compiler used for host builds)
# linux-ppc64 (GNU compiler used for host builds)
# linux-x86 (GNU compiler used for host builds)
@@ -37,10 +38,13 @@
# solaris-x86_64-gnu (GNU compiler used for host builds)
# win32-x86 (MS Visual C++ compiler used for host builds)
# win32-x86-mingw (MinGW compiler used for host builds)
# win32-x86-static (MS Visual C++ compiler used for host builds)
# windows-x64 (MS Visual C++ compiler used for host builds)
# windows-x64-mingw (MinGW compiler used for host builds)
# windows-x64-static (MS Visual C++ compiler used for host builds)
# Debugging builds:
# linux-arm-debug (GNU compiler used for host builds)
# linux-x86-debug (GNU compiler with -g option for host builds)
# linux-x86_64-debug (GNU compiler with -g option for host builds)
# solaris-sparc-debug (sun compiler no optimization,-g for debugging info)
@@ -57,13 +61,13 @@
#
# Currently Supporting:
# ios-arm
# ios-386
# ios-arm (darwin-x86 host)
# ios-386 (darwin-x86 host)
# linux-386 (linux-x86 host)
# linux-486 (linux-x86 host)
# linux-586 (linux-x86 host)
# linux-686 (linux-x86 host)
# linux-arm (linux-x86 host)
# linux-arm (linux-x86 or -x86_64 host)
# linux-arm_eb (linux-x86 host)
# linux-arm_el (linux-x86 host)
# linux-athlon (linux-x86 host)
@@ -98,6 +102,7 @@
# RTEMS-pc386
# RTEMS-psim
# RTEMS-uC5282
# win32-x86-mingw (linux-x86 or -x86_64 host)
#
# Which target architectures to cross-compile for.
@@ -147,7 +152,7 @@ CROSS_WARN=YES
# Use POSIX thread priority scheduling (if available).
# Must be either YES or NO
USE_POSIX_THREAD_PRIORITY_SCHEDULING = NO
USE_POSIX_THREAD_PRIORITY_SCHEDULING = YES
# Site version number, if set will append '-' and this string to the
# EPICS version number string that is reported by many tools.
+9 -9
View File
@@ -29,9 +29,9 @@ vpath %.acs $(USR_VPATH) $(SRC_DIRS) $(COMMON_DIR)
DBD_SEARCH_DIRS = . .. $(COMMON_DIR) $(SRC_DIRS) $(INSTALL_DBD) $(RELEASE_DBD_DIRS)
DB_SEARCH_DIRS = . .. $(COMMON_DIR) $(SRC_DIRS) $(INSTALL_DB) $(RELEASE_DB_DIRS)
DBDFLAGS = $(USR_DBDFLAGS) $(addprefix -I,$(DBD_SEARCH_DIRS))
DBFLAGS = $($*_DBFLAGS) $(USR_DBFLAGS) $(addprefix -I,$(DB_SEARCH_DIRS))
REGRDDFLAGS = $(DBDFLAGS) $($*_REGRDDFLAGS) $(USR_REGRDDFLAGS)
DBDFLAGS = $(USR_DBDFLAGS) $(CMD_DBDFLAGS) $(addprefix -I,$(DBD_SEARCH_DIRS))
DBFLAGS = $($*_DBFLAGS) $(USR_DBFLAGS) $(CMD_DBFLAGS) $(addprefix -I,$(DB_SEARCH_DIRS))
REGRDDFLAGS = $(DBDFLAGS) $($*_REGRDDFLAGS) $(USR_REGRDDFLAGS) $(CMD_REGRDDFLAGS)
##################################################### Targets
@@ -300,11 +300,11 @@ $(COMMON_DIR)/%$(SUBST_SUFFIX):
endif
$(INSTALL_DB)/%$(SUBST_SUFFIX): %$(SUBST_SUFFIX)
$(ECHO) "Installing db file $@"
$(ECHO) "Installing substitution file $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
$(INSTALL_DB)/%$(SUBST_SUFFIX): ../%$(SUBST_SUFFIX)
$(ECHO) "Installing db file $@"
$(ECHO) "Installing substitution file $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
.PRECIOUS: $(COMMON_DIR)/%$(SUBST_SUFFIX)
@@ -318,11 +318,11 @@ $(COMMON_DIR)/%.template: $(COMMON_DIR)/%.edf
@$(RM) $@.VAR
$(INSTALL_DB)/%.template: %.template
$(ECHO) "Installing db file $@"
$(ECHO) "Installing template file $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
$(INSTALL_DB)/%.template: ../%.template
$(ECHO) "Installing db file $@"
$(ECHO) "Installing template file $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
.PRECIOUS: $(COMMON_DIR)/%.template
@@ -508,11 +508,11 @@ $(COMMON_DIR)/%.db: $(COMMON_DIR)/%.db$(RAW)
else
$(INSTALL_DB)/%: %
$(ECHO) "Installing db file $@"
$(ECHO) "Installing $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
$(INSTALL_DB)/%: ../%
$(ECHO) "Installing db file $@"
$(ECHO) "Installing $@"
@$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D)
endif
+23 -14
View File
@@ -19,9 +19,6 @@ ACTIONS += install
ACTIONS += buildInstall
ACTIONS += runtests tapfiles
actionPart = $(word 1, $(subst $(DIVIDER), ,$@))
archPart = $(word 2, $(subst $(DIVIDER), ,$@))
actionArchTargets = $(foreach action, $(ACTIONS), \
$(addprefix $(action)$(DIVIDER), $(BUILD_ARCHS)))
@@ -29,9 +26,17 @@ cleanArchTargets = $(addprefix clean$(DIVIDER), $(BUILD_ARCHS))
buildDirs = $(addprefix O., $(BUILD_ARCHS))
#*************************************************************************
# Create EPICS_HOST_ARCH dependancies for GNU make -j option
# Needed in dirs where EPICS_HOST_ARCH builds a tool used by
# Include <top>/cfg/DIR_RULES* files from tops defined in RELEASE* files
# Do this here so they can add ACTIONS
#
RELEASE_CFG_DIR_RULES = $(foreach top, $(RELEASE_TOPS), \
$(wildcard $($(top))/cfg/DIR_RULES*))
ifneq ($(RELEASE_CFG_DIR_RULES),)
include $(RELEASE_CFG_DIR_RULES)
endif
# Create EPICS_HOST_ARCH dependancies for GNU make -j option.
# Needed in dirs where EPICS_HOST_ARCH build creates a tool used in
# cross arch builds
CROSS_ARCHS += $(CROSS1) $(CROSS2)
@@ -40,11 +45,9 @@ define DEP_template
$(2) : $(EPICS_HOST_ARCH)
$(1)$(DIVIDER)$(2) : $(1)$(DIVIDER)$(EPICS_HOST_ARCH) O.$(2)
endef
$(foreach action, $(ACTIONS), $(foreach arch, $(CROSS_ARCHS), \
$(eval $(call DEP_template,$(action),$(arch)))))
#*************************************************************************
$(foreach action, $(ACTIONS), \
$(foreach arch, $(CROSS_ARCHS), \
$(eval $(call DEP_template,$(action),$(arch)))))
# Allows rebuild to work with parallel builds option, -j.
ifeq (rebuild,$(filter rebuild,$(MAKECMDGOALS)))
@@ -52,8 +55,11 @@ ifeq (rebuild,$(filter rebuild,$(MAKECMDGOALS)))
rebuild : install
endif
archPart = $(word 2, $(subst $(DIVIDER), ,$@))
actionPart = $(word 1, $(subst $(DIVIDER), ,$@))
$(actionArchTargets) : $(buildDirs) O.Common
$(MAKE) -C O.$(archPart) -f ../Makefile TOP=$(TOP)/.. T_A=$(archPart) $(actionPart)
$(MAKE) -C O.$(archPart) -f ../Makefile TOP=$(TOP)/.. \
T_A=$(archPart) $(actionPart)
$(BUILD_ARCHS) : % : O.% O.Common
$(MAKE) -C O.$@ -f ../Makefile TOP=$(TOP)/.. T_A=$@
@@ -66,8 +72,7 @@ $(buildDirs):
O.Common:
$(MKDIR) O.Common
#
# special clean rule
# Clean rules
#
clean: archsCommonClean
@@ -87,3 +92,7 @@ realclean:
.PHONY : $(cleanArchTargets)
.PHONY : $(BUILD_ARCHS) rebuild archsCommonClean
.PHONY : $(ACTIONS) clean realclean archclean host all
# User specific rules
#
-include $(HOME)/configure/RULES_USER
+11 -4
View File
@@ -94,7 +94,7 @@ include $(CONFIG)/RULES_TARGET
# Read dependency files
ifneq (,$(strip $(HDEPENDS_FILES)))
$(filter-out $(wildcard *$(DEP)), $(HDEPENDS_FILES)): $(COMMON_INC)
$(filter-out $(wildcard *$(DEP)), $(HDEPENDS_FILES)): | $(COMMON_INC)
-include $(HDEPENDS_FILES)
endif
@@ -215,15 +215,16 @@ $(TESTPRODNAME) $(PRODNAME): %$(EXE):
%.o : %.cc
%.o : %.cpp
%$(OBJ): %.c $(COMMON_INC) $(INSTALL_INC)
# Include files are order-only prerequisites for compilation:
%$(OBJ): %.c | $(COMMON_INC) $(INSTALL_INC)
@$(RM) $@
$(COMPILE.c) -c $<
%$(OBJ): %.cc $(COMMON_INC) $(INSTALL_INC)
%$(OBJ): %.cc | $(COMMON_INC) $(INSTALL_INC)
@$(RM) $@
$(COMPILE.cpp) -c $<
%$(OBJ): %.cpp $(COMMON_INC) $(INSTALL_INC)
%$(OBJ): %.cpp | $(COMMON_INC) $(INSTALL_INC)
@$(RM) $@
$(COMPILE.cpp) -c $<
@@ -310,6 +311,12 @@ $(MUNCHNAME): %$(MUNCH_SUFFIX): $(MUNCH_DEPENDS) %$(EXE)
#---------------------------------------------------------------
# Automated testing
# GeSys modules for RTEMS
$(MODNAME): %$(MODEXT): %$(EXE)
@echo "Building module $@"
@$(RM) $@
$(LINK.mod)
runtests: $(TESTSCRIPTS)
-$(PERL) -MTest::Harness -e 'runtests @ARGV if @ARGV;' $^
+45 -25
View File
@@ -15,28 +15,32 @@ ARCHS += $(BUILD_ARCHS)
ACTIONS += inc build install buildInstall clean realclean archclean
ACTIONS += runtests tapfiles
dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@))))
actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$(notdir $@))), \
$(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@)))))
dirActionArchTargets = $(foreach dir, $(DIRS), \
$(foreach action, $(ACTIONS),\
$(foreach arch, $(ARCHS), \
$(dir)$(DIVIDER)$(action)$(DIVIDER)$(arch))))
$(foreach action, $(ACTIONS), \
$(foreach arch, $(ARCHS), \
$(dir)$(DIVIDER)$(action)$(DIVIDER)$(arch))))
dirArchTargets += $(foreach dir, $(DIRS), \
$(foreach arch, $(ARCHS),\
$(dir)$(DIVIDER)$(arch)))
$(foreach arch, $(ARCHS), \
$(dir)$(DIVIDER)$(arch)))
dirActionTargets += $(foreach dir, $(DIRS), \
$(foreach action, $(ACTIONS),\
$(dir)$(DIVIDER)$(action)))
actionArchTargets = $(foreach action, $(ACTIONS),\
$(foreach arch, $(ARCHS), \
$(action)$(DIVIDER)$(arch)))
$(foreach action, $(ACTIONS), \
$(dir)$(DIVIDER)$(action)))
actionArchTargets = $(foreach action, $(ACTIONS), \
$(foreach arch, $(ARCHS), \
$(action)$(DIVIDER)$(arch)))
all: install
host: install$(DIVIDER)$(EPICS_HOST_ARCH)
# Include <top>/cfg/DIR_RULES* files from tops defined in RELEASE* files
# Do this here so they can add ACTIONS
#
RELEASE_CFG_DIR_RULES = $(foreach top, $(RELEASE_TOPS), \
$(wildcard $($(top))/cfg/DIR_RULES*))
ifneq ($(RELEASE_CFG_DIR_RULES),)
include $(RELEASE_CFG_DIR_RULES)
endif
# Allows rebuild to work with parallel builds option, -j.
ifeq (rebuild,$(filter rebuild,$(MAKECMDGOALS)))
$(foreach dir, $(DIRS), $(dir)$(DIVIDER)install): \
@@ -49,30 +53,42 @@ endif
define DEP_template1
$(1): $$($(1)_DEPEND_DIRS)
endef
$(foreach dir, $(DIRS),$(eval $(call DEP_template1,$(dir))))
$(foreach dir, $(DIRS), \
$(eval $(call DEP_template1,$(dir))))
define DEP_template2
$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS),$$(addsuffix $$(DIVIDER)$(2),$$(ddir)))
$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \
$$(addsuffix $$(DIVIDER)$(2),$$(ddir)))
endef
$(foreach action, $(ACTIONS), $(foreach dir, $(DIRS),$(eval $(call DEP_template2,$(dir),$(action)))))
$(foreach action, $(ACTIONS), \
$(foreach dir, $(DIRS), \
$(eval $(call DEP_template2,$(dir),$(action)))))
define DEP_template3
$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS),$$(addsuffix $$(DIVIDER)$(2),$$(ddir)))
$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \
$$(addsuffix $$(DIVIDER)$(2),$$(ddir)))
endef
$(foreach arch, $(ARCHS), $(foreach dir, $(DIRS),$(eval $(call DEP_template3,$(dir),$(arch)))))
$(foreach arch, $(ARCHS), \
$(foreach dir, $(DIRS), \
$(eval $(call DEP_template3,$(dir),$(arch)))))
define DEP_template4
$(1)$$(DIVIDER)$(2)$$(DIVIDER)$(3) : $$(foreach ddir, $$($(1)_DEPEND_DIRS),$$(addsuffix $$(DIVIDER)$(2)$$(DIVIDER)$(3),$$(ddir)))
$(1)$$(DIVIDER)$(2)$$(DIVIDER)$(3) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \
$$(addsuffix $$(DIVIDER)$(2)$$(DIVIDER)$(3),$$(ddir)))
endef
$(foreach arch, $(ARCHS), $(foreach action, $(ACTIONS), $(foreach dir, $(DIRS), \
$(eval $(call DEP_template4,$(dir),$(action),$(arch))))))
$(foreach arch, $(ARCHS), \
$(foreach action, $(ACTIONS), \
$(foreach dir, $(DIRS), \
$(eval $(call DEP_template4,$(dir),$(action),$(arch))))))
dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@))))
actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$(notdir $@))), \
$(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@)))))
$(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets) :
$(MAKE) -C $(dirPart) $(actionArchPart)
$(ARCHS) $(ACTIONS) $(actionArchTargets) :%: \
$(foreach dir, $(DIRS), $(dir)$(DIVIDER)%)
$(foreach dir, $(DIRS), $(dir)$(DIVIDER)%)
.PHONY : $(DIRS) all host rebuild
.PHONY : $(ARCHS) $(ACTIONS)
@@ -80,3 +96,7 @@ $(ARCHS) $(ACTIONS) $(actionArchTargets) :%: \
.PHONY : $(dirActionArchTargets)
.PHONY : $(actionArchTargets)
# User specific rules
#
-include $(HOME)/configure/RULES_USER
+23 -21
View File
@@ -6,27 +6,27 @@
# EPICS BASE is distributed subject to a Software License Agreement found
# in the file LICENSE that is included with this distribution.
#*************************************************************************
#
# $Revision-Id$
#
#---------------------------------------------------------------
# Include <top>/configure/RULES_BUILD definitions from tops defined in RELEASE* files
# Include <top>/configure/RULES_BUILD from tops defined in RELEASE* files
#
RELEASE_RULES_BUILDS = $(foreach top, $(RELEASE_TOPS), $(wildcard $($(top))/configure/RULES_BUILD))
RELEASE_RULES_BUILDS = $(foreach top, $(RELEASE_TOPS), \
$(wildcard $($(top))/configure/RULES_BUILD))
ifneq ($(RELEASE_RULES_BUILDS),)
include $(RELEASE_RULES_BUILDS)
endif
#---------------------------------------------------------------
# Include <top>/cfg/RULES* definitions from tops defined in RELEASE* files
# Include <top>/cfg/RULES* files from tops defined in RELEASE* files
#
RELEASE_CFG_RULES = $(foreach top, $(RELEASE_TOPS), $(wildcard $($(top))/cfg/RULES*))
RELEASE_CFG_RULES = $(foreach top, $(RELEASE_TOPS), \
$(wildcard $($(top))/cfg/RULES*))
ifneq ($(RELEASE_CFG_RULES),)
include $(RELEASE_CFG_RULES)
endif
#---------------------------------------------------------------
# If this is not BASE then include TOP/configure/RULES_BUILD definitions
# If this is not BASE then include <TOP>/configure/RULES_BUILD
#
ifeq ($(wildcard $(TOP)/configure/CONFIG_BASE_VERSION),)
TOP_RULES_BUILDS = $(wildcard $(TOP)/configure/RULES_BUILD)
@@ -35,40 +35,42 @@ ifneq ($(TOP_RULES_BUILDS),)
endif
endif
#---------------------------------------------
# Include our own $(INSTALL_CFG)/RULES* definitions
# Include our own $(INSTALL_CFG)/RULES* files
#
TOP_CFG_RULES = $(wildcard $(INSTALL_CFG)/RULES*)
ifneq ($(TOP_CFG_RULES),)
include $(TOP_CFG_RULES)
endif
#---------------------------------------------------------------
# Rules to install each FILE_TYPE
#
define FILE_TYPE_template
$(1) += $$(if $$(strip $$($(1)_$$(OS_CLASS))),$$(subst -nil-,,$$($(1)_$$(OS_CLASS))), $$($(1)_DEFAULT))
$(1) += $$(if $$(strip $$($(1)_$(OS_CLASS))), \
$$(subst -nil-,,$$($(1)_$(OS_CLASS))), \
$$($(1)_DEFAULT))
INSTALLS_$(1) = $$($(1):%=$$(INSTALL_$(1))/%)
$$(INSTALL_$(1))/%: ../%
$(ECHO) "Installing $(1) file $$@"
@$$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$< $$(dir $$@)
$$(INSTALL_$(1))/%: %
$(ECHO) "Installing $(1) file $$@"
@$$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$< $$(dir $$@)
buildInstall : $$(INSTALLS_$(1))
buildInstall: $$(INSTALLS_$(1))
endef
$(foreach type, $(FILE_TYPE), \
$(eval $(call FILE_TYPE_template,$(strip $(type)))))
$(foreach type, $(FILE_TYPE),$(eval $(call FILE_TYPE_template,$(strip $(type)))))
#---------------------------------------------
# Cleaning FILE_TYPE files
#
clean: file_type_clean
file_type_clean:
@$(RM) $(foreach type, $(FILE_TYPE), $($(type)))
.PHONY : file_type_clean
# User specific rules
#
-include $(HOME)/configure/RULES_USER
+15 -10
View File
@@ -4,17 +4,17 @@
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
# in the file LICENSE that is included with this distribution.
#*************************************************************************
#
# $Revision-Id$
# $Revision-Id$
#
include $(CONFIG)/RULES_DIRS
distclean: realclean cvsclean realuninstall
CVSCLEAN=$(firstword $(wildcard $(TOOLS)/cvsclean.pl $(TOP)/src/tools/cvsclean.pl))
CVSCLEAN = $(call FIND_TOOL,cvsclean.pl)
cvsclean:
$(PERL) $(CVSCLEAN)
@@ -22,16 +22,14 @@ realuninstall: uninstallDirs
$(RMDIR) $(INSTALL_LOCATION_BIN)
$(RMDIR) $(INSTALL_LOCATION_LIB)
UNINSTALL_DIRS += $(INSTALL_DBD) $(INSTALL_INCLUDE) $(INSTALL_DOC)
UNINSTALL_DIRS += $(INSTALL_HTML) $(INSTALL_TEMPLATES) $(INSTALL_DB)
UNINSTALL_DIRS += $(DIRECTORY_TARGETS)
UNINSTALL_DIRS += $(INSTALL_DBD) $(INSTALL_INCLUDE) $(INSTALL_DOC) \
$(INSTALL_HTML) $(INSTALL_TEMPLATES) $(INSTALL_DB) $(DIRECTORY_TARGETS)
uninstallDirs:
$(RMDIR) $(UNINSTALL_DIRS)
uninstall: archuninstall uninstallDirs
archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS))
@$(MAKE) -f Makefile cleandirs
archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS)) | cleandirs
archPart = $(word 2, $(subst $(DIVIDER), ,$@))
uninstall$(DIVIDER)%:
@@ -39,14 +37,14 @@ uninstall$(DIVIDER)%:
$(RMDIR) $(INSTALL_LOCATION_LIB)/$(archPart)
cleandirs:
@$(NOP)
ifeq ($(wildcard $(INSTALL_LOCATION_BIN)/*),)
$(RMDIR) $(INSTALL_LOCATION_BIN)
endif
ifeq ($(wildcard $(INSTALL_LOCATION_LIB)/*),)
$(RMDIR) $(INSTALL_LOCATION_LIB)
endif
@echo
# The echo above stops a "nothing to be done for cleandirs" message
help:
@echo "Usage: gnumake [options] [target] ..."
@@ -82,3 +80,10 @@ help:
.PHONY: cleandirs distclean cvsclean realuninstall archuninstall uninstallDirs
.PHONY: uninstall help
# Include <top>/cfg/TOP_RULES* files from tops defined in RELEASE* files
#
RELEASE_CFG_TOP_RULES = $(foreach top, $(RELEASE_TOPS), \
$(wildcard $($(top))/cfg/TOP_RULES*))
ifneq ($(RELEASE_CFG_TOP_RULES),)
include $(RELEASE_CFG_TOP_RULES)
endif
+57 -17
View File
@@ -49,27 +49,29 @@ RANLIB := $(RTEMS_TOOLS)/bin/$(RANLIB)
VALID_BUILDS = Ioc
#--------------------------------------------------
# The RTEMS Makefiles redefine several macros, so we have to go
# through the following contortions to get the EPICS flags back.
CFLAGS = $(CROSS_CFLAGS) $(OPT_CFLAGS) $(DEBUG_CFLAGS)\
$(WARN_CFLAGS) $(TARGET_CFLAGS) $(USR_CFLAGS) $(ARCH_DEP_CFLAGS)\
$(CODE_CFLAGS) $(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS)
# The RTEMS Makefiles redefine several macros, so we have to
# reset them to the proper EPICS values, from CONFIG_COMMON
CFLAGS = $($(BUILD_CLASS)_CFLAGS) $(POSIX_CFLAGS) $(OPT_CFLAGS)\
$(DEBUG_CFLAGS) $(PIPE_CFLAGS) $(WARN_CFLAGS) $(TARGET_CFLAGS)\
$(USR_CFLAGS) $(CMD_CFLAGS) $(ARCH_DEP_CFLAGS) $(CODE_CFLAGS)\
$(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS)
CXXFLAGS = $(CROSS_CXXFLAGS) $(OPT_CXXFLAGS)\
$(DEBUG_CXXFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS) $(USR_CXXFLAGS)\
$(ARCH_DEP_CXXFLAGS) $(CODE_CXXFLAGS) $(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS)\
$(LIBRARY_SRC_CFLAGS)
CXXFLAGS = $($(BUILD_CLASS)_CXXFLAGS) $(POSIX_CXXFLAGS) $(OPT_CXXFLAGS)\
$(DEBUG_CXXFLAGS) $(PIPE_CFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS)\
$(USR_CXXFLAGS) $(CMD_CXXFLAGS) $(ARCH_DEP_CXXFLAGS) $(CODE_CXXFLAGS)\
$(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS) $(LIBRARY_SRC_CFLAGS)
LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) \
$(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS) $(CROSS_LDFLAGS)\
$(RUNTIME_LDFLAGS) $(CODE_LDFLAGS)
LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(CMD_LDFLAGS)\
$(POSIX_LDFLAGS) $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS)\
$($(BUILD_CLASS)_LDFLAGS) $(RUNTIME_LDFLAGS) $(CODE_LDFLAGS)
LDLIBS = \
$(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(DEBUG_LDLIBS) $(OP_SYS_LDLIBS)
LDLIBS = $(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(DEBUG_LDLIBS) $(OP_SYS_LDLIBS)\
$(GNU_LDLIBS_$(GNU))
CPPFLAGS += $(CROSS_CPPFLAGS) $(POSIX_CPPFLAGS)\
$(BASE_CPPFLAGS) $(TARGET_CPPFLAGS) $(USR_CPPFLAGS) $(ARCH_DEP_CPPFLAGS)\
$(OP_SYS_CPPFLAGS) $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)
CPPFLAGS += $($(BUILD_CLASS)_CPPFLAGS) $(POSIX_CPPFLAGS) $(OPT_CPPFLAGS)\
$(DEBUG_CPPFLAGS) $(WARN_CPPFLAGS) $(BASE_CPPFLAGS) $(TARGET_CPPFLAGS)\
$(USR_CPPFLAGS) $(CMD_CPPFLAGS) $(ARCH_DEP_CPPFLAGS) $(OP_SYS_CPPFLAGS)\
$(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)
ECHO = @$(if $(findstring s,$(patsubst T_A=%,,$(MAKEFLAGS))),$(NOP),echo)
@@ -83,6 +85,8 @@ OPT_CXXFLAGS_YES = $(CFLAGS_OPTIMIZE_V)
OPT_CFLAGS_NO = $(CFLAGS_DEBUG_V)
OPT_CXXFLAGS_NO = $(CFLAGS_DEBUG_V)
MODEXT=.obj
#--------------------------------------------------
# operating system class (include/os/<os_class>)
OS_CLASS = RTEMS
@@ -97,6 +101,42 @@ OP_SYS_LDFLAGS += $(CPU_CFLAGS) -u Init \
$(PROJECT_RELEASE)/lib/no-signal.rel \
$(PROJECT_RELEASE)/lib/no-rtmon.rel
MOD_SYS_LDFLAGS += $(CPU_CFLAGS) -Wl,-r -nostdlib
# Do not link against libraries which are part of the Generic Image
GESYS_LIBS += -lgcc
GESYS_LIBS += -lc -lm -lrtemscpu -lrtemsbsp -lrtems++ -lbspExt
GESYS_LIBS += -lcexp -ltecla_r -lspencer_regexp -lpmelf -lpmbfd
GESYS_LIBS += -lnfs -ltelnetd -lrtems-gdb-stub
# While not part of the Generic Image it provides symbols which
# would conflict.
GESYS_LIBS += -lrtemsCom
#--------------------------------------------------
# Options for building GeSys loadable objects
MODNAME_YES = $(PRODNAME:%$(EXE)=%$(MODEXT))
MODNAME += $(MODNAME_$(USE_GESYS))
PRODTARGETS += $(MODNAME)
BIN_INSTALLS += $(MODNAME)
# changes to LDFLAGS in CONFIG_COMMON and LINK.cpp in CONFIG.Common.UnixCommon
# should be reflected here with the following exceptions
#
# replace OP_SYS_LDFLAGS with MOD_SYS_LDFLAGS
# replace PROD_LDLIBS with MOD_LDLIBS
# remove STATIC_LDFLAGS
MOD_LDLIBS = $(filter-out $(GESYS_LIBS),$(PROD_LDLIBS))
MOD_LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(POSIX_LDFLAGS) \
$(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(MOD_SYS_LDFLAGS) $($(BUILD_CLASS)_LDFLAGS)\
$(RUNTIME_LDFLAGS) $(CODE_LDFLAGS)
LINK.mod = $(CCC) -o $@ $(PRODDIR_LDFLAGS) $(MOD_LDFLAGS)
LINK.mod += $(PROD_LDFLAGS) $(PROD_LD_OBJS) $(PROD_LD_RESS) $(MOD_LDLIBS)
#--------------------------------------------------
# RTEMS has neither shared libraries nor dynamic loading
STATIC_BUILD=YES
+1 -1
View File
@@ -1,5 +1,5 @@
#
# CONFIG.Common.RTEMS-mvme3100
# CONFIG.Common.RTEMS-mvme2100
# $Revision-Id$
# Author: W. Eric Norum <wenorum@lbl.gov>
#
@@ -22,4 +22,6 @@ define MUNCH_CMD
$(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary $< $@
endef
OP_SYS_LDLIBS += -lbspExt
include $(CONFIG)/os/CONFIG.Common.RTEMS
+1 -1
View File
@@ -12,7 +12,7 @@ MUNCH_SUFFIX = .boot
MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX))
define MUNCH_CMD
$(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary -R .comment -S $< temp.bin
$(PROJECT_RELEASE)/build-tools/bin2boot $@ 0x00097E00 \
$(BIN2BOOT) $@ 0x00097E00 \
$(PROJECT_RELEASE)/lib/start16.bin 0x00097C00 0 temp.bin 0x00100000 0
rm -f temp.bin
endef
+1 -26
View File
@@ -1,9 +1,7 @@
# CONFIG.Common.linux-arm
#
# This file is maintained by the build community.
#
# Definitions for linux-arm target builds
# Sites may override these definitions in CONFIG_SITE.Common.linux-arm
# Override these settings in CONFIG_SITE.Common.linux-arm
#-------------------------------------------------------
# Include definitions common to all Linux targets
@@ -11,26 +9,3 @@ include $(CONFIG)/os/CONFIG.Common.linuxCommon
ARCH_CLASS = arm
ifeq ($(BUILD_CLASS),CROSS)
VALID_BUILDS = Ioc
GNU_TARGET = arm-linux
# prefix of compiler tools
CMPLR_SUFFIX =
CMPLR_PREFIX = $(addsuffix -,$(GNU_TARGET))
# Provide a link-time path for shared libraries
SHRLIBDIR_RPATH_LDFLAGS_YES += $(SHRLIB_DEPLIB_DIRS:%=-Wl,-rpath-link,%)
SHRLIBDIR_LDFLAGS += $(SHRLIBDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH))
# Provide a link-time path for products
PRODDIR_RPATH_LDFLAGS_YES += $(PROD_DEPLIB_DIRS:%=-Wl,-rpath-link,%)
PRODDIR_LDFLAGS += $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH))
# Provide a link-time path for readline
RUNTIME_LDFLAGS_READLINE_YES = -Wl,-rpath-link,$(GNU_DIR)/lib
RUNTIME_LDFLAGS_READLINE = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH))
RUNTIME_LDFLAGS_READLINE_CURSES = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH))
RUNTIME_LDFLAGS_READLINE_NCURSES = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH))
endif
@@ -0,0 +1,13 @@
# CONFIG.Common.linux-arm-debug
#
# $Revision-Id$
# This file is maintained by the build community.
#
# Definitions for linux-arm with debug compiler flags
# Override these settings in CONFIG_SITE.Common.linux-arm-debug
#-------------------------------------------------------
# Include definitions common to all linux-arm target archs
include $(CONFIG)/os/CONFIG.Common.linux-arm
HOST_OPT=NO
@@ -36,6 +36,7 @@ ARCH_DEP_LDFLAGS += -m32
OP_SYS_CPPFLAGS = -D_MINGW
EXE = .exe
RES = .coff
# Use .o for static object files, .obj for shared library object files
OBJ_NO = .o
@@ -0,0 +1,12 @@
# CONFIG.linux-arm-debug.Common
#
# $Revision-Id$
# This file is maintained by the build community.
#
# Definitions for linux-arm-debug host builds
# Override these settings in CONFIG_SITE.linux-arm-debug.Common
#-------------------------------------------------------
#Include definitions common to linux-arm hosts
include $(CONFIG)/os/CONFIG.linux-arm.Common
@@ -0,0 +1,14 @@
# CONFIG.linux-arm-debug.linux-arm-debug
#
# $Revision-Id$
# This file is maintained by the build community.
#
# Definitions for linux-arm-debug host and target build
# Override these settings in CONFIG_SITE.linux-arm-debug.linux-arm-debug
#-------------------------------------------------------
include $(CONFIG)/os/CONFIG.linux-arm.linux-arm
# Removes -O optimization and adds -g compile option
HOST_OPT=NO
@@ -0,0 +1,15 @@
# CONFIG.linux-arm.linux-arm-debug
#
# $Revision-Id$
# This file is maintained by the build community.
#
# Definitions for linux-arm host - linux-arm-debug target build
# Override these settings in CONFIG_SITE.linux-arm.linux-arm-debug
#-------------------------------------------------------
-include $(CONFIG)/os/CONFIG.linux-arm.linux-arm
-include $(CONFIG)/os/CONFIG_SITE.Common.linux-arm
-include $(CONFIG)/os/CONFIG_SITE.linux-arm.linux-arm
BUILD_CLASS=HOST
HOST_OPT=NO
+23 -2
View File
@@ -1,10 +1,31 @@
# CONFIG.linux-x86.linux-arm
#
# Definitions for linux-x86 host - linux-arm target builds
# Sites may override these definitions in CONFIG_SITE.linux-x86.linux-arm
# Override these settings in CONFIG_SITE.linux-x86.linux-arm
#-------------------------------------------------------
# Copied from x86.x86
VALID_BUILDS = Ioc
GNU_TARGET = arm-linux
# prefix of compiler tools
CMPLR_SUFFIX =
CMPLR_PREFIX = $(addsuffix -,$(GNU_TARGET))
# Provide a link-time path for shared libraries
SHRLIBDIR_RPATH_LDFLAGS_YES += $(SHRLIB_DEPLIB_DIRS:%=-Wl,-rpath-link,%)
SHRLIBDIR_LDFLAGS += $(SHRLIBDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH))
# Provide a link-time path for products
PRODDIR_RPATH_LDFLAGS_YES += $(PROD_DEPLIB_DIRS:%=-Wl,-rpath-link,%)
PRODDIR_LDFLAGS += $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH))
# Provide a link-time path for readline
RUNTIME_LDFLAGS_READLINE_YES = -Wl,-rpath-link,$(GNU_DIR)/lib
RUNTIME_LDFLAGS_READLINE = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH))
RUNTIME_LDFLAGS_READLINE_CURSES = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH))
RUNTIME_LDFLAGS_READLINE_NCURSES = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH))
# Library flags
STATIC_LDFLAGS_YES= -Wl,-Bstatic
STATIC_LDFLAGS_NO=
STATIC_LDLIBS_YES= -Wl,-Bdynamic
@@ -0,0 +1,9 @@
# CONFIG.linux-x86.linux-arm-debug
#
# Definitions for linux-x86 host - linux-arm-debug target builds
# Override these settings in CONFIG_SITE.linux-x86.linux-arm-debug
#-------------------------------------------------------
# Include definitions for linux-arm targets
include $(CONFIG)/os/CONFIG.linux-x86.linux-arm
@@ -7,19 +7,18 @@
# Include common gnu compiler definitions
include $(CONFIG)/CONFIG.gnuCommon
RES = .coff
# Add resource compiler
RCCMD = $(GNU_BIN)/$(CMPLR_PREFIX)windres$(CMPLR_SUFFIX) $(INCLUDES) $< $@
# No -fPIC avoids "-fPIC ignored for target (all code is position independent)"
# Remove -fPIC flags, add out-implib
SHRLIB_CFLAGS =
SHRLIB_LDFLAGS = -shared \
-Wl,--out-implib,$(DLLSTUB_PREFIX)$*$(DLLSTUB_SUFFIX)
LOADABLE_SHRLIB_LDFLAGS = -shared \
-Wl,--out-implib,$(DLLSTUB_PREFIX)$*$(DLLSTUB_SUFFIX)
# Override linking with gcc library from CONFIG.gnuCommon
# Don't link with gcc library
GNU_LDLIBS_YES =
# Link with winsock2
OP_SYS_LDLIBS = -lws2_32
@@ -0,0 +1,8 @@
# CONFIG.linux-x86_64.linux-arm
#
# Definitions for linux-x86_64 host - linux-arm target builds
# Sites may override these definitions in CONFIG_SITE.linux-x86_64.linux-arm
#-------------------------------------------------------
include $(CONFIG)/os/CONFIG.linux-x86.linux-arm
@@ -0,0 +1,8 @@
# CONFIG.linux-x86_64.linux-arm-debug
#
# Definitions for linux-x86_64 host - linux-arm-debug target builds
# Override these settings in CONFIG_SITE.linux-x86_64.linux-arm-debug
#-------------------------------------------------------
include $(CONFIG)/os/CONFIG.linux-x86.linux-arm
+1 -1
View File
@@ -3,7 +3,7 @@
# $Revision-Id$
# This file is maintained by the build community.
#
# Definitions for solaris-sparc Sun compiler host builds
# Definitions for solaris-sparc64 Sun compiler host builds
# Sites may override these definitions in CONFIG_SITE.solaris-sparc64.Common
#-------------------------------------------------------
@@ -3,7 +3,7 @@
# $Revision-Id$
# This file is maintained by the build community.
#
# Definitions for solaris-sparc Sun compiler host - solaris-sparc Sun compiler target builds
# Definitions for solaris-sparc64 compiler host - solaris-sparc64 compiler target builds
# Sites may override these definitions in CONFIG_SITE.solaris-sparc64.solaris-sparc64
#-------------------------------------------------------
@@ -3,8 +3,8 @@
# $Revision-Id$
# This file is maintained by the build community.
#
# Definitions for solaris-sparc host - solaris-sparc target build
# Sites may override these definitions in CONFIG_SITE.solaris-sparc.solaris-sparc
# Definitions for solaris host - solaris target build
# Sites may override these definitions in CONFIG_SITE.solarisCommon.solarisCommon
#-------------------------------------------------------
CMPLR_CLASS = solStudio
@@ -9,24 +9,29 @@
# Include common gnu compiler definitions
include $(CONFIG)/CONFIG.gnuCommon
# Undo various things set by CONFIG.gnuCommon
CMPLR_PREFIX =
# Remove $(GNU_BIN)/ path
CC = $(CMPLR_PREFIX)gcc
CCC = $(CMPLR_PREFIX)g++
AR = $(CMPLR_PREFIX)ar -rc
LD = $(CMPLR_PREFIX)ld -r
RANLIB = $(CMPLR_PREFIX)ranlib
RES = .coff
# Add resource compiler
RCCMD = $(CMPLR_PREFIX)windres $(INCLUDES) $< $@
# No -fPIC avoids "-fPIC ignored for target (all code is position independent)"
# Remove -fPIC flags, add out-implib
SHRLIB_CFLAGS =
SHRLIB_LDFLAGS = -shared \
-Wl,--out-implib,$(DLLSTUB_PREFIX)$*$(DLLSTUB_SUFFIX)
LOADABLE_SHRLIB_LDFLAGS = -shared \
-Wl,--out-implib,$(DLLSTUB_PREFIX)$*$(DLLSTUB_SUFFIX)
# Override linking with gcc library from CONFIG.gnuCommon
# Don't link with gcc library
GNU_LDLIBS_YES =
# Link with winsock2
OP_SYS_LDLIBS = -lws2_32
+3 -3
View File
@@ -161,10 +161,10 @@ OP_SYS_CXXFLAGS = $(COMPILER_CXXFLAGS)
#
# Files and flags needed to link DLLs (used in RULES_BUILD)
#
WIN32_DLLFLAGS = /subsystem:windows /dll $(OPT_LDFLAGS) \
$(USR_LDFLAGS) $(CMD_LDFLAGS) $(TARGET_LDFLAGS) $(LIB_LDFLAGS)
WIN32_DLLFLAGS = -subsystem:windows -dll \
$(OPT_LDFLAGS) $(USR_LDFLAGS) $(TARGET_LDFLAGS) $(LIB_LDFLAGS)
#
# specify dll .def file only if it exists
#
DLL_DEF_FLAG = $(addprefix -def:,$(wildcard ../$(addsuffix .def,$*)))
+11 -2
View File
@@ -1,17 +1,26 @@
# CONFIG_SITE.Common.RTEMS
#
# $Revision-Id$
#
# Site-specific information for all RTEMS targets
#
#-------------------------------------------------------
# Where to find RTEMS
#
# APS:
RTEMS_VERSION = 4.10.2
RTEMS_BASE = /usr/local/rtems/rtems-$(RTEMS_VERSION)
RTEMS_BASE = /usr/local/vw/rtems/rtems-$(RTEMS_VERSION)
# Cross-compile toolchain in $(RTEMS_TOOLS)/bin
#
RTEMS_TOOLS = $(RTEMS_BASE)
# Link Generic System loadable objects instead of full executable.
#
# A GeSys object is similar to a shared library. It can be (un)loaded
# at runtime by the Generic System loader which is available as a
# patch against RTEMS.
USE_GESYS = NO
# If you're using neither BOOTP/DHCP nor FLASH to pick up your IOC
# network configuration you must uncomment and specify your Internet
+6 -2
View File
@@ -12,10 +12,14 @@
#IOS_DEPLOYMENT_TARGET = 5.1
#IOS_DEPLOYMENT_TARGET = 6.0
#IOS_DEPLOYMENT_TARGET = 6.1
IOS_DEPLOYMENT_TARGET = 7.0
#IOS_DEPLOYMENT_TARGET = 8.0
#IOS_DEPLOYMENT_TARGET = 7.0
#IOS_DEPLOYMENT_TARGET = 7.1
IOS_DEPLOYMENT_TARGET = 8.0
#IOS_DEPLOYMENT_TARGET = 8.1
# Older versions of Xcode may require this SDK_DIR definition
#SDK_DIR = $(PLATFORM_DIR)/Developer/SDKs/$(IOS_PLATFORM)$(IOS_DEPLOYMENT_TARGET).sdk
# Which compiler to use:
# CLANG is required for Xcode 5.0 and later
+41
View File
@@ -0,0 +1,41 @@
# CONFIG_SITE.Common.linux-arm
#
# $Revision-Id$
#
# Site Specific definitions for all linux-arm targets
#-------------------------------------------------------
# NOTE for SHARED_LIBRARIES: In most cases if this is set to YES the
# shared libraries will be found automatically. However if the .so
# files are installed at a different path to their compile-time path
# then in order to be found at runtime do one of these:
# a) LD_LIBRARY_PATH must include the full absolute pathname to
# $(INSTALL_LOCATION)/lib/$(EPICS_HOST_ARCH) when invoking base
# executables.
# b) Add the runtime path to SHRLIB_DEPLIB_DIRS and PROD_DEPLIB_DIRS, which
# will add the named directory to the list contained in the executables.
# c) Add the runtime path to /etc/ld.so.conf and run ldconfig
# to inform the system of the shared library location.
# Depending on your version of Linux you'll want one of the following
# lines to enable command-line editing and history in iocsh. If you're
# not sure which, start with the top one and work downwards until the
# build doesn't fail to link the readline library. If none of them work,
# comment them all out to build without readline support.
# No other libraries needed (recent Fedora, Ubuntu etc.):
#COMMANDLINE_LIBRARY = READLINE
# Needs -lncurses (RHEL 5 etc.):
#COMMANDLINE_LIBRARY = READLINE_NCURSES
# Needs -lcurses (older versions)
#COMMANDLINE_LIBRARY = READLINE_CURSES
# It makes sense to include debugging symbols even in optimized builds
# in case you want to attach gdb to the process or examine a core-dump.
# This does cost disk space, but not memory as debug symbols are not
# loaded into RAM when the binary is loaded.
OPT_CFLAGS_YES += -g
OPT_CXXFLAGS_YES += -g
@@ -1,9 +1,12 @@
# CONFIG_SITE.Common.linux-xscale_be
#
# $Revision-Id$
#
# Site specific definitions for linux-xscale_be target builds.
#-------------------------------------------------------
# Set GNU_DIR to point to directory containing the tool-chain
GNU_DIR = /usr/local/xscale_be
# APS:
GNU_DIR = /usr/local/vw/xscale_be
@@ -4,7 +4,6 @@
#
# Site Specific definitions for win32-x86-mingw target
# If readline is not installed comment the following line
# to omit command-line editing and history support
# If readline is available uncomment the following line
# to enable command-line editing and history support
#COMMANDLINE_LIBRARY = READLINE
@@ -0,0 +1,13 @@
# CONFIG_SITE.linux-arm-debug.linux-arm-debug
#
# $Revision-Id$
#
# Site specific overrides for linux-arm-debug host and target builds
#-------------------------------------------------------
#Prepares the object code to collect data for profiling with prof.
#PROFILE=YES
#Compiles for profiling with the gprof profiler.
#GPROF=YES
@@ -1,3 +1,9 @@
# CONFIG_SITE.linux-x86-debug.linux-x86-debug
#
# $Revision-Id$
#
# Site specific overrides for linux-x86-debug host and target builds
#-------------------------------------------------------
#Prepares the object code to collect data for profiling with prof.
#PROFILE=YES
+3 -2
View File
@@ -1,4 +1,4 @@
# CONFIG_SITE.linux-x86.linux-arm
# CONFIG_SITE.linux-x86.linux-arm
#
# $Revision-Id$
#
@@ -8,7 +8,8 @@
# Tools install path
#GNU_DIR = /home/targetOS/linux-arm/host/x86-linux/gcc_3.3.3
GNU_DIR = /net/phoebus/vw/zynq-2011.09
# APS:
GNU_DIR = /usr/local/vw/zynq-2011.09
# GNU crosscompiler target name
GNU_TARGET = arm-xilinx-linux-gnueabi
@@ -0,0 +1,9 @@
# CONFIG_SITE.linux-x86.linux-arm-debug
#
# $Revision-Id$
#
# Site specific settings for linux-x86 host - linux-arm-debug target builds
#-------------------------------------------------------
# Inherit settings from linux-arm
include $(CONFIG)/os/CONFIG_SITE.linux-x86.linux-arm
@@ -4,8 +4,8 @@
#-------------------------------------------------------
# Early versions of the MinGW cross-build tools can only build
# static (non-DLL) libraries. The version of gcc 4.6.3 for Ubuntu
# succeeds, but Fedora's 4.4.6 does not and needs these uncommented:
# static (non-DLL) libraries. For example RHEL's cross-gcc 4.4.6
# needs these uncommented, cross-gcc 4.6.3 for Ubuntu does not:
SHARED_LIBRARIES = NO
STATIC_BUILD = YES
@@ -18,4 +18,5 @@ STATIC_BUILD = YES
#CMPLR_PREFIX = i686-w64-mingw32-
# RHEL:
CMPLR_PREFIX = i686-pc-mingw32-
# Debian?
#CMPLR_PREFIX = i586-mingw32msvc-
@@ -2,10 +2,8 @@
#
# $Revision-Id$
#
# Site specific override definitions for solaris-sparc host builds
# Only the local epics system manager should modify this file
# Site specific overrides for linux-x86_64 host and target builds
#-------------------------------------------------------
#Prepares the object code to collect data for profiling with prof.
#PROFILE=YES
@@ -0,0 +1,9 @@
# CONFIG_SITE.linux-x86_64.linux-arm
#
# $Revision-Id$
#
# Site specific settings for linux-x86_64 host - linux-arm target builds
#-------------------------------------------------------
# Inherit setting from linux-x86
include $(CONFIG)/os/CONFIG_SITE.linux-x86.linux-arm
@@ -0,0 +1,9 @@
# CONFIG_SITE.linux-x86_64.linux-arm-debug
#
# $Revision-Id$
#
# Site specific settings for linux-x86_64 host - linux-arm-debug target builds
#-------------------------------------------------------
# Inherit settings from linux-arm
include $(CONFIG)/os/CONFIG_SITE.linux-x86.linux-arm
@@ -3,15 +3,9 @@
# $Revision-Id$
#
# Site Specific definitions for win32-x86-mingw target
# Only the local epics system manager should modify this file
# The MinGW bin directory must be in your path.
# Uncomment the following settings for MinGW_w32 releases
# <MinGW directory>/bin should be in your path
#CMPLR_PREFIX=i686-w64-mingw32-
#CC = $(CMPLR_PREFIX)gcc
#CCC = $(CMPLR_PREFIX)g++
#AR = $(CMPLR_PREFIX)ar -rc
#LD = $(CMPLR_PREFIX)ld -r
#RANLIB = $(CMPLR_PREFIX)ranlib
# Set the compiler prefix for your MinGW installation
#CMPLR_PREFIX = i686-w64-mingw32-
#CMPLR_PREFIX = i586-mingw32msvc-
+12 -12
View File
@@ -1,6 +1,6 @@
Installation Instructions
EPICS Base Release 3.15.1
EPICS Base Release 3.15.1
--------------------------------------------------------------------------
@@ -102,13 +102,13 @@
later.
GNU readline or Tecla library
GNU readline and Tecla librararies can be used by the IOC shell to
provide command line editing and command line history recall and edit.
GNU readline (or Tecla library) must be installed on your target system
when COMMANDLINE_LIBRARY is set to READLINE (or TECLA) for that target.
EPICS (EPICS shell) is the default specified in CONFIG_COMMON. A
READLINE override is defined for linux-x86 in the EPICS distribution.
Comment out COMMANDLINE_LIBRARY=READLINE in
GNU readline and Tecla libraries can be used by the IOC shell to provide
command line editing and command line history recall and edit. GNU
readline (or Tecla library) must be installed on your target system when
COMMANDLINE_LIBRARY is set to READLINE (or TECLA) for that target. EPICS
(EPICS shell) is the default specified in CONFIG_COMMON. A READLINE
override is defined for linux-x86 in the EPICS distribution. Comment out
COMMANDLINE_LIBRARY=READLINE in
configure/os/CONFIG_SITE.Common.linux-x86 if readline is not installed
on linux-x86. Command-line editing and history will then be those
supplied by the os. On vxWorks the ledLib command-line input library is
@@ -125,7 +125,7 @@
EPICS documentation is available through the EPICS website at Argonne.
Release specific documenataion can also be found in the
Release specific documentation can also be found in the
base/documentation directory of the distribution.
Directory Structure
@@ -135,7 +135,7 @@
base Root directory of the base distribution
base/configure Operating system independent build config files
base/configure/os Operating system dependent build config files
base/documentation Distributation documentation
base/documentation Distribution documentation
base/src Source code in various subdirectories
base/startup Scripts for setting up path and environment
@@ -156,7 +156,7 @@
Build related components
base/documentation/README* files
base/documentation directory - contains setup, build, and install documents
README.1st Instructions for setup and building epics base
README.html html version of README.1st
@@ -185,7 +185,7 @@
CONFIG_COMMON Definitions common to all builds
CONFIG_ENV Definitions of EPICS environment variables
CONFIG_FILE_TYPE
CONFIG_SITE Site specific make defintions
CONFIG_SITE Site specific make definitions
CONFIG_SITE_ENV Site defaults for EPICS environment variables
MAKEFILE Installs CONFIG* RULES* creates
RELEASE Location of external products
+6 -5
View File
@@ -107,7 +107,7 @@
For RTEMS targets, you need RTEMS core and toolset version 4.9.2 or later.</P>
<P><B>GNU readline or Tecla library</B><BR>
GNU readline and Tecla librararies can be used by the IOC shell to
GNU readline and Tecla libraries can be used by the IOC shell to
provide command line editing and command line history recall and edit.
GNU readline (or Tecla library) must be installed on your target system
when COMMANDLINE_LIBRARY is set to READLINE (or TECLA) for that target.
@@ -130,7 +130,7 @@
<H3><A NAME="0_0_8"> Documentation</A></H3>
<BLOCKQUOTE>EPICS documentation is available through the
<a href="http://www.aps.anl.gov/epics/">EPICS website</a> at Argonne.
<P>Release specific documenataion can also be found in the base/documentation
<P>Release specific documentation can also be found in the base/documentation
directory of the distribution.</BLOCKQUOTE>
<H3><A NAME="0_0_10"> Directory Structure</A></H3>
@@ -140,7 +140,7 @@
base Root directory of the base distribution
base/configure Operating system independent build config files
base/configure/os Operating system dependent build config files
base/documentation Distributation documentation
base/documentation Distribution documentation
base/src Source code in various subdirectories
base/startup Scripts for setting up path and environment
</PRE>
@@ -165,7 +165,8 @@
<H3><A NAME="0_0_11"> Build related components</A></H3>
<BLOCKQUOTE>
<H4>base/documentation/README* files</H4>
<H4>base/documentation directory - contains setup, build, and install
documents</H4>
<PRE>
README.1st Instructions for setup and building epics base
README.html html version of README.1st
@@ -196,7 +197,7 @@
CONFIG_COMMON Definitions common to all builds
CONFIG_ENV Definitions of EPICS environment variables
CONFIG_FILE_TYPE
CONFIG_SITE Site specific make defintions
CONFIG_SITE Site specific make definitions
CONFIG_SITE_ENV Site defaults for EPICS environment variables
MAKEFILE Installs CONFIG* RULES* creates
RELEASE Location of external products
+2 -3
View File
@@ -24,9 +24,8 @@ PERL_VERSION = $(shell $(PERL) ../perlConfig.pl version)
PERL_ARCHNAME = $(shell $(PERL) ../perlConfig.pl archname)
PERL_ARCHPATH = $(PERL_VERSION)/$(PERL_ARCHNAME)
ifeq ($(findstring Host,$(VALID_BUILDS)),Host)
ifeq ($(findstring $(OS_CLASS),WIN32 cygwin32),)
# Doesn't build on WIN32
ifeq ($(T_A),$(EPICS_HOST_ARCH)) # No cross-builds (wrong Perl!)
ifeq ($(findstring $(OS_CLASS),WIN32 cygwin32),) # Doesn't build on WIN32
LOADABLE_LIBRARY_HOST = Cap5
PERL_SCRIPTS += cainfo.pl
+38 -52
View File
@@ -3,8 +3,7 @@
* 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
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
@@ -16,26 +15,6 @@
* Author: Jeff Hill
* Date: 3-27-90
*
* Control System Software for the GTA Project
*
* Copyright 1988, 1989, the Regents of the University of California.
*
* This software was produced under a U.S. Government contract
* (W-7405-ENG-36) at the Los Alamos National Laboratory, which is
* operated by the University of California for the U.S. Department
* of Energy.
*
* Developed by the Controls and Automation Group (AT-8)
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Jeff HIll, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 665-1831
* E-mail: johill@lanl.gov
*
* PURPOSE:
* Broadcasts fan out over the LAN, but old IP kernels do not allow
* two processes on the same machine to get the same broadcast
@@ -108,23 +87,24 @@ static const unsigned short PORT_ANY = 0u;
/*
* makeSocket()
*/
static bool makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock )
static int makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock )
{
int status;
union {
struct sockaddr_in ia;
struct sockaddr sa;
} bd;
SOCKET sock = epicsSocketCreate ( AF_INET, SOCK_DGRAM, 0 );
if ( sock == INVALID_SOCKET ) {
return false;
*pSock = sock;
return SOCKERRNO;
}
/*
* no need to bind if unconstrained
*/
if ( port != PORT_ANY ) {
int status;
union {
struct sockaddr_in ia;
struct sockaddr sa;
} bd;
memset ( (char *) &bd, 0, sizeof (bd) );
bd.ia.sin_family = AF_INET;
@@ -132,15 +112,16 @@ static bool makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock )
bd.ia.sin_port = htons ( port );
status = bind ( sock, &bd.sa, (int) sizeof(bd) );
if ( status < 0 ) {
status = SOCKERRNO;
epicsSocketDestroy ( sock );
return false;
return status;
}
if ( reuseAddr ) {
epicsSocketEnableAddressReuseDuringTimeWaitState ( sock );
}
}
*pSock = sock;
return true;
return 0;
}
repeaterClient::repeaterClient ( const osiSockAddr &fromIn ) :
@@ -156,10 +137,10 @@ bool repeaterClient::connect ()
{
int status;
if ( ! makeSocket ( PORT_ANY, false, & this->sock ) ) {
if ( int sockerrno = makeSocket ( PORT_ANY, false, & this->sock ) ) {
char sockErrBuf[64];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
epicsSocketConvertErrorToString (
sockErrBuf, sizeof ( sockErrBuf ), sockerrno );
fprintf ( stderr, "%s: no client sock because \"%s\"\n",
__FILE__, sockErrBuf );
return false;
@@ -300,20 +281,25 @@ inline bool repeaterClient::identicalPort ( const osiSockAddr &fromIn )
bool repeaterClient::verify ()
{
SOCKET tmpSock;
bool success = makeSocket ( this->port (), false, & tmpSock );
if ( success ) {
int sockerrno = makeSocket ( this->port (), false, & tmpSock );
if ( sockerrno == SOCK_EADDRINUSE ) {
// Normal result, client using port
return true;
}
if ( sockerrno == 0 ) {
// Client went away, released port
epicsSocketDestroy ( tmpSock );
}
else {
if ( SOCKERRNO != SOCK_EADDRINUSE ) {
char sockErrBuf[64];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
fprintf ( stderr, "CA Repeater: bind test err was \"%s\"\n",
sockErrBuf );
}
char sockErrBuf[64];
epicsSocketConvertErrorToString (
sockErrBuf, sizeof ( sockErrBuf ), sockerrno );
fprintf ( stderr, "CA Repeater: Bind test error \"%s\"\n",
sockErrBuf );
}
return ! success;
return false;
}
@@ -387,10 +373,10 @@ static void register_new_client ( osiSockAddr & from,
if ( ! init ) {
SOCKET sock;
if ( ! makeSocket ( PORT_ANY, true, & sock ) ) {
if ( int sockerrno = makeSocket ( PORT_ANY, true, & sock ) ) {
char sockErrBuf[64];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
epicsSocketConvertErrorToString (
sockErrBuf, sizeof ( sockErrBuf ), sockerrno );
fprintf ( stderr, "%s: Unable to create repeater bind test socket because \"%s\"\n",
__FILE__, sockErrBuf );
}
@@ -511,18 +497,18 @@ void ca_repeater ()
port = envGetInetPortConfigParam ( & EPICS_CA_REPEATER_PORT,
static_cast <unsigned short> (CA_REPEATER_PORT) );
if ( ! makeSocket ( port, true, & sock ) ) {
if ( int sockerrno = makeSocket ( port, true, & sock ) ) {
/*
* test for server was already started
*/
if ( SOCKERRNO == SOCK_EADDRINUSE ) {
if ( sockerrno == SOCK_EADDRINUSE ) {
osiSockRelease ();
debugPrintf ( ( "CA Repeater: exiting because a repeater is already running\n" ) );
return;
}
char sockErrBuf[64];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
epicsSocketConvertErrorToString (
sockErrBuf, sizeof ( sockErrBuf ), sockerrno );
fprintf ( stderr, "%s: Unable to create repeater socket because \"%s\" - fatal\n",
__FILE__, sockErrBuf );
osiSockRelease ();
+22 -16
View File
@@ -59,28 +59,33 @@ capri caPriority = DEFAULT_CA_PRIORITY; /* CA Priority */
void sprint_long (char *ret, long val, IntFormatT outType)
static void sprint_long (char *ret, dbr_long_t val, IntFormatT outType)
{
long i, bit, skip=-1L; /* used only for printing bits */
switch (outType) {
case hex: sprintf(ret, "0x%lX", val); break;
case oct: sprintf(ret, "0o%lo", val); break;
case bin:
for (i=31; i>=0 ; i--)
{
bit = (val>>i) & 0x1L;
if (skip<0 && bit)
{
if (outType == bin && val != 0) {
/* sprintf doesn't do binary; this code doesn't handle 0 */
int i, skip = -1;
for (i = 31; i >= 0; i--) {
int bit = (val >> i) & 1;
if (skip < 0 && bit) {
skip = 31 - i; /* skip leading 0's */
ret[i+1] = '\0';
}
if (skip >= 0)
{
ret[31-i-skip] = (bit) ? '1' : '0';
if (skip >= 0) {
ret[31-i-skip] = '0' + bit;
}
}
break;
default: sprintf(ret, "%ld", val); /* decimal */
}
else {
const char *fmt[4] = { /* Order must match the enum IntFormatT */
"%ld" /* dec */,
"0" /* bin, val is 0 */,
"0o%lo" /* oct */,
"0x%lX" /* hex */
};
sprintf(ret, fmt[outType], val);
}
}
@@ -113,6 +118,7 @@ char *val2str (const void *v, unsigned type, int index)
strcpy (str, "*** invalid type");
return str;
}
strcpy (str, "!!!");
base_type = type % (LAST_TYPE+1);
+5
View File
@@ -739,6 +739,11 @@ static long getLinkValue(DBADDR *paddr, short dbrType,
if (nRequest && *nRequest > 1) *nRequest = 1;
break;
case DBR_DOUBLE: /* Needed for dbCa links */
if (nRequest && *nRequest) *nRequest = 1;
*(double *)pbuf = epicsNAN;
return 0;
case DBR_CHAR:
case DBR_UCHAR:
if (nRequest && *nRequest > 0) {
+7 -1
View File
@@ -425,7 +425,7 @@ long dbCaPutLinkCallback(struct link *plink,short dbrType,
plink->value.pv_link.pvlMask |= pvlOptOutNative;
*/
}
if (nRequest == 1){
if (nRequest == 1 && pca->nelements==1){
long (*fConvert)(const void *from, void *to, struct dbAddr *paddr);
fConvert = dbFastPutConvertRoutine[dbrType][newType];
@@ -439,7 +439,13 @@ long dbCaPutLinkCallback(struct link *plink,short dbrType,
dbAddr.pfield = pca->pputNative;
/*Following only used for DBF_STRING*/
dbAddr.field_size = MAX_STRING_SIZE;
if(nRequest>pca->nelements)
nRequest = pca->nelements;
status = aConvert(&dbAddr, pbuffer, nRequest, pca->nelements, 0);
if(nRequest<pca->nelements) {
long elemsize = dbr_value_size[ca_field_type(pca->chid)];
memset(nRequest*elemsize+(char*)pca->pputNative, 0, (pca->nelements-nRequest)*elemsize);
}
}
link_action |= CA_WRITE_NATIVE;
pca->gotOutNative = TRUE;
+1 -1
View File
@@ -14,7 +14,7 @@ TESTLIBRARY = dbTestIoc
dbTestIoc_SRCS += xRecord.c
dbTestIoc_SRCS += dbLinkdset.c
dbTestIoc_LIBS = dbCore
dbTestIoc_LIBS = dbCore ca Com
TARGETS += $(COMMON_DIR)/dbTestIoc.dbd
dbTestIoc_DBD += menuGlobal.dbd
+1 -1
View File
@@ -50,7 +50,7 @@
int dbStaticDebug = 0;
static char *pNullString = "";
#define messagesize 100
#define RPCL_LEN 184
#define RPCL_LEN INFIX_TO_POSTFIX_SIZE(80)
static char *ppstring[5]={"NPP","PP","CA","CP","CPP"};
static char *msstring[4]={"NMS","MS","MSI","MSS"};
+6 -4
View File
@@ -271,12 +271,14 @@ alias: tokenALIAS '(' tokenSTRING ',' tokenSTRING ')'
static int yyerror(char *str)
{
if (str)
epicsPrintf("Error: %s\n ", str);
epicsPrintf("Error: %s\n", str);
else
epicsPrintf("Error");
epicsPrintf(" at or before \"%s\"", yytext);
dbIncludePrint();
yyFailed = TRUE;
if (!yyFailed) { /* Only print this stuff once */
epicsPrintf(" at or before \"%s\"", yytext);
dbIncludePrint();
yyFailed = TRUE;
}
return(0);
}
static long pvt_yy_parse(void)
+10 -12
View File
@@ -284,21 +284,18 @@ static void log_header (
pciu = MPTOPCIU(mp);
if (pContext) {
epicsPrintf ("CAS: request from %s => \"%s\"\n",
epicsPrintf ("CAS: request from %s => %s\n",
hostName, pContext);
}
epicsPrintf (
"CAS: Request from %s => cmmd=%d cid=0x%x type=%d count=%d postsize=%u\n",
epicsPrintf ( "CAS: Request from %s => cmmd=%d cid=0x%x type=%d count=%d postsize=%u\n",
hostName, mp->m_cmmd, mp->m_cid, mp->m_dataType, mp->m_count, mp->m_postsize);
epicsPrintf (
"CAS: Request from %s => available=0x%x \tN=%u dbch=%p\n",
hostName, mp->m_available, mnum, (pciu?(void *)&pciu->dbch:NULL));
epicsPrintf ( "CAS: Request from %s => available=0x%x \tN=%u paddr=%p\n",
hostName, mp->m_available, mnum, (pciu ? (void *)&pciu->dbch : NULL));
if (mp->m_cmmd==CA_PROTO_WRITE && mp->m_dataType==DBF_STRING && pPayLoad ) {
epicsPrintf (
"CAS: Request from %s => \tThe string written: %s \n",
epicsPrintf ( "CAS: Request from %s => Wrote string \"%s\"\n",
hostName, (char *)pPayLoad );
}
}
@@ -854,10 +851,10 @@ static int write_action ( caHdrLargeArray *mp,
return RSRV_ERROR;
}
asWritePvt = asTrapWriteBefore ( pciu->asClientPVT,
asWritePvt = asTrapWriteWithData ( pciu->asClientPVT,
pciu->client->pUserName ? pciu->client->pUserName : "",
pciu->client->pHostName ? pciu->client->pHostName : "",
pciu->dbch );
pciu->dbch, mp->m_dataType, mp->m_count, pPayload );
dbStatus = dbChannel_put(
pciu->dbch,
@@ -1881,11 +1878,12 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload,
pciu->pPutNotify->dbrType = mp->m_dataType;
pciu->pPutNotify->asWritePvt = asTrapWriteBefore (
pciu->pPutNotify->asWritePvt = asTrapWriteWithData (
pciu->asClientPVT,
pciu->client->pUserName ? pciu->client->pUserName : "",
pciu->client->pHostName ? pciu->client->pHostName : "",
pciu->dbch );
pciu->dbch, mp->m_dataType, mp->m_count,
pciu->pPutNotify->pbuffer );
dbProcessNotify(&pciu->pPutNotify->dbPutNotify);
+13 -8
View File
@@ -68,9 +68,10 @@ void camsgtask ( void *pParm )
status = socket_ioctl (client->sock, FIONREAD, &nchars);
if (status < 0) {
char sockErrBuf[64];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
errlogPrintf("CAS: io ctl err - %s\n",
errlogPrintf("CAS: ioctl error - %s\n",
sockErrBuf);
cas_send_bs_msg(client, TRUE);
}
@@ -99,9 +100,8 @@ void camsgtask ( void *pParm )
}
if ( anerrno == SOCK_ENOBUFS ) {
errlogPrintf (
"rsrv: system low on network buffers "
"- receive retry in 15 seconds\n" );
errlogPrintf (
"CAS: Out of network buffers, retring receive in 15 seconds\n" );
epicsThreadSleep ( 15.0 );
continue;
}
@@ -110,10 +110,15 @@ void camsgtask ( void *pParm )
* normal conn lost conditions
*/
if ( ( anerrno != SOCK_ECONNABORTED &&
anerrno != SOCK_ECONNRESET &&
anerrno != SOCK_ETIMEDOUT ) ||
CASDEBUG > 2 ) {
errlogPrintf ( "CAS: client disconnect(errno=%d)\n", anerrno );
anerrno != SOCK_ECONNRESET &&
anerrno != SOCK_ETIMEDOUT ) ||
CASDEBUG > 2 ) {
char sockErrBuf[64];
epicsSocketConvertErrorToString(
sockErrBuf, sizeof ( sockErrBuf ), anerrno);
errlogPrintf ( "CAS: Client disconnected - %s\n",
sockErrBuf );
}
break;
}
+7 -10
View File
@@ -90,7 +90,8 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed )
}
if ( anerrno == SOCK_ENOBUFS ) {
errlogPrintf ( "rsrv: system low on network buffers - send retry in 15 seconds\n" );
errlogPrintf (
"CAS: Out of network buffers, retrying send in 15 seconds\n" );
epicsThreadSleep ( 15.0 );
continue;
}
@@ -108,8 +109,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed )
char sockErrBuf[64];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
errlogPrintf (
"CAS: TCP send to \"%s\" failed because \"%s\"\n",
errlogPrintf ( "CAS: TCP send to %s failed - %s\n",
buf, sockErrBuf);
}
pclient->disconnect = TRUE;
@@ -135,7 +135,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed )
char sockErrBuf[64];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
errlogPrintf ("rsrv: socket shutdown error was %s\n",
errlogPrintf ("CAS: Socket shutdown error - %s\n",
sockErrBuf );
}
}
@@ -204,7 +204,7 @@ void cas_send_dg_msg ( struct client * pclient )
}
else {
errlogPrintf (
"cas: system failed to send entire udp frame?\n" );
"CAS: System failed to send entire udp frame?\n" );
}
}
else {
@@ -213,11 +213,8 @@ void cas_send_dg_msg ( struct client * pclient )
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
ipAddrToDottedIP ( &pclient->addr, buf, sizeof(buf) );
errlogPrintf(
"CAS: UDP send to \"%s\" "
"failed because \"%s\"\n",
buf,
sockErrBuf);
errlogPrintf( "CAS: UDP send to %s failed - %s\n",
buf, sockErrBuf);
}
pclient->send.stk = 0u;
+4 -4
View File
@@ -276,7 +276,7 @@ int rsrv_init (void)
status = envGetLongConfigParam ( &EPICS_CA_MAX_ARRAY_BYTES, &maxBytesAsALong );
if ( status || maxBytesAsALong < 0 ) {
errlogPrintf ( "cas: EPICS_CA_MAX_ARRAY_BYTES was not a positive integer\n" );
errlogPrintf ( "CAS: EPICS_CA_MAX_ARRAY_BYTES was not a positive integer\n" );
rsrvSizeofLargeBufTCP = MAX_TCP;
}
else {
@@ -290,7 +290,7 @@ int rsrv_init (void)
maxBytes = 0xffffffff;
}
if ( maxBytes < MAX_TCP ) {
errlogPrintf ( "cas: EPICS_CA_MAX_ARRAY_BYTES was rounded up to %u\n", MAX_TCP );
errlogPrintf ( "CAS: EPICS_CA_MAX_ARRAY_BYTES was rounded up to %u\n", MAX_TCP );
rsrvSizeofLargeBufTCP = MAX_TCP;
}
else {
@@ -571,7 +571,7 @@ void destroy_client ( struct client *client )
freeListFree ( rsrvLargeBufFreeListTCP, client->send.buf );
}
else {
errlogPrintf ( "cas: Corrupt send buffer free list type code=%u during client cleanup?\n",
errlogPrintf ( "CAS: Corrupt send buffer free list type code=%u during client cleanup?\n",
client->send.type );
}
}
@@ -583,7 +583,7 @@ void destroy_client ( struct client *client )
freeListFree ( rsrvLargeBufFreeListTCP, client->recv.buf );
}
else {
errlogPrintf ( "cas: Corrupt recv buffer free list type code=%u during client cleanup?\n",
errlogPrintf ( "CAS: Corrupt recv buffer free list type code=%u during client cleanup?\n",
client->send.type );
}
}
+30 -16
View File
@@ -30,25 +30,38 @@ typedef enum{
} asClientStatus;
typedef void (*ASCLIENTCALLBACK) (ASCLIENTPVT,asClientStatus);
/* The following routines are macros with the following syntax
long asCheckGet(ASCLIENTPVT asClientPvt);
long asCheckPut(ASCLIENTPVT asClientPvt);
*/
#define asCheckGet(asClientPvt)\
(asActive \
? ((asClientPvt)->access>=asREAD ? TRUE : FALSE)\
: TRUE)
#define asCheckPut(asClientPvt)\
(asActive \
? ((asClientPvt)->access>=asWRITE ? TRUE : FALSE)\
: TRUE)
#define asTrapWriteBefore(asClientPvt,user,host,addr) \
(((asActive) && (asClientPvt)->trapMask) \
? asTrapWriteBeforeWrite((user),(host),(addr)) \
: 0)
#define asCheckGet(asClientPvt) \
(!asActive || ((asClientPvt)->access >= asREAD))
#define asCheckPut(asClientPvt) \
(!asActive || ((asClientPvt)->access >= asWRITE))
/* More convenience macros
void *asTrapWriteWithData(ASCLIENTPVT asClientPvt,
const char *userid, const char *hostid, void *addr,
int dbrType, int no_elements, void *data);
void asTrapWriteAfter(ASCLIENTPVT asClientPvt);
*/
#define asTrapWriteWithData(asClientPvt, user, host, addr, type, count, data) \
((asActive && (asClientPvt)->trapMask) \
? asTrapWriteBeforeWithData((user), (host), (addr), (type), (count), (data)) \
: 0)
#define asTrapWriteAfter(pvt) \
if (pvt) asTrapWriteAfterWrite(pvt)
/* This macro is for backwards compatibility, upgrade any code
calling it to use asTrapWriteWithData() instead ASAP:
void *asTrapWriteBefore(ASCLIENTPVT asClientPvt,
const char *userid, const char *hostid, void *addr);
*/
#define asTrapWriteBefore(asClientPvt, user, host, addr) \
asTrapWriteWithData(asClientPvt, user, host, addr, 0, 0, NULL)
#define asTrapWriteAfter(pvt) if((pvt)) asTrapWriteAfterWrite((pvt))
epicsShareFunc long epicsShareAPI asInitialize(ASINPUTFUNCPTR inputfunction);
epicsShareFunc long epicsShareAPI asInitFile(
const char *filename,const char *substitutions);
@@ -100,8 +113,9 @@ epicsShareFunc int epicsShareAPI asDumpMemFP(FILE *fp,const char *asgname,
epicsShareFunc int epicsShareAPI asDumpHash(void);
epicsShareFunc int epicsShareAPI asDumpHashFP(FILE *fp);
epicsShareFunc void * epicsShareAPI asTrapWriteBeforeWrite(
const char *userid,const char *hostid,void *addr);
epicsShareFunc void * epicsShareAPI asTrapWriteBeforeWithData(
const char *userid, const char *hostid, void *addr,
int dbrType, int no_elements, void *data);
epicsShareFunc void epicsShareAPI asTrapWriteAfterWrite(void *pvt);
+31 -24
View File
@@ -3,8 +3,7 @@
* 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
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*asTrapWrite.c */
@@ -101,47 +100,53 @@ void epicsShareAPI asTrapWriteUnregisterListener(asTrapWriteId id)
= (listenerPvt *)ellNext(&plistenerPvt->node);
if(plistenerPvt->plistener == plistener) {
ellDelete(&pwriteMessage->listenerPvtList,&plistenerPvt->node);
freeListFree(pasTrapWritePvt->freeListListenerPvt,(void *)plistenerPvt);
freeListFree(pasTrapWritePvt->freeListListenerPvt, plistenerPvt);
}
plistenerPvt = pnext;
}
pwriteMessage = (writeMessage *)ellNext(&pwriteMessage->node);
}
ellDelete(&pasTrapWritePvt->listenerList,&plistener->node);
free((void *)plistener);
free(plistener);
epicsMutexUnlock(pasTrapWritePvt->lock);
}
void * epicsShareAPI asTrapWriteBeforeWrite(
const char *userid,const char *hostid,void *addr)
void * epicsShareAPI asTrapWriteBeforeWithData(
const char *userid, const char *hostid, void *addr,
int dbrType, int no_elements, void *data)
{
writeMessage *pwriteMessage;
listener *plistener;
listenerPvt *plistenerPvt;
if(pasTrapWritePvt==0) return(0);
if(ellCount(&pasTrapWritePvt->listenerList)<=0) return 0;
if (pasTrapWritePvt == 0 ||
ellCount(&pasTrapWritePvt->listenerList) <= 0) return 0;
pwriteMessage = (writeMessage *)freeListCalloc(
pasTrapWritePvt->freeListWriteMessage);
pwriteMessage->message.userid = userid;
pwriteMessage->message.hostid = hostid;
pwriteMessage->message.serverSpecific = addr;
pwriteMessage->message.dbrType = dbrType;
pwriteMessage->message.no_elements = no_elements;
pwriteMessage->message.data = data;
ellInit(&pwriteMessage->listenerPvtList);
epicsMutexMustLock(pasTrapWritePvt->lock);
ellAdd(&pasTrapWritePvt->writeMessageList,&pwriteMessage->node);
ellAdd(&pasTrapWritePvt->writeMessageList, &pwriteMessage->node);
plistener = (listener *)ellFirst(&pasTrapWritePvt->listenerList);
while(plistener) {
plistenerPvt = (listenerPvt *)freeListCalloc(
while (plistener) {
listenerPvt *plistenerPvt = (listenerPvt *)freeListCalloc(
pasTrapWritePvt->freeListListenerPvt);
plistenerPvt->plistener = plistener;
pwriteMessage->message.userPvt = 0;
(*plistener->func)(&pwriteMessage->message,0);
plistener->func(&pwriteMessage->message, 0);
plistenerPvt->userPvt = pwriteMessage->message.userPvt;
ellAdd(&pwriteMessage->listenerPvtList,&plistenerPvt->node);
ellAdd(&pwriteMessage->listenerPvtList, &plistenerPvt->node);
plistener = (listener *)ellNext(&plistener->node);
}
epicsMutexUnlock(pasTrapWritePvt->lock);
return((void *)pwriteMessage);
return pwriteMessage;
}
void epicsShareAPI asTrapWriteAfterWrite(void *pvt)
@@ -149,20 +154,22 @@ void epicsShareAPI asTrapWriteAfterWrite(void *pvt)
writeMessage *pwriteMessage = (writeMessage *)pvt;
listenerPvt *plistenerPvt;
if(pwriteMessage==0 || pasTrapWritePvt==0) return;
if (pwriteMessage == 0 ||
pasTrapWritePvt == 0) return;
epicsMutexMustLock(pasTrapWritePvt->lock);
plistenerPvt = (listenerPvt *)ellFirst(&pwriteMessage->listenerPvtList);
while(plistenerPvt) {
while (plistenerPvt) {
listenerPvt *pnext = (listenerPvt *)ellNext(&plistenerPvt->node);
listener *plistener;
plistener = plistenerPvt->plistener;
listener *plistener = plistenerPvt->plistener;
pwriteMessage->message.userPvt = plistenerPvt->userPvt;
(*plistener->func)(&pwriteMessage->message,1);
ellDelete(&pwriteMessage->listenerPvtList,&plistenerPvt->node);
freeListFree(pasTrapWritePvt->freeListListenerPvt,(void *)plistenerPvt);
plistener->func(&pwriteMessage->message, 1);
ellDelete(&pwriteMessage->listenerPvtList, &plistenerPvt->node);
freeListFree(pasTrapWritePvt->freeListListenerPvt, plistenerPvt);
plistenerPvt = pnext;
}
ellDelete(&pasTrapWritePvt->writeMessageList,&pwriteMessage->node);
freeListFree(pasTrapWritePvt->freeListWriteMessage,(void *)pwriteMessage);
ellDelete(&pasTrapWritePvt->writeMessageList, &pwriteMessage->node);
freeListFree(pasTrapWritePvt->freeListWriteMessage, pwriteMessage);
epicsMutexUnlock(pasTrapWritePvt->lock);
}
+5 -3
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.
\*************************************************************************/
/*asTrapWrite.h*/
/* Author: Marty Kraimer Date: 07NOV2000 */
@@ -24,6 +23,9 @@ typedef struct asTrapWriteMessage {
const char *hostid;
void *serverSpecific;
void *userPvt;
int dbrType; /* Data type from ca/db_access.h, NOT dbFldTypes.h */
int no_elements;
void *data; /* Might be NULL if no data is available */
} asTrapWriteMessage;
+1
View File
@@ -19,6 +19,7 @@
#define epicsSingleton_h
#include <new>
#include <cstddef>
#include "shareLib.h"
#include "epicsAssert.h"
+5 -5
View File
@@ -100,7 +100,7 @@ int epicsStrnRawFromEscaped(char *dst, size_t dstlen, const char *src,
{ /* \xXXX... */
unsigned int u = 0;
if (!srclen-- || !(c = *src++))
if (!srclen-- || !(c = *src++ & 0xff))
goto done;
while (isxdigit(c)) {
@@ -108,7 +108,7 @@ int epicsStrnRawFromEscaped(char *dst, size_t dstlen, const char *src,
if (u > 0xff) {
/* Undefined behaviour! */
}
if (!srclen-- || !(c = *src++)) {
if (!srclen-- || !(c = *src++ & 0xff)) {
OUT(u);
goto done;
}
@@ -153,7 +153,7 @@ int epicsStrnEscapedFromRaw(char *dst, size_t dstlen, const char *src,
case '\'': OUT('\\'); OUT('\''); break;
case '\"': OUT('\\'); OUT('\"'); break;
default:
if (isprint(c)) {
if (isprint(c & 0xff)) {
OUT(c);
break;
}
@@ -183,7 +183,7 @@ size_t epicsStrnEscapedFromRawSize(const char *src, size_t srclen)
ndst++;
break;
default:
if (!isprint(c))
if (!isprint(c & 0xff))
ndst += 3;
}
}
@@ -247,7 +247,7 @@ int epicsStrPrintEscaped(FILE *fp, const char *s, size_t len)
case '\'': nout += fprintf(fp, "\\'"); break;
case '\"': nout += fprintf(fp, "\\\""); break;
default:
if (isprint((int)c))
if (isprint(0xff & (int)c))
nout += fprintf(fp, "%c", c);
else
nout += fprintf(fp, "\\%03o", (unsigned char)c);
@@ -20,6 +20,12 @@
# error compiler/clang/compilerSpecific.h is only for use with the clang compiler
#endif
#if __has_attribute(always_inline)
#define EPICS_ALWAYS_INLINE __inline__ __attribute__((always_inline))
#else
#define EPICS_ALWAYS_INLINE __inline__
#endif
#ifdef __cplusplus
/*
@@ -16,16 +16,8 @@
#ifndef epicsAtomicCD_h
#define epicsAtomicCD_h
#if defined ( __cplusplus )
# define EPICS_ATOMIC_INLINE inline
#else
# define EPICS_ATOMIC_INLINE __inline__
#endif
#define EPICS_ATOMIC_CMPLR_NAME "CLANG"
/*
* we have an inline keyword so we can proceed
* with an os specific inline instantiation
*/
#include "epicsAtomicOSD.h"
#endif /* epicsAtomicCD_h */
@@ -15,6 +15,14 @@
#ifndef compilerSpecific_h
#define compilerSpecific_h
/* The 'inline' key work, possibily with compiler
* dependent flags to force inlineing where it would
* otherwise not be done.
*
* Warning: Second guessing the compiler may result in larger code size
*/
#define EPICS_ALWAYS_INLINE inline
#ifdef __cplusplus
@@ -16,15 +16,8 @@
#ifndef epicsAtomicCD_h
#define epicsAtomicCD_h
#if __STDC_VERSION__ >= 199901L || defined ( __cplusplus )
# define EPICS_ATOMIC_INLINE inline
/*
* We have already defined the public interface in epicsAtomic.h
* so there is nothing more to implement if there isnt an inline
* keyword available. Otherwise, if we have an inline keyword
* we will proceed with an os specific inline implementation.
*/
# include "epicsAtomicOSD.h"
#endif
#define EPICS_ATOMIC_CMPLR_NAME "DEFAULT"
#include "epicsAtomicOSD.h"
#endif /* epicsAtomicCD_h */
@@ -23,6 +23,12 @@
#ifdef __clang__
# error compiler/gcc/compilerSpecific.h is not for use with the clang compiler
#endif
#if __GNUC__ > 2
# define EPICS_ALWAYS_INLINE __inline__ __attribute__((always_inline))
#else
# define EPICS_ALWAYS_INLINE __inline__
#endif
#ifdef __cplusplus
+5 -5
View File
@@ -20,7 +20,7 @@
# error this header is only for use with the gnu compiler
#endif
#define EPICS_ATOMIC_INLINE __inline__
#define EPICS_ATOMIC_CMPLR_NAME "GCC"
#define GCC_ATOMIC_CONCAT( A, B ) GCC_ATOMIC_CONCATR(A,B)
#define GCC_ATOMIC_CONCATR( A, B ) ( A ## B )
@@ -69,7 +69,7 @@ extern "C" {
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
#define EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
{
__sync_synchronize ();
}
@@ -77,7 +77,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
#ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
#define EPICS_ATOMIC_WRITE_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
{
__sync_synchronize ();
}
@@ -88,7 +88,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
#if GCC_ATOMIC_INTRINSICS_MIN_X86
#define EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
{
asm("mfence;");
}
@@ -98,7 +98,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
#ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
#if GCC_ATOMIC_INTRINSICS_MIN_X86
#define EPICS_ATOMIC_WRITE_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
{
asm("mfence;");
}
@@ -20,6 +20,12 @@
# error compiler/msvc/compilerSpecific.h is only for use with the Microsoft compiler
#endif
#if _MSC_VER >= 1200
#define EPICS_ALWAYS_INLINE __forceinline
#else
#define EPICS_ALWAYS_INLINE __inline
#endif
#ifdef __cplusplus
/*
+8 -14
View File
@@ -24,18 +24,14 @@
#ifdef _MSC_EXTENSIONS
#include <intrin.h>
#define EPICS_ATOMIC_CMPLR_NAME "MSVC-INTRINSIC"
#if _MSC_VER >= 1200
# define EPICS_ATOMIC_INLINE __forceinline
#else
# define EPICS_ATOMIC_INLINE __inline
#endif
#include <intrin.h>
#if defined ( _M_IX86 )
# pragma warning( push )
# pragma warning( disable : 4793 )
EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void)
{
long fence;
__asm { xchg fence, eax }
@@ -44,14 +40,14 @@
#elif defined ( _M_X64 )
# define MS_ATOMIC_64
# pragma intrinsic ( __faststorefence )
EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void)
{
__faststorefence ();
}
#elif defined ( _M_IA64 )
# define MS_ATOMIC_64
# pragma intrinsic ( __mf )
EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void)
{
__mf ();
}
@@ -88,13 +84,13 @@ extern "C" {
#endif /* __cplusplus */
#define EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
{
epicsAtomicMemoryBarrier ();
}
#define EPICS_ATOMIC_WRITE_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
{
epicsAtomicMemoryBarrier ();
}
@@ -108,9 +104,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
#else /* ifdef _MSC_EXTENSIONS */
#if defined ( __cplusplus )
# define EPICS_ATOMIC_INLINE inline
#endif
#define EPICS_ATOMIC_CMPLR_NAME "MSVC-DIRECT"
/*
* if unavailable as an intrinsic we will try
@@ -0,0 +1,44 @@
/*************************************************************************\
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* Author:
* Jeffrey O. Hill
* johill@lanl.gov
*/
#ifndef compilerSpecific_h
#define compilerSpecific_h
#if !defined(__SUNPRO_C) && !defined (__SUNPRO_CC)
# error Not Solaris Studio
#endif
#if (defined(__SUNPRO_C) && __SUNPRO_C < 0x590) || \
(defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
# define EPICS_ALWAYS_INLINE inline
#else
# define EPICS_ALWAYS_INLINE inline __attribute__((always_inline))
#endif
#ifdef __cplusplus
/*
* CXX_PLACEMENT_DELETE - defined if compiler supports placement delete
* CXX_THROW_SPECIFICATION - defined if compiler supports throw specification
*
* (our default guess is that the compiler implements the C++ 97 standard)
*/
#define CXX_THROW_SPECIFICATION
#define CXX_PLACEMENT_DELETE
#endif /* __cplusplus */
#endif /* ifndef compilerSpecific_h */
@@ -16,16 +16,8 @@
#ifndef epicsAtomicCD_h
#define epicsAtomicCD_h
#if defined ( __cplusplus )
# define EPICS_ATOMIC_INLINE inline
#else
# define EPICS_ATOMIC_INLINE __inline
#endif
#define EPICS_ATOMIC_CMPLR_NAME "SOLSTUDIO"
/*
* we have an inline keyword so we can proceed
* with an os specific inline instantiation
*/
#include "epicsAtomicOSD.h"
#endif /* epicsAtomicCD_h */
+41 -60
View File
@@ -17,7 +17,9 @@
#include <stdlib.h> /* define size_t */
#include "shareLib.h"
#include "compilerSpecific.h"
#define EPICS_ATOMIC_INLINE static EPICS_ALWAYS_INLINE
#ifdef __cplusplus
extern "C" {
@@ -26,10 +28,10 @@ extern "C" {
typedef void * EpicsAtomicPtrT;
/* load target into cache */
epicsShareFunc void epicsAtomicReadMemoryBarrier ();
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void);
/* push cache version of target into target */
epicsShareFunc void epicsAtomicWriteMemoryBarrier ();
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void);
/*
* lock out other smp processors from accessing the target,
@@ -37,8 +39,8 @@ epicsShareFunc void epicsAtomicWriteMemoryBarrier ();
* to target, allow other smp processors to access the target,
* return new value of target as modified by this operation
*/
epicsShareFunc size_t epicsAtomicIncrSizeT ( size_t * pTarget );
epicsShareFunc int epicsAtomicIncrIntT ( int * pTarget );
EPICS_ATOMIC_INLINE size_t epicsAtomicIncrSizeT ( size_t * pTarget );
EPICS_ATOMIC_INLINE int epicsAtomicIncrIntT ( int * pTarget );
/*
* lock out other smp processors from accessing the target,
@@ -46,8 +48,8 @@ epicsShareFunc int epicsAtomicIncrIntT ( int * pTarget );
* to target, allow out other smp processors to access the target,
* return new value of target as modified by this operation
*/
epicsShareFunc size_t epicsAtomicDecrSizeT ( size_t * pTarget );
epicsShareFunc int epicsAtomicDecrIntT ( int * pTarget );
EPICS_ATOMIC_INLINE size_t epicsAtomicDecrSizeT ( size_t * pTarget );
EPICS_ATOMIC_INLINE int epicsAtomicDecrIntT ( int * pTarget );
/*
* lock out other smp processors from accessing the target,
@@ -55,23 +57,23 @@ epicsShareFunc int epicsAtomicDecrIntT ( int * pTarget );
* to target, allow other smp processors to access the target,
* return new value of target as modified by this operation
*/
epicsShareFunc size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta );
epicsShareFunc size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta );
epicsShareFunc int epicsAtomicAddIntT ( int * pTarget, int delta );
EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta );
EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta );
EPICS_ATOMIC_INLINE int epicsAtomicAddIntT ( int * pTarget, int delta );
/*
* set cache version of target, flush cache to target
*/
epicsShareFunc void epicsAtomicSetSizeT ( size_t * pTarget, size_t newValue );
epicsShareFunc void epicsAtomicSetIntT ( int * pTarget, int newValue );
epicsShareFunc void epicsAtomicSetPtrT ( EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT newValue );
EPICS_ATOMIC_INLINE void epicsAtomicSetSizeT ( size_t * pTarget, size_t newValue );
EPICS_ATOMIC_INLINE void epicsAtomicSetIntT ( int * pTarget, int newValue );
EPICS_ATOMIC_INLINE void epicsAtomicSetPtrT ( EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT newValue );
/*
* fetch target into cache, return new value of target
*/
epicsShareFunc size_t epicsAtomicGetSizeT ( const size_t * pTarget );
epicsShareFunc int epicsAtomicGetIntT ( const int * pTarget );
epicsShareFunc EpicsAtomicPtrT epicsAtomicGetPtrT ( const EpicsAtomicPtrT * pTarget );
EPICS_ATOMIC_INLINE size_t epicsAtomicGetSizeT ( const size_t * pTarget );
EPICS_ATOMIC_INLINE int epicsAtomicGetIntT ( const int * pTarget );
EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicGetPtrT ( const EpicsAtomicPtrT * pTarget );
/*
* lock out other smp processors from accessing the target,
@@ -80,11 +82,11 @@ epicsShareFunc EpicsAtomicPtrT epicsAtomicGetPtrT ( const EpicsAtomicPtrT * pTar
* to access the target, return the original value stored in the
* target
*/
epicsShareFunc size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget,
EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget,
size_t oldVal, size_t newVal );
epicsShareFunc int epicsAtomicCmpAndSwapIntT ( int * pTarget,
EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget,
int oldVal, int newVal );
epicsShareFunc EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT (
EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT (
EpicsAtomicPtrT * pTarget,
EpicsAtomicPtrT oldVal,
EpicsAtomicPtrT newVal );
@@ -111,119 +113,98 @@ namespace atomic {
/*
* overloaded c++ interface
*/
epicsShareFunc size_t increment ( size_t & v );
epicsShareFunc int increment ( int & v );
epicsShareFunc size_t decrement ( size_t & v );
epicsShareFunc int decrement ( int & v );
epicsShareFunc size_t add ( size_t & v, size_t delta );
epicsShareFunc int add ( int & v, int delta );
epicsShareFunc size_t subtract ( size_t & v, size_t delta );
epicsShareFunc int subtract ( int & v, int delta );
epicsShareFunc void set ( size_t & v , size_t newValue );
epicsShareFunc void set ( int & v, int newValue );
epicsShareFunc void set ( EpicsAtomicPtrT & v,
EpicsAtomicPtrT newValue );
epicsShareFunc size_t get ( const size_t & v );
epicsShareFunc int get ( const int & v );
epicsShareFunc EpicsAtomicPtrT get ( const EpicsAtomicPtrT & v );
epicsShareFunc size_t compareAndSwap ( size_t & v, size_t oldVal,
size_t newVal );
epicsShareFunc int compareAndSwap ( int & v, int oldVal, int newVal );
epicsShareFunc EpicsAtomicPtrT compareAndSwap ( EpicsAtomicPtrT & v,
EpicsAtomicPtrT oldVal,
EpicsAtomicPtrT newVal );
/************* incr ***************/
inline size_t increment ( size_t & v )
EPICS_ATOMIC_INLINE size_t increment ( size_t & v )
{
return epicsAtomicIncrSizeT ( & v );
}
inline int increment ( int & v )
EPICS_ATOMIC_INLINE int increment ( int & v )
{
return epicsAtomicIncrIntT ( & v );
}
/************* decr ***************/
inline size_t decrement ( size_t & v )
EPICS_ATOMIC_INLINE size_t decrement ( size_t & v )
{
return epicsAtomicDecrSizeT ( & v );
}
inline int decrement ( int & v )
EPICS_ATOMIC_INLINE int decrement ( int & v )
{
return epicsAtomicDecrIntT ( & v );
}
/************* add ***************/
inline size_t add ( size_t & v, size_t delta )
EPICS_ATOMIC_INLINE size_t add ( size_t & v, size_t delta )
{
return epicsAtomicAddSizeT ( & v, delta );
}
inline int add ( int & v, int delta )
EPICS_ATOMIC_INLINE int add ( int & v, int delta )
{
return epicsAtomicAddIntT ( & v, delta );
}
/************* sub ***************/
inline size_t subtract ( size_t & v, size_t delta )
EPICS_ATOMIC_INLINE size_t subtract ( size_t & v, size_t delta )
{
return epicsAtomicSubSizeT ( & v, delta );
}
inline int subtract ( int & v, int delta )
EPICS_ATOMIC_INLINE int subtract ( int & v, int delta )
{
return epicsAtomicAddIntT ( & v, -delta );
}
/************* set ***************/
inline void set ( size_t & v , size_t newValue )
EPICS_ATOMIC_INLINE void set ( size_t & v , size_t newValue )
{
epicsAtomicSetSizeT ( & v, newValue );
}
inline void set ( int & v, int newValue )
EPICS_ATOMIC_INLINE void set ( int & v, int newValue )
{
epicsAtomicSetIntT ( & v, newValue );
}
inline void set ( EpicsAtomicPtrT & v, EpicsAtomicPtrT newValue )
EPICS_ATOMIC_INLINE void set ( EpicsAtomicPtrT & v, EpicsAtomicPtrT newValue )
{
epicsAtomicSetPtrT ( & v, newValue );
}
/************* get ***************/
inline size_t get ( const size_t & v )
EPICS_ATOMIC_INLINE size_t get ( const size_t & v )
{
return epicsAtomicGetSizeT ( & v );
}
inline int get ( const int & v )
EPICS_ATOMIC_INLINE int get ( const int & v )
{
return epicsAtomicGetIntT ( & v );
}
inline EpicsAtomicPtrT get ( const EpicsAtomicPtrT & v )
EPICS_ATOMIC_INLINE EpicsAtomicPtrT get ( const EpicsAtomicPtrT & v )
{
return epicsAtomicGetPtrT ( & v );
}
/************* cas ***************/
inline size_t compareAndSwap ( size_t & v,
size_t oldVal, size_t newVal )
EPICS_ATOMIC_INLINE size_t compareAndSwap ( size_t & v,
size_t oldVal, size_t newVal )
{
return epicsAtomicCmpAndSwapSizeT ( & v, oldVal, newVal );
}
inline int compareAndSwap ( int & v, int oldVal, int newVal )
EPICS_ATOMIC_INLINE int compareAndSwap ( int & v, int oldVal, int newVal )
{
return epicsAtomicCmpAndSwapIntT ( & v, oldVal, newVal );
}
inline EpicsAtomicPtrT compareAndSwap ( EpicsAtomicPtrT & v,
EpicsAtomicPtrT oldVal,
EpicsAtomicPtrT newVal )
EPICS_ATOMIC_INLINE EpicsAtomicPtrT compareAndSwap ( EpicsAtomicPtrT & v,
EpicsAtomicPtrT oldVal,
EpicsAtomicPtrT newVal )
{
return epicsAtomicCmpAndSwapPtrT ( & v, oldVal, newVal );
}
+65
View File
@@ -0,0 +1,65 @@
/*************************************************************************\
* Copyright (c) 2011 LANS LLC, as Operator of
* Los Alamos National Laboratory.
* Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* Author Jeffrey O. Hill
* johill@lanl.gov
*/
#ifndef epicsAtomicOSD_h
#define epicsAtomicOSD_h
#include <shareLib.h>
#include "epicsMMIO.h"
#include "compilerSpecific.h"
#include "epicsInterrupt.h"
#define EPICS_ATOMIC_OS_NAME "RTEMS"
typedef struct EpicsAtomicLockKey {
int key;
} EpicsAtomicLockKey;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
{
epicsAtomicMemoryBarrierFallback();
}
#endif
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
{
rwbarr();
}
#endif
EPICS_ATOMIC_INLINE void epicsAtomicLock ( struct EpicsAtomicLockKey * pkey )
{
pkey->key = epicsInterruptLock();
}
EPICS_ATOMIC_INLINE void epicsAtomicUnlock ( struct EpicsAtomicLockKey * pkey )
{
epicsInterruptUnlock(pkey->key);
}
#ifdef __cplusplus
} /* end of extern "C" */
#endif /* __cplusplus */
#include "epicsAtomicDefault.h"
#endif /* epicsAtomicOSD_h */
@@ -1,22 +0,0 @@
/*************************************************************************\
* Copyright (c) 2011 LANS LLC, as Operator of
* Los Alamos National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* Author Jeffrey O. Hill
* johill@lanl.gov
*/
#define epicsExportSharedSymbols
#include "epicsAtomic.h"
// if the compiler is unable to inline then instantiate out-of-line
#ifndef EPICS_ATOMIC_INLINE
# define EPICS_ATOMIC_INLINE
# include "epicsAtomicOSD.h"
#endif
+2
View File
@@ -16,6 +16,8 @@
#ifndef epicsAtomicOSD_h
#define epicsAtomicOSD_h
#define EPICS_ATOMIC_OS_NAME "WIN32"
#ifdef VC_EXTRALEAN
# define VC_EXTRALEAN_DETECTED_epicsAtomicOSD_h
#else
@@ -1,11 +1,9 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* 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
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
@@ -20,28 +18,36 @@
#include "epicsStdio.h"
/*
* epicsSocketConvertErrnoToString ()
* epicsSocketConvertErrorToString ()
*/
void epicsSocketConvertErrnoToString (
char * pBuf, unsigned bufSize )
void epicsSocketConvertErrorToString (
char * pBuf, unsigned bufSize, int theSockError )
{
if ( bufSize ) {
/*
* this does not work on systems prior to W2K
*/
int theSockError = SOCKERRNO;
DWORD success = FormatMessage (
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL, theSockError,
MAKELANGID ( LANG_NEUTRAL, SUBLANG_DEFAULT ), /* Default language */
pBuf, bufSize, NULL );
if ( ! success ) {
/*
* this does not work on systems prior to W2K
*/
DWORD success = FormatMessage (
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL, theSockError,
MAKELANGID ( LANG_NEUTRAL, SUBLANG_DEFAULT ), /* Default language */
pBuf, bufSize, NULL );
if ( ! success ) {
int status = epicsSnprintf (
pBuf, bufSize, "WINSOCK Error %d", theSockError );
if ( status <= 0 ) {
strncpy ( pBuf, "WINSOCK Error", bufSize );
pBuf [bufSize - 0] = '\0';
}
}
}
}
}
/*
* epicsSocketConvertErrnoToString ()
*/
void epicsSocketConvertErrnoToString (
char * pBuf, unsigned bufSize )
{
epicsSocketConvertErrorToString ( pBuf, bufSize, SOCKERRNO );
}
@@ -1,11 +1,9 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* 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
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* osdSock.c */
@@ -22,14 +20,22 @@
#include "osiSock.h"
/*
* epicsSocketConvertErrnoToString()
* epicsSocketConvertErrorToString()
*/
void epicsSocketConvertErrnoToString (
char * pBuf, unsigned bufSize )
void epicsSocketConvertErrorToString (
char * pBuf, unsigned bufSize, int theSockError )
{
if ( bufSize ) {
strncpy ( pBuf, strerror ( SOCKERRNO ), bufSize );
strncpy ( pBuf, strerror ( theSockError ), bufSize );
pBuf[bufSize-1] = '\0';
}
}
/*
* epicsSocketConvertErrnoToString()
*/
void epicsSocketConvertErrnoToString (
char * pBuf, unsigned bufSize )
{
epicsSocketConvertErrorToString ( pBuf, bufSize, SOCKERRNO );
}
+1 -26
View File
@@ -19,14 +19,6 @@
#include "epicsAssert.h"
#include "epicsAtomic.h"
// if the compiler is unable to inline then instantiate out-of-line
#ifndef EPICS_ATOMIC_INLINE
# define EPICS_ATOMIC_INLINE
# include "epicsAtomicOSD.h"
#endif
#ifndef EPICS_ATOMIC_LOCK
/*
* Slow, but probably correct on all systems.
* Useful only if something more efficient isn`t
@@ -69,31 +61,14 @@ void epicsAtomicUnlock ( EpicsAtomicLockKey * )
assert ( status == 0 );
}
#endif // ifndef EPICS_ATOMIC_LOCK
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
// Slow, but probably correct on all systems.
// Useful only if something more efficient isn`t
// provided based on knowledge of the compiler
// or OS
void epicsAtomicReadMemoryBarrier ()
void epicsAtomicMemoryBarrierFallback (void)
{
EpicsAtomicLockKey key;
epicsAtomicLock ( & key );
epicsAtomicUnlock ( & key );
}
#endif
#ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
// Slow, but probably correct on all systems.
// Useful only if something more efficient isn`t
// provided based on knowledge of the compiler
// or OS
void epicsAtomicWriteMemoryBarrier ()
{
EpicsAtomicLockKey key;
epicsAtomicLock ( & key );
epicsAtomicUnlock ( & key );
}
#endif
+19
View File
@@ -16,6 +16,10 @@
#ifndef epicsAtomicOSD_h
#define epicsAtomicOSD_h
#include <shareLib.h>
#define EPICS_ATOMIC_OS_NAME "POSIX"
typedef struct EpicsAtomicLockKey {} EpicsAtomicLockKey;
#ifdef __cplusplus
@@ -24,6 +28,21 @@ extern "C" {
epicsShareFunc void epicsAtomicLock ( struct EpicsAtomicLockKey * );
epicsShareFunc void epicsAtomicUnlock ( struct EpicsAtomicLockKey * );
epicsShareFunc void epicsAtomicMemoryBarrierFallback ( void );
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
{
epicsAtomicMemoryBarrierFallback();
}
#endif
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
{
epicsAtomicMemoryBarrierFallback();
}
#endif
#ifdef __cplusplus
} /* end of extern "C" */
+9 -1
View File
@@ -64,12 +64,14 @@ typedef struct commonAttr{
int maxPriority;
int minPriority;
int schedPolicy;
int usePolicy;
} commonAttr;
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0
typedef struct {
int min_pri, max_pri;
int policy;
int ok;
} priAvailable;
#endif
@@ -132,6 +134,8 @@ static void setSchedulingPolicy(epicsThreadOSD *pthreadInfo,int policy)
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0
int status;
if(!pcommonAttr->usePolicy) return;
status = pthread_attr_getschedparam(
&pthreadInfo->attr,&pthreadInfo->schedParam);
checkStatusOnce(status,"pthread_attr_getschedparam");
@@ -281,6 +285,7 @@ int low, try;
prm->min_pri = min;
prm->max_pri = try_pri(max, prm->policy) ? max-1 : max;
prm->ok = 1;
return 0;
}
@@ -293,6 +298,7 @@ void *dummy;
int status;
arg.policy = a_p->schedPolicy;
arg.ok = 0;
status = pthread_create(&id, 0, find_pri_range, &arg);
checkStatusQuit(status, "pthread_create","epicsThreadInit");
@@ -302,6 +308,7 @@ int status;
a_p->minPriority = arg.min_pri;
a_p->maxPriority = arg.max_pri;
a_p->usePolicy = arg.ok;
}
#endif
@@ -627,7 +634,8 @@ epicsShareFunc void epicsShareAPI epicsThreadSetPriority(epicsThreadId pthreadIn
pthreadInfo->osiPriority = priority;
if(!pthreadInfo->isRealTimeScheduled) return;
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0
#if defined (_POSIX_THREAD_PRIORITY_SCHEDULING) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0
if(!pcommonAttr->usePolicy) return;
pthreadInfo->schedParam.sched_priority = epicsThreadGetPosixPriority(pthreadInfo);
status = pthread_attr_setschedparam(
&pthreadInfo->attr,&pthreadInfo->schedParam);
+11 -7
View File
@@ -13,9 +13,13 @@
* johill@lanl.gov
*/
#include "shareLib.h"
#ifndef epicsAtomicOSD_h
#define epicsAtomicOSD_h
#define EPICS_ATOMIC_OS_NAME "Solaris"
#if defined ( __SunOS_5_10 )
/*
@@ -31,7 +35,7 @@ extern "C" {
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
#define EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
{
membar_consumer ();
}
@@ -39,7 +43,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
#ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
#define EPICS_ATOMIC_WRITE_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
{
membar_producer ();
}
@@ -47,7 +51,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
#ifndef EPICS_ATOMIC_CAS_INTT
#define EPICS_ATOMIC_CAS_INTT
EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget,
EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget,
int oldVal, int newVal )
{
STATIC_ASSERT ( sizeof ( int ) == sizeof ( unsigned ) );
@@ -59,7 +63,7 @@ EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget,
#ifndef EPICS_ATOMIC_CAS_SIZET
#define EPICS_ATOMIC_CAS_SIZET
EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT (
EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT (
size_t * pTarget,
size_t oldVal, size_t newVal )
{
@@ -71,7 +75,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT (
#ifndef EPICS_ATOMIC_CAS_PTRT
#define EPICS_ATOMIC_CAS_PTRT
EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT (
EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT (
EpicsAtomicPtrT * pTarget,
EpicsAtomicPtrT oldVal,
EpicsAtomicPtrT newVal )
@@ -132,7 +136,7 @@ EPICS_ATOMIC_INLINE int epicsAtomicAddIntT ( int * pTarget, int delta )
#ifndef EPICS_ATOMIC_ADD_SIZET
#define EPICS_ATOMIC_ADD_SIZET
EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget,
EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget,
size_t delta )
{
STATIC_ASSERT ( sizeof ( ulong_t ) == sizeof ( size_t ) );
@@ -143,7 +147,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget,
#ifndef EPICS_ATOMIC_SUB_SIZET
#define EPICS_ATOMIC_SUB_SIZET
EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget,
EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget,
size_t delta )
{
STATIC_ASSERT ( sizeof ( ulong_t ) == sizeof ( size_t ) );
@@ -1,21 +0,0 @@
/*************************************************************************\
* Copyright (c) 2011 LANS LLC, as Operator of
* Los Alamos National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* Author Jeffrey O. Hill
* johill@lanl.gov
*/
#define epicsExportSharedSymbols
#include "epicsAtomic.h"
// if the compiler is unable to inline then instantiate out-of-line
#ifndef EPICS_ATOMIC_INLINE
# define EPICS_ATOMIC_INLINE
# include "epicsAtomicOSD.h"
#endif
+8 -4
View File
@@ -32,13 +32,15 @@
#include <limits.h>
#include <vxAtomicLib.h>
#define EPICS_ATOMIC_OS_NAME "VX-ATOMICLIB"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER
#define EPICS_ATOMIC_READ_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void)
{
VX_MEM_BARRIER_R ();
}
@@ -46,7 +48,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier ()
#ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
#define EPICS_ATOMIC_WRITE_MEMORY_BARRIER
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier ()
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void)
{
VX_MEM_BARRIER_W ();
}
@@ -206,6 +208,8 @@ EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget,
#include "vxLib.h"
#include "intLib.h"
#define EPICS_ATOMIC_OS_NAME "VX-INTLIB"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -232,7 +236,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicUnlock ( EpicsAtomicLockKey * pKey )
* no need for memory barrior since prior to vxWorks 6.6 it is a single cpu system
* (we are not protecting against multiple access to memory mapped IO)
*/
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () {}
EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) {}
#endif
#ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER
@@ -241,7 +245,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () {}
* no need for memory barrior since prior to vxWorks 6.6 it is a single cpu system
* (we are not protecting against multiple access to memory mapped IO)
*/
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () {}
EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) {}
#endif
#ifdef __cplusplus
+4 -2
View File
@@ -140,9 +140,11 @@ epicsShareFunc int epicsShareAPI osiSockAttach (void); /* returns T if success,
epicsShareFunc void epicsShareAPI osiSockRelease (void);
/*
* convert socket error number to a string
* convert socket error numbers to a string
*/
epicsShareFunc void epicsSocketConvertErrnoToString (
epicsShareFunc void epicsSocketConvertErrorToString (
char * pBuf, unsigned bufSize, int error );
epicsShareFunc void epicsSocketConvertErrnoToString (
char * pBuf, unsigned bufSize );
typedef union osiSockAddr {
+8
View File
@@ -22,6 +22,14 @@ epicsTypesTest_SRCS += epicsTypesTest.cpp
testHarness_SRCS += epicsTypesTest.cpp
TESTS += epicsTypesTest
TESTPROD_HOST += epicsInlineTest
epicsInlineTest_SRCS += epicsInlineTest1.c
epicsInlineTest_SRCS += epicsInlineTest2.c
epicsInlineTest_SRCS += epicsInlineTest3.cpp
epicsInlineTest_SRCS += epicsInlineTest4.cpp
testHarness_SRCS += $(epicsInlineTest_SRCS)
TESTS += epicsInlineTest
TESTPROD_HOST += epicsCalcTest
epicsCalcTest_SRCS += epicsCalcTest.cpp
testHarness_SRCS += epicsCalcTest.cpp
+78
View File
@@ -248,11 +248,89 @@ template void testCAS < EpicsAtomicPtrT > (void);
# pragma warning ( pop )
#endif
static void testClassify()
{
testDiag("Classify Build conditions");
#ifdef EPICS_ATOMIC_CMPLR_NAME
testDiag("Compiler dependent impl name %s", EPICS_ATOMIC_CMPLR_NAME);
#else
testDiag("Compiler dependent impl name undefined");
#endif
#ifdef EPICS_ATOMIC_OS_NAME
testDiag("OS dependent impl name %s", EPICS_ATOMIC_OS_NAME);
#else
testDiag("OS dependent impl name undefined");
#endif
#ifdef __GNUC__
#if GCC_ATOMIC_INTRINSICS_GCC4_OR_BETTER
testDiag("GCC using atomic builtin memory barrier");
#else
testDiag("GCC using asm memory barrier");
#endif
#if GCC_ATOMIC_INTRINSICS_AVAIL_INT_T || GCC_ATOMIC_INTRINSICS_AVAIL_EARLIER
testDiag("GCC use builtin for int");
#endif
#if GCC_ATOMIC_INTRINSICS_AVAIL_SIZE_T || GCC_ATOMIC_INTRINSICS_AVAIL_EARLIER
testDiag("GCC use builtin for size_t");
#endif
#ifndef EPICS_ATOMIC_INCR_INTT
testDiag("Use default epicsAtomicIncrIntT()");
#endif
#ifndef EPICS_ATOMIC_INCR_SIZET
testDiag("Use default epicsAtomicIncrSizeT()");
#endif
#ifndef EPICS_ATOMIC_DECR_INTT
testDiag("Use default epicsAtomicDecrIntT()");
#endif
#ifndef EPICS_ATOMIC_DECR_SIZET
testDiag("Use default epicsAtomicDecrSizeT()");
#endif
#ifndef EPICS_ATOMIC_ADD_INTT
testDiag("Use default epicsAtomicAddIntT()");
#endif
#ifndef EPICS_ATOMIC_ADD_SIZET
testDiag("Use default epicsAtomicAddSizeT()");
#endif
#ifndef EPICS_ATOMIC_SUB_SIZET
testDiag("Use default epicsAtomicSubSizeT()");
#endif
#ifndef EPICS_ATOMIC_SET_INTT
testDiag("Use default epicsAtomicSetIntT()");
#endif
#ifndef EPICS_ATOMIC_SET_SIZET
testDiag("Use default epicsAtomicSetSizeT()");
#endif
#ifndef EPICS_ATOMIC_SET_PTRT
testDiag("Use default epicsAtomicSetPtrT()");
#endif
#ifndef EPICS_ATOMIC_GET_INTT
testDiag("Use default epicsAtomicGetIntT()");
#endif
#ifndef EPICS_ATOMIC_GET_SIZET
testDiag("Use default epicsAtomicGetSizeT()");
#endif
#ifndef EPICS_ATOMIC_GET_PTRT
testDiag("Use default epicsAtomicGetPtrT()");
#endif
#ifndef EPICS_ATOMIC_CAS_INTT
testDiag("Use default epicsAtomicCmpAndSwapIntT()");
#endif
#ifndef EPICS_ATOMIC_CAS_SIZET
testDiag("Use default epicsAtomicCmpAndSwapSizeT()");
#endif
#ifndef EPICS_ATOMIC_CAS_PTRT
testDiag("Use default epicsAtomicCmpAndSwapPtrT()");
#endif
#endif /* __GNUC__ */
}
MAIN ( epicsAtomicTest )
{
testPlan ( 31 );
testClassify ();
testIncrDecr < int > ();
testIncrDecr < size_t > ();
+8
View File
@@ -553,10 +553,18 @@ MAIN(epicsCalcTest)
testExpr(0.0 + NaN);
testExpr(Inf + 0.0);
testExpr(Inf + Inf);
#if defined(_WIN64) && defined(_MSC_VER)
testCalc("Inf + -Inf", NaN);
#else
testExpr(Inf + -Inf);
#endif
testExpr(Inf + NaN);
testExpr(-Inf + 0.0);
#if defined(_WIN64) && defined(_MSC_VER)
testCalc("-Inf + Inf", NaN);
#else
testExpr(-Inf + Inf);
#endif
testExpr(-Inf + -Inf);
testExpr(-Inf + NaN);
testExpr(NaN + 0.0);
+1 -1
View File
@@ -70,7 +70,7 @@ static void epicsExceptionTestPrivate ()
try {
char * p = new ( nothrow )
char [unsuccessfulNewSize];
testOk(p == 0, "new (nothrow)");
testOk(p == 0, "new (nothrow) returned %p", p);
}
catch( ... ) {
testFail("new (nothrow): threw");
+64
View File
@@ -0,0 +1,64 @@
/*************************************************************************\
* Copyright (c) 2015 Brookhaven Science Associates, as Operator of
* Brookhaven National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* This test checks the variations on inline function defintions.
*
* "static inline int func(void) {...}"
*
* Consistent meaning in C89, C99, and C++ (98 and 11).
* If not inline'd results in a private symbol in each compilation unit.
* Thus the non-inline'd version is duplicated in each compilation unit.
* However, definitions in different compilation units may be different.
*
* "inline int func(void) {...}"
* Warning: Not consistent, avoid use in headers meant for C or C++
*
* In C++ this may be safely defined in more than one compilation unit.
* Where not inlined it will result in a weak public symbol.
* Thus non-inline'd version isn't duplicated, but must be the same
* in all compilation units.
*
*/
#include "compilerSpecific.h"
#include "epicsUnitTest.h"
#include "testMain.h"
static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void)
{
return 1;
}
/* Fails to link in C99
inline int epicsInlineTestFn2(void)
{
return 42;
}
*/
void epicsInlineTest1(void)
{
testDiag("epicsInlineTest1()");
testOk1(epicsInlineTestFn1()==1);
/*testOk1(epicsInlineTestFn2()==42);*/
}
void epicsInlineTest2(void);
void epicsInlineTest3(void);
void epicsInlineTest4(void);
MAIN(epicsInlineTest)
{
testPlan(6);
testDiag("Test variation on inline int func()");
epicsInlineTest1();
epicsInlineTest2();
epicsInlineTest3();
epicsInlineTest4();
return testDone();
}
+28
View File
@@ -0,0 +1,28 @@
/*************************************************************************\
* Copyright (c) 2015 Brookhaven Science Associates, as Operator of
* Brookhaven National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#include "compilerSpecific.h"
#include "epicsUnitTest.h"
static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void)
{
return 2;
}
/* Fails to link in C99
inline int epicsInlineTestFn2(void)
{
return 42;
}
*/
void epicsInlineTest2(void)
{
testDiag("epicsInlineTest2()");
testOk1(epicsInlineTestFn1()==2);
/*testOk1(epicsInlineTestFn2()==42);*/
}
+27
View File
@@ -0,0 +1,27 @@
/*************************************************************************\
* Copyright (c) 2015 Brookhaven Science Associates, as Operator of
* Brookhaven National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#include "compilerSpecific.h"
#include "epicsUnitTest.h"
static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void)
{
return 3;
}
inline int epicsInlineTestFn2(void)
{
return 42;
}
extern "C"
void epicsInlineTest3(void)
{
testDiag("epicsInlineTest3()");
testOk1(epicsInlineTestFn1()==3);
testOk1(epicsInlineTestFn2()==42);
}
+27
View File
@@ -0,0 +1,27 @@
/*************************************************************************\
* Copyright (c) 2015 Brookhaven Science Associates, as Operator of
* Brookhaven National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#include "compilerSpecific.h"
#include "epicsUnitTest.h"
static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void)
{
return 4;
}
inline int epicsInlineTestFn2(void)
{
return 42;
}
extern "C"
void epicsInlineTest4(void)
{
testDiag("epicsInlineTest4()");
testOk1(epicsInlineTestFn1()==4);
testOk1(epicsInlineTestFn2()==42);
}
+22
View File
@@ -31,11 +31,26 @@ MAIN(epicsMathTest)
testOk1(epicsINF == epicsINF);
testOk1(epicsINF > 0.0);
testOk1(epicsINF - epicsINF != 0.0);
#if defined(_WIN64) && defined(_MSC_VER)
testTodoBegin("Known failure on windows-x64");
#endif
testOk1(epicsINF + -epicsINF != 0.0);
testOk1(-epicsINF + epicsINF != 0.0);
#if defined(_WIN64) && defined(_MSC_VER)
testTodoEnd();
#endif
testOk1(isnan(epicsINF - epicsINF));
#if defined(_WIN64) && defined(_MSC_VER)
testTodoBegin("Known failure on windows-x64");
#endif
testOk1(isnan(epicsINF + -epicsINF));
testOk1(isnan(-epicsINF + epicsINF));
#if defined(_WIN64) && defined(_MSC_VER)
testTodoEnd();
#endif
testOk1(isnan(epicsNAN));
testOk1(!isinf(epicsNAN));
@@ -46,8 +61,15 @@ MAIN(epicsMathTest)
testOk1(!(epicsNAN >= epicsNAN));
testOk1(!(epicsNAN > epicsNAN));
testOk1(isnan(epicsNAN - epicsNAN));
#if defined(_WIN64) && defined(_MSC_VER)
testTodoBegin("Known failure on windows-x64");
#endif
testOk1(isnan(epicsNAN + -epicsNAN));
testOk1(isnan(-epicsNAN + epicsNAN));
#if defined(_WIN64) && defined(_MSC_VER)
testTodoEnd();
#endif
c = huge / tiny;
testOk(!isnan(c), "!isnan(1e300 / 1e-300)");
+63 -31
View File
@@ -10,8 +10,6 @@
* $Revision-Id$
*
* Author W. Eric Norum
* norume@aps.anl.gov
* 630 252 4793
*/
#include <stdio.h>
#include <stdlib.h>
@@ -27,8 +25,10 @@
#include "testMain.h"
static const char *msg1 = "1234567890This is a very long message.";
static volatile int testExit = 0;
static volatile int sendExit = 0;
static volatile int recvExit = 0;
static epicsEventId finished;
static unsigned int mediumStack;
/*
* In Numerical Recipes in C: The Art of Scientific Computing (William H.
@@ -79,6 +79,7 @@ extern "C" void
receiver(void *arg)
{
epicsMessageQueue *q = (epicsMessageQueue *)arg;
const char *myName = epicsThreadGetNameSelf();
char cbuf[80];
int expectmsg[4];
int len;
@@ -87,10 +88,10 @@ receiver(void *arg)
for (sender = 1 ; sender <= 4 ; sender++)
expectmsg[sender-1] = 1;
while (!testExit) {
while (!recvExit) {
cbuf[0] = '\0';
len = q->receive(cbuf, sizeof cbuf, 5.0);
if (len < 0 && !testExit) {
if (len < 0 && !recvExit) {
testDiag("receiver() received unexpected timeout");
++errors;
}
@@ -98,7 +99,8 @@ receiver(void *arg)
sender >= 1 && sender <= 4) {
if (expectmsg[sender-1] != msgNum) {
++errors;
testDiag("%s received %d '%.*s' -- expected %d", epicsThreadGetNameSelf(), len, len, cbuf, expectmsg[sender-1]);
testDiag("%s received %d '%.*s' -- expected %d",
myName, len, len, cbuf, expectmsg[sender-1]);
}
expectmsg[sender-1] = msgNum + 1;
epicsThreadSleep(0.001 * (randBelow(20)));
@@ -106,10 +108,12 @@ receiver(void *arg)
}
for (sender = 1 ; sender <= 4 ; sender++) {
if (expectmsg[sender-1] > 1)
testDiag("Sender %d -- %d messages", sender, expectmsg[sender-1]-1);
testDiag("Received %d messages from Sender %d",
expectmsg[sender-1]-1, sender);
}
if (!testOk1(errors == 0))
testDiag("error count was %d", errors);
testDiag("Error count was %d", errors);
testDiag("%s exiting", myName);
epicsEventSignal(finished);
}
@@ -121,16 +125,18 @@ sender(void *arg)
int len;
int i = 0;
while (!testExit) {
while (!sendExit) {
len = sprintf(cbuf, "%s -- %d.", epicsThreadGetNameSelf(), ++i);
while (q->trySend((void *)cbuf, len) < 0)
epicsThreadSleep(0.005 * (randBelow(5)));
epicsThreadSleep(0.005 * (randBelow(20)));
}
testDiag("%s exiting, sent %d messages", epicsThreadGetNameSelf(), i);
}
extern "C" void messageQueueTest(void *parm)
{
epicsThreadId myThreadId = epicsThreadGetIdSelf();
unsigned int i;
char cbuf[80];
int len;
@@ -152,20 +158,23 @@ extern "C" void messageQueueTest(void *parm)
len = q1->receive(cbuf, sizeof cbuf);
testOk1(q1->pending() == 3);
if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0)))
testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf);
testDiag("wanted:%d '%.*s' got:%d '%.*s'",
want, want, msg1, len, len, cbuf);
want++;
len = q1->receive(cbuf, sizeof cbuf);
testOk1(q1->pending() == 2);
if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0)))
testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf);
testDiag("wanted:%d '%.*s' got:%d '%.*s'",
want, want, msg1, len, len, cbuf);
q1->trySend((void *)msg1, i++);
want++;
len = q1->receive(cbuf, sizeof cbuf);
testOk1(q1->pending() == 2);
if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0)))
testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf);
testDiag("wanted:%d '%.*s' got:%d '%.*s'",
want, want, msg1, len, len, cbuf);
q1->trySend((void *)msg1, i++);
testOk1(q1->pending() == 3);
@@ -175,7 +184,8 @@ extern "C" void messageQueueTest(void *parm)
testOk(q1->pending() == i, "q1->pending() == %d", i);
want++;
if (!testOk1((len == want) & (strncmp(msg1, cbuf, len) == 0)))
testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf);
testDiag("wanted:%d '%.*s' got:%d '%.*s'",
want, want, msg1, len, len, cbuf);
}
testOk1(q1->pending() == 0);
@@ -192,20 +202,23 @@ extern "C" void messageQueueTest(void *parm)
len = q1->receive(cbuf, sizeof cbuf);
testOk1(q1->pending() == 3);
if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0)))
testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf);
testDiag("wanted:%d '%.*s' got:%d '%.*s'",
want, want, msg1, len, len, cbuf);
want++;
len = q1->receive(cbuf, sizeof cbuf);
testOk1(q1->pending() == 2);
if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0)))
testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf);
testDiag("wanted:%d '%.*s' got:%d '%.*s'",
want, want, msg1, len, len, cbuf);
q1->send((void *)msg1, i++, 1.0);
want++;
len = q1->receive(cbuf, sizeof cbuf);
testOk1(q1->pending() == 2);
if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0)))
testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf);
testDiag("wanted:%d '%.*s' got:%d '%.*s'",
want, want, msg1, len, len, cbuf);
q1->send((void *)msg1, i++, 1.0);
testOk1(q1->pending() == 3);
@@ -215,7 +228,8 @@ extern "C" void messageQueueTest(void *parm)
testOk(q1->pending() == i, "q1->pending() == %d", i);
want++;
if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0)))
testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf);
testDiag("wanted:%d '%.*s' got:%d '%.*s'",
want, want, msg1, len, len, cbuf);
}
testOk1(q1->pending() == 0);
@@ -231,7 +245,8 @@ extern "C" void messageQueueTest(void *parm)
testOk1(q1->pending() == 0);
testDiag("Single receiver with invalid size, single sender tests:");
epicsThreadCreate("Bad Receiver", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), badReceiver, q1);
epicsThreadCreate("Bad Receiver", epicsThreadPriorityMedium,
mediumStack, badReceiver, q1);
epicsThreadSleep(1.0);
testOk(q1->send((void *)msg1, 10) == 0, "Send with waiting receiver");
epicsThreadSleep(2.0);
@@ -239,8 +254,9 @@ extern "C" void messageQueueTest(void *parm)
epicsThreadSleep(2.0);
testDiag("Single receiver, single sender tests:");
epicsThreadSetPriority(epicsThreadGetIdSelf(), epicsThreadPriorityHigh);
epicsThreadCreate("Receiver one", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), receiver, q1);
epicsThreadSetPriority(myThreadId, epicsThreadPriorityHigh);
epicsThreadCreate("Receiver one", epicsThreadPriorityMedium,
mediumStack, receiver, q1);
for (pass = 1 ; pass <= 3 ; pass++) {
for (i = 0 ; i < 10 ; i++) {
if (q1->trySend((void *)msg1, i) < 0)
@@ -252,7 +268,7 @@ extern "C" void messageQueueTest(void *parm)
case 1:
if (i<6)
testDiag(" priority-based scheduler, sent %d messages", i);
epicsThreadSetPriority(epicsThreadGetIdSelf(), epicsThreadPriorityLow);
epicsThreadSetPriority(myThreadId, epicsThreadPriorityLow);
break;
case 2:
if (i<10)
@@ -272,27 +288,43 @@ extern "C" void messageQueueTest(void *parm)
*/
testDiag("Single receiver, multiple sender tests:");
testDiag("This test lasts 60 seconds...");
epicsThreadCreate("Sender 1", epicsThreadPriorityLow, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1);
epicsThreadCreate("Sender 2", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1);
epicsThreadCreate("Sender 3", epicsThreadPriorityHigh, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1);
epicsThreadCreate("Sender 4", epicsThreadPriorityHigh, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1);
testOk(!!epicsThreadCreate("Sender 1", epicsThreadPriorityLow,
mediumStack, sender, q1),
"Created Sender 1");
testOk(!!epicsThreadCreate("Sender 2", epicsThreadPriorityMedium,
mediumStack, sender, q1),
"Created Sender 2");
testOk(!!epicsThreadCreate("Sender 3", epicsThreadPriorityHigh,
mediumStack, sender, q1),
"Created Sender 3");
testOk(!!epicsThreadCreate("Sender 4", epicsThreadPriorityHigh,
mediumStack, sender, q1),
"Created Sender 4");
epicsThreadSleep(60.0);
for (i = 0; i < 10; i++) {
testDiag("... %2d", 10 - i);
epicsThreadSleep(6.0);
}
testExit = 1;
sendExit = 1;
epicsThreadSleep(1.0);
recvExit = 1;
testDiag("Scheduler exiting");
}
MAIN(epicsMessageQueueTest)
{
testPlan(58);
testPlan(62);
finished = epicsEventMustCreate(epicsEventEmpty);
mediumStack = epicsThreadGetStackSize(epicsThreadStackMedium);
epicsThreadCreate("messageQueueTest", epicsThreadPriorityMedium,
epicsThreadGetStackSize(epicsThreadStackMedium),
messageQueueTest, NULL);
mediumStack, messageQueueTest, NULL);
(void) epicsEventWait(finished);
epicsEventMustWait(finished);
testDiag("Main thread signalled");
epicsThreadSleep(1.0);
return testDone();
}

Some files were not shown because too many files have changed in this diff Show More