From b36b07db9ea15ba1a13dbde743ba04892f284020 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 7 Nov 2011 11:58:09 -0600 Subject: [PATCH 01/12] Clean up some compiler warnings reported by J. Lewis Muir. --- src/catools/caput.c | 1 - src/libCom/test/epicsErrlogTest.c | 18 +++++++++--------- src/libCom/test/macEnvExpandTest.c | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/catools/caput.c b/src/catools/caput.c index 62815b104..cea443c0d 100644 --- a/src/catools/caput.c +++ b/src/catools/caput.c @@ -251,7 +251,6 @@ int caget (pv *pvs, int nPvs, OutputT format, int main (int argc, char *argv[]) { - int n; int i; int result; /* CA result */ OutputT format = plain; /* User specified format */ diff --git a/src/libCom/test/epicsErrlogTest.c b/src/libCom/test/epicsErrlogTest.c index 08389e438..b93bee967 100644 --- a/src/libCom/test/epicsErrlogTest.c +++ b/src/libCom/test/epicsErrlogTest.c @@ -143,7 +143,7 @@ MAIN(epicsErrlogTest) pvt.expect = "Testing"; pvt.checkLen = strlen(pvt.expect); - errlogPrintfNoConsole(pvt.expect); + errlogPrintfNoConsole("%s", pvt.expect); errlogFlush(); testOk1(pvt.count == 1); @@ -153,7 +153,7 @@ MAIN(epicsErrlogTest) pvt2.expect = pvt.expect = "Testing2"; pvt2.checkLen = pvt.checkLen = strlen(pvt.expect); - errlogPrintfNoConsole(pvt.expect); + errlogPrintfNoConsole("%s", pvt.expect); errlogFlush(); testOk1(pvt.count == 2); @@ -165,7 +165,7 @@ MAIN(epicsErrlogTest) pvt2.expect = "Testing3"; pvt2.checkLen = strlen(pvt2.expect); - errlogPrintfNoConsole(pvt2.expect); + errlogPrintfNoConsole("%s", pvt2.expect); errlogFlush(); testOk1(pvt.count == 2); @@ -188,7 +188,7 @@ MAIN(epicsErrlogTest) pvt.expect = truncmsg; pvt.checkLen = 255; - errlogPrintfNoConsole(longmsg); + errlogPrintfNoConsole("%s", longmsg); errlogFlush(); testOk1(pvt.count == 3); @@ -201,7 +201,7 @@ MAIN(epicsErrlogTest) */ pvt.jam = 1; - errlogPrintfNoConsole(longmsg); + errlogPrintfNoConsole("%s", longmsg); epicsThreadSleep(0.1); testOk1(pvt.count == 3); @@ -227,7 +227,7 @@ MAIN(epicsErrlogTest) pvt.jam = 1; for (i = 0; i < N; i++) { - errlogPrintfNoConsole(msg); + errlogPrintfNoConsole("%s", msg); } epicsEventSignal(pvt.jammer); @@ -258,7 +258,7 @@ MAIN(epicsErrlogTest) testDiag("Filling with %d messages of size %d", (int) N, (int) mlen); for (i = 0; i < N; i++) { - errlogPrintfNoConsole(msg); + errlogPrintfNoConsole("%s", msg); } epicsThreadSleep(0.1); /* should really be a second Event */ @@ -273,10 +273,10 @@ MAIN(epicsErrlogTest) testOk1(pvt.count == 2); /* The buffer has space for 1 more message: sizeof(msgNode) + 256 bytes */ - errlogPrintfNoConsole(msg); /* Use up that space */ + errlogPrintfNoConsole("%s", msg); /* Use up that space */ testDiag("Overflow the buffer"); - errlogPrintfNoConsole(msg); + errlogPrintfNoConsole("%s", msg); testOk1(pvt.count == 2); diff --git a/src/libCom/test/macEnvExpandTest.c b/src/libCom/test/macEnvExpandTest.c index df8d6c391..99464873a 100644 --- a/src/libCom/test/macEnvExpandTest.c +++ b/src/libCom/test/macEnvExpandTest.c @@ -42,7 +42,7 @@ static void check(const char *str, const char *expect) testDiag("Got \"%s\", expected \"%s\".\n", got, expect); pass = 0; } - testOk(pass, str); + testOk(pass, "%s", str); } MAIN(macEnvExpandTest) From 0dfbd460e1ca63ec77a767233cc54171d3f5d3b6 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 8 Nov 2011 13:23:25 -0600 Subject: [PATCH 02/12] configure: Fix potential parallel build issue When creating files in ../O.Common it is eesential to use atomic file replacement rather than deleting the old file and creating a new one in its place, because two or three architectures could be being built in parallel which might interfere. This commit also ensures that .dbd.d files are constructed properly when using 'make -s'; $(ECHO) does nothing then. --- configure/RULES.Db | 57 ++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/configure/RULES.Db b/configure/RULES.Db index 556218303..96d51ec7f 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -121,7 +121,7 @@ MAKEDBDEPENDS = $(PERL) $(TOOLS)/makeDbDepends.pl ifndef T_A -ECHO := $(if $(findstring s,$(MAKEFLAGS)),\#,@echo) +ECHO := $(if $(findstring s,$(MAKEFLAGS)),$(COMMENT),@echo) COMMON_DIR = . INSTALL_DBDS = INSTALL_DBS = @@ -223,58 +223,65 @@ $(INSTALL_DB)/%.template: %.template $(COMMON_DIR)/%Record.h: $(COMMON_DIR)/%Record.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) - @$(RM) $@ - $(DBTORECORDTYPEH) $(DBDFLAGS) $< $@ + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) + @$(RM) $(notdir $@) + $(DBTORECORDTYPEH) $(DBDFLAGS) $< $(notdir $@) + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%Record.h: %Record.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) - @$(RM) $@ - $(DBTORECORDTYPEH) $(DBDFLAGS) $< $@ + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) + @$(RM) $(notdir $@) + $(DBTORECORDTYPEH) $(DBDFLAGS) $< $(notdir $@) + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/menu%.h: $(COMMON_DIR)/menu%.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) - @$(RM) $@ - $(DBTOMENUH) $(DBDFLAGS) $< $@ + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) + @$(RM) $(notdir $@) + $(DBTOMENUH) $(DBDFLAGS) $< $(notdir $@) + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/menu%.h: menu%.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) - @$(RM) $@ - $(DBTOMENUH) $(DBDFLAGS) $< $@ + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) + @$(RM) $(notdir $@) + $(DBTOMENUH) $(DBDFLAGS) $< $(notdir $@) + @$(MV) $(notdir $@) $@ .PRECIOUS: $(COMMON_DIR)/%.h ##################################################### DBD files $(COMMON_DIR)/bpt%.dbd: bpt%.data - @$(RM) $@ - $(MAKEBPT) $< $@ + $(MAKEBPT) $< $(notdir $@) + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%.dbd: $(COMMON_DIR)/%Include.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) $(ECHO) "Expanding dbd" - @$(RM) $@ - @$(DBEXPAND) $(DBDFLAGS) -o $@ $< + @$(RM) $(notdir $@) + @$(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $< + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%.dbd: %Include.dbd @$(RM) $(notdir $@)$(DEP) @$(DBDDEPENDS_CMD) - $(ECHO) "$<:../Makefile" >> $(notdir $@)$(DEP) + echo "$< : ../Makefile" >> $(notdir $@)$(DEP) $(ECHO) "Expanding dbd" - @$(RM) $@ - $(DBEXPAND) $(DBDFLAGS) -o $@ $< + @$(RM) $(notdir $@) + $(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $< + @$(MV) $(notdir $@) $@ $(COMMON_DIR)/%Include.dbd: - @$(RM) $@ - $(PERL) $(TOOLS)/makeIncludeDbd.pl $($*_DBD) $@ + @$(RM) $(notdir $@) + $(PERL) $(TOOLS)/makeIncludeDbd.pl $($*_DBD) $(notdir $@) + @$(MV) $(notdir $@) $@ $(INSTALL_DBD)/%: $(COMMON_DIR)/% $(ECHO) "Installing created dbd file $@" @@ -302,8 +309,8 @@ $(COMMON_DIR)/%.db$(RAW): $(COMMON_DIR)/%.edf $(COMMON_DIR)/%.db$(RAW): %.substitutions @$(RM) $(notdir $@)$(DEP) - $(MAKEDBDEPENDS) $@ $< $(TEMPLATE_FILENAME) >> $(notdir $@)$(DEP) - $(ECHO) "$@:$(TEMPLATE_FILENAME)" >> $(notdir $@)$(DEP) + @$(MAKEDBDEPENDS) $@ $< $(TEMPLATE_FILENAME) >> $(notdir $@)$(DEP) + echo "$@ : $(TEMPLATE_FILENAME)" >> $(notdir $@)$(DEP) $(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)" @$(RM) $@ $*.tmp $(MSI) $(DBFLAGS) -S$< $(TEMPLATE_FILENAME) > $*.tmp From bb14c6594b4b46350d85d98420dfa76343b04c10 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 8 Nov 2011 15:57:15 -0600 Subject: [PATCH 03/12] Win32: Fix for lp:861214 --- src/libCom/osi/os/WIN32/osdThread.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdThread.c b/src/libCom/osi/os/WIN32/osdThread.c index b7d63a787..c880fbd1a 100644 --- a/src/libCom/osi/os/WIN32/osdThread.c +++ b/src/libCom/osi/os/WIN32/osdThread.c @@ -272,10 +272,6 @@ static void threadCleanupWIN32 ( void ) ellFirst ( & pGbl->threadList ) ) ) { epicsParmCleanupWIN32 ( pParm ); } - - TlsFree ( pGbl->tlsIndexThreadLibraryEPICS ); - - DeleteCriticalSection ( & pGbl->mutex ); } /* From a0c1c0fb1548d7116761114e29cbd0df84fe45e2 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 8 Nov 2011 17:51:19 -0600 Subject: [PATCH 04/12] makeBaseApp: Remove local duplicates of library functions Replace the buggy local copies of the functions UnixPath(), LocalPath(), readRelease() and expandRelease() with the library versions from our EPICS::Path and EPICS::Release perl modules. --- src/makeBaseApp/makeBaseApp.pl | 90 +++------------------------------- 1 file changed, 8 insertions(+), 82 deletions(-) diff --git a/src/makeBaseApp/makeBaseApp.pl b/src/makeBaseApp/makeBaseApp.pl index d993a6ac9..f60ec3e5d 100755 --- a/src/makeBaseApp/makeBaseApp.pl +++ b/src/makeBaseApp/makeBaseApp.pl @@ -4,10 +4,15 @@ eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*- # Authors: Ralph Lange, Marty Kraimer, Andrew Johnson and Janet Anderson # $Revision-Id$ +use FindBin qw($Bin); +use lib ("$Bin/../../lib/perl", $Bin); + use Cwd; use Getopt::Std; use File::Find; -use File::Path; +use File::Path 'mkpath'; +use EPICS::Path; +use EPICS::Release; $app_top = cwd(); @@ -17,10 +22,8 @@ $app_top = cwd(); $bad_ident_chars = '[^0-9A-Za-z_]'; &GetUser; # Ensure we know who's in charge -&readRelease("configure/RELEASE", \%release, \@apps) if (-r "configure/RELEASE"); -&readRelease("configure/RELEASE.$ENV{EPICS_HOST_ARCH}", \%release, \@apps) - if (-r "configure/RELEASE.$ENV{EPICS_HOST_ARCH}"); -&expandRelease(\%release, \@apps); +&readReleaseFiles("configure/RELEASE", \%release, \@apps); +&expandRelease(\%release); &get_commandline_opts; # Check command-line options # @@ -297,57 +300,6 @@ sub get_commandline_opts { #no args . "EPICS-Base: $epics_base\n\n" if $opt_d; } -# -# Parse a configure/RELEASE file. -# -# NB: This subroutine also appears in base/configure/tools/convertRelease.pl -# If you make changes here, they will be needed there as well. -# -sub readRelease { - my ($file, $Rmacros, $Rapps) = @_; - # $Rmacros is a reference to a hash, $Rapps a ref to an array - my ($pre, $var, $post, $macro, $path); - local *IN; - open(IN, $file) or die "Can't open $file: $!\n"; - while () { - chomp; - s/\r$//; # Shouldn't need this, but sometimes... - s/\s*#.*$//; # Remove trailing comments - next if /^\s*$/; # Skip blank lines - - # Expand all already-defined macros in the line: - while (($pre,$var,$post) = /(.*)\$\((\w+)\)(.*)/) { - last unless (exists $Rmacros->{$var}); - $_ = $pre . $Rmacros->{$var} . $post; - } - - # Handle " = " - ($macro, $path) = /^\s*(\w+)\s*=\s*(.*)/; - if ($macro ne "") { - $Rmacros->{$macro} = $path; - push @$Rapps, $macro; - next; - } - # Handle "include " syntax - ($path) = /^\s*include\s+(.*)/; - &readRelease($path, $Rmacros, $Rapps) if (-r $path); - } - close IN; -} - -sub expandRelease { - my ($Rmacros, $Rapps) = @_; - # $Rmacros is a reference to a hash, $Rapps a ref to an array - - # Expand any (possibly nested) macros that were defined after use - while (($macro, $path) = each %$Rmacros) { - while (($pre,$var,$post) = $path =~ /(.*)\$\((\w+)\)(.*)/) { - $path = $pre . $Rmacros->{$var} . $post; - $Rmacros->{$macro} = $path; - } - } -} - # # List application types # @@ -480,29 +432,3 @@ sub GetUser { } die "No user name" unless $user; } - -# Path rewriting rules for various OSs -# These functions are duplicated in configure/convertRelease.pl -sub UnixPath { - my ($newpath) = @_; - if ($^O eq 'cygwin') { - $newpath =~ s{\\}{/}go; - $newpath =~ s{^([a-zA-Z]):/}{/cygdrive/$1/}; - } elsif ($^O eq 'MSWin32') { - $newpath =~ s{\\}{/}go; - } elsif ($^O eq 'sunos') { - $newpath =~ s{^/tmp_mnt/}{/}; - } - return $newpath; -} - -sub LocalPath { - my ($newpath) = @_; - if ($^O eq "cygwin") { - $newpath =~ s{^/cygdrive/([a-zA-Z])/}{$1:/}; - } elsif ($^O eq "darwin") { - # These rules are likely to be site-specific - $newpath =~ s{^/private/var/auto\.home/}{/home/}; # APS - } - return $newpath; -} From fae5bbcf866e0a4883d6ecf373235aeed147160e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 10 Nov 2011 13:29:33 -0600 Subject: [PATCH 05/12] cap5: Don't try to process POD on Win32 --- src/cap5/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cap5/Makefile b/src/cap5/Makefile index 05f3de1e3..e408a1cde 100644 --- a/src/cap5/Makefile +++ b/src/cap5/Makefile @@ -33,6 +33,12 @@ ifeq ($(findstring $(OS_CLASS),WIN32 cygwin32),) PERL_SCRIPTS += camonitor.pl PERL_MODULES += CA.pm + + ifeq ($(findstring Host,$(VALID_BUILDS)),Host) + # Can only create docs in Host build + HTMLS_DIR = . + HTMLS = CA.html + endif endif Cap5_SRCS = Cap5.xs @@ -40,12 +46,6 @@ Cap5_LIBS = ca Com Cap5_INCLUDES = -I$(shell $(PERL) ../perlConfig.pl archlib)/CORE Cap5_CFLAGS = $(shell $(PERL) ../perlConfig.pl ccflags) -ifeq ($(findstring Host,$(VALID_BUILDS)),Host) - # Can only create docs in Host build - HTMLS_DIR = . - HTMLS = CA.html -endif - include $(TOP)/configure/RULES ifdef T_A From a252218e697694923352d76f0337dcfe8aa76c59 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 10 Nov 2011 14:03:01 -0700 Subject: [PATCH 06/12] fixed launchpad bug 697519 (rollover time diff calc off by two ticks) --- src/libCom/osi/os/WIN32/osdTime.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdTime.cpp b/src/libCom/osi/os/WIN32/osdTime.cpp index 035c7308c..ed450dd65 100644 --- a/src/libCom/osi/os/WIN32/osdTime.cpp +++ b/src/libCom/osi/os/WIN32/osdTime.cpp @@ -60,6 +60,7 @@ static int osdTimeGetCurrent ( epicsTimeStamp *pDest ); // for mingw #if !defined ( MAXLONGLONG ) #define MAXLONGLONG LL_CONSTANT(0x7fffffffffffffff) +#define MINLONGLONG LL_CONSTANT(~0x7fffffffffffffff) #endif static const LONGLONG epicsEpochInFileTime = LL_CONSTANT(0x01b41e2a18d64000); @@ -346,7 +347,7 @@ void currentTime::getCurrentTime ( epicsTimeStamp & dest ) // counter resolution will more than likely improve over time. // offset = ( MAXLONGLONG - this->lastPerfCounter ) - + ( curPerfCounter.QuadPart + MAXLONGLONG ); + + ( curPerfCounter.QuadPart - MINLONGLONG ) + 1; } if ( offset < MAXLONGLONG / EPICS_TIME_TICKS_PER_SEC ) { offset *= EPICS_TIME_TICKS_PER_SEC; @@ -424,7 +425,7 @@ epicsTimerNotify::expireStatus currentTime::expire ( const epicsTime & ) // counter resolution will more than likely improve over time. // perfCounterDiff = ( MAXLONGLONG - this->lastPerfCounterPLL ) - + ( curPerfCounter.QuadPart + MAXLONGLONG ); + + ( curPerfCounter.QuadPart - MINLONGLONG ) + 1; } this->lastPerfCounterPLL = curPerfCounter.QuadPart; @@ -473,7 +474,7 @@ epicsTimerNotify::expireStatus currentTime::expire ( const epicsTime & ) // perfCounterDiffSinceLastFetch = ( MAXLONGLONG - this->lastPerfCounter ) - + ( curPerfCounter.QuadPart + MAXLONGLONG ); + + ( curPerfCounter.QuadPart - MINLONGLONG ) + 1; } // Update the current estimated time. From 5b46eebe1aaa751a629d1e72a5e3a3c861525b77 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 10 Nov 2011 14:52:22 -0700 Subject: [PATCH 07/12] fixed LP bug 697516, PLL time adjustments fail if user sets system time before EPICS epoch --- src/libCom/osi/os/WIN32/osdTime.cpp | 33 ++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdTime.cpp b/src/libCom/osi/os/WIN32/osdTime.cpp index ed450dd65..dfb7e4d76 100644 --- a/src/libCom/osi/os/WIN32/osdTime.cpp +++ b/src/libCom/osi/os/WIN32/osdTime.cpp @@ -303,8 +303,8 @@ currentTime::currentTime () : } else { errlogPrintf ( - "win32 osdTime.cpp detected questionable " - "system date prior to EPICS epoch\n" ); + "win32 osdTime.cpp init detected questionable " + "system date prior to EPICS epoch, epics time will not advance\n" ); this->epicsTimeLast = 0; } @@ -483,9 +483,32 @@ epicsTimerNotify::expireStatus currentTime::expire ( const epicsTime & ) / this->perfCounterFreq; this->lastPerfCounter = curPerfCounter.QuadPart; - LONGLONG epicsTimeFromCurrentFileTime = - ( curFileTime.QuadPart - epicsEpochInFileTime ) * - ET_TICKS_PER_FT_TICK; + LONGLONG epicsTimeFromCurrentFileTime; + + { + static bool firstMessageWasSent = false; + if ( curFileTime.QuadPart >= epicsEpochInFileTime ) { + epicsTimeFromCurrentFileTime = + ( curFileTime.QuadPart - epicsEpochInFileTime ) * + ET_TICKS_PER_FT_TICK; + firstMessageWasSent = false; + } + else { + /* + * if the system time jumps to before the EPICS epoch + * then latch to the EPICS epoch printing only one + * warning message the first time that the issue is + * detected + */ + if ( ! firstMessageWasSent ) { + errlogPrintf ( + "win32 osdTime.cpp time PLL update detected questionable " + "system date prior to EPICS epoch, epics time will not advance\n" ); + firstMessageWasSent = true; + } + epicsTimeFromCurrentFileTime = 0; + } + } delta = epicsTimeFromCurrentFileTime - this->epicsTimeLast; if ( delta > EPICS_TIME_TICKS_PER_SEC || delta < -EPICS_TIME_TICKS_PER_SEC ) { From 652235ef132a824142d085fd3343407ad8b4a0e8 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 10 Nov 2011 17:22:22 -0700 Subject: [PATCH 08/12] fixed LP Bug #697517, WIN32 osdtime should handle the system time change properly --- src/libCom/osi/os/WIN32/osdTime.cpp | 30 ++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdTime.cpp b/src/libCom/osi/os/WIN32/osdTime.cpp index dfb7e4d76..cd05f2362 100644 --- a/src/libCom/osi/os/WIN32/osdTime.cpp +++ b/src/libCom/osi/os/WIN32/osdTime.cpp @@ -82,7 +82,7 @@ private: epicsTimerQueueActive * pTimerQueue; epicsTimer * pTimer; bool perfCtrPresent; - + static const int pllDelay; /* integer seconds */ epicsTimerNotify::expireStatus expire ( const epicsTime & ); }; @@ -92,6 +92,8 @@ static const LONGLONG EPICS_TIME_TICKS_PER_SEC = 1000000000; static const LONGLONG ET_TICKS_PER_FT_TICK = EPICS_TIME_TICKS_PER_SEC / FILE_TIME_TICKS_PER_SEC; +const int currentTime :: pllDelay = 5; + // // Start and register time provider // @@ -433,10 +435,10 @@ epicsTimerNotify::expireStatus currentTime::expire ( const epicsTime & ) this->lastFileTimePLL = curFileTime.QuadPart; // discard glitches - if ( fileTimeDiff == 0 ) { + if ( fileTimeDiff <= 0 ) { LeaveCriticalSection( & this->mutex ); - debugPrintf ( ( "currentTime: file time difference in PLL was zero\n" ) ); - return expireStatus ( restart, 1.0 /* sec */ ); + debugPrintf ( ( "currentTime: file time difference in PLL was less than zero\n" ) ); + return expireStatus ( restart, pllDelay /* sec */ ); } LONGLONG freq = ( FILE_TIME_TICKS_PER_SEC * perfCounterDiff ) / fileTimeDiff; @@ -450,7 +452,7 @@ epicsTimerNotify::expireStatus currentTime::expire ( const epicsTime & ) static_cast < int > ( -bound ), static_cast < int > ( delta ), static_cast < int > ( bound ) ) ); - return expireStatus ( restart, 1.0 /* sec */ ); + return expireStatus ( restart, pllDelay /* sec */ ); } // update feedback loop estimating the performance counter's frequency @@ -476,6 +478,20 @@ epicsTimerNotify::expireStatus currentTime::expire ( const epicsTime & ) ( MAXLONGLONG - this->lastPerfCounter ) + ( curPerfCounter.QuadPart - MINLONGLONG ) + 1; } + + // discard performance counter delay measurement glitches + { + const LONGLONG expectedDly = this->perfCounterFreq * pllDelay; + const LONGLONG bnd = expectedDly / 4; + if ( perfCounterDiffSinceLastFetch <= 0 || + perfCounterDiffSinceLastFetch >= expectedDly + bnd ) { + LeaveCriticalSection( & this->mutex ); + debugPrintf ( ( "perf ctr measured delay out of bounds m=%d max=%d\n", + static_cast < int > ( perfCounterDiffSinceLastFetch ), + static_cast < int > ( expectedDly + bnd ) ) ); + return expireStatus ( restart, pllDelay /* sec */ ); + } + } // Update the current estimated time. this->epicsTimeLast += @@ -561,7 +577,7 @@ epicsTimerNotify::expireStatus currentTime::expire ( const epicsTime & ) LeaveCriticalSection ( & this->mutex ); - return expireStatus ( restart, 1.0 /* sec */ ); + return expireStatus ( restart, pllDelay /* sec */ ); } void currentTime::startPLL () @@ -570,7 +586,7 @@ void currentTime::startPLL () if ( this->perfCtrPresent && ! this->pTimerQueue ) { this->pTimerQueue = & epicsTimerQueueActive::allocate ( true ); this->pTimer = & this->pTimerQueue->createTimer (); - this->pTimer->start ( *this, 1.0 ); + this->pTimer->start ( *this, pllDelay ); } } From 6ef52b5d037cb8db8a88af031a9e7a6e318169da Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 10 Nov 2011 17:34:47 -0700 Subject: [PATCH 09/12] fixed launchpad bug 697509, Thread synchronization issue in libCom/osi/os/WIN32/osdTime.cpp --- src/libCom/osi/os/WIN32/osdTime.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdTime.cpp b/src/libCom/osi/os/WIN32/osdTime.cpp index cd05f2362..d69c4f157 100644 --- a/src/libCom/osi/os/WIN32/osdTime.cpp +++ b/src/libCom/osi/os/WIN32/osdTime.cpp @@ -395,6 +395,8 @@ void currentTime::getCurrentTime ( epicsTimeStamp & dest ) // epicsTimerNotify::expireStatus currentTime::expire ( const epicsTime & ) { + EnterCriticalSection ( & this->mutex ); + // avoid interruptions by briefly becoming a time critical thread LARGE_INTEGER curFileTime; LARGE_INTEGER curPerfCounter; @@ -410,8 +412,6 @@ epicsTimerNotify::expireStatus currentTime::expire ( const epicsTime & ) curFileTime.HighPart = ft.dwHighDateTime; } - EnterCriticalSection ( & this->mutex ); - LONGLONG perfCounterDiff; if ( curPerfCounter.QuadPart >= this->lastPerfCounterPLL ) { perfCounterDiff = curPerfCounter.QuadPart - this->lastPerfCounterPLL; From b27e22d75e8e36fd51f8855a4d8ee24351cd11d9 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 14 Nov 2011 12:33:07 -0600 Subject: [PATCH 10/12] Makefile cleanup Various minor changes to comments and build variable names. --- configure/CONFIG_ADDONS | 3 ++- configure/CONFIG_COMMON | 5 ++--- src/RTEMS/base/Makefile | 15 +++++++-------- src/bpt/Makefile | 3 ++- src/cas/example/directoryService/Makefile | 4 ++-- src/excas/Makefile | 4 ++-- src/makeBaseApp/top/caServerApp/Makefile | 16 ++++++++-------- src/rec/Makefile | 5 ++--- 8 files changed, 27 insertions(+), 28 deletions(-) diff --git a/configure/CONFIG_ADDONS b/configure/CONFIG_ADDONS index f86b30185..7fdff395d 100644 --- a/configure/CONFIG_ADDONS +++ b/configure/CONFIG_ADDONS @@ -1,5 +1,5 @@ #************************************************************************* -# Copyright (c) 2002 The University of Chicago, as Operator of Argonne +# Copyright (c) 2011 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. @@ -34,6 +34,7 @@ # LIBSRCS source files for building libraries (deprecated) # PROD_OBJS object files for building prods # LIB_OBJS object files for building libraries +# USR_OBJS object files for building libraries and prods # USR_LIBS libs needed by PROD and TESTPROD and LIBRARY # PROD_LIBS libs needed by PROD and TESTPROD # LIB_LIBS libs needed by shared LIBRARY diff --git a/configure/CONFIG_COMMON b/configure/CONFIG_COMMON index 20aa9ccec..4527e997a 100644 --- a/configure/CONFIG_COMMON +++ b/configure/CONFIG_COMMON @@ -1,10 +1,9 @@ #************************************************************************* -# Copyright (c) 2002 The University of Chicago, as Operator of Argonne +# Copyright (c) 2011 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 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. #************************************************************************* # diff --git a/src/RTEMS/base/Makefile b/src/RTEMS/base/Makefile index 98d24509f..e77beeeb7 100644 --- a/src/RTEMS/base/Makefile +++ b/src/RTEMS/base/Makefile @@ -12,15 +12,14 @@ include $(TOP)/configure/CONFIG INC += epicsRtemsInitHooks.h -SRCS += rtems_init.c -SRCS += rtems_config.c -SRCS += rtems_netconfig.c -SRCS += rtems_util.c -SRCS += setBootConfigFromNVRAM.c -SRCS += epicsRtemsInitHookPre.c -SRCS += epicsRtemsInitHookPost.c +rtemsCom_SRCS += rtems_init.c +rtemsCom_SRCS += rtems_config.c +rtemsCom_SRCS += rtems_netconfig.c +rtemsCom_SRCS += rtems_util.c +rtemsCom_SRCS += setBootConfigFromNVRAM.c +rtemsCom_SRCS += epicsRtemsInitHookPre.c +rtemsCom_SRCS += epicsRtemsInitHookPost.c LIBRARY_RTEMS = rtemsCom -LIBRARY_SRCS = $(SRCS) $(BUILD_ARCHS) include $(TOP)/configure/RULES diff --git a/src/bpt/Makefile b/src/bpt/Makefile index f78b13d98..231c1b105 100644 --- a/src/bpt/Makefile +++ b/src/bpt/Makefile @@ -22,7 +22,8 @@ DBD += bptTypeKdegF.dbd PROD_LIBS = Com PROD_HOST += makeBpt -makeBpt_SRCS=makeBpt + +makeBpt_SRCS = makeBpt include $(TOP)/configure/RULES diff --git a/src/cas/example/directoryService/Makefile b/src/cas/example/directoryService/Makefile index d6b4aefb7..af38f906a 100644 --- a/src/cas/example/directoryService/Makefile +++ b/src/cas/example/directoryService/Makefile @@ -23,8 +23,8 @@ PROD_LIBS := cas ca gdd Com # PROD_SYS_LIBS_WIN32 := ws2_32 advapi32 user32 -SRCS += main.cc -SRCS += directoryServer.cc +caDirServ_SRCS += main.cc +caDirServ_SRCS += directoryServer.cc PROD_HOST = caDirServ diff --git a/src/excas/Makefile b/src/excas/Makefile index 0d4d51638..aed68cd74 100644 --- a/src/excas/Makefile +++ b/src/excas/Makefile @@ -1,5 +1,5 @@ #************************************************************************* -# Copyright (c) 2002 The University of Chicago, as Operator of Argonne +# Copyright (c) 2011 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. @@ -19,7 +19,7 @@ SRC_DIRS += $(TOP)/src/makeBaseApp/top/caServerApp # # Added ws2_32 winmm user32 for the non-dll build # -SYS_PROD_LIBS_WIN32 += ws2_32 advapi32 user32 +PROD_SYS_LIBS_WIN32 += ws2_32 advapi32 user32 PROD_HOST = excas diff --git a/src/makeBaseApp/top/caServerApp/Makefile b/src/makeBaseApp/top/caServerApp/Makefile index 8584b8804..0195112ac 100644 --- a/src/makeBaseApp/top/caServerApp/Makefile +++ b/src/makeBaseApp/top/caServerApp/Makefile @@ -17,15 +17,15 @@ PROD_LIBS += $(EPICS_BASE_HOST_LIBS) # # Added ws2_32 winmm user32 for the non-dll build # -SYS_PROD_LIBS_WIN32 += ws2_32 advapi32 user32 +PROD_SYS_LIBS_WIN32 += ws2_32 advapi32 user32 -SRCS += main.cc -SRCS += exServer.cc -SRCS += exPV.cc -SRCS += exVectorPV.cc -SRCS += exScalarPV.cc -SRCS += exAsyncPV.cc -SRCS += exChannel.cc +casexample_SRCS += main.cc +casexample_SRCS += exServer.cc +casexample_SRCS += exPV.cc +casexample_SRCS += exVectorPV.cc +casexample_SRCS += exScalarPV.cc +casexample_SRCS += exAsyncPV.cc +casexample_SRCS += exChannel.cc PROD_HOST = casexample diff --git a/src/rec/Makefile b/src/rec/Makefile index 0d4b78aa8..325bc750b 100644 --- a/src/rec/Makefile +++ b/src/rec/Makefile @@ -1,10 +1,9 @@ #************************************************************************* -# Copyright (c) 2002 The University of Chicago, as Operator of Argonne +# Copyright (c) 2011 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 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. #************************************************************************* TOP=../.. From 967ce8eb8427899451f78679d56bba3ae5b2ec8e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 14 Nov 2011 14:03:22 -0600 Subject: [PATCH 11/12] Creating 3.14.12.2-pre1 Set version number, update release notes. --- configure/CONFIG_BASE_VERSION | 14 +++---- documentation/RELEASE_NOTES.html | 69 ++++++++++++++++++++++++++++++-- 2 files changed, 73 insertions(+), 10 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index 8a5ae824a..cf6b727d8 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -1,5 +1,5 @@ #************************************************************************* -# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne +# Copyright (c) 2011 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. @@ -19,22 +19,22 @@ BASE_3_14=YES -# EPICS_VERSION must be a number >0 and <256 +# EPICS_VERSION must be a number >0 and <256 EPICS_VERSION = 3 -# EPICS_REVISION must be a number >=0 and <256 +# EPICS_REVISION must be a number >=0 and <256 EPICS_REVISION = 14 -# EPICS_MODIFICATION must be a number >=0 and <256 +# EPICS_MODIFICATION must be a number >=0 and <256 EPICS_MODIFICATION = 12 # EPICS_PATCH_LEVEL must be a number (win32 resource file requirement) # Not included if zero -EPICS_PATCH_LEVEL = 1 +EPICS_PATCH_LEVEL = 2 # This will end in -DEV between official releases -EPICS_DEV_SNAPSHOT=-DEV -#EPICS_DEV_SNAPSHOT=-pre1 +#EPICS_DEV_SNAPSHOT=-DEV +EPICS_DEV_SNAPSHOT=-pre1 #EPICS_DEV_SNAPSHOT=-pre1-DEV #EPICS_DEV_SNAPSHOT=-pre2 #EPICS_DEV_SNAPSHOT=-pre2-DEV diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 23523aaab..d05102908 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -3,16 +3,79 @@ - EPICS Base R3.14.12.2 Release Notes + EPICS Base R3.14.12.2-pre1 Release Notes -

EPICS Base Release 3.14.12.2

+

EPICS Base Release 3.14.12.2-pre1

-

Changes between 3.14.12.1 and 3.14.12.2

+

Changes between 3.14.12.1 and 3.14.12.2-pre1

+

Launchpad Bugs Resolved

+ +

The following are links to bugs in the Launchpad bug tracker that have been +fixed in this release:

+ + + +

Added database sanity checks to iocInit

+ +

Two menus may legitimately be modified by users; some checks have been added +that run at iocInit and make sure the choices haven't been changed too much for +the IOC to function properly:

+ +
    +
  • menuConvert is checked to flag problems with IOCs converted from + 3.13.x, where the SLOPE choice didn't exist.

    +
  • menuScan is checked to ensure the three initial choices are still + present and that there is at least one periodic scan rate.
  • +
+

Fix various catools issues

Array handling in the caget and camonitor programs has been debugged, fixing From b48979f5a50d236a8b853d348cce125d05fc9075 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 14 Nov 2011 14:07:02 -0600 Subject: [PATCH 12/12] Set snapshot to 3.14.12.2-pre1-DEV --- configure/CONFIG_BASE_VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index cf6b727d8..3061fd41b 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -34,8 +34,8 @@ EPICS_PATCH_LEVEL = 2 # This will end in -DEV between official releases #EPICS_DEV_SNAPSHOT=-DEV -EPICS_DEV_SNAPSHOT=-pre1 -#EPICS_DEV_SNAPSHOT=-pre1-DEV +#EPICS_DEV_SNAPSHOT=-pre1 +EPICS_DEV_SNAPSHOT=-pre1-DEV #EPICS_DEV_SNAPSHOT=-pre2 #EPICS_DEV_SNAPSHOT=-pre2-DEV #EPICS_DEV_SNAPSHOT=-rc1