From f874913cf795e6dcbbc7559965ff98848bf6b9b7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 13 Feb 2015 12:17:24 -0600 Subject: [PATCH 1/9] Fix epicsExceptionTest on darwin Clang's optimizer seems to elide the new (nothrow) if we don't actually observe the value of p... --- src/libCom/test/epicsExceptionTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libCom/test/epicsExceptionTest.cpp b/src/libCom/test/epicsExceptionTest.cpp index a15b49672..53f56c32d 100644 --- a/src/libCom/test/epicsExceptionTest.cpp +++ b/src/libCom/test/epicsExceptionTest.cpp @@ -77,7 +77,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"); From 26d60bc516b83720f6863d105ae8e7541bd50ab2 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 13 Feb 2015 15:29:08 -0600 Subject: [PATCH 2/9] Attempt to fix Windows test failures epicsMessageQueue test wasn't printing the last test result. --- src/libCom/test/epicsMessageQueueTest.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libCom/test/epicsMessageQueueTest.cpp b/src/libCom/test/epicsMessageQueueTest.cpp index f9c1d98fa..5b0f46490 100644 --- a/src/libCom/test/epicsMessageQueueTest.cpp +++ b/src/libCom/test/epicsMessageQueueTest.cpp @@ -10,8 +10,6 @@ * $Revision-Id$ * * Author W. Eric Norum - * norume@aps.anl.gov - * 630 252 4793 */ #include #include @@ -109,6 +107,7 @@ receiver(void *arg) testDiag("Sender %d -- %d messages", sender, expectmsg[sender-1]-1); } testOk1(errors == 0); + testDiag("Receiver finished"); epicsEventSignal(finished); } @@ -126,6 +125,7 @@ sender(void *arg) epicsThreadSleep(0.005 * (randBelow(5))); epicsThreadSleep(0.005 * (randBelow(20))); } + testDiag("%s exiting, sent %d messages", epicsThreadGetNameSelf(), i-1); } extern "C" void messageQueueTest(void *parm) @@ -273,13 +273,13 @@ extern "C" void messageQueueTest(void *parm) * Single receiver, multiple sender tests */ testDiag("Single receiver, multiple sender tests:"); - testDiag("This test takes 5 minutes..."); + 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); - epicsThreadSleep(300.0); + epicsThreadSleep(60.0); testExit = 1; } @@ -295,6 +295,7 @@ MAIN(epicsMessageQueueTest) messageQueueTest, NULL); epicsEventWait(finished); + epicsThreadSleep(1.0); return testDone(); } From 2e4d8b31ff43b2595b81530452451c293c1090ef Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 13 Feb 2015 15:56:50 -0600 Subject: [PATCH 3/9] Mark windows-x64 Math failures as TODO --- src/libCom/test/epicsMathTest.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/libCom/test/epicsMathTest.c b/src/libCom/test/epicsMathTest.c index 527dd2922..8ea763cf0 100644 --- a/src/libCom/test/epicsMathTest.c +++ b/src/libCom/test/epicsMathTest.c @@ -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)"); From c5ded30684a27292923140834d46d661fdeedbfd Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 16 Feb 2015 16:30:52 -0600 Subject: [PATCH 4/9] Extended asTrapWrite to provide put data Backwards-compatible enhancement to the asTrapWrite API to provide listener routines with the data being put by the client. The asTrapWriteMessage structure is extended with 3 new fields for data type, element count and a pointer to the source buffer. Tim Mooney requested this enhancement for his caPutRecorder code, which doesn't work if the record overwrites the new value within its process() routine, e.g. when jogging a motor record. --- documentation/RELEASE_NOTES.html | 25 +++++++++++++++ src/as/asLib.h | 46 ++++++++++++++++---------- src/as/asTrapWrite.c | 55 ++++++++++++++++++-------------- src/as/asTrapWrite.h | 8 +++-- src/rsrv/camessage.c | 9 +++--- 5 files changed, 96 insertions(+), 47 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index f95eb2e03..837b7e024 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,31 @@ +

