From b041041518c33c79d47007315b8e9953fbc6376a Mon Sep 17 00:00:00 2001 From: "J. Lewis Muir" Date: Wed, 18 Feb 2015 15:46:05 -0600 Subject: [PATCH 01/11] doc: fix typos and list of files in documentation directory --- documentation/README.1st | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/documentation/README.1st b/documentation/README.1st index 6d1142fdb..b5b85f2d3 100644 --- a/documentation/README.1st +++ b/documentation/README.1st @@ -100,7 +100,7 @@ later. GNU readline or Tecla library - 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. @@ -124,7 +124,7 @@ EPICS documentation is available through the [3]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 @@ -137,7 +137,7 @@ base/configure Operating system independent build config files base/configure/os Operating system dependent build config files base/configure/tools Perl and shell scripts used in the build - base/documentation Distributation documentation + base/documentation Distribution documentation base/src All epics base source code in subdirectories base/src/RTEMS Code to configure RTEMS for EPICS base/src/as Access security @@ -170,7 +170,7 @@ base/src/libCom/macLib Macro substitution handler base/src/libCom/misc Miscellaneous utilities base/src/libCom/osi Operating system independent API - base/src/libCom/osi/os Operating system dependant code in subdirectories + base/src/libCom/osi/os Operating system dependent code in subdirectories base/src/libCom/ring Methods for creating and using ring buffers base/src/libCom/taskwd Task watchdog base/src/libCom/test Test tools (timer, semBinary, semMutex,fdmgr, ...) @@ -206,14 +206,14 @@ 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 - README.WIN32 Microsoft WIN32 specific instructions - README.cxxTemplates Information about C++ templates in EPICS base + README.MS_Windows Microsoft Windows specific instructions + README.cris Axis CRIS specific instructions + README.darwin.html Installation notes for OS X (Darwin) README.niCpu030 NI cpu030 specific instructions - README.darwin Installation notes for Mac OS X (Darwin) RELEASE_NOTES.html Notes on release changes KnownProblems.html List of known problems and workarounds Converting*To*.html Release specific conversion instructions @@ -240,7 +240,7 @@ CONFIG_BASE_VERSION Definitions for EPICS base version number CONFIG_COMMON Definitions common to all builds CONFIG_ENV Definitions of EPICS environment variables - 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 CONFIG_APP_INCLUDE @@ -271,7 +271,7 @@ base/src/tools directory - contains Perl scripts used for the build Makefile Makefile for installing the scripts into cfg dir - convertRelease.pl Performs consistancy checks on RELEASE files + convertRelease.pl Performs consistency checks on RELEASE files cvsclean.pl Remove all .#* files in directory tree dos2unix.pl Converts text file from DOS CR/LF to unix ISO expandvars.pl Tool to expand @VAR@ variables while copying a file From 836d81f0b75dc44a0275f8accc4dc2c3ac552c47 Mon Sep 17 00:00:00 2001 From: "J. Lewis Muir" Date: Wed, 18 Feb 2015 16:55:09 -0600 Subject: [PATCH 02/11] doc: HTML: fix typos and list of files in documentation directory --- documentation/README.html | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/documentation/README.html b/documentation/README.html index f84dbfca5..620feffcc 100644 --- a/documentation/README.html +++ b/documentation/README.html @@ -1,4 +1,7 @@ + README - EPICS Base Installation Instructions @@ -102,7 +105,7 @@ For RTEMS targets, you need RTEMS core and toolset version 4.9.2 or later.

GNU readline or Tecla library
- 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. @@ -124,7 +127,7 @@

Documentation

EPICS documentation is available through the EPICS website at Argonne. -

Release specific documenataion can also be found in the base/documentation +

Release specific documentation can also be found in the base/documentation directory of the distribution.

Directory Structure