Enhanced API for asTrapWrite listeners

+ +

External software such as the CA Put Logging module that registers a listener +with the asTrapWrite subsystem was not previously given access to the actual +data being sent by the CA client. In most cases this was not a problem as the +listener can look at the field being modified both before and after the +operation, but if the put processes the record which immediately overwrites the +new value, the client's value cannot be observed.

+ +

This release adds three fields to the asTrapWriteMessage structure that is +passed to the listener routines. These new fields provide the CA data type, the +number of array elements, and a pointer to the source data buffer. This change +is completely backwards compatible with listener code written against the +original API. The new API can be detected at compile-time as follows:

+ +
+#include "asLib.h"
+
+/* ... */
+
+#ifdef asTrapWriteWithData
+    /* Enhanced API */
+#endif
+
+

Back-ported the tapfiles build target from 3.15

This GNUmake target runs the same tests as the runtests target, but diff --git a/src/as/asLib.h b/src/as/asLib.h index b3da2f836..2a420a23b 100644 --- a/src/as/asLib.h +++ b/src/as/asLib.h @@ -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); diff --git a/src/as/asTrapWrite.c b/src/as/asTrapWrite.c index 7c2536f93..65a77f09f 100644 --- a/src/as/asTrapWrite.c +++ b/src/as/asTrapWrite.c @@ -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 */ @@ -100,47 +99,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) @@ -148,20 +153,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); } diff --git a/src/as/asTrapWrite.h b/src/as/asTrapWrite.h index ec34c5312..b8033cb94 100644 --- a/src/as/asTrapWrite.h +++ b/src/as/asTrapWrite.h @@ -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; diff --git a/src/rsrv/camessage.c b/src/rsrv/camessage.c index ba83af1b3..4ad28243a 100644 --- a/src/rsrv/camessage.c +++ b/src/rsrv/camessage.c @@ -814,10 +814,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 : "", - (void *) &pciu->addr ); + (void *) &pciu->addr, mp->m_dataType, mp->m_count, pPayload ); dbStatus = db_put_field( &pciu->addr, @@ -1819,11 +1819,12 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, return RSRV_OK; } - pciu->pPutNotify->asWritePvt = asTrapWriteBefore ( + pciu->pPutNotify->asWritePvt = asTrapWriteWithData ( pciu->asClientPVT, pciu->client->pUserName ? pciu->client->pUserName : "", pciu->client->pHostName ? pciu->client->pHostName : "", - (void *) &pciu->addr ); + (void *) &pciu->addr, mp->m_dataType, mp->m_count, + pciu->pPutNotify->dbPutNotify.pbuffer ); dbPutNotify(&pciu->pPutNotify->dbPutNotify); From 2f0e9172a4e26aed422cbcc5899f51aab1087a3e Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 17 Feb 2015 10:45:30 -0500 Subject: [PATCH 5/9] tool_lib.c: ensure output string is always set Ensure that val2str always writes to its output buffer, which is static and shared between all PVs. Should make bugs like lp:1418526 more obvious. --- src/catools/tool_lib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/catools/tool_lib.c b/src/catools/tool_lib.c index 080b6c3de..22ea66c7e 100644 --- a/src/catools/tool_lib.c +++ b/src/catools/tool_lib.c @@ -120,6 +120,7 @@ char *val2str (const void *v, unsigned type, int index) strcpy (str, "*** invalid type"); return str; } + strcpy (str, "!!!"); base_type = type % (LAST_TYPE+1); From b996e63beb2e90895423a543aae808a9793e1be6 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 17 Feb 2015 10:57:05 -0500 Subject: [PATCH 6/9] dbReadTest.c: flush errlog on exit as per lp:1419879 --- src/dbStatic/dbReadTest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbStatic/dbReadTest.c b/src/dbStatic/dbReadTest.c index c7a433232..d3771019d 100644 --- a/src/dbStatic/dbReadTest.c +++ b/src/dbStatic/dbReadTest.c @@ -86,5 +86,6 @@ int main(int argc,char **argv) dbReportDeviceConfig(pdbbase,stdout); */ dbFreeBase(pdbbase); + errlogFlush(); return(0); } From 2623c2f46f7a529ead9b687f515040bce69618e8 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 17 Feb 2015 11:01:49 -0500 Subject: [PATCH 7/9] dbStaticLib.c: clean pdbbase after free --- src/dbStatic/dbStaticLib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbStatic/dbStaticLib.c b/src/dbStatic/dbStaticLib.c index 8334ef7f6..fa6a1303d 100644 --- a/src/dbStatic/dbStaticLib.c +++ b/src/dbStatic/dbStaticLib.c @@ -727,6 +727,7 @@ void epicsShareAPI dbFreeBase(dbBase *pdbbase) dbPvdFreeMem(pdbbase); dbFreePath(pdbbase); free((void *)pdbbase); + pdbbase = NULL; return; } From 276ea54ee48976bc29f9682e1a5a3c2f8ce39149 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 17 Feb 2015 11:03:06 -0500 Subject: [PATCH 8/9] don't destroy locked mutex --- src/dbStatic/dbPvdLib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbStatic/dbPvdLib.c b/src/dbStatic/dbPvdLib.c index 43f9cd40f..49060366b 100644 --- a/src/dbStatic/dbPvdLib.c +++ b/src/dbStatic/dbPvdLib.c @@ -181,6 +181,7 @@ void dbPvdFreeMem(dbBase *pdbbase) ellDelete(&pbucket->list, (ELLNODE *)ppvdNode); free(ppvdNode); } + epicsMutexUnlock(pbucket->lock); epicsMutexDestroy(pbucket->lock); free(pbucket); } From 681a996bf0b2a10c2d267952bc9965fce27abb49 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 17 Feb 2015 13:59:13 -0600 Subject: [PATCH 9/9] Unifying rsrv error messages --- src/rsrv/camessage.c | 13 +++++-------- src/rsrv/camsgtask.c | 21 +++++++++++++-------- src/rsrv/caserverio.c | 17 +++++++---------- src/rsrv/caservertask.c | 8 ++++---- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/rsrv/camessage.c b/src/rsrv/camessage.c index ba83af1b3..e0521cf3a 100644 --- a/src/rsrv/camessage.c +++ b/src/rsrv/camessage.c @@ -274,21 +274,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 paddr=%p\n", - hostName, mp->m_available, mnum, (pciu?(void *)&pciu->addr:NULL)); + epicsPrintf ( "CAS: Request from %s => available=0x%x \tN=%u paddr=%p\n", + hostName, mp->m_available, mnum, (pciu ? (void *)&pciu->addr : 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 ); } } diff --git a/src/rsrv/camsgtask.c b/src/rsrv/camsgtask.c index a5133caf6..c1f112961 100644 --- a/src/rsrv/camsgtask.c +++ b/src/rsrv/camsgtask.c @@ -67,9 +67,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); } @@ -98,9 +99,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; } @@ -109,10 +109,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; } diff --git a/src/rsrv/caserverio.c b/src/rsrv/caserverio.c index 466e492f0..387bf210b 100644 --- a/src/rsrv/caserverio.c +++ b/src/rsrv/caserverio.c @@ -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; diff --git a/src/rsrv/caservertask.c b/src/rsrv/caservertask.c index 21bcba9f4..7c911d64b 100644 --- a/src/rsrv/caservertask.c +++ b/src/rsrv/caservertask.c @@ -252,7 +252,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 { @@ -266,7 +266,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 { @@ -551,7 +551,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 ); } } @@ -563,7 +563,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 ); } }