@@ -137,7 +140,7 @@ base/configure Operating system independent build config files base/configure/os Operating system dependent build config files base/configure/tools Perl and shell scripts used in the build - base/documentation Distributation documentation + base/documentation Distribution documentation base/src All epics base source code in subdirectories base/src/RTEMS Code to configure RTEMS for EPICS base/src/as Access security @@ -170,7 +173,7 @@ base/src/libCom/macLib Macro substitution handler base/src/libCom/misc Miscellaneous utilities base/src/libCom/osi Operating system independent API - base/src/libCom/osi/os Operating system dependant code in subdirectories + base/src/libCom/osi/os Operating system dependent code in subdirectories base/src/libCom/ring Methods for creating and using ring buffers base/src/libCom/taskwd Task watchdog base/src/libCom/test Test tools (timer, semBinary, semMutex,fdmgr, ...) @@ -210,14 +213,15 @@

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
-        README.WIN32         Microsoft WIN32 specific instructions
-        README.cxxTemplates  Information about C++ templates in EPICS base
+        README.MS_Windows    Microsoft Windows specific instructions
+        README.cris          Axis CRIS specific instructions
+        README.darwin.html   Installation notes for OS X (Darwin)
         README.niCpu030      NI cpu030 specific instructions
-        README.darwin        Installation notes for Mac OS X (Darwin)
         RELEASE_NOTES.html   Notes on release changes
         KnownProblems.html   List of known problems and workarounds
         Converting*To*.html  Release specific conversion instructions
@@ -246,7 +250,7 @@
         CONFIG_BASE_VERSION   Definitions for EPICS base version number
         CONFIG_COMMON         Definitions common to all builds
         CONFIG_ENV            Definitions of EPICS environment variables
-        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
         CONFIG_APP_INCLUDE
@@ -279,7 +283,7 @@
 

base/src/tools directory - contains Perl scripts used for the build

         Makefile                Makefile for installing the scripts into cfg dir
-        convertRelease.pl       Performs consistancy checks on RELEASE files
+        convertRelease.pl       Performs consistency checks on RELEASE files
         cvsclean.pl             Remove all .#* files in directory tree
         dos2unix.pl             Converts text file from DOS CR/LF to unix ISO
         expandvars.pl           Tool to expand @VAR@ variables while copying a file

From 9813fa6474d2c161723bd592eae5d0fec39723f1 Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Thu, 19 Feb 2015 15:55:48 -0600
Subject: [PATCH 03/11] db: Allow link fields to return a DOUBLE value

A dbCa link does a ca_get with type DBR_CTRL_DOUBLE
to populate its list of attribute values immediately
after connecting. If the target is a DBF_*LINK field
it used to return an error, preventing the link from
properly connecting. This change makes dbGetField()
return a single NAN value instead of rejecting the
request.

Fixes: lp:545358
---
 src/db/dbAccess.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/db/dbAccess.c b/src/db/dbAccess.c
index 787bdbe1e..068e59bd4 100644
--- a/src/db/dbAccess.c
+++ b/src/db/dbAccess.c
@@ -969,6 +969,11 @@ long epicsShareAPI dbGetField(DBADDR *paddr,short dbrType,
             if (nRequest && *nRequest > 1) *nRequest = 1;
             break;
 
+        case DBR_DOUBLE:    /* Needed for dbCa links */
+            if (nRequest && *nRequest) *nRequest = 1;
+            *(double *)pbuffer = epicsNAN;
+            goto done;
+
         case DBR_CHAR:
         case DBR_UCHAR:
             if (nRequest && *nRequest > 0) {

From e822d8d8c46def2ef128f2aa6e064de8ef8eb18a Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Thu, 19 Feb 2015 17:33:27 -0600
Subject: [PATCH 04/11] Suppress corrupt error output from dbStatic parser

The yyerror() routine gets called twice in some cases.
Don't print the yytext or input file location the second
time through -- yytext has already been freed, and the
user doesn't need to see the location twice.

Fixes lp:1422803
---
 src/dbStatic/dbYacc.y | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/dbStatic/dbYacc.y b/src/dbStatic/dbYacc.y
index b8cc9b4cf..24be58d87 100644
--- a/src/dbStatic/dbYacc.y
+++ b/src/dbStatic/dbYacc.y
@@ -266,12 +266,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)

From 3501fda48d5cf3f18d3de498618ad718a9785709 Mon Sep 17 00:00:00 2001
From: Michael Davidsaver 
Date: Thu, 19 Feb 2015 19:18:16 -0500
Subject: [PATCH 05/11] dbCa: dbCaPutLinkCallback prevent out of bounds write

The internal buffer of the caLink is sized based on the
number of elements of the destination PV.
---
 src/db/dbCa.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/db/dbCa.c b/src/db/dbCa.c
index 22870ba30..b35b5d80d 100644
--- a/src/db/dbCa.c
+++ b/src/db/dbCa.c
@@ -381,6 +381,8 @@ 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);
         }
         link_action |= CA_WRITE_NATIVE;

From c0cf25eeeea5d66f719cb2ae7bddb56e9451a82b Mon Sep 17 00:00:00 2001
From: Michael Davidsaver 
Date: Thu, 19 Feb 2015 19:18:27 -0500
Subject: [PATCH 06/11] dbCa: dbCaPutLinkCallback initialize entire array

CA links will write the full target array size.
Ensure that uninitialized elements are zeroed.
---
 src/db/dbCa.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/db/dbCa.c b/src/db/dbCa.c
index b35b5d80d..bb976bd5b 100644
--- a/src/db/dbCa.c
+++ b/src/db/dbCa.c
@@ -367,7 +367,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];
@@ -384,6 +384,10 @@ long dbCaPutLinkCallback(struct link *plink,short dbrType,
             if(nRequest>pca->nelements)
                 nRequest = pca->nelements;
             status = aConvert(&dbAddr, pbuffer, nRequest, pca->nelements, 0);
+            if(nRequestnelements) {
+                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;

From 3e6597be90848ccfd4f9449ada2d12aeac9b3475 Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 12:13:05 -0600
Subject: [PATCH 07/11] Applied record-support-santity-check.patch

---
 src/dbStatic/dbToRecordtypeH.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/dbStatic/dbToRecordtypeH.c b/src/dbStatic/dbToRecordtypeH.c
index a97a44f87..cfd62792f 100644
--- a/src/dbStatic/dbToRecordtypeH.c
+++ b/src/dbStatic/dbToRecordtypeH.c
@@ -228,12 +228,14 @@ int main(int argc,char **argv)
 	fprintf(outFile,"#ifdef __cplusplus\n");
 	fprintf(outFile,"extern \"C\" {\n");
 	fprintf(outFile,"#endif\n");
+        fprintf(outFile,"#include \n");
         fprintf(outFile,"#include \n");
 	pdbRecordType = (dbRecordType *)ellFirst(&pdbbase->recordTypeList);
 	while(pdbRecordType) {
 		fprintf(outFile,"static int %sRecordSizeOffset(dbRecordType *pdbRecordType)\n{\n",
 		pdbRecordType->name);
 	    fprintf(outFile,"    %sRecord *prec = 0;\n",pdbRecordType->name);
+	    fprintf(outFile,"  assert(pdbRecordType->no_fields==%u);\n", pdbRecordType->no_fields);
 	    for(i=0; ino_fields; i++) {
 		char	name[256];
 		int		j;

From a6af0daae9e5f854a310dc74a751e7d83e76ca6a Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 12:21:45 -0600
Subject: [PATCH 08/11] Applied linux-use-RT-thread-priorities.patch

---
 configure/CONFIG_SITE | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE
index 57779f637..22f9cef1f 100644
--- a/configure/CONFIG_SITE
+++ b/configure/CONFIG_SITE
@@ -176,7 +176,7 @@ COMPAT_313=NO
 #INSTALL_LOCATION=
 
 # Use POSIX thread priority scheduling (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

From a437768c9c4bd58a8267ab8842540a30160ebdc4 Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 12:25:28 -0600
Subject: [PATCH 09/11] Applied
 linux-runtime-disable-RT-priorities-if-not-supported.patch

---
 src/libCom/osi/os/posix/osdThread.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/libCom/osi/os/posix/osdThread.c b/src/libCom/osi/os/posix/osdThread.c
index 30583e162..0f1523549 100644
--- a/src/libCom/osi/os/posix/osdThread.c
+++ b/src/libCom/osi/os/posix/osdThread.c
@@ -57,6 +57,7 @@ typedef struct commonAttr{
     int                maxPriority;
     int                minPriority;
     int                schedPolicy;
+    int                usePolicy;
 } commonAttr;
 
 typedef struct epicsThreadOSD {
@@ -79,6 +80,7 @@ typedef struct epicsThreadOSD {
 typedef struct {
     int min_pri, max_pri;
     int policy;
+    int ok;
 } priAvailable;
 #endif
 
@@ -138,6 +140,8 @@ static void setSchedulingPolicy(epicsThreadOSD *pthreadInfo,int policy)
 #if defined (_POSIX_THREAD_PRIORITY_SCHEDULING)
     int status;
 
+    if(!pcommonAttr->usePolicy) return;
+
     status = pthread_attr_getschedparam(
         &pthreadInfo->attr,&pthreadInfo->schedParam);
     checkStatusOnce(status,"pthread_attr_getschedparam");
@@ -278,6 +282,7 @@ int           low, try;
 
     prm->min_pri = min;
     prm->max_pri = try_pri(max, prm->policy) ? max-1 : max;
+    prm->ok = 1;
 
     return 0;
 }
@@ -290,6 +295,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");
@@ -299,6 +305,7 @@ int          status;
 
     a_p->minPriority = arg.min_pri;
     a_p->maxPriority = arg.max_pri;
+    a_p->usePolicy = arg.ok;
 }
 #endif
 
@@ -608,6 +615,7 @@ epicsShareFunc void epicsShareAPI epicsThreadSetPriority(epicsThreadId pthreadIn
     pthreadInfo->osiPriority = priority;
     if(!pthreadInfo->isFifoScheduled) return;
 #if defined (_POSIX_THREAD_PRIORITY_SCHEDULING) 
+    if(!pcommonAttr->usePolicy) return;
     pthreadInfo->schedParam.sched_priority = getOssPriorityValue(pthreadInfo);
     status = pthread_attr_setschedparam(
         &pthreadInfo->attr,&pthreadInfo->schedParam);

From 0fa8702842136a5b29c22dc7b9caed4eb7a0d852 Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 12:34:53 -0600
Subject: [PATCH 10/11] Applied test-epicsTimerQueue-reference-counter.patch

---
 src/libCom/test/epicsTimerTest.cpp | 38 +++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/libCom/test/epicsTimerTest.cpp b/src/libCom/test/epicsTimerTest.cpp
index 25264e1e1..43a6528b3 100644
--- a/src/libCom/test/epicsTimerTest.cpp
+++ b/src/libCom/test/epicsTimerTest.cpp
@@ -29,6 +29,41 @@
 #define verify(exp) ((exp) ? (void)0 : \
     epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
 
+class notified : public epicsTimerNotify
+{
+public:
+    bool done;
+    notified() : epicsTimerNotify(), done(false) {}
+
+    expireStatus expire(const epicsTime ¤tTime)
+    {done=true; return expireStatus(noRestart);}
+};
+
+void testRefCount()
+{
+    notified action;
+
+    epicsTimerQueueActive *Q1, *Q2;
+    epicsTimer *T1, *T2;
+
+    Q1 = &epicsTimerQueueActive::allocate ( true, epicsThreadPriorityMin );
+
+    T1 = &Q1->createTimer();
+    //timer->start(action, 0.0);
+
+    Q2 = &epicsTimerQueueActive::allocate ( true, epicsThreadPriorityMin );
+
+    testOk1(Q1==Q2);
+
+    T2 = &Q2->createTimer();
+
+    T2->destroy();
+    Q2->release();
+
+    T1->destroy();
+    Q1->release();
+}
+
 static const double delayVerifyOffset = 1.0; // sec 
 
 class delayVerify : public epicsTimerNotify {
@@ -419,7 +454,8 @@ void testPeriodic ()
 
 MAIN(epicsTimerTest)
 {
-    testPlan(40);
+    testPlan(41);
+    testRefCount();
     testAccuracy ();
     testCancel ();
     testExpireDestroy ();

From 4cf3613ace5e3e6abd15fd82a50a8cb09910143e Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 12:38:26 -0600
Subject: [PATCH 11/11] Applied missing-header.patch

---
 src/libCom/cxxTemplates/epicsSingleton.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libCom/cxxTemplates/epicsSingleton.h b/src/libCom/cxxTemplates/epicsSingleton.h
index b97c82b8c..cece8007c 100644
--- a/src/libCom/cxxTemplates/epicsSingleton.h
+++ b/src/libCom/cxxTemplates/epicsSingleton.h
@@ -19,6 +19,7 @@
 #define epicsSingleton_h
 
 #include 
+#include 
 
 #include "shareLib.h"
 #include "epicsAssert.h"