From 89784a114e96e019d73c76620e1dfbc22503b79b Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 25 Feb 2026 13:01:09 +0000 Subject: [PATCH 001/141] setup codeowners for the CODEOWNERS and documentation files --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..9b588f5c2 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +/.github/CODEOWNERS @epics-base/core-devs +/documentation/ @epics-base/documentation From 5b23dcb46652e5f359af1f72477987e21868abd5 Mon Sep 17 00:00:00 2001 From: ReBarsotti-HZB Date: Thu, 5 Mar 2026 18:43:14 +0100 Subject: [PATCH 002/141] Added Doxygen annotations to iocInit.h (#804) Doxygen annotations for iocInit.h --- documentation/Makefile.headers | 1 + modules/database/src/ioc/misc/iocInit.h | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/documentation/Makefile.headers b/documentation/Makefile.headers index bc14cf525..136a6dffc 100644 --- a/documentation/Makefile.headers +++ b/documentation/Makefile.headers @@ -83,6 +83,7 @@ database_HEADERS += dbUnitTest database_HEADERS += devSup database_HEADERS += drvSup database_HEADERS += initHooks +database_HEADERS += iocInit record_HEADERS += aaiRecord record_HEADERS += aaoRecord diff --git a/modules/database/src/ioc/misc/iocInit.h b/modules/database/src/ioc/misc/iocInit.h index 1acd8ee8f..7c9048428 100644 --- a/modules/database/src/ioc/misc/iocInit.h +++ b/modules/database/src/ioc/misc/iocInit.h @@ -7,7 +7,8 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* iocInit.h ioc initialization */ +/** @file iocInit.h + * @brief ioc initialization */ #ifndef INCiocInith #define INCiocInith @@ -22,15 +23,30 @@ enum iocStateEnum { extern "C" { #endif -/** Query present IOC run state +/** Query the present IOC run state * @since 3.15.8 */ DBCORE_API enum iocStateEnum getIocState(void); + +/** @brief Initalizes the IOC in two distinct parts - iocBuild and iocRun + */ DBCORE_API int iocInit(void); + +/** @brief Puts the IOC into a quiescent state without allowing the various internal threads it starts to actually run */ DBCORE_API int iocBuild(void); +/** @brief Allows to start an IOC without its Channel Access parts. It can then be shutdown cleanly using iocShutdown. + * Feature only intended to be used for test programs, not production IOCs. */ DBCORE_API int iocBuildIsolated(void); +/** @brief Brings the IOC online after iocBuild or iocPause*/ DBCORE_API int iocRun(void); + +/** @brief Freezes all internal operations + * + * the iocRun command can restart it from where it left off or the ioc can be shut down. Pausing may not always be safe as not all drivers and device support may have been written with the possibility of pausing an IOC in mind. + */ DBCORE_API int iocPause(void); + +/** @brief Exits the program, shutsdown the IOC */ DBCORE_API int iocShutdown(void); #ifdef __cplusplus From 01e10731632de3ff966568d81c19e5d62a4d821e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 10 Mar 2026 12:03:23 -0500 Subject: [PATCH 003/141] Fix editorconfig failure --- modules/database/src/ioc/misc/iocInit.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/database/src/ioc/misc/iocInit.h b/modules/database/src/ioc/misc/iocInit.h index 7c9048428..cf7cda3f7 100644 --- a/modules/database/src/ioc/misc/iocInit.h +++ b/modules/database/src/ioc/misc/iocInit.h @@ -7,7 +7,7 @@ * EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/** @file iocInit.h +/** @file iocInit.h * @brief ioc initialization */ #ifndef INCiocInith @@ -34,7 +34,7 @@ DBCORE_API int iocInit(void); /** @brief Puts the IOC into a quiescent state without allowing the various internal threads it starts to actually run */ DBCORE_API int iocBuild(void); -/** @brief Allows to start an IOC without its Channel Access parts. It can then be shutdown cleanly using iocShutdown. +/** @brief Allows to start an IOC without its Channel Access parts. It can then be shutdown cleanly using iocShutdown. * Feature only intended to be used for test programs, not production IOCs. */ DBCORE_API int iocBuildIsolated(void); /** @brief Brings the IOC online after iocBuild or iocPause*/ From e271752158dd23b6ca9aa0819a3914f9d1b52486 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 3 Mar 2026 13:29:17 -0600 Subject: [PATCH 004/141] Added -d option to caRepeater, sets debug level Added debug messages for client verification. With -d the repeater shows client events, e.g. $ caRepeater -d CA Repeater: Attached and initialized New client on port 60307 Verified 1 active clients New client on port 52541 Verified 2 active clients Client on port 60307 refused message Deleted client on port 60307 Client on port 52541 refused message Deleted client on port 52541 ^C Running "caRepeater -dd" also shows beacon forwarding and individual client verification: $ caRepeater -dd CA Repeater: Attached and initialized New client on port 49968 Client on port 49968 is alive Verified 1 active clients Sent to port 49968 Sent to port 49968 Sent to port 49968 New client on port 65377 Sent to port 49968 Client on port 49968 is alive Client on port 65377 is alive Verified 2 active clients Sent to port 49968 Sent to port 65377 Sent to port 49968 Sent to port 65377 Client on port 49968 refused message Deleted client on port 49968 Sent to port 65377 Sent to port 65377 Client on port 65377 refused message Deleted client on port 65377 ^C --- modules/ca/src/client/caRepeater.cpp | 13 ++++--- modules/ca/src/client/repeater.cpp | 54 +++++++++++++++++----------- modules/ca/src/client/udpiiu.h | 2 +- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/modules/ca/src/client/caRepeater.cpp b/modules/ca/src/client/caRepeater.cpp index c8385ba3b..5d7695057 100644 --- a/modules/ca/src/client/caRepeater.cpp +++ b/modules/ca/src/client/caRepeater.cpp @@ -47,19 +47,21 @@ static void usage(char* argv[]) { - fprintf(stderr, "Usage: %s -hv\n" + fprintf(stderr, "Usage: %s -hdv\n" "\n" " -h - Print this message\n" - " -v - Do not replace stdin/out/err with /dev/null\n", + " -d - Increment debug level and set verbose\n" + " -v - Verbose, don't suppress messages\n", argv[0]); } int main(int argc, char* argv[]) { + int debug = 0; bool detachinout = true; int opt; - while ((opt = getopt(argc, argv, "hv")) != -1) { + while ((opt = getopt(argc, argv, "dhv")) != -1) { switch (opt) { default: usage(argv); @@ -68,6 +70,9 @@ int main(int argc, char* argv[]) case 'h': usage(argv); return 0; + case 'd': + debug++; + // Fall through case 'v': detachinout = false; break; @@ -91,7 +96,7 @@ int main(int argc, char* argv[]) #endif (void)! chdir ( "/" ); - ca_repeater (); + ca_repeater ( debug ); return ( 0 ); } diff --git a/modules/ca/src/client/repeater.cpp b/modules/ca/src/client/repeater.cpp index c7b019051..9ccf071e3 100644 --- a/modules/ca/src/client/repeater.cpp +++ b/modules/ca/src/client/repeater.cpp @@ -70,6 +70,7 @@ #include "taskwd.h" #include "errlog.h" +#define DEBUG // Tell iocinf.h to define debugPrint #include "iocinf.h" #include "caProto.h" #include "udpiiu.h" @@ -85,6 +86,8 @@ static tsDLList < repeaterClient > client_list; static const unsigned short PORT_ANY = 0u; +static int debug = 0; + /* * makeSocket() */ @@ -128,10 +131,10 @@ static int makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock ) repeaterClient::repeaterClient ( const osiSockAddr &fromIn ) : from ( fromIn ), sock ( INVALID_SOCKET ) { -#ifdef DEBUG - unsigned port = ntohs ( from.ia.sin_port ); - debugPrintf ( ( "new client %u\n", port ) ); -#endif + if ( debug ) { + unsigned port = ntohs ( from.ia.sin_port ); + debugPrintf ( ( "New client on port %u\n", port ) ); + } } bool repeaterClient::connect () @@ -193,19 +196,19 @@ bool repeaterClient::sendMessage ( const void *pBuf, unsigned bufSize ) status = send ( this->sock, (char *) pBuf, bufSize, 0 ); if ( status >= 0 ) { assert ( static_cast ( status ) == bufSize ); -#ifdef DEBUG - epicsUInt16 port = ntohs ( this->from.ia.sin_port ); - debugPrintf ( ("Sent to %u\n", port ) ); -#endif + if ( debug > 1 ) { + epicsUInt16 port = ntohs ( this->from.ia.sin_port ); + debugPrintf ( ("Sent to port %u\n", port ) ); + } return true; } else { int errnoCpy = SOCKERRNO; if ( errnoCpy == SOCK_ECONNREFUSED ) { -#ifdef DEBUG - epicsUInt16 port = ntohs ( this->from.ia.sin_port ); - debugPrintf ( ("Client refused message %u\n", port ) ); -#endif + if ( debug ) { + epicsUInt16 port = ntohs ( this->from.ia.sin_port ); + debugPrintf ( ("Client on port %u refused message\n", port ) ); + } } else { char sockErrBuf[64]; @@ -221,10 +224,10 @@ repeaterClient::~repeaterClient () if ( this->sock != INVALID_SOCKET ) { epicsSocketDestroy ( this->sock ); } -#ifdef DEBUG - epicsUInt16 port = ntohs ( this->from.ia.sin_port ); - debugPrintf ( ( "Deleted client %u\n", port ) ); -#endif + if ( debug ) { + epicsUInt16 port = ntohs ( this->from.ia.sin_port ); + debugPrintf ( ( "Deleted client on port %u\n", port ) ); + } } void repeaterClient::operator delete ( void * ) @@ -286,6 +289,10 @@ bool repeaterClient::verify () if ( sockerrno == SOCK_EADDRINUSE ) { // Normal result, client using port + if ( debug > 1 ) { + epicsUInt16 port = ntohs ( this->from.ia.sin_port ); + debugPrintf ( ("Client on port %u is alive\n", port ) ); + } return true; } @@ -321,6 +328,9 @@ static void verifyClients ( tsFreeList < repeaterClient, 0x20 > & freeList ) freeList.release ( pclient ); } } + if ( debug ) { + debugPrintf ( ( "Verified %u active clients\n", theClients.count() ) ); + } client_list.add ( theClients ); } @@ -444,11 +454,11 @@ static void register_new_client ( osiSockAddr & from, client_list.remove ( *pNewClient ); pNewClient->~repeaterClient (); freeList.release ( pNewClient ); -# ifdef DEBUG + if ( debug ) { epicsUInt16 port = ntohs ( from.ia.sin_port ); - debugPrintf ( ( "Deleted repeater client=%u (error while sending ack)\n", + debugPrintf ( ( "Deleted repeater client on port %u, error sending ack\n", port ) ); -# endif + } } /* @@ -480,7 +490,7 @@ static void register_new_client ( osiSockAddr & from, /* * ca_repeater () */ -void ca_repeater () +void ca_repeater ( int setDebug ) { tsFreeList < repeaterClient, 0x20 > freeList; int size; @@ -489,6 +499,8 @@ void ca_repeater () unsigned short port; char * pBuf; + debug = setDebug; + pBuf = new char [MAX_UDP_RECV]; { @@ -504,7 +516,7 @@ void ca_repeater () */ if ( sockerrno == SOCK_EADDRINUSE ) { osiSockRelease (); - debugPrintf ( ( "CA Repeater: exiting because a repeater is already running\n" ) ); + debugPrintf ( ( "CA Repeater: Exiting, a repeater is already running\n" ) ); delete [] pBuf; return; } diff --git a/modules/ca/src/client/udpiiu.h b/modules/ca/src/client/udpiiu.h index 3b1177ece..f7964c5ab 100644 --- a/modules/ca/src/client/udpiiu.h +++ b/modules/ca/src/client/udpiiu.h @@ -59,7 +59,7 @@ LIBCA_API void epicsStdCall caRepeaterRegistrationMessage ( SOCKET sock, unsigned repeaterPort, unsigned attemptNumber ); extern "C" LIBCA_API void caRepeaterThread ( void * pDummy ); -LIBCA_API void ca_repeater ( void ); +LIBCA_API void ca_repeater ( int setDebug = 0 ); class cac; class cacContextNotify; From f4ccf7bc8ca6800aa3568d0b9d1ce4f7086760f1 Mon Sep 17 00:00:00 2001 From: Irie Railton <175622981+irierr@users.noreply.github.com> Date: Tue, 10 Mar 2026 17:48:05 +0000 Subject: [PATCH 005/141] iocsh command dbCreateRecord (#812) * skeleton for implementation of dbCreateRecord iocsh exposure * Add functionality of dbCreateRecordCallFunc Includes adding dependancy to iocInit.h and a new error type in dbStaticLib.h * Fix error message for case when adding record to IOC post init * add new error message for when no record name is passed and check for empty strings * add release note for dbCreateRecord IOC shell command * fix issues from codeql in release notes * fix documentation md based on codacy styling --- documentation/new-notes/PR-812.md | 16 ++++++ .../src/ioc/dbStatic/dbStaticIocRegister.c | 50 +++++++++++++++++++ .../database/src/ioc/dbStatic/dbStaticLib.h | 30 +++++------ 3 files changed, 82 insertions(+), 14 deletions(-) create mode 100644 documentation/new-notes/PR-812.md diff --git a/documentation/new-notes/PR-812.md b/documentation/new-notes/PR-812.md new file mode 100644 index 000000000..a15eabcca --- /dev/null +++ b/documentation/new-notes/PR-812.md @@ -0,0 +1,16 @@ +### Expose `dbCreateRecord` in IOC shell + +Add a new IOC shell command `dbCreateRecord` allowing for records to be created +from the shell. + +Only works when called before `iocInit` and will fail if called afterwards. + +The pdbbase variable, a record type, and the new record's name should be passed +as arguments. + +Example usage: + +```sh +dbCreateRecord(pdbbase, "ai", "example:ai") +iocInit() +``` diff --git a/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c b/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c index 26493f67a..c3dce5885 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c +++ b/modules/database/src/ioc/dbStatic/dbStaticIocRegister.c @@ -9,6 +9,7 @@ \*************************************************************************/ #include "iocsh.h" +#include "iocInit.h" #include "errSymTbl.h" #include "errlog.h" @@ -260,6 +261,54 @@ static void dbCreateAliasCallFunc(const iocshArgBuf *args) } } +static const iocshArg dbCreateRecordArg0 = { "recordType", iocshArgString}; +static const iocshArg dbCreateRecordArg1 = { "recordName", iocshArgString}; +static const iocshArg * const dbCreateRecordArgs[] = {&argPdbbase, &dbCreateRecordArg0, &dbCreateRecordArg1}; +static const iocshFuncDef dbCreateRecordFuncDef = { + "dbCreateRecord", + 3, + dbCreateRecordArgs, + "Add a new record to the database.\n" + "\n" + "Example: dbCreateRecord pdbbase ai record:name\n", +}; + +/** + * @brief Call function for dbCreateRecord iocsh command. + * Creates a new record in the database with the specified record type and record name. + * @param args The arguments passed from iocsh, where args[0] is the pointer to the database, + * args[1] is the record type name, and args[2] is the record name. + */ +static void dbCreateRecordCallFunc(const iocshArgBuf *args) +{ + DBENTRY ent; + long status; + enum iocStateEnum iocState; + + iocState = getIocState(); + if(iocState != iocVoid) { + status = S_dbLib_postInitRecRegister; + } + else { + dbInitEntry(*iocshPpdbbase, &ent); + if(!args[2].sval || (args[2].sval[0] == '\0')) { + status = S_dbLib_recordNameMissing; + } else if(!args[1].sval) { + status = S_dbLib_recordTypeNotFound; + } else { + status = dbFindRecordType(&ent, args[1].sval); + if(!status) { + status = dbCreateRecord(&ent, args[2].sval); + } + } + dbFinishEntry(&ent); + } + if(status) { + fprintf(stderr, ERL_ERROR ": %ld %s\n", status, errSymMsg(status)); + iocshSetError(1); + } +} + void dbStaticIocRegister(void) { iocshRegister(&dbDumpPathFuncDef, dbDumpPathCallFunc); @@ -278,4 +327,5 @@ void dbStaticIocRegister(void) iocshRegister(&dbPvdTableSizeFuncDef,dbPvdTableSizeCallFunc); iocshRegister(&dbReportDeviceConfigFuncDef, dbReportDeviceConfigCallFunc); iocshRegister(&dbCreateAliasFuncDef, dbCreateAliasCallFunc); + iocshRegister(&dbCreateRecordFuncDef, dbCreateRecordCallFunc); } diff --git a/modules/database/src/ioc/dbStatic/dbStaticLib.h b/modules/database/src/ioc/dbStatic/dbStaticLib.h index 6f772f27d..48f770dd5 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticLib.h +++ b/modules/database/src/ioc/dbStatic/dbStaticLib.h @@ -252,20 +252,22 @@ DBCORE_API void dbCatString(char **string, int *stringLength, extern int dbStaticDebug; extern int dbConvertStrict; -#define S_dbLib_recordTypeNotFound (M_dbLib|1) /* Record Type does not exist */ -#define S_dbLib_recExists (M_dbLib|3) /* Record Already exists */ -#define S_dbLib_recNotFound (M_dbLib|5) /* Record Not Found */ -#define S_dbLib_flddesNotFound (M_dbLib|7) /* Field Description Not Found */ -#define S_dbLib_fieldNotFound (M_dbLib|9) /* Field Not Found */ -#define S_dbLib_badField (M_dbLib|11) /* Bad Field value */ -#define S_dbLib_menuNotFound (M_dbLib|13) /* Menu not found */ -#define S_dbLib_badLink (M_dbLib|15) /* Bad Link Field */ -#define S_dbLib_nameLength (M_dbLib|17) /* Record Name is too long */ -#define S_dbLib_noRecSup (M_dbLib|19) /* Record support not found */ -#define S_dbLib_strLen (M_dbLib|21) /* String is too long */ -#define S_dbLib_noSizeOffset (M_dbLib|23) /* Missing SizeOffset Routine - No record support? */ -#define S_dbLib_outMem (M_dbLib|27) /* Out of memory */ -#define S_dbLib_infoNotFound (M_dbLib|29) /* Info item Not Found */ +#define S_dbLib_recordTypeNotFound (M_dbLib|1) /* Record Type does not exist */ +#define S_dbLib_recExists (M_dbLib|3) /* Record Already exists */ +#define S_dbLib_recNotFound (M_dbLib|5) /* Record Not Found */ +#define S_dbLib_flddesNotFound (M_dbLib|7) /* Field Description Not Found */ +#define S_dbLib_fieldNotFound (M_dbLib|9) /* Field Not Found */ +#define S_dbLib_badField (M_dbLib|11) /* Bad Field value */ +#define S_dbLib_menuNotFound (M_dbLib|13) /* Menu not found */ +#define S_dbLib_badLink (M_dbLib|15) /* Bad Link Field */ +#define S_dbLib_nameLength (M_dbLib|17) /* Record Name is too long */ +#define S_dbLib_noRecSup (M_dbLib|19) /* Record support not found */ +#define S_dbLib_strLen (M_dbLib|21) /* String is too long */ +#define S_dbLib_noSizeOffset (M_dbLib|23) /* Missing SizeOffset Routine - No record support? */ +#define S_dbLib_outMem (M_dbLib|27) /* Out of memory */ +#define S_dbLib_infoNotFound (M_dbLib|29) /* Info item Not Found */ +#define S_dbLib_postInitRecRegister (M_dbLib|31) /* IOC already initialized - No new records can be added */ +#define S_dbLib_recordNameMissing (M_dbLib|33) /* Record name is required */ #ifdef __cplusplus } From 2d8a6f91a902b4cc0e8d9e11accb070275dd98fe Mon Sep 17 00:00:00 2001 From: ronaldomercado Date: Wed, 18 Mar 2026 15:45:25 +0000 Subject: [PATCH 006/141] Use consistent language for string termination (#806) Avoid hyphen, prefer space: "null terminated" --- modules/ca/src/client/CAref.html | 2 +- modules/ca/src/client/cadef.h | 2 +- modules/ca/src/client/db_access.h | 2 +- modules/database/src/ioc/db/dbChannel.h | 4 +-- modules/database/src/ioc/db/dbConvert.c | 4 +-- modules/database/src/ioc/db/dbLink.h | 2 +- modules/libcom/src/dbmf/dbmf.h | 6 ++-- modules/libcom/src/env/envDefs.h | 2 +- modules/libcom/src/macLib/macCore.c | 2 +- modules/libcom/src/macLib/macLib.h | 4 +-- modules/libcom/src/macLib/macLibREADME | 4 +-- modules/libcom/src/misc/epicsString.h | 10 +++---- modules/libcom/src/osi/epicsStdio.h | 2 +- modules/libcom/src/yajl/yajl_gen.h | 2 +- modules/libcom/src/yajl/yajl_parse.h | 2 +- modules/libcom/test/epicsStringTest.c | 40 ++++++++++++------------- 16 files changed, 45 insertions(+), 45 deletions(-) diff --git a/modules/ca/src/client/CAref.html b/modules/ca/src/client/CAref.html index 9b5c95bb3..3d8568e9b 100644 --- a/modules/ca/src/client/CAref.html +++ b/modules/ca/src/client/CAref.html @@ -2751,7 +2751,7 @@ time.

Arguments

PVNAME
-
A nil terminated process variable name string. EPICS process control +
A null terminated process variable name string. EPICS process control function block database variable names are of the form "<record name>.<field name>". If the field name and the period separator are omitted then the "VAL" field is implicit. For example "RFHV01" and diff --git a/modules/ca/src/client/cadef.h b/modules/ca/src/client/cadef.h index d03328ed1..65afb5fee 100644 --- a/modules/ca/src/client/cadef.h +++ b/modules/ca/src/client/cadef.h @@ -465,7 +465,7 @@ typedef unsigned capri; * * See `caExample.c` in the example application created by `makeBaseApp.pl`. * - * \param[in] pChanName A nil terminated process variable name string. + * \param[in] pChanName A null terminated process variable name string. * \parblock * EPICS process control * function block database variable names are of the * form `.`. If the field name and the period diff --git a/modules/ca/src/client/db_access.h b/modules/ca/src/client/db_access.h index 62d693bea..75debf0b5 100644 --- a/modules/ca/src/client/db_access.h +++ b/modules/ca/src/client/db_access.h @@ -128,7 +128,7 @@ LIBCA_API extern const int epicsTypeToDBR_XXXX [lastEpicsType+1]; LIBCA_API extern const epicsType DBR_XXXXToEpicsType [LAST_BUFFER_TYPE+1]; /* values returned for each field type - * DBR_STRING returns a NULL terminated string + * DBR_STRING returns a null terminated string * DBR_SHORT returns an unsigned short * DBR_INT returns an unsigned short * DBR_FLOAT returns an IEEE floating point value diff --git a/modules/database/src/ioc/db/dbChannel.h b/modules/database/src/ioc/db/dbChannel.h index 56ce8c4d6..0daed5a9c 100644 --- a/modules/database/src/ioc/db/dbChannel.h +++ b/modules/database/src/ioc/db/dbChannel.h @@ -206,7 +206,7 @@ typedef struct chFilterIf { * * Optional. * \param filter Pointer to instance data. - * \param stringVal Value, not zero-terminated. + * \param stringVal Value, not null terminated. * \param stringLen Number of chars in \p stringVal. * \returns \p parse_stop on error, or \p parse_continue */ @@ -226,7 +226,7 @@ typedef struct chFilterIf { * * Optional. * \param filter Pointer to instance data. - * \param key Value not zero-terminated. + * \param key Value not null terminated. * \param stringLen Number of chars in \p key * \returns \p parse_stop on error, or \p parse_continue */ diff --git a/modules/database/src/ioc/db/dbConvert.c b/modules/database/src/ioc/db/dbConvert.c index 2b17358c4..2592c90fc 100644 --- a/modules/database/src/ioc/db/dbConvert.c +++ b/modules/database/src/ioc/db/dbConvert.c @@ -444,7 +444,7 @@ static long getCharChar(const dbAddr *paddr, if (paddr->pfldDes && paddr->pfldDes->field_type == DBF_STRING) { /* This is a DBF_STRING field being read as a long string. - * The buffer we return must be zero-terminated. + * The buffer we return must be null terminated. */ pdst[--nRequest] = 0; if (nRequest == 0) @@ -466,7 +466,7 @@ static long getCharUchar(const dbAddr *paddr, if (paddr->pfldDes && paddr->pfldDes->field_type == DBF_STRING) { /* This is a DBF_STRING field being read as a long string. - * The buffer we return must be zero-terminated. + * The buffer we return must be null terminated. */ pdst[--nRequest] = 0; if (nRequest == 0) diff --git a/modules/database/src/ioc/db/dbLink.h b/modules/database/src/ioc/db/dbLink.h index e53133541..3c374655b 100644 --- a/modules/database/src/ioc/db/dbLink.h +++ b/modules/database/src/ioc/db/dbLink.h @@ -111,7 +111,7 @@ typedef struct lset { /** @brief load constant long string from link type * * Usually called during IOC initialization, constant link types must copy a - * nil-terminated string up to size characters long to the buffer provided, + * null terminated string up to size characters long to the buffer provided, * and write the length of that string to the plen location. A non-constant * link type can use this as an early hint that subsequent calls to * dbGetLink() will request long string data, although this might change. diff --git a/modules/libcom/src/dbmf/dbmf.h b/modules/libcom/src/dbmf/dbmf.h index f1df3d31c..dd62b988d 100644 --- a/modules/libcom/src/dbmf/dbmf.h +++ b/modules/libcom/src/dbmf/dbmf.h @@ -64,7 +64,7 @@ LIBCOM_API void * dbmfMalloc(size_t bytes); * \brief Duplicate a string. * * Create a copy of the input string. - * \param str Pointer to the null-terminated string to be copied. + * \param str Pointer to the null terminated string to be copied. * \return A pointer to the new copy, or NULL on failure. */ LIBCOM_API char * dbmfStrdup(const char *str); @@ -73,7 +73,7 @@ LIBCOM_API char * dbmfStrdup(const char *str); * * Copy at most len bytes of the input string into a new buffer. If no nil * terminator is seen in the first \c len bytes a nil terminator is added. - * \param str Pointer to the null-terminated string to be copied. + * \param str Pointer to the null terminated string to be copied. * \param len Max number of bytes to copy. * \return A pointer to the new string, or NULL on failure. */ @@ -81,7 +81,7 @@ LIBCOM_API char * dbmfStrndup(const char *str, size_t len); /** * \brief Concatenate three strings. - * Returns a pointer to a null-terminated string made by concatenating the + * Returns a pointer to a null terminated string made by concatenating the * three input strings. * \param lhs Start string to which the others get concatenated to (left part). * \param mid Next string to be concatenated to the lhs (mid part). diff --git a/modules/libcom/src/env/envDefs.h b/modules/libcom/src/env/envDefs.h index a768d13c8..ec336704c 100644 --- a/modules/libcom/src/env/envDefs.h +++ b/modules/libcom/src/env/envDefs.h @@ -104,7 +104,7 @@ struct in_addr; * \return Pointer to the environment variable value string, or * NULL if no parameter value and default value was empty. * - * \post A terminating nil will be written to pBuf. + * \post A terminating '\0' will be written to pBuf to ensure it is null terminated. */ LIBCOM_API char * epicsStdCall envGetConfigParam(const ENV_PARAM *pParam, int bufDim, char *pBuf); diff --git a/modules/libcom/src/macLib/macCore.c b/modules/libcom/src/macLib/macCore.c index 34910b015..cd19988f5 100644 --- a/modules/libcom/src/macLib/macCore.c +++ b/modules/libcom/src/macLib/macCore.c @@ -794,7 +794,7 @@ static void refer ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, r++; /* translate name (may contain macro references); truncated - quietly if too long but always guaranteed zero-terminated */ + quietly if too long but always guaranteed to be null terminated */ trans( handle, entry, level + 1, macEnd, &r, &rn, rn + MAC_SIZE ); refname[MAC_SIZE] = '\0'; diff --git a/modules/libcom/src/macLib/macLib.h b/modules/libcom/src/macLib/macLib.h index 4ed7ead3c..45c8ad984 100644 --- a/modules/libcom/src/macLib/macLib.h +++ b/modules/libcom/src/macLib/macLib.h @@ -126,7 +126,7 @@ epicsStdCall macPutValue( * \brief Returns the value of a macro * \return Returns the length of the value string, <0 if undefined * - * \c value will be zero-terminated if the length of the value is less than + * \c value will be null terminated if the length of the value is less than * \c capacity. The return value is the number of characters copied to * \c value (see below for behavior if the macro is undefined). If \c capacity * is zero, no characters will be copied to \c value (which may be NULL) @@ -277,7 +277,7 @@ epicsStdCall macInstallMacros( * environment variables. It parses the string looking for such * references and passes them to macGetValue() for translation. It uses * malloc() to allocate space for the expanded string and returns a - * pointer to this null-terminated string. It returns NULL if the source + * pointer to this null terminated string. It returns NULL if the source * string contains any undefined references. */ LIBCOM_API char * diff --git a/modules/libcom/src/macLib/macLibREADME b/modules/libcom/src/macLib/macLibREADME index 9efcb9a20..66fc95ea5 100644 --- a/modules/libcom/src/macLib/macLibREADME +++ b/modules/libcom/src/macLib/macLibREADME @@ -36,7 +36,7 @@ c) long macGetValue ( MAC_HANDLE *handle, char *name, char *value, long maxlen ); Returns up to maxlen characters of the value of macro "name". "value" - will be zero-terminated if the length of the value is less than + will be null terminated if the length of the value is less than maxlen. The function value will be the number of characters copied to "value" (see below for behavior if the macro is undefined). If maxlen is zero, no characters will be copied to "value" (which can be NULL) @@ -161,7 +161,7 @@ d) char *macEnvExpand( char *src ); environment variables. It parses the string looking for such references and passes them to macGetValue() for translation. It uses malloc() to allocate space for the expanded string and returns a - pointer to this null-terminated string. It returns NULL if the source + pointer to this null terminated string. It returns NULL if the source string contains any undefined references. e) char *macDefExpand( char *src, MAC_HANDLE *macros ); diff --git a/modules/libcom/src/misc/epicsString.h b/modules/libcom/src/misc/epicsString.h index 8f7f2b001..eee26553a 100644 --- a/modules/libcom/src/misc/epicsString.h +++ b/modules/libcom/src/misc/epicsString.h @@ -37,7 +37,7 @@ extern "C" { * \p inbuf and \p outbuf to point to the same buffer and \p outsize and \p inlen * be equal, thus performing the character translation in-place. * - * \param outbuf buffer to copy string to. The resulting string will be zero-terminated as long as + * \param outbuf buffer to copy string to. The resulting string will be null terminated as long as * \p outsize is non-zero. * \param outsize length of output buffer not including the null-terminator. * \param inbuf buffer to copy from. Null byte terminates the string. @@ -59,7 +59,7 @@ LIBCOM_API int epicsStrnRawFromEscaped(char *outbuf, size_t outsize, * All other non-printable characters appear in form `\xHH` where HH are two hex digits. * Non-printable characters are determined by the C runtime library’s isprint() function. * - * \param outbuf buffer to copy string to. The resulting string will be zero-terminated as long as + * \param outbuf buffer to copy string to. The resulting string will be null terminated as long as * @p outsize is non-zero. * \param outsize length of output buffer not including the null-terminator. * \param inbuf buffer to copy from. Null byte will not terminates the string. @@ -159,12 +159,12 @@ LIBCOM_API int epicsStrnGlobMatch(const char *str, size_t len, const char *patte */ LIBCOM_API char * epicsStrtok_r(char *s, const char *delim, char **lasts); -/** \brief Calculates a hash of a null-terminated string +/** \brief Calculates a hash of a null terminated string * - * Calculates a hash of a null-terminated string. Initial seed may be provided which + * Calculates a hash of a null terminated string. Initial seed may be provided which * permits multiple strings to be combined into a single hash result. * - *\param str null-terminated string + *\param str null terminated string *\param seed Optionally provide seed to combine multiple strings in a single hash. Otherwise * set to 0. * diff --git a/modules/libcom/src/osi/epicsStdio.h b/modules/libcom/src/osi/epicsStdio.h index b2bda61a3..1dd560040 100644 --- a/modules/libcom/src/osi/epicsStdio.h +++ b/modules/libcom/src/osi/epicsStdio.h @@ -125,7 +125,7 @@ extern "C" { * correctly return the number of characters that would have been written when * the output gets truncated, it is not worth trying to fix this as long as * they return `size-1` instead; the resulting string must always be correctly - * terminated with a zero byte. + * null terminated. * * In some scenarios the epicsSnprintf() implementation may not provide the * correct C99 semantics for the return value when `size` is given as zero. diff --git a/modules/libcom/src/yajl/yajl_gen.h b/modules/libcom/src/yajl/yajl_gen.h index 50b163cd0..974e364f8 100644 --- a/modules/libcom/src/yajl/yajl_gen.h +++ b/modules/libcom/src/yajl/yajl_gen.h @@ -196,7 +196,7 @@ extern "C" { /** Finish generating a JSON array. */ YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand); - /** Access the zero-terminated generator buffer. If incrementally + /** Access the null terminated generator buffer. If incrementally * outputting JSON, one should call yajl_gen_clear() to clear the * buffer. This allows stream generation. */ YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand, diff --git a/modules/libcom/src/yajl/yajl_parse.h b/modules/libcom/src/yajl/yajl_parse.h index 2e5c2e34c..428e405a4 100644 --- a/modules/libcom/src/yajl/yajl_parse.h +++ b/modules/libcom/src/yajl/yajl_parse.h @@ -79,7 +79,7 @@ extern "C" { size_t numberLen); /** Strings are returned as pointers into the JSON text when - * possible. As a result they are _not_ zero-terminated. */ + * possible. As a result they are _not_ null terminated. */ int (* yajl_string)(void * ctx, const unsigned char * stringVal, size_t stringLen); diff --git a/modules/libcom/test/epicsStringTest.c b/modules/libcom/test/epicsStringTest.c index 08ede829b..77c53f041 100644 --- a/modules/libcom/test/epicsStringTest.c +++ b/modules/libcom/test/epicsStringTest.c @@ -313,13 +313,13 @@ MAIN(epicsStringTest) memset(result, 'x', sizeof(result)); status = epicsStrnEscapedFromRaw(result, 1, ABCD, 4); testOk(status == 4, "epicsStrnEscapedFromRaw(out, 1) -> %d (exp. 4)", status); - testOk(result[0] == 0, " 0-terminated"); + testOk(result[0] == 0, " null terminated"); testOk(result[1] == 'x', " No overrun"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 1, ABCD, 4); testOk(status == 0, "epicsStrnRawFromEscaped(out, 1) -> %d (exp. 0)", status); - testOk(result[0] == 0, " 0-terminated"); + testOk(result[0] == 0, " null terminated"); testOk(result[1] == 'x', " No overrun"); testDiag("Testing size = epicsStrnEscapedFromRawSize"); @@ -336,19 +336,19 @@ MAIN(epicsStringTest) memset(result, 'x', sizeof(result)); status = epicsStrnEscapedFromRaw(result, 4, ABCD, 3); testOk(status == 3, "esc(\"ABCD\", 3) -> %d (exp. 3)", status); - testOk(result[3] == 0, " 0-terminated"); + testOk(result[3] == 0, " null terminated"); testOk(result[4] == 'x', " No overrun"); memset(result, 'x', sizeof(result)); status = epicsStrnEscapedFromRaw(result, 4, ABCD, 4); testOk(status == 4, "esc(\"ABCD\", 4) -> %d (exp. 4)", status); - testOk(result[3] == 0, " 0-terminated"); + testOk(result[3] == 0, " null terminated"); testOk(result[4] == 'x', " No overrun"); memset(result, 'x', sizeof(result)); status = epicsStrnEscapedFromRaw(result, 4, ABCD, 5); testOk(status == 6, "esc(\"ABCD\", 5) -> %d (exp. 8)", status); - testOk(result[3] == 0, " 0-terminated"); + testOk(result[3] == 0, " null terminated"); testOk(result[4] == 'x', " No overrun"); testDiag("Testing raw = epicsStrnRawFromEscaped(out, 4, ...)"); @@ -356,20 +356,20 @@ MAIN(epicsStringTest) memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, ABCD, 0); testOk(status == 0, "raw(\"ABCD\", 0) -> %d (exp. 0)", status); - testOk(result[0] == 0, " 0-terminated"); + testOk(result[0] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, ABCD, 1); testOk(status == 1, "raw(\"ABCD\", 1) -> %d (exp. 1)", status); testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]); - testOk(result[1] == 0, " 0-terminated"); + testOk(result[1] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, ABCD, 2); testOk(status == 2, "raw(\"ABCD\", 2) -> %d (exp. 2)", status); testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]); testOk(result[1] == 'B', " Char '%c' (exp. 'B')", result[1]); - testOk(result[2] == 0, " 0-terminated"); + testOk(result[2] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, ABCD, 3); @@ -377,7 +377,7 @@ MAIN(epicsStringTest) testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]); testOk(result[1] == 'B', " Char '%c' (exp. 'B')", result[1]); testOk(result[2] == 'C', " Char '%c' (exp. 'C')", result[2]); - testOk(result[3] == 0, " 0-terminated"); + testOk(result[3] == 0, " null terminated"); testOk(result[4] == 'x', " No write outside buffer"); memset(result, 'x', sizeof(result)); @@ -386,7 +386,7 @@ MAIN(epicsStringTest) testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]); testOk(result[1] == 'B', " Char '%c' (exp. 'B')", result[1]); testOk(result[2] == 'C', " Char '%c' (exp. 'C')", result[2]); - testOk(result[3] == 0, " 0-terminated"); + testOk(result[3] == 0, " null terminated"); testOk(result[4] == 'x', " No write outside buffer"); memset(result, 'x', sizeof(result)); @@ -395,49 +395,49 @@ MAIN(epicsStringTest) testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]); testOk(result[1] == 'B', " Char '%c' (exp. 'B')", result[1]); testOk(result[2] == 'C', " Char '%c' (exp. 'C')", result[2]); - testOk(result[3] == 0, " 0-terminated"); + testOk(result[3] == 0, " null terminated"); testOk(result[4] == 'x', " No write outside buffer"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, "A", 2); testOk(status == 1, "raw(\"A\", 2) -> %d (exp. 1)", status); testOk(result[0] == 'A', " Char '%c' (exp. 'A')", result[0]); - testOk(result[status] == 0, " 0-terminated"); + testOk(result[status] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, "\\x12", 1); testOk(status == 0, "raw(\"\\x12\", 1) -> %d (exp. 0)", status); - testOk(result[status] == 0, " 0-terminated"); + testOk(result[status] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, "\\x12", 2); testOk(status == 0, "raw(\"\\x12\", 2) -> %d (exp. 0)", status); - testOk(result[status] == 0, " 0-terminated"); + testOk(result[status] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, "\\x12", 3); testOk(status == 1, "raw(\"\\x12\", 3) -> %d (exp. 1)", status); testOk(result[0] == 1, " Hex escape (got \\x%x)", result[0]); - testOk(result[status] == 0, " 0-terminated"); + testOk(result[status] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, "\\x12", 4); testOk(status == 1, "raw(\"\\x12\", 4) -> %d (exp. 1)", status); testOk(result[0] == 0x12," Hex escape (got \\x%x)", result[0]); - testOk(result[status] == 0, " 0-terminated"); + testOk(result[status] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, "\\xaF", 4); testOk(status == 1, "raw(\"\\xaF\", 4) -> %d (exp. 1)", status); testOk(result[0] == '\xaF'," Hex escape (got \\x%x)", result[0] & 0xFF); - testOk(result[status] == 0, " 0-terminated"); + testOk(result[status] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, "\\x012", 5); testOk(status == 2, "raw(\"\\x012\", 5) -> %d (exp. 2)", status); testOk(result[0] == 0x1," Hex escape (got \\x%x)", result[0]); testOk(result[1] == '2', " Terminator char got '%c'", result[1]); - testOk(result[status] == 0, " 0-terminated"); + testOk(result[status] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, "\\x0012", 6); @@ -445,14 +445,14 @@ MAIN(epicsStringTest) testOk(result[0] == 0," Hex escape (got \\x%x)", result[0]); testOk(result[1] == '1', " Terminator char got '%c'", result[1]); testOk(result[2] == '2', " Following char got '%c'", result[2]); - testOk(result[status] == 0, " 0-terminated"); + testOk(result[status] == 0, " null terminated"); memset(result, 'x', sizeof(result)); status = epicsStrnRawFromEscaped(result, 4, "\\x1g", 4); testOk(status == 2, "raw(\"\\x1g\", 4) -> %d (exp. 2)", status); testOk(result[0] == 1, " Hex escape (got \\x%x)", result[0]); testOk(result[1] == 'g', " Terminator char got '%c'", result[1]); - testOk(result[status] == 0, " 0-terminated"); + testOk(result[status] == 0, " null terminated"); testDistance(); testStrTok(); From 4dfd5c7694d5275338373a4818f6ae0b9453d1c6 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 31 Mar 2026 14:17:50 -0700 Subject: [PATCH 007/141] skip readline interactive setup when not interactive --- modules/libcom/src/iocsh/iocsh.cpp | 33 +++++++++++++++++------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index 1ea0d631b..37658c8f9 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -605,6 +605,7 @@ char** iocsh_attempt_completion(const char* word, int start, int end) struct ReadlineContext { void *context; + FILE *context_fp; #ifdef USE_READLINE // readline on BSD/OSX missing 'rl_completion_func_t' typedef, and 'const' char* prev_rl_readline_name; @@ -618,12 +619,14 @@ struct ReadlineContext { ReadlineContext() :context(NULL) + ,context_fp(NULL) {} bool setup(FILE *fp) { + context_fp = fp; context = epicsReadlineBegin(fp); #ifdef USE_READLINE - if(context) { + if(context && !fp) { prev_rl_readline_name = (char*)rl_readline_name; prev_rl_basic_word_break_characters = (char*)rl_basic_word_break_characters; prev_rl_completer_word_break_characters = (char*)rl_completer_word_break_characters; @@ -656,21 +659,23 @@ struct ReadlineContext { ~ReadlineContext() { if(context) { #ifdef USE_READLINE - if(!hist_file.empty()) { - if(int err = write_history(hist_file.c_str())) { - fprintf(epicsGetStderr(), - ERL_ERROR " %s (%d) writing '%s'\n", - strerror(err), err, hist_file.c_str()); + if(!context_fp) { + if(!hist_file.empty()) { + if(int err = write_history(hist_file.c_str())) { + fprintf(epicsGetStderr(), + ERL_ERROR " %s (%d) writing '%s'\n", + strerror(err), err, hist_file.c_str()); + } } + rl_readline_name = prev_rl_readline_name; + rl_basic_word_break_characters = prev_rl_basic_word_break_characters; + rl_completer_word_break_characters = prev_rl_completer_word_break_characters; + rl_basic_quote_characters = prev_rl_basic_quote_characters; + rl_completer_quote_characters = prev_rl_completer_quote_characters; + rl_attempted_completion_function = prev_rl_attempted_completion_function; + // cf. osdReadlineBegin() in gnuReadline.c + rl_bind_key('\t', rl_insert); } - rl_readline_name = prev_rl_readline_name; - rl_basic_word_break_characters = prev_rl_basic_word_break_characters; - rl_completer_word_break_characters = prev_rl_completer_word_break_characters; - rl_basic_quote_characters = prev_rl_basic_quote_characters; - rl_completer_quote_characters = prev_rl_completer_quote_characters; - rl_attempted_completion_function = prev_rl_attempted_completion_function; - // cf. osdReadlineBegin() in gnuReadline.c - rl_bind_key('\t', rl_insert); #endif epicsReadlineEnd(context); } From e181517de11640ae90a82fad8fa799f9deb48a47 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 31 Mar 2026 15:57:19 -0700 Subject: [PATCH 008/141] readline history, clear before append read_history() appends to the global history array. Clear before each read to prevent duplication. --- modules/libcom/src/iocsh/iocsh.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index 37658c8f9..3182a57b2 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -643,6 +643,7 @@ struct ReadlineContext { rl_bind_key('\t', rl_complete); compute_hist_file(); if(!hist_file.empty()) { + clear_history(); // clear as read_history() will append if(int err = read_history(hist_file.c_str())) { if(err!=ENOENT) fprintf(epicsGetStderr(), From d0c7992c698a67050533f094585a88cbd1579de5 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 25 Mar 2026 10:11:54 -0500 Subject: [PATCH 009/141] Check build arch's are known before creating build dirs --- configure/RULES_ARCHS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure/RULES_ARCHS b/configure/RULES_ARCHS index 0d4d944d4..2346e1b13 100644 --- a/configure/RULES_ARCHS +++ b/configure/RULES_ARCHS @@ -64,6 +64,9 @@ $(BUILD_ARCHS) : % : O.% O.Common $(ACTIONS) : % : $(foreach arch, $(BUILD_ARCHS), %$(DIVIDER)$(arch)) $(buildDirs): + $(if $(wildcard $(CONFIG)/os/CONFIG.Common.$(archPart) \ + $(CONFIG)/os/CONFIG.$(EPICS_HOST_ARCH).$(archPart)),, \ + $(error Base not configured to build target $(archPart))) $(PERL) $(TOOLS)/makeMakefile.pl $@ $(TOP)/.. O.Common: From 6ef94d744f4b6c16f534935a39aadfaf5494f129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Thu, 19 Mar 2026 11:03:15 -0300 Subject: [PATCH 010/141] Use deterministic timezones in epicsTimeZoneTest The DST characteristics of the POSIX EST5EDT and CST6CDT timezones depend on whether the implementation uses the built-in POSIX definition or reads an updated version from the tzdata files, and for POSIX timezones, there is no specified behavior [1]. To avoid any plaform-specific behavior, we can specify the desired DST ourselves. We used the timezone values available in configure/CONFIG_SITE_ENV, which already included DST information, and means the tests are consistent with our own usage. [1] https://www.openwall.com/lists/musl/2024/03/05/2 --- modules/libcom/test/epicsTimeZoneTest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/libcom/test/epicsTimeZoneTest.c b/modules/libcom/test/epicsTimeZoneTest.c index f10688765..8437a33ad 100644 --- a/modules/libcom/test/epicsTimeZoneTest.c +++ b/modules/libcom/test/epicsTimeZoneTest.c @@ -89,10 +89,10 @@ MAIN(epicsTimeZoneTest) * Mon Oct 19 13:00:16 2015 UTC */ testDiag("POSIX 1445259616"); - setTZ("EST5EDT"); + setTZ("EST5EDT,M3.2.0/2,M11.1.0/2"); test_localtime(1445259616ul, 16, 0, 9, 19, 9, 2015, 1, 291, 1); test_gmtime (1445259616ul, 16, 0, 13, 19, 9, 2015, 1, 291, 0); - setTZ("CST6CDT"); + setTZ("CST6CDT,M3.2.0/2,M11.1.0/2"); test_localtime(1445259616ul, 16, 0, 8, 19, 9, 2015, 1, 291, 1); test_gmtime (1445259616ul, 16, 0, 13, 19, 9, 2015, 1, 291, 0); #if defined(__rtems__) @@ -112,10 +112,10 @@ MAIN(epicsTimeZoneTest) * Wed Jan 14 14:15:31 2015 UTC */ testDiag("POSIX 1421244931"); - setTZ("EST5EDT"); + setTZ("EST5EDT,M3.2.0/2,M11.1.0/2"); test_localtime(1421244931ul, 31, 15, 9, 14, 0, 2015, 3, 13, 0); test_gmtime (1421244931ul, 31, 15, 14, 14, 0, 2015, 3, 13, 0); - setTZ("CST6CDT"); + setTZ("CST6CDT,M3.2.0/2,M11.1.0/2"); test_localtime(1421244931ul, 31, 15, 8, 14, 0, 2015, 3, 13, 0); test_gmtime (1421244931ul, 31, 15, 14, 14, 0, 2015, 3, 13, 0); #if defined(__rtems__) From 77a3b8110fa0daba3b015b195436f27d9d1eac55 Mon Sep 17 00:00:00 2001 From: Evan Daykin Date: Wed, 18 Mar 2026 16:12:21 -0400 Subject: [PATCH 011/141] use (s)rand() to generate RNDM calc values with a system clock nanosecond seed --- modules/libcom/src/calc/calcPerform.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/modules/libcom/src/calc/calcPerform.c b/modules/libcom/src/calc/calcPerform.c index 340078f82..14bc73bf8 100644 --- a/modules/libcom/src/calc/calcPerform.c +++ b/modules/libcom/src/calc/calcPerform.c @@ -20,6 +20,7 @@ #include "osiUnistd.h" #include "dbDefs.h" #include "epicsMath.h" +#include "epicsTime.h" #include "epicsTypes.h" #include "errlog.h" #include "postfix.h" @@ -505,22 +506,18 @@ calcArgUsage(const char *pinst, unsigned long *pinputs, unsigned long *pstores) return 0; } -/* Generate a random number between 0 and 1 using the algorithm - * seed = (multy * seed) + addy Random Number Generator by Knuth - * SemiNumerical Algorithms - * Chapter 1 - * randy = seed / 65535.0 To normalize the number between 0 - 1 - */ -static unsigned short seed = 0xa3bf; -static unsigned short multy = 191 * 8 + 5; /* 191 % 8 == 5 */ -static unsigned short addy = 0x3141; - static double calcRandom(void) { - seed = (seed * multy) + addy; - + static int seeded = 0; + static struct epicsTimeStamp ts; + if(!seeded) + { + epicsTimeGetMonotonic(&ts); + srand((unsigned) ts.nsec); + seeded = 1; + } /* between 0 - 1 */ - return (double) seed / 65535.0; + return (double) rand() / RAND_MAX; } /* Search the instruction stream for a matching operator, skipping any From 1c9ef9481872e3e62955f3c3d8ad8d1b72ebedda Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 16 Mar 2026 12:15:50 -0500 Subject: [PATCH 012/141] Fix the bug reported in #834, but behaves differently Adds tests and checks for unterminated macros, which are now reported but not expanded. --- modules/libcom/src/macLib/macCore.c | 32 +++++++++++++++++++++-------- modules/libcom/test/macLibTest.c | 16 ++++++++++++++- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/modules/libcom/src/macLib/macCore.c b/modules/libcom/src/macLib/macCore.c index cd19988f5..7a1f241f3 100644 --- a/modules/libcom/src/macLib/macCore.c +++ b/modules/libcom/src/macLib/macCore.c @@ -773,13 +773,14 @@ static void trans( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, static void refer ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, const char **rawval, char **value, char *valend ) { - const char *r = *rawval; + const char *r = *rawval + 1; /* step over '$' */ + const char *macEnd = (*r++ == '(') ? "=,)" : "=,}"; + const char close = macEnd[2]; /* Matching ')' or '}' */ char *v = *value; char refname[MAC_SIZE + 1] = {'\0'}; char *rn = refname; MAC_ENTRY *refentry; const char *defval = NULL; - const char *macEnd; const char *errval = NULL; int pop = FALSE; @@ -788,14 +789,14 @@ static void refer ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, printf( "refer-> entry = %p, level = %d, capacity = %u, rawval = %s\n", entry, level, (unsigned int)(valend - *value), *rawval ); - /* step over '$(' or '${' */ - r++; - macEnd = ( *r == '(' ) ? "=,)" : "=,}"; - r++; - /* translate name (may contain macro references); truncated quietly if too long but always guaranteed to be null terminated */ - trans( handle, entry, level + 1, macEnd, &r, &rn, rn + MAC_SIZE ); + { + int flags = handle->flags; + handle->flags |= FLAG_SUPPRESS_WARNINGS; + trans( handle, entry, level + 1, macEnd, &r, &rn, rn + MAC_SIZE ); + handle->flags = flags; + } refname[MAC_SIZE] = '\0'; /* Is there a default value? */ @@ -858,6 +859,21 @@ static void refer ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, handle->flags = flags; } + /* If the closing delimiter doesn't match the opener, pass through verbatim */ + if ( *r != close ) { + const char *p; + v = *value; + for ( p = *rawval; p <= r && v < valend; p++ ) + *v++ = *p; + *v = '\0'; + entry->error = TRUE; + if ( (handle->flags & FLAG_SUPPRESS_WARNINGS) == 0 ) + errlogPrintf( "macLib: " ANSI_MAGENTA("unterminated") + " macro reference in %s %s\n", + entry->type, entry->name ); + goto cleanup; + } + /* Now we can look up the translated name */ refentry = lookup( handle, refname, FALSE ); diff --git a/modules/libcom/test/macLibTest.c b/modules/libcom/test/macLibTest.c index eea6268dd..4c5f6824c 100644 --- a/modules/libcom/test/macLibTest.c +++ b/modules/libcom/test/macLibTest.c @@ -66,13 +66,25 @@ static void ovcheck(void) MAIN(macLibTest) { - testPlan(93); + testPlan(105); if (macCreateHandle(&h, NULL)) testAbort("macCreateHandle() failed"); eltc(0); check("FOO", " FOO"); + check("F(O){O}", " F(O){O}"); + check("F(O}{O)", " F(O}{O)"); + + check("x${FOO)", "!x${FOO)"); + check("x${FOO=bar)", "!x${FOO=bar)"); + check("x${FOO,bar)", "!x${FOO,bar)"); + check("x${FOO ${BAR", "!x${FOO ${BAR"); + + check("x$(FOO}", "!x$(FOO}"); + check("x$(FOO=bar}", "!x$(FOO=bar}"); + check("x$(FOO,bar}", "!x$(FOO,bar}"); + check("x$(FOO $(BAR", "!x$(FOO $(BAR"); check("$(FOO)", "!$(FOO,undefined)"); check("${FOO}", "!$(FOO,undefined)"); @@ -115,6 +127,8 @@ MAIN(macLibTest) check("${=BAR}", " BAR"); check("x${=BAR}y", " xBARy"); + check("x(${=)}y", " x()y"); + check("x{$(=})y", " x{}y"); check("${FOO=BAR}", " BAR"); check("x${FOO=BAR}y", " xBARy"); From 05c27e453c08ffddd0f366e989173a1f6a5771f3 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 16 Mar 2026 12:16:39 -0500 Subject: [PATCH 013/141] Color the keywords in macLib errors --- modules/libcom/src/macLib/macCore.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/libcom/src/macLib/macCore.c b/modules/libcom/src/macLib/macCore.c index 7a1f241f3..165d2583a 100644 --- a/modules/libcom/src/macLib/macCore.c +++ b/modules/libcom/src/macLib/macCore.c @@ -897,7 +897,8 @@ static void refer ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, entry->error = TRUE; errval = ",recursive)"; if ( (handle->flags & FLAG_SUPPRESS_WARNINGS) == 0 ) { - errlogPrintf( "macLib: %s %s is recursive (expanding %s %s)\n", + errlogPrintf( "macLib: %s %s is " ANSI_MAGENTA("recursive") + " (expanding %s %s)\n", entry->type, entry->name, refentry->type, refentry->name ); } @@ -911,8 +912,9 @@ static void refer ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level, entry->error = TRUE; errval = ",undefined)"; if ( (handle->flags & FLAG_SUPPRESS_WARNINGS) == 0 ) { - errlogPrintf( "macLib: macro %s is " ANSI_MAGENTA("undefined") " (expanding %s %s)\n", - refname, entry->type, entry->name ); + errlogPrintf( "macLib: macro %s is " ANSI_MAGENTA("undefined") + " (expanding %s %s)\n", + refname, entry->type, entry->name ); } } From fb09dc0df99dafdf6e5ef751a911282a22ba4eb8 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Tue, 17 Mar 2026 19:52:34 +0000 Subject: [PATCH 014/141] Fix memory overwrite in macParseDefns --- modules/libcom/src/macLib/macUtil.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/libcom/src/macLib/macUtil.c b/modules/libcom/src/macLib/macUtil.c index 920ac006f..5c04c9075 100644 --- a/modules/libcom/src/macLib/macUtil.c +++ b/modules/libcom/src/macLib/macUtil.c @@ -62,8 +62,11 @@ epicsStdCall macParseDefns( printf( "macParseDefns( %s )\n", defns ); /* allocate temporary pointer arrays; in worst case they need to have - as many entries as the length of the defns string */ - numMax = strlen( defns ); + as many entries as the length of the defns string + 2 + for defns="1,3,5" give 3 pairs so num will be 6 (strlen(defns)+1) + but as num is used as an index e.g. del[num] we need + numMax to be strlen(defns) + 2 */ + numMax = strlen( defns ) + 2; if ( numMax < altNumMax ) numMax = altNumMax; ptr = (const char **) calloc( numMax, sizeof( char * ) ); From acf53d31eebfcce694c093141cf0ba6d88189263 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Fri, 20 Mar 2026 17:20:23 +0000 Subject: [PATCH 015/141] Add test case --- modules/libcom/test/macDefExpandTest.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/libcom/test/macDefExpandTest.c b/modules/libcom/test/macDefExpandTest.c index 37f11f9f4..14cec45b9 100644 --- a/modules/libcom/test/macDefExpandTest.c +++ b/modules/libcom/test/macDefExpandTest.c @@ -61,6 +61,27 @@ static void macEnvScope(void) checkMac(handle, "E", "15"); checkMac(handle, "F", NULL); + { + /* test worst case for short definitions + * https://github.com/epics-base/epics-base/pull/838 + */ + macParseDefns(NULL, "1,3,5", &defines); /* smoke */ + +#define CASE(I,V) \ + testOk(defines[I] && strcmp(defines[I], V)==0, "defines[%u] \"%s\" == \"" V "\"", I, defines[I]) + CASE(0,"1"); + testOk1(defines[1]==NULL); + CASE(2,"3"); + testOk1(defines[3]==NULL); + CASE(4,"5"); + testOk1(defines[5]==NULL); + testOk1(defines[6]==NULL); +#undef CASE + + free(defines); + defines = NULL; + } + { macPushScope(handle); From 631c8831b942ee5533a2f7016085dcef52c2f3ba Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Fri, 20 Mar 2026 21:41:19 +0000 Subject: [PATCH 016/141] Fix number of tests --- modules/libcom/test/macDefExpandTest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libcom/test/macDefExpandTest.c b/modules/libcom/test/macDefExpandTest.c index 14cec45b9..a93727a58 100644 --- a/modules/libcom/test/macDefExpandTest.c +++ b/modules/libcom/test/macDefExpandTest.c @@ -169,7 +169,7 @@ static void check(const char *str, const char *macros, const char *expect) MAIN(macDefExpandTest) { eltc(0); - testPlan(97); + testPlan(104); check("FOO", "", "FOO"); From c9817fa591dfc9d01b33dfaf303223926f95cc4b Mon Sep 17 00:00:00 2001 From: Edmund Blomley <43214674+eddybl@users.noreply.github.com> Date: Wed, 1 Apr 2026 18:53:39 +0200 Subject: [PATCH 017/141] Add AFTC flag for bi record and fix mbbi AFTC bug (#817) * Add AFTC feature to bi record with tests. * Fix broken AFTC handling for mbbi record, also fix bug in COSV and LALM handling. * Add release notes and update record docs. --- documentation/new-notes/PR-817.md | 13 ++ modules/database/src/std/rec/biRecord.c | 54 ++++- modules/database/src/std/rec/biRecord.dbd.pod | 21 +- modules/database/src/std/rec/mbbiRecord.c | 6 +- modules/database/test/std/rec/Makefile | 7 + modules/database/test/std/rec/biTest.c | 66 +++++- modules/database/test/std/rec/biTest.db | 7 + modules/database/test/std/rec/mbbiTest.c | 201 ++++++++++++++++++ modules/database/test/std/rec/mbbiTest.db | 13 ++ 9 files changed, 371 insertions(+), 17 deletions(-) create mode 100644 documentation/new-notes/PR-817.md create mode 100644 modules/database/test/std/rec/mbbiTest.c create mode 100644 modules/database/test/std/rec/mbbiTest.db diff --git a/documentation/new-notes/PR-817.md b/documentation/new-notes/PR-817.md new file mode 100644 index 000000000..3aa1370a1 --- /dev/null +++ b/documentation/new-notes/PR-817.md @@ -0,0 +1,13 @@ +### AFTC for bi record + +The bi record now also supports the AFTC parameter. +The AFTC field sets the time constant on a low-pass filter that delays the +reporting of limit alarms until the signal has been within the alarm range for +that number of seconds (the default AFTC value of zero retains the previous +behavior). One has to make sure that the bi record is processed at a reasonably fast rate +when using AFTC, so that the record can respond to changes in the input signal +within the time constant. + +### AFTC and LALM fix for mbbi record + +Fixed two issues in the mbbi record where the AFTC and LALM fields were not operating as expected. diff --git a/modules/database/src/std/rec/biRecord.c b/modules/database/src/std/rec/biRecord.c index 941ac563b..e8bae6e86 100644 --- a/modules/database/src/std/rec/biRecord.c +++ b/modules/database/src/std/rec/biRecord.c @@ -23,6 +23,7 @@ #include "dbDefs.h" #include "epicsPrint.h" +#include "epicsMath.h" #include "alarm.h" #include "callback.h" #include "dbAccess.h" @@ -40,6 +41,9 @@ #undef GEN_SIZE_OFFSET #include "epicsExport.h" +/* Hysteresis for alarm filtering: 1-1/e */ +#define THRESHOLD 0.6321 + /* Create RSET - Record Support Entry Table*/ #define report NULL #define initialize NULL @@ -80,7 +84,7 @@ rset biRSET={ }; epicsExportAddress(rset,biRSET); -static void checkAlarms(biRecord *); +static void checkAlarms(biRecord *, epicsTimeStamp *); static void monitor(biRecord *); static long readValue(biRecord *); @@ -119,6 +123,7 @@ static long process(struct dbCommon *pcommon) bidset *pdset = (bidset *)(prec->dset); long status; unsigned char pact=prec->pact; + epicsTimeStamp timeLast; if( (pdset==NULL) || (pdset->read_bi==NULL) ) { prec->pact=TRUE; @@ -126,6 +131,8 @@ static long process(struct dbCommon *pcommon) return(S_dev_missingSup); } + timeLast = prec->time; + status=readValue(prec); /* read the new value */ /* check if device support set pact */ if ( !pact && prec->pact ) return(0); @@ -140,7 +147,7 @@ static long process(struct dbCommon *pcommon) } else if(status==2) status=0; /* check for alarms */ - checkAlarms(prec); + checkAlarms(prec, &timeLast); /* check event list */ monitor(prec); /* process the forward scan link record */ @@ -217,27 +224,52 @@ static long put_enum_str(const DBADDR *paddr, const char *pstring) } -static void checkAlarms(biRecord *prec) +static void checkAlarms(biRecord *prec, epicsTimeStamp *timeLast) { + epicsEnum16 asev; unsigned short val = prec->val; - if(prec->udf == TRUE){ recGblSetSevr(prec,UDF_ALARM,prec->udfs); return; } if(val>1)return; - /* check for state alarm */ - if (val == 0){ - recGblSetSevr(prec,STATE_ALARM,prec->zsv); - }else{ - recGblSetSevr(prec,STATE_ALARM,prec->osv); + + if (val == 0) { + asev = prec->zsv; + } else { + asev = prec->osv; } - /* check for cos alarm */ + unsigned short alarm = asev; /* Initialize alarm with current state severity */ + double aftc = prec->aftc; + double afvl = 0; + + if (aftc > 0) { + afvl = prec->afvl; + if (afvl == 0) { + afvl = (double) alarm; + } else { + double t = epicsTimeDiffInSeconds(&prec->time, timeLast); + double alpha = aftc / (t + aftc); + + afvl = alpha * afvl + + ((afvl > 0) ? (1.0 - alpha) : (alpha - 1.0)) * alarm; + if (afvl - floor(afvl) > THRESHOLD) + afvl = -afvl; + + alarm = abs((int)floor(afvl)); + } + } + prec->afvl = afvl; + + asev = alarm; + recGblSetSevr(prec,STATE_ALARM,asev); + + /* check for cos alarm */ if(val == prec->lalm) return; - recGblSetSevr(prec,COS_ALARM,prec->cosv); + recGblSetSevr(prec,COS_ALARM,prec->cosv); prec->lalm = val; return; } diff --git a/modules/database/src/std/rec/biRecord.dbd.pod b/modules/database/src/std/rec/biRecord.dbd.pod index 2b772b5e3..8db4634a3 100644 --- a/modules/database/src/std/rec/biRecord.dbd.pod +++ b/modules/database/src/std/rec/biRecord.dbd.pod @@ -107,13 +107,20 @@ C. The ZSV field holds the severity for the zero state; OSV, for the one state. COSV causes an alarm whenever the state changes between 0 and 1 and the severity is configured as MINOR or MAJOR. +Since UNRELEASED, the alarm filter time constant (AFTC) is available for the bi record. +The AFTC field sets the time constant on a low-pass filter that delays the +reporting of limit alarms until the signal has been within the alarm range for +that number of seconds (the default AFTC value of zero retains the previous +behavior). Be sure that the bi record is processed at a reasonably fast rate +when using AFTC, so that the record can respond to changes in the input signal +within the time constant. + See L for a complete explanation of record alarms and of the standard fields. L lists other fields related to alarms that are common to all record types. -=fields ZSV, OSV, COSV - +=fields ZSV, OSV, COSV, AFTC =head3 Run-time Parameters These parameters are used by the run-time code for processing the binary @@ -220,6 +227,16 @@ is not equal to VAL. special(SPC_NOMOD) interest(3) } + field(AFTC, DBF_DOUBLE) { + prompt("Alarm Filter Time Constant") + promptgroup("70 - Alarm") + interest(1) + } + field(AFVL, DBF_DOUBLE) { + prompt("Alarm Filter Value") + special(SPC_NOMOD) + interest(3) + } =head3 Simulation Mode Parameters diff --git a/modules/database/src/std/rec/mbbiRecord.c b/modules/database/src/std/rec/mbbiRecord.c index 018c861c1..141c6692d 100644 --- a/modules/database/src/std/rec/mbbiRecord.c +++ b/modules/database/src/std/rec/mbbiRecord.c @@ -336,15 +336,15 @@ static void checkAlarms(mbbiRecord *prec, epicsTimeStamp *timeLast) alarm = abs((int)floor(afvl)); } } + prec->afvl = afvl; asev = alarm; recGblSetSevr(prec, STATE_ALARM, asev); /* Check for COS alarm */ - if (val == prec->lalm || - recGblSetSevr(prec, COS_ALARM, prec->cosv)) + if (val == prec->lalm) return; - + recGblSetSevr(prec, COS_ALARM, prec->cosv); prec->lalm = val; } diff --git a/modules/database/test/std/rec/Makefile b/modules/database/test/std/rec/Makefile index c5eca0dbe..9debe231d 100644 --- a/modules/database/test/std/rec/Makefile +++ b/modules/database/test/std/rec/Makefile @@ -195,6 +195,13 @@ testHarness_SRCS += simmTest_registerRecordDeviceDriver.cpp TESTFILES += $(COMMON_DIR)/simmTest.dbd $(COMMON_DIR)/simmTest.db TESTS += simmTest +TESTPROD_HOST += mbbiTest +mbbiTest_SRCS += mbbiTest.c +mbbiTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp +testHarness_SRCS += mbbiTest.c +TESTFILES += ../mbbiTest.db +TESTS += mbbiTest + TESTPROD_HOST += mbbioDirectTest mbbioDirectTest_SRCS += mbbioDirectTest.c mbbioDirectTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp diff --git a/modules/database/test/std/rec/biTest.c b/modules/database/test/std/rec/biTest.c index ff7c975ce..c4861e6f6 100644 --- a/modules/database/test/std/rec/biTest.c +++ b/modules/database/test/std/rec/biTest.c @@ -9,6 +9,7 @@ #include "errlog.h" #include "dbAccess.h" #include "menuAlarmSevr.h" +#include "menuScan.h" void recTestIoc_registerRecordDeviceDriver(struct dbBase *); @@ -96,9 +97,71 @@ static void test_alarm(void){ // number of tests = 13 } +static void test_aftc(void){ + const double aftc = 3.0; + testMonitor* test_mon = NULL; + epicsTimeStamp startTime; + epicsTimeStamp endTime; + double diffTime = 0; + + /* set soft channel */ + testdbPutFieldOk("test_bi_rec2.DTYP", DBF_STRING, "Soft Channel"); + testdbPutFieldOk("test_bi_rec2.INP", DBF_STRING, "test_bi_link_rec2.VAL"); + testdbPutFieldOk("test_bi_link_rec2.FLNK", DBF_STRING, "test_bi_rec2"); + + /* set alarm parameters */ + testdbPutFieldOk("test_bi_rec2.ZSV", DBF_SHORT, menuAlarmSevrMINOR); + testdbPutFieldOk("test_bi_rec2.OSV", DBF_SHORT, menuAlarmSevrMAJOR); + + /* set start VAL to FALSE (NO_ALARM) */ + testdbPutFieldOk("test_bi_link_rec2.VAL", DBF_SHORT, FALSE); + + /* test AFTC using a monitor and time stamps */ + testdbPutFieldOk("test_bi_rec2.AFTC", DBF_DOUBLE, aftc); + testdbPutFieldOk("test_bi_rec2.SCAN", DBF_SHORT, menuScan_1_second); + + /* set VAL to TRUE (MAJOR alarm) */ + testdbPutFieldOk("test_bi_link_rec2.VAL", DBF_SHORT, TRUE); + + /* Create test monitor for alarm SEVR */ + test_mon = testMonitorCreate("test_bi_rec2.VAL", DBE_ALARM, 0); + + /* Get start time */ + epicsTimeGetCurrent(&startTime); + + /* wait for monitor to trigger on the new alarm status */ + testMonitorWait(test_mon); + epicsTimeGetCurrent(&endTime); + + /* Verify that alarm status is now MAJOR */ + testdbGetFieldEqual("test_bi_rec2.SEVR", DBF_SHORT, menuAlarmSevrMAJOR); + + /* set VAL back to FALSE (NO_ALARM) */ + testdbPutFieldOk("test_bi_link_rec2.VAL", DBF_SHORT, FALSE); + + /* Create test monitor for alarm SEVR */ + test_mon = testMonitorCreate("test_bi_rec2.VAL", DBE_ALARM, 0); + + /* Get start time */ + epicsTimeGetCurrent(&startTime); + + /* wait for monitor to trigger on the new alarm status */ + testMonitorWait(test_mon); + epicsTimeGetCurrent(&endTime); + + /* Verify that alarm status is now NO_ALARM */ + testdbGetFieldEqual("test_bi_rec2.SEVR", DBF_SHORT, menuAlarmSevrMINOR); + + /* Verify that time is at least equal to configured aftc */ + diffTime = epicsTimeDiffInSeconds(&endTime, &startTime); + testOk(diffTime >= aftc, "AFTC time %lf", diffTime); + + // number of tests = 13 +} + MAIN(biTest) { - testPlan(6+6+11+13); + testPlan(6+6+11+13+13); testdbPrepare(); testdbReadDatabase("recTestIoc.dbd", NULL, NULL); @@ -114,6 +177,7 @@ MAIN(biTest) { test_raw_soft_input(); test_operator_display(); test_alarm(); + test_aftc(); testIocShutdownOk(); testdbCleanup(); diff --git a/modules/database/test/std/rec/biTest.db b/modules/database/test/std/rec/biTest.db index 4304cce91..4877c90d2 100644 --- a/modules/database/test/std/rec/biTest.db +++ b/modules/database/test/std/rec/biTest.db @@ -4,3 +4,10 @@ record(bi, "test_bi_rec") { record(bo, "test_bi_link_rec") { } + +record(bi, "test_bi_rec2") { +} + +record(bo, "test_bi_link_rec2") { + +} diff --git a/modules/database/test/std/rec/mbbiTest.c b/modules/database/test/std/rec/mbbiTest.c new file mode 100644 index 000000000..6f5889737 --- /dev/null +++ b/modules/database/test/std/rec/mbbiTest.c @@ -0,0 +1,201 @@ +/*************************************************************************\ +* Copyright (c) 2026 Edmund Blomley +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include "dbUnitTest.h" +#include "testMain.h" +#include "errlog.h" +#include "dbAccess.h" +#include "menuAlarmSevr.h" +#include "menuScan.h" + +void recTestIoc_registerRecordDeviceDriver(struct dbBase *); + +static void test_soft_input(void){ + /* set soft channel */ + testdbPutFieldOk("test_mbbi_rec.DTYP", DBF_STRING, "Soft Channel"); + testdbPutFieldOk("test_mbbi_rec.INP", DBF_STRING, "test_mbbi_link_rec.VAL"); + testdbPutFieldOk("test_mbbi_link_rec.FLNK", DBF_STRING, "test_mbbi_rec"); + + /* set VAL to on linked record */ + testdbPutFieldOk("test_mbbi_link_rec.VAL", DBF_SHORT, 1); + + /* verify that this record VAL is updated but RVAL is not */ + testdbGetFieldEqual("test_mbbi_rec.VAL", DBF_SHORT, 1); + testdbGetFieldEqual("test_mbbi_rec.RVAL", DBF_SHORT, 0); + + // number of tests = 6 +} + +static void test_operator_display(void){ + /* set operator display parameters */ + testdbPutFieldOk("test_mbbi_rec.ZRST", DBF_STRING, "ZRST_TEST"); + testdbPutFieldOk("test_mbbi_rec.ONST", DBF_STRING, "ONST_TEST"); + testdbPutFieldOk("test_mbbi_rec.TWST", DBF_STRING, "TWST_TEST"); + testdbPutFieldOk("test_mbbi_rec.THST", DBF_STRING, "THST_TEST"); + testdbPutFieldOk("test_mbbi_rec.FRST", DBF_STRING, "FRST_TEST"); + testdbPutFieldOk("test_mbbi_rec.FVST", DBF_STRING, "FVST_TEST"); + testdbPutFieldOk("test_mbbi_rec.SXST", DBF_STRING, "SXST_TEST"); + testdbPutFieldOk("test_mbbi_rec.SVST", DBF_STRING, "SVST_TEST"); + testdbPutFieldOk("test_mbbi_rec.EIST", DBF_STRING, "EIST_TEST"); + testdbPutFieldOk("test_mbbi_rec.NIST", DBF_STRING, "NIST_TEST"); + testdbPutFieldOk("test_mbbi_rec.TEST", DBF_STRING, "TEST_TEST"); + testdbPutFieldOk("test_mbbi_rec.ELST", DBF_STRING, "ELST_TEST"); + testdbPutFieldOk("test_mbbi_rec.TVST", DBF_STRING, "TVST_TEST"); + testdbPutFieldOk("test_mbbi_rec.TTST", DBF_STRING, "TTST_TEST"); + testdbPutFieldOk("test_mbbi_rec.FTST", DBF_STRING, "FTST_TEST"); + testdbPutFieldOk("test_mbbi_rec.FFST", DBF_STRING, "FFST_TEST"); + testdbPutFieldOk("test_mbbi_rec.DESC", DBF_STRING, "DESC_TEST"); + + /* verify operator display parameters */ + testdbGetFieldEqual("test_mbbi_rec.ZRST", DBF_STRING, "ZRST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.ONST", DBF_STRING, "ONST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.TWST", DBF_STRING, "TWST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.THST", DBF_STRING, "THST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.FRST", DBF_STRING, "FRST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.FVST", DBF_STRING, "FVST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.SXST", DBF_STRING, "SXST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.SVST", DBF_STRING, "SVST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.EIST", DBF_STRING, "EIST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.NIST", DBF_STRING, "NIST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.TEST", DBF_STRING, "TEST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.ELST", DBF_STRING, "ELST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.TVST", DBF_STRING, "TVST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.TTST", DBF_STRING, "TTST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.FTST", DBF_STRING, "FTST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.FFST", DBF_STRING, "FFST_TEST"); + testdbGetFieldEqual("test_mbbi_rec.NAME", DBF_STRING, "test_mbbi_rec"); + testdbGetFieldEqual("test_mbbi_rec.DESC", DBF_STRING, "DESC_TEST"); + + /* verify conversion */ + testdbPutFieldOk("test_mbbi_link_rec.VAL", DBF_SHORT, 1); + testdbGetFieldEqual("test_mbbi_rec.VAL", DBF_STRING, "ONST_TEST"); + testdbPutFieldOk("test_mbbi_link_rec.VAL", DBF_SHORT, 0); + testdbGetFieldEqual("test_mbbi_rec.VAL", DBF_STRING, "ZRST_TEST"); + + // number of tests = 39 +} + +static void test_alarm(void){ + /* set soft channel */ + testdbPutFieldOk("test_mbbi_rec.DTYP", DBF_STRING, "Soft Channel"); + testdbPutFieldOk("test_mbbi_rec.INP", DBF_STRING, "test_mbbi_link_rec.VAL"); + testdbPutFieldOk("test_mbbi_link_rec.FLNK", DBF_STRING, "test_mbbi_rec"); + testdbPutFieldOk("test_mbbi_rec.ZRST", DBF_STRING, "ZRST_TEST"); + testdbPutFieldOk("test_mbbi_rec.ONST", DBF_STRING, "ONST_TEST"); + testdbPutFieldOk("test_mbbi_rec.ZRVL", DBF_STRING, "0"); + testdbPutFieldOk("test_mbbi_rec.ONVL", DBF_STRING, "1"); + + /* set start VAL to 0*/ + testdbPutFieldOk("test_mbbi_link_rec.VAL", DBF_SHORT, 0); + + /* set alarm parameters */ + testdbPutFieldOk("test_mbbi_rec.ZRSV", DBF_SHORT, menuAlarmSevrNO_ALARM); + testdbPutFieldOk("test_mbbi_rec.ONSV", DBF_SHORT, menuAlarmSevrMINOR); + testdbPutFieldOk("test_mbbi_rec.COSV", DBF_SHORT, menuAlarmSevrINVALID); + + /* verify alarm status is NO_ALARM*/ + testdbGetFieldEqual("test_mbbi_rec.SEVR", DBF_SHORT, menuAlarmSevrNO_ALARM); + + /* set ZRSV to MAJOR and verify that SEVR is now MAJOR */ + testdbPutFieldOk("test_mbbi_rec.ZRSV", DBF_SHORT, menuAlarmSevrMAJOR); + testdbGetFieldEqual("test_mbbi_rec.SEVR", DBF_SHORT, menuAlarmSevrMAJOR); + + /* set VAL to 1 on linked record and verify that COSV now sets the SEVR to INVALID */ + testdbPutFieldOk("test_mbbi_link_rec.VAL", DBF_SHORT, 1); + testdbGetFieldEqual("test_mbbi_rec.SEVR", DBF_SHORT, menuAlarmSevrINVALID); + + /* verify LAML */ + testdbGetFieldEqual("test_mbbi_rec.LALM", DBF_SHORT, 1); + + // number of tests = 17 +} + +static void test_aftc(void){ + const double aftc = 3.0; + testMonitor* test_mon = NULL; + epicsTimeStamp startTime; + epicsTimeStamp endTime; + double diffTime = 0; + + /* set soft channel */ + testdbPutFieldOk("test_mbbi_rec2.DTYP", DBF_STRING, "Soft Channel"); + testdbPutFieldOk("test_mbbi_rec2.INP", DBF_STRING, "test_mbbi_link_rec2.VAL"); + testdbPutFieldOk("test_mbbi_link_rec2.FLNK", DBF_STRING, "test_mbbi_rec2"); + + /* set alarm parameters */ + testdbPutFieldOk("test_mbbi_rec2.ZRSV", DBF_SHORT, menuAlarmSevrMINOR); + testdbPutFieldOk("test_mbbi_rec2.ONSV", DBF_SHORT, menuAlarmSevrMAJOR); + + /* set start VAL to FALSE (NO_ALARM) */ + testdbPutFieldOk("test_mbbi_link_rec2.VAL", DBF_SHORT, FALSE); + + /* test AFTC using a monitor and time stamps */ + testdbPutFieldOk("test_mbbi_rec2.AFTC", DBF_DOUBLE, aftc); + testdbPutFieldOk("test_mbbi_rec2.SCAN", DBF_SHORT, menuScan_1_second); + + /* set VAL to TRUE (MAJOR alarm) */ + testdbPutFieldOk("test_mbbi_link_rec2.VAL", DBF_SHORT, TRUE); + + /* Create test monitor for alarm SEVR */ + test_mon = testMonitorCreate("test_mbbi_rec2.VAL", DBE_ALARM, 0); + + /* Get start time */ + epicsTimeGetCurrent(&startTime); + + /* wait for monitor to trigger on the new alarm status */ + testMonitorWait(test_mon); + epicsTimeGetCurrent(&endTime); + + /* Verify that alarm status is now MAJOR */ + testdbGetFieldEqual("test_mbbi_rec2.SEVR", DBF_SHORT, menuAlarmSevrMAJOR); + + /* set VAL back to FALSE (NO_ALARM) */ + testdbPutFieldOk("test_mbbi_link_rec2.VAL", DBF_SHORT, FALSE); + + /* Create test monitor for alarm SEVR */ + test_mon = testMonitorCreate("test_mbbi_rec2.VAL", DBE_ALARM, 0); + + /* Get start time */ + epicsTimeGetCurrent(&startTime); + + /* wait for monitor to trigger on the new alarm status */ + testMonitorWait(test_mon); + epicsTimeGetCurrent(&endTime); + + /* Verify that alarm status is now NO_ALARM */ + testdbGetFieldEqual("test_mbbi_rec2.SEVR", DBF_SHORT, menuAlarmSevrMINOR); + + /* Verify that time is at least equal to configured aftc */ + diffTime = epicsTimeDiffInSeconds(&endTime, &startTime); + testOk(diffTime >= aftc, "AFTC time %lf", diffTime); + + // number of tests = 13 +} + +MAIN(mbbiTest) { + + testPlan(6+39+17+13); + + testdbPrepare(); + testdbReadDatabase("recTestIoc.dbd", NULL, NULL); + recTestIoc_registerRecordDeviceDriver(pdbbase); + + testdbReadDatabase("mbbiTest.db", NULL, NULL); + + eltc(0); + testIocInitOk(); + eltc(1); + + test_soft_input(); + test_operator_display(); + test_alarm(); + test_aftc(); + + testIocShutdownOk(); + testdbCleanup(); + + return testDone(); +} diff --git a/modules/database/test/std/rec/mbbiTest.db b/modules/database/test/std/rec/mbbiTest.db new file mode 100644 index 000000000..106e99db8 --- /dev/null +++ b/modules/database/test/std/rec/mbbiTest.db @@ -0,0 +1,13 @@ +record(mbbi, "test_mbbi_rec") { +} + +record(longout, "test_mbbi_link_rec") { + +} + +record(mbbi, "test_mbbi_rec2") { +} + +record(longout, "test_mbbi_link_rec2") { + +} From 77e499ae847530b5f2cb1516c2ddaea4daf22da7 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 8 Jan 2026 16:58:12 -0800 Subject: [PATCH 018/141] doc dbProcess() --- modules/database/src/ioc/db/dbAccessDefs.h | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/modules/database/src/ioc/db/dbAccessDefs.h b/modules/database/src/ioc/db/dbAccessDefs.h index b26a1a56e..b9d8783d1 100644 --- a/modules/database/src/ioc/db/dbAccessDefs.h +++ b/modules/database/src/ioc/db/dbAccessDefs.h @@ -214,7 +214,46 @@ DBCORE_API int dbIsValueField(const struct dbFldDes *pdbFldDes); DBCORE_API int dbGetFieldIndex(const struct dbAddr *paddr); DBCORE_API long dbScanPassive( struct dbCommon *pfrom,struct dbCommon *pto); +/** @brief Begin processing of target record + * @param precord Target record + * @return 0 on success, non-zero on error. + * + * @pre After iocInit(), and before iocShutdown() + * @pre Record must be locked. @see dbScanLock() + * + * This function will attempt to begin record processing, which may have one of + * several possible outcomes depending on the PACT state of the record, + * and the actions of its rset::process() method. + * + * If asynchronously processing is ongoing (PACT is initially non-zero), + * then a SCAN_ALARM is signaled and posted on the VAL field. + * This function returns zero. + * + * If the record is idle (PACT is zero), then rset::process() runs. + * This method may return an error, or not. + * Record or device support may also leave PACT as zero, + * in which case record processing has compeleted synchronously + * Or PACT may be left non-zero, in which case asynchronous processing is ongoing. + * + * If asynchronous processing is ongoing, + * the caller of dbProcess() takes no further action. + * Record support code must arrange to complete processing at some future time. + * + * @code{.c} + * dbCommon *prec = ...; + * dbScanLock(prec); + * long status = dbProcess(prec); + * dbScanUnlock(prec); + * @endcode + */ DBCORE_API long dbProcess(struct dbCommon *precord); +/** @brief Lookup dbAddr from record.FLD + * @param pname PV name + * @param paddr Pointer to uninitialized address + * @return zero on success + * + * Prefer dbChannel for new code. + */ DBCORE_API long dbNameToAddr(const char *pname, struct dbAddr *paddr); /** Initialize DBADDR from a dbEntry From b761beaf0c277a839ec1cced2b61f6f562e3fbc6 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 10 Feb 2026 18:23:55 -0800 Subject: [PATCH 019/141] doc --- modules/libcom/src/misc/epicsString.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/libcom/src/misc/epicsString.h b/modules/libcom/src/misc/epicsString.h index eee26553a..5b36ebb94 100644 --- a/modules/libcom/src/misc/epicsString.h +++ b/modules/libcom/src/misc/epicsString.h @@ -156,6 +156,15 @@ LIBCOM_API int epicsStrnGlobMatch(const char *str, size_t len, const char *patte /** \brief Extract tokens from string * * Implements strtok_r from the C standard library + * + * @code + * char *input = ...; // string will be temporarily modified + * char *saved = nullptr; + * for(char* word = epicsStrtok_r(input, " ", &saved) + * ; word + * ; word = epicsStrtok_r(NULL, " ", &saved)) + * { } // act on word + * @endcode */ LIBCOM_API char * epicsStrtok_r(char *s, const char *delim, char **lasts); From ef48298294e25528b8babbdb3dbe16133b4dd7da Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 10 Apr 2026 19:36:48 -0700 Subject: [PATCH 020/141] dbCa: iocInit wait for all conditions After connectCallback, need to wait for up to three concurrent actions. Native and string subscriptions, as well as GET of metadata. Complicated because event_handler_args does not identify the evid. see 717d69e1fcf3cb8dc4533ba53bdae838a396d274 --- modules/database/src/ioc/db/dbCa.c | 58 +++++++++++++++++++-------- modules/database/src/ioc/db/dbCaPvt.h | 12 +++++- modules/database/src/ioc/db/dbLink.c | 2 +- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/modules/database/src/ioc/db/dbCa.c b/modules/database/src/ioc/db/dbCa.c index dda84f34c..5d9c6e9fc 100644 --- a/modules/database/src/ioc/db/dbCa.c +++ b/modules/database/src/ioc/db/dbCa.c @@ -65,7 +65,7 @@ extern int dbServiceIsolate; static ELLLIST workList = ELLLIST_INIT; /* Work list for dbCaTask */ static epicsMutexId workListLock; /*Mutual exclusions semaphores for workList*/ static epicsEventId workListEvent; /*wakeup event for dbCaTask*/ -static size_t initOutstanding; // one count for every link with DBCA_CALLBACK_INIT_WAIT +static size_t initOutstanding; // one count for every link with a DBCA_CALLBACK_INIT_WAIT bit static int removesOutstanding = 0; #define removesOutstandingWarning 10000 @@ -405,7 +405,7 @@ void dbCaAddLinkCallbackOpt(struct dbLocker *locker, struct link *plink, pca->userPvt = userPvt; pca->flags = flags; - if(flags & DBCA_CALLBACK_INIT_WAIT) + if(flags & DBCA_CALLBACK_INIT_WAITING) epicsAtomicIncrSizeT(&initOutstanding); epicsMutexMustLock(pca->lock); @@ -830,6 +830,21 @@ static lset dbCa_lset = { scanForward, doLocked }; +// caller must hold caLink::lock +static +short testInitReady(caLink *pca, unsigned clear) +{ + if(pca->flags & DBCA_CALLBACK_INIT_WAIT_MASK) { + pca->flags &= ~clear; + assert(pca->flags & DBCA_CALLBACK_INIT_WAITING); // only cleared by dbCa worker + if(!(pca->flags & DBCA_CALLBACK_INIT_WAIT_MASK)) { + // all complete + return CA_INIT_READY; + } + } + return 0; +} + static void connectionCallback(struct connection_handler_args arg) { caLink *pca; @@ -859,8 +874,6 @@ static void connectionCallback(struct connection_handler_args arg) } pca->hasReadAccess = ca_read_access(arg.chid); pca->hasWriteAccess = ca_write_access(arg.chid); - if (pca->flags & DBCA_CALLBACK_INIT_WAIT) - link_action |= CA_INIT_READY; // declare initialized, unless cleared below if (pca->gotFirstConnection) { if (pca->nelements != ca_element_count(arg.chid) || @@ -895,11 +908,13 @@ static void connectionCallback(struct connection_handler_args arg) pca->dbrType = ca_field_type(arg.chid); if ((plink->value.pv_link.pvlMask & pvlOptInpNative) && !pca->pgetNative) { link_action |= CA_MONITOR_NATIVE; - link_action &= ~CA_INIT_READY; // defer to eventCallback() + } else { + link_action |= testInitReady(pca, DBCA_CALLBACK_INIT_WAIT_NATIVE); } if ((plink->value.pv_link.pvlMask & pvlOptInpString) && !pca->pgetString) { link_action |= CA_MONITOR_STRING; - link_action &= ~CA_INIT_READY; // defer to eventCallback() + } else { + link_action |= testInitReady(pca, DBCA_CALLBACK_INIT_WAIT_STRING); } if ((plink->value.pv_link.pvlMask & pvlOptOutNative) && pca->gotOutNative) { link_action |= CA_WRITE_NATIVE; @@ -911,8 +926,8 @@ static void connectionCallback(struct connection_handler_args arg) if (pca->dbrType != DBR_STRING) { /* will run connect() callback later */ link_action |= CA_GET_ATTRIBUTES; - link_action &= ~CA_INIT_READY; // defer to getAttribEventCallback() } else { + link_action |= testInitReady(pca, DBCA_CALLBACK_INIT_WAIT_ATTRIB); connect = pca->connect; userPvt = pca->userPvt; } @@ -922,7 +937,7 @@ done: if (connect) connect(userPvt); } -static void eventCallback(struct event_handler_args arg) +static void eventCallbackComm(struct event_handler_args arg, unsigned initmask) { caLink *pca = (caLink *)arg.usr; struct link *plink; @@ -996,13 +1011,22 @@ static void eventCallback(struct event_handler_args arg) link_action |= CA_DBPROCESS; } } - if (pca->flags & DBCA_CALLBACK_INIT_WAIT) - link_action |= CA_INIT_READY; + link_action |= testInitReady(pca, initmask); done: if (link_action) addAction(pca, link_action); epicsMutexUnlock(pca->lock); if (monitor) monitor(userPvt); } + +static void eventCallbackNative(struct event_handler_args arg) +{ + eventCallbackComm(arg, DBCA_CALLBACK_INIT_WAIT_NATIVE); +} + +static void eventCallbackString(struct event_handler_args arg) +{ + eventCallbackComm(arg, DBCA_CALLBACK_INIT_WAIT_STRING); +} static void exceptionCallback(struct exception_handler_args args) { @@ -1123,8 +1147,9 @@ static void getAttribEventCallback(struct event_handler_args arg) pca->alarmLimits[3] = pdbr->upper_alarm_limit; pca->precision = pdbr->precision; memcpy(pca->units, pdbr->units, MAX_UNITS_SIZE); - if (pca->flags & DBCA_CALLBACK_INIT_WAIT) - addAction(pca, CA_INIT_READY); + short link_action = testInitReady(pca, DBCA_CALLBACK_INIT_WAIT_ATTRIB); + if (link_action) + addAction(pca, link_action); epicsMutexUnlock(pca->lock); if (getAttributes) getAttributes(getAttributesPvt); if (connect) connect(userPvt); @@ -1265,7 +1290,7 @@ static void dbCaTask(void *arg) status = ca_add_array_event( dbf_type_to_DBR_TIME(ca_field_type(pca->chid)), 0, /* dynamic size */ - pca->chid, eventCallback, pca, 0.0, 0.0, 0.0, + pca->chid, eventCallbackNative, pca, 0.0, 0.0, 0.0, &pca->evidNative); if (status != ECA_NORMAL) { errlogPrintf("dbCaTask ca_add_array_event %s\n", @@ -1278,7 +1303,7 @@ static void dbCaTask(void *arg) pca->pgetString = dbCalloc(1, MAX_STRING_SIZE); epicsMutexUnlock(pca->lock); status = ca_add_array_event(DBR_TIME_STRING, 1, - pca->chid, eventCallback, pca, 0.0, 0.0, 0.0, + pca->chid, eventCallbackString, pca, 0.0, 0.0, 0.0, &pca->evidString); if (status != ECA_NORMAL) { errlogPrintf("dbCaTask ca_add_array_event %s\n", @@ -1295,8 +1320,9 @@ static void dbCaTask(void *arg) db_process(prec); dbScanUnlock(prec); } - if ((link_action & CA_INIT_READY) && (pca->flags & DBCA_CALLBACK_INIT_WAIT)) { - pca->flags &= ~DBCA_CALLBACK_INIT_WAIT; + if ((link_action & CA_INIT_READY) && (pca->flags & DBCA_CALLBACK_INIT_WAITING)) { + assert(!(pca->flags & DBCA_CALLBACK_INIT_WAIT_MASK)); + pca->flags &= ~DBCA_CALLBACK_INIT_WAITING; if (epicsAtomicDecrSizeT(&initOutstanding)==0) { epicsEventSignal(startStopEvent); /* unblock dbCaRun() */ diff --git a/modules/database/src/ioc/db/dbCaPvt.h b/modules/database/src/ioc/db/dbCaPvt.h index f1a6e758e..9704b94e0 100644 --- a/modules/database/src/ioc/db/dbCaPvt.h +++ b/modules/database/src/ioc/db/dbCaPvt.h @@ -112,7 +112,17 @@ typedef struct caLink unsigned long nUpdate; }caLink; -#define DBCA_CALLBACK_INIT_WAIT (1) +/* Local link initial connection waiting + */ +// starting condition +#define DBCA_CALLBACK_INIT_START (0xf) +// set while initOutstanding incremented +#define DBCA_CALLBACK_INIT_WAITING (0x1) +// set for each condition necessary prior to completion (decrement initOutstanding) +#define DBCA_CALLBACK_INIT_WAIT_NATIVE (0x2) +#define DBCA_CALLBACK_INIT_WAIT_STRING (0x4) +#define DBCA_CALLBACK_INIT_WAIT_ATTRIB (0x8) +#define DBCA_CALLBACK_INIT_WAIT_MASK (0xe) void dbCaAddLinkCallbackOpt(struct dbLocker *locker, struct link *plink, dbCaCallback connect, dbCaCallback monitor, diff --git a/modules/database/src/ioc/db/dbLink.c b/modules/database/src/ioc/db/dbLink.c index e03650eab..ac4c0f5ff 100644 --- a/modules/database/src/ioc/db/dbLink.c +++ b/modules/database/src/ioc/db/dbLink.c @@ -127,7 +127,7 @@ void dbInitLink(struct link *plink, short dbfType) int isLocal = dbChannelTest(plink->value.pv_link.pvname)==0; - dbCaAddLinkCallbackOpt(NULL, plink, NULL, NULL, NULL, isLocal ? DBCA_CALLBACK_INIT_WAIT : 0); + dbCaAddLinkCallbackOpt(NULL, plink, NULL, NULL, NULL, isLocal ? DBCA_CALLBACK_INIT_START : 0); if (dbfType == DBF_FWDLINK) { char *pperiod = strrchr(plink->value.pv_link.pvname, '.'); From b5434c1e6bd6f8f1729efd93df19aed5e71c5f79 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 30 Mar 2026 12:20:38 -0500 Subject: [PATCH 021/141] Error message fixes/improvements --- modules/database/src/ioc/misc/iocInit.c | 3 ++- modules/database/src/std/dev/devGeneralTime.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/database/src/ioc/misc/iocInit.c b/modules/database/src/ioc/misc/iocInit.c index 57f141014..488b3b58c 100644 --- a/modules/database/src/ioc/misc/iocInit.c +++ b/modules/database/src/ioc/misc/iocInit.c @@ -185,7 +185,8 @@ static int iocBuild_2(void) scanInit(); if (asInit()) { - errlogPrintf(ERL_ERROR " iocBuild: asInit Failed.\n"); + errlogPrintf(ERL_ERROR " iocBuild: asInit Failed.\n" + ANSI_MAGENTA(" The IOC has not been started.") "\n"); return -1; } dbProcessNotifyInit(); diff --git a/modules/database/src/std/dev/devGeneralTime.c b/modules/database/src/std/dev/devGeneralTime.c index 5894f5730..fad368887 100644 --- a/modules/database/src/std/dev/devGeneralTime.c +++ b/modules/database/src/std/dev/devGeneralTime.c @@ -120,7 +120,7 @@ static long init_bo(dbCommon *pcommon) if (prec->out.type != INST_IO) { recGblRecordError(S_db_badField, prec, - "devAiGeneralTime::init_ai: Illegal INP field"); + "devBoGeneralTime::init_bo: Illegal OUT field"); prec->pact = TRUE; return S_db_badField; } From 7ec20ec4d31f56fe634c08f847662c13f38c6720 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 30 Mar 2026 12:21:50 -0500 Subject: [PATCH 022/141] Remove duplicate link to dbDefs Header file lives in libCom so that's what we keep. --- documentation/Makefile.headers | 1 - 1 file changed, 1 deletion(-) diff --git a/documentation/Makefile.headers b/documentation/Makefile.headers index 136a6dffc..44499f50c 100644 --- a/documentation/Makefile.headers +++ b/documentation/Makefile.headers @@ -71,7 +71,6 @@ database_HEADERS += chfPlugin database_HEADERS += dbBase database_HEADERS += dbChannel database_HEADERS += dbCommon -database_HEADERS += dbDefs database_HEADERS += dbEvent database_HEADERS += dbExtractArray database_HEADERS += dbLink From 6b6e73b416251cf50f590e5c3280cd6a6ded129b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 30 Mar 2026 12:24:13 -0500 Subject: [PATCH 023/141] Adjust the sort order of the new-notes files Preparing to sort PR-999.md and PR-1000.md correctly --- documentation/make-notes.pl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/documentation/make-notes.pl b/documentation/make-notes.pl index 37c1271e4..537bb54e4 100644 --- a/documentation/make-notes.pl +++ b/documentation/make-notes.pl @@ -58,7 +58,15 @@ if ($opt_d) { opendir my $dh, $opt_d or die "$tool: Can't open '-d' directory: $!\n"; - foreach my $fn (sort grep !m/^ \. \.? $/x, readdir $dh) { + # Get filenames, exclude dot-files, sort + my @files = sort { + my $rx = qr/^ (\D+) (\d+) (.*) $/x; + my @a = ($a =~ m/$rx/); + my @b = ($b =~ m/$rx/); + $a[0] cmp $b[0] || $a[1] <=> $b[1] || $a[2] cmp $b[2]; + } grep !m/^ \. \.? $/x, readdir $dh; + + foreach my $fn (@files) { next if $fn eq 'README.txt'; die "$tool: Not markdown? File '$fn' lacks '.md' extension\n" unless $fn =~ m/\.md$/; From ac0fc2effff43c9db116ae68c91f3a9767c991ec Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 30 Mar 2026 12:27:12 -0500 Subject: [PATCH 024/141] Reformat the ReleaseChecklist file - Remove all the HTML tags - Convert the table into Markdown sections - Set release version to 7.0.11 --- documentation/ReleaseChecklist.md | 685 +++++++++++++++--------------- 1 file changed, 336 insertions(+), 349 deletions(-) diff --git a/documentation/ReleaseChecklist.md b/documentation/ReleaseChecklist.md index 7fefba00b..416917d48 100644 --- a/documentation/ReleaseChecklist.md +++ b/documentation/ReleaseChecklist.md @@ -25,366 +25,353 @@ Responsible for maintaining the EPICS software **Website Editors** Responsible for the EPICS websites - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
WhoDescription
Preparing for a release
Release ManagerNotify core developers about the upcoming release and ask about any -remaining tasks that must be finished.
All developersCheck the bug tracker for any outstanding items and handle -appropriately.
Release ManagerSet a Feature Freeze date, by which time all Git branches for +---- + +### Preparing for a release + +**Release Manager:** +Notify core developers about the upcoming release and ask about any +remaining tasks that must be finished. + +**All developers:** +Check the bug tracker for any outstanding items and handle +appropriately. + +**Release Manager:** +Set a Feature Freeze date, by which time all Git branches for enhancements and new functionality should have been merged. After this date, commits and merges should only be made to fix problems that show -up during testing.
Release Manager
-& all developers
Request that documentation be updated and information about new +up during testing. + +**Release Manager & all developers:** +Request that documentation be updated and information about new features be added before the release date: -
Release ManagerReview and update this checklist for the upcoming release. Update -the release version number in the tags and messages below.
Testing
Platform DevelopersRun the internal test programs on all appropriate platforms.
Platform DevelopersCheck that all makeBaseApp templates build and run properly, all -xxxApp and xxxBoot types and any internal options, -e.g. setting STATIC_BUILD=YES or using a different -INSTALL_LOCATION in configure/CONFIG_SITE.
Release ManagerCheck that documentation has been updated: -
Release Approval
Core DevelopersReach a consensus that the software is ready to release.
Creating the final release version
Release Manager

For each external -submodule to be tagged

-
    -
  1. cd base-7.0/modules/<module>; git grep UNRELEASED -and insert the submodule's version number into any doxygen annotations -that have a @since UNRELEASED comment. Commit (don't push -yet).
  2. -
  3. Check that the submodule's Release Notes have been updated to cover -all changes; add missing items as necessary, and set the module version -number and release date if appropriate.
    -Commit the changes to the submodule's Notes file (don't push).
  4. -
  5. Copy the new submodule version number and Release Notes entries into -a new file named -module-release -in the base-7.0/documentation/new-notes directory.
  6. -
  7. Edit the module's release version file -configure/CONFIG_module_VERSION -and the Doxyfiles in the top-level and/or documentation -directories. In these, set DEVELOPMENT_FLAG=0 and remove --dev from the PROJECT_NUMBER string. Commit -these changes (don't push):

    -
    - git commit -m 'Final commit for <submodule-version>' -
  8. -
  9. Tag the submodule:

    -
    - git tag -m 'ANJ: Tag for EPICS 7.0.10' <submodule-version> -
  10. -
  11. Generate documentation for modules with -release_notes.dox files. Prepare to update the github-pages -website as follows:

    -
    - cd base-7.0/modules/<module>/documentation
    -make commit
    -git push --force upstream gh-pages -
    -

    Q: Delay this git push until later?

  12. -
  13. Update the Git submodule on the Base-7.0 branch to the -newly-tagged version, check the module's status matches the tag:

    -
    - cd base-7.0/modules
    -git add <module>
    -git submodule status --cached -
    -

    Don't commit the submodule updates yet.

  14. -
  15. Edit the module's release version file -configure/CONFIG_module_VERSION -and its top-level Doxyfile; increment the -MAINTENANCE_VERSION, set the DEVELOPMENT_FLAG -value to 1, and update the PROJECT_NUMBER string, appending --dev to the new module version number. Commit changes.
  16. -
  17. Push commits and the new tag to the submodule's GitHub repository -(assumed to be the upstream remote):

    -
    - cd base-7.0/modules/<module>
    -git push --follow-tags upstream master -
  18. -
Release Manager

After all submodules -have been updated:

-
    -
  1. Commit the submodule updates which were added for each submodule -in step 7 above to the 7.0 branch (don't push):

    -
    - cd base-7.0/modules
    -git commit -m "Update git submodules for release" -
  2. -
  3. Make sure that the output from -git submodule status --cached only shows the appropriate -version tags in the right-most parenthesized column with no --n-gxxxxxxx -suffix.
  4. -
  5. Add and commit the new Release Note entry files that were created -for each submodule in step 3 above (don't push):

    -
    - cd base-7.0/documentation
    -git add new-notes
    -git commit -m "Add submodule release note entries" -
  6. -
Release Manager

In the main epics-base -repository

-
    -
  1. cd base-7.0; git grep UNRELEASED and insert the release -version to any doxygen annotations that have a -@since UNRELEASED comment. Commit (don't push).
  2. -
  3. Edit the main EPICS Base version file and the built-in module -version files: -
      -
    • configure/CONFIG_BASE_VERSION
    • -
    • configure/CONFIG_LIBCOM_VERSION
    • -
    • configure/CONFIG_CA_VERSION
    • -
    • configure/CONFIG_DATABASE_VERSION
    • -
  4. -
  5. Version numbers should be set according to the level of changes made -since the last release. Note that the MAINTENANCE_VERSION -or PATCH_LEVEL value will have been incremented immediately -after the previous release tag was applied, so don't double-increment -them. Set all DEVELOPMENT_FLAG values to 0 and set the -EPICS_DEV_SNAPSHOT to an empty string (no quotes).
  6. -
  7. Commit the above changes (don't push):

    -
    - cd base-7.0
    -git add configure/CONFIG_*_VERSION
    -git commit -m "Set core version numbers for release" -
  8. -
  9. When EPICS_DEV_SNAPSHOT is empty because a release -is being created, the documentation/Makefile supports a -build target release for creating a new release notes file -documentation/RELEASE-version.md -from the Markdown files in the documentation/new-notes -directory. When run, it copies the notes entries from all the -new-notes/*.md files, then deletes the files and prepares a -Git commit to apply those changes permanently to the repository.

    -

    Run these commands to generate the RELEASE-7.0.10.md -file and remove the individual release note entry files:

    -
    - cd base-7.0/documentation
    -make release -
  10. -
  11. The make release command add some changes into the -Git index but didn't commit them. These commands let you check what was -done and commit the result (don't push yet!):

    -
    - git status
    -git diff --staged
    -git commit -m "Generate RELEASE-7.0.10.md notes file" -
    -

    To undo those Git actions and confirm that happened, run these:

    -
    - make unrelease
    -git status -
  12. -
Release ManagerTag the epics-base module in Git: -
- cd base-7.0
-git tag -m 'ANJ: Tagged for release' R7.0.10 -
-

Don't push to GitHub yet.

Release Manager

After tagging the release

+ +- Release Notes +- Doxygen annotations +- Other documents on + [docs.epics-controls.org](https://docs.epics-controls.org/en/latest/) + +**Release Manager:** +Review and update this checklist for the upcoming release. Update +the release version number in the tags and messages below. + +---- + +### Testing + +**All Developers:** +Run the internal test programs on supported platforms that aren't checked by CI. + +**ALL Developers:** +Check that all makeBaseApp templates build and run properly, +all _xxxApp_ and _xxxBoot_ types and any internal options, +e.g. setting `STATIC_BUILD=YES` or using a different +`INSTALL_LOCATION` in `configure/CONFIG_SITE`. + +**Release Manager:** +Check that documentation has been updated: + +- Release Notes +- Doxygen annotations +- Other documents on + [docs.epics-controls.org](https://docs.epics-controls.org/en/latest/) + +**Core Developers:** +Reach a consensus that the software is ready to release. + +---- + +### Creating the final release version + +#### A. For each external submodule to be tagged + +**Release Manager:** + +1. `cd base-7.0/modules/; git grep UNRELEASED` + and insert the submodule's version number into any doxygen annotations + that have a `@since UNRELEASED` comment. Commit (don't push yet). + +2. Check that the submodule's Release Notes have been updated to cover + all changes; add missing items as necessary, and set the module version + number and release date if appropriate. + Commit the changes to the submodule's Notes file (don't push). + +3. Copy the new submodule version number and Release Notes entries into + a new file named `-.md` + in the `base-7.0/documentation/new-notes` directory. + +4. Edit the module's release version file + `configure/CONFIG__VERSION` + and any `Doxyfile` in the top-level and/or `documentation` + directories. In these, set `DEVELOPMENT_FLAG=0` and remove + `-dev` from the `PROJECT_NUMBER` string. Commit + these changes (don't push): + + ``` + git commit -m "Final commit for " + ``` + +5. Tag the submodule (replace `ANJ` with your initials): + + ``` + git tag -m "ANJ: Tag for EPICS 7.0.11" + ``` + +6. Generate documentation for modules with + `release_notes.dox` files. Prepare to update the github-pages + website as follows: + + ``` + cd base-7.0/modules//documentation + make commit + git push --force upstream gh-pages + ``` + + _Q: Delay this `git push` until later?_ + +7. Update the Git submodule on the Base-7.0 branch to the + newly-tagged version, check the module's status matches the tag: + + ``` + cd base-7.0/modules + git add + git submodule status --cached + ``` + + Don't commit the submodule updates yet. + +8. Edit the module's release version file + `configure/CONFIG__VERSION` + and its top-level `Doxyfile`; increment the + `MAINTENANCE_VERSION`, set the `DEVELOPMENT_FLAG` + value to 1, and update the `PROJECT_NUMBER` string, appending + `-dev` to the new module version number. Commit changes. + +9. Push commits and the new tag to the submodule's GitHub repository + (assumed to be the `upstream` remote): + + ``` + cd base-7.0/modules/ + git push --follow-tags upstream master + ``` + +#### B. After all submodules have been updated + +**Release Manager:** + +1. Commit the submodule updates which were added for each submodule + in step 7 above to the 7.0 branch (don't push): + + ``` + cd base-7.0/modules + git commit -m "Update git submodules for release" + ``` + +2. Make sure that the output from + `git submodule status --cached` only shows the appropriate + version tags in the right-most parenthesized column with no + `--g` suffix. + +3. Add and commit the new Release Note entry files that were created + for each submodule in step 3 above (don't push): + + ``` + cd base-7.0/documentation + git add new-notes + git commit -m "Add submodule release note entries" + ``` + +#### C. In the main epics-base repository + +**Release Manager:** + +1. `cd base-7.0; git grep UNRELEASED` and insert the release + version to any doxygen annotations that have a + `@since UNRELEASED` comment. Commit (don't push). + +2. Edit the main EPICS Base version file and the built-in module + version files: + - `configure/CONFIG_BASE_VERSION` + - `configure/CONFIG_LIBCOM_VERSION` + - `configure/CONFIG_CA_VERSION` + - `configure/CONFIG_DATABASE_VERSION` + +3. Version numbers should be set according to the level of changes made + since the last release. Note that the `MAINTENANCE_VERSION` + or `PATCH_LEVEL` value will have been incremented immediately + after the previous release tag was applied, so don't double-increment + them. Set all `DEVELOPMENT_FLAG` values to 0 and set the + `EPICS_DEV_SNAPSHOT` to an empty string (no quotes). + +4. Commit the above changes (don't push): + + ``` + cd base-7.0 + git add configure/CONFIG_*_VERSION + git commit -m "Set core version numbers for release" + ``` + +5. When `EPICS_DEV_SNAPSHOT` is empty because a release + is being created, the `documentation/Makefile` supports a + build target `release` for creating a new release notes file + `documentation/RELEASE-.md` + from the Markdown files in the `documentation/new-notes` directory. + When run, it copies the notes entries from all the + `new-notes/*.md` files, then deletes the files and prepares a + Git commit to apply those changes permanently to the repository. + + Run these commands to generate the `RELEASE-7.0.11.md` + file and remove the individual release note entry files: + + ``` + cd base-7.0/documentation + make release + ``` + +6. The `make release` command adds some changes into the + Git index but doesn't commit them. These commands let you check what + was done and commit the result (don't push yet!): + + ``` + git status + git diff --staged + git commit -m "Generate RELEASE-7.0.11.md notes file" + ``` + + If you need to undo those Git actions before committing and confirm + that happened, use `make unrelease; git status` + +#### D. Tag the main repository + +**Release Manager:** +Tag the epics-base module in Git (replace `ANJ` with your initials): + +``` +cd base-7.0 +git tag -m "ANJ: Tagged for release" R7.0.11 +``` + +Don't push to GitHub yet. + +#### E. After tagging + +**Release Manager:** Edit the main EPICS Base version file and the built-in module version files: -
    -
  • configure/CONFIG_BASE_VERSION
  • -
  • configure/CONFIG_LIBCOM_VERSION
  • -
  • configure/CONFIG_CA_VERSION
  • -
  • configure/CONFIG_DATABASE_VERSION
  • -
-

Version numbers should be set for the next expected patch/maintenance + +- `configure/CONFIG_BASE_VERSION` +- `configure/CONFIG_LIBCOM_VERSION` +- `configure/CONFIG_CA_VERSION` +- `configure/CONFIG_DATABASE_VERSION` + +Version numbers should be set for the next expected patch/maintenance release by incrementing the MAINTENANCE_VERSION or PATCH_LEVEL value in -each file. Set all DEVELOPMENT_FLAG values to 1 and -EPICS_DEV_SNAPSHOT to "-DEV".

-

Commit these changes (don't push).

Release ManagerExport the tagged version into a tarfile. The -make-tar.sh script generates a gzipped tarfile directly +each file. Set all `DEVELOPMENT_FLAG` values to 1 and +`EPICS_DEV_SNAPSHOT` to `-DEV`. + +Commit these changes (don't push). + +**Release Manager:** +Export the tagged version into a tarfile. The +`make-tar.sh` script generates a gzipped tarfile directly from the tag, excluding the files and directories that are only used for continuous integration: -
- cd base-7.0
-./.tools/make-tar.sh R7.0.10 ../base-7.0.10.tar.gz base-7.0.10/ -
+ +``` +cd base-7.0 +./.tools/make-tar.sh R7.0.11 ../base-7.0.11.tar.gz base-7.0.11/ +``` + Create a GPG signature file of the tarfile as follows: -
- cd ..
-gpg --armor --sign --detach-sig base-7.0.10.tar.gz -
Release ManagerTest the tar file by extracting its contents and building it on at + +``` +cd .. +gpg --armor --sign --detach-sig base-7.0.11.tar.gz +``` + +**Release Manager:** +Test the tar file by extracting its contents and building it on at least one supported platform. If this succeeds the commits and new git tag can be pushed to the GitHub repository's 7.0 branch (assumed to be -the upstream remote): -
- git push --follow-tags upstream 7.0 -
Publish to epics.anl.gov
Website EditorCopy the tarfile and its signature to the Base download area of the -website.
Website EditorAdd the new release tar file to the website Base download index -page.
Website EditorCreate or update the website subdirectory that holds the release +the `upstream` remote): + +``` +git push --follow-tags upstream 7.0 +``` + +---- + +### Publish the Release + +These stages don't have to happen in this particular order. + +#### A. Publish to epics.anl.gov + +**Website Editor:** +Copy the tarfile and its signature to the Base download area of the +website. + +**Website Editor:** +Add the new release tar file to the website Base download index +page. + +**Website Editor:** +Create or update the website subdirectory that holds the release documentation, and copy in the files to be published with this release -version.
Website EditorUpdate the webpage for the new release with links to the release -documents and tar file.
Website EditorLink to the release webpage from other relevant areas of the website -- update front page and sidebars.
Website EditorAdd an entry to the website News page, linking to the new version -webpage.
Publish to epics-controls.org
Website EditorUpload the tar file and its .asc signature file to the +version. + +**Website Editor:** +Update the webpage for the new release with links to the release +documents and tar file. + +**Website Editor:** +Link to the release webpage from other relevant areas of the website, +updating the front page and sidebar. + +**Website Editor:** +Add an entry to the website News page, linking to the new version +webpage. + +### B. Publish to epics-controls.org + +**Website Editor:** +Upload the tar file and its `.asc` signature file to the epics-controls web-server. -
- scp base-7.0.10.tar.gz base-7.0.10.tar.gz.asc epics-controls:download/base
-
Website Editor

Follow instructions on - -Add a page for a new release -to create a new release webpage (not -required for a patch release, just edit the existing page). Update the -TablePress "Point Releases" table and add the new download, and adjust -the Html Snippet for the series download.

-

Not covered in those instructions: Go to Posts, find a previous + +``` +scp base-7.0.11.tar.gz base-7.0.11.tar.gz.asc epics-controls:download/base +``` + +**Website Editor:** +Follow instructions on +[Add a page for a new release](https://epics-controls.org/resources-and-support/documents/epics-website-documentation/adding-a-page-for-a-new-release/) +to create a new release webpage (not required for a patch release, just +edit the existing page). Update the TablePress "Point Releases" table +and add the new download, and adjust the Html Snippet for the series +download. + +Not covered in the instructions on the website: Go to Posts, find a previous release and use "Duplicate Post", then edit the result and publish it. -This generates the News item.

Publish to GitHub
Release ManagerGo to the GitHub - -Create -release from tag R7.0.10 page. Upload the tar file and its -.asc signature file to the new GitHub release page, or just -drag-n-drop them into the page. Copy/paste the text from the previous -release and edit. Submit.
Release ManagerWe used to close out bug reports in Launchpad at release-time, this -would be the time to do that if we have an equivalent on GitHub.
Make Announcement
Release ManagerAnnounce the release on the tech-talk mailing list.
+This generates the News item. + +### C. Publish to GitHub + +**Release Manager:** +Go to the GitHub +[Create release from tag R7.0.11](https://github.com/epics-base/epics-base/releases/new?tag=R7.0.11) +page. Upload the tar file and its `.asc` signature file to the new +GitHub release page, or just drag-n-drop them into the page. Copy/paste +the text from the previous release and edit. Submit. + +**Release Manager:** +We used to close out bug reports in Launchpad at release-time, this +would be the time to do that if we want an equivalent on GitHub. + +---- + +### Make Announcement + +**Release Manager:** +Announce the release on the tech-talk mailing list, and possibly on the EPICS +Matrix Chat server. From 8bfe89b57d8c5df81baf8a264e4c3aed2ae310c1 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 12 May 2026 18:48:48 -0700 Subject: [PATCH 025/141] doc dbBase.h document dbBase list node types --- modules/database/src/ioc/dbStatic/dbBase.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/database/src/ioc/dbStatic/dbBase.h b/modules/database/src/ioc/dbStatic/dbBase.h index 1a080393c..da7db6ed5 100644 --- a/modules/database/src/ioc/dbStatic/dbBase.h +++ b/modules/database/src/ioc/dbStatic/dbBase.h @@ -170,7 +170,7 @@ typedef struct dbRecordType { char **papsortFldName;/**< \brief ptr to array of ptr to fld names*/ short *sortFldInd; /**< \brief * addr of array of ind in papFldDes*/ dbFldDes *pvalFldDes; /**< \brief pointer dbFldDes for VAL field*/ - short indvalFlddes; /**< \brief ind in papFldDes*/ + short indvalFlddes; /**< \brief index of VAL field in papFldDes[] */ dbFldDes **papFldDes; /**< \brief ptr to array of ptr to fldDes*/ /*The following are only available on run time system*/ rset *prset; @@ -181,15 +181,25 @@ struct dbPvd; /* Contents private to dbPvdLib code */ struct gphPvt; /* Contents private to gpHashLib code */ typedef struct dbBase { + // struct dbMenu ELLLIST menuList; + // struct dbRecordType ELLLIST recordTypeList; + // struct drvSup ELLLIST drvList; + // struct linkSup ELLLIST linkList; + // struct dbText ELLLIST registrarList; + // struct dbText ELLLIST functionList; + // struct dbVariableDef ELLLIST variableList; + // struct brkTable ELLLIST bptList; + // struct chFilterPlugin ELLLIST filterList; + // struct dbGuiGroup (private) ELLLIST guiGroupList; void *pathPvt; struct dbPvd *ppvd; From 2f20e78e43aa6218b4efdc8ffb0cd576b92cdadf Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 12 May 2026 18:33:22 -0700 Subject: [PATCH 026/141] epicsStrPrintEscaped() operate on unterminated string see 3a2d225682d79f79c84852dbcb98d54cb250d62f see f488765631998c9d0b27a14c13aa412ec81a5fe9 --- modules/libcom/src/misc/epicsString.c | 2 +- modules/libcom/src/misc/epicsString.h | 3 +++ modules/libcom/test/epicsStringTest.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/libcom/src/misc/epicsString.c b/modules/libcom/src/misc/epicsString.c index bcd10a504..2c56eeec1 100644 --- a/modules/libcom/src/misc/epicsString.c +++ b/modules/libcom/src/misc/epicsString.c @@ -234,7 +234,7 @@ int epicsStrPrintEscaped(FILE *fp, const char *s, size_t len) if (fp == NULL) return -1; - if (s == NULL || strlen(s) == 0 || len == 0) + if (s == NULL || len == 0) return 0; // No work to do while (len--) { diff --git a/modules/libcom/src/misc/epicsString.h b/modules/libcom/src/misc/epicsString.h index 5b36ebb94..573efa692 100644 --- a/modules/libcom/src/misc/epicsString.h +++ b/modules/libcom/src/misc/epicsString.h @@ -119,6 +119,9 @@ LIBCOM_API char * epicsStrnDup(const char *s, size_t len); * \param fp File descriptor to print to * \param s String to print * \param n Length of string + * \return Number of characters printed, or negative on error. + * + * \since 7.0.8 until UNRELEASED, @code strlen(s) @endcode must be valid. */ LIBCOM_API int epicsStrPrintEscaped(FILE *fp, const char *s, size_t n); diff --git a/modules/libcom/test/epicsStringTest.c b/modules/libcom/test/epicsStringTest.c index 77c53f041..6fe45dd99 100644 --- a/modules/libcom/test/epicsStringTest.c +++ b/modules/libcom/test/epicsStringTest.c @@ -220,6 +220,7 @@ void testEpicsStrPrintEscaped(void) // Passing cases testOk1(epicsStrPrintEscaped(testFile, "1234", 4) == 4); + testOk1(epicsStrPrintEscaped(testFile, "1234extra", 4) == 4); testOk1(epicsStrPrintEscaped(testFile, "\a\b\f\n\r\t\v\\\'\"", 10) == 20); // Failing cases @@ -236,7 +237,6 @@ void testEpicsStrPrintEscaped(void) testSkip(1, "fprintf is broken on this system"); } testOk1(epicsStrPrintEscaped(testFile, NULL, 4) == 0); - testOk1(epicsStrPrintEscaped(testFile, "", 4) == 0); testOk1(epicsStrPrintEscaped(testFile, "1234", 0) == 0); fclose(testFile); From 7e68cf7ea6032f34f1115c18a136c119c8532c52 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 15 May 2026 17:17:07 -0500 Subject: [PATCH 027/141] Adjust make-notes.pl sorting code to avoid a Perl warning --- documentation/make-notes.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/documentation/make-notes.pl b/documentation/make-notes.pl index 537bb54e4..b6dbe46d6 100644 --- a/documentation/make-notes.pl +++ b/documentation/make-notes.pl @@ -59,10 +59,10 @@ if ($opt_d) { die "$tool: Can't open '-d' directory: $!\n"; # Get filenames, exclude dot-files, sort + my $rx = qr/^ (\D+) (\d+) (.*) $/x; my @files = sort { - my $rx = qr/^ (\D+) (\d+) (.*) $/x; - my @a = ($a =~ m/$rx/); - my @b = ($b =~ m/$rx/); + my @a = ($a =~ m/$rx/, '', ''); + my @b = ($b =~ m/$rx/, '', ''); $a[0] cmp $b[0] || $a[1] <=> $b[1] || $a[2] cmp $b[2]; } grep !m/^ \. \.? $/x, readdir $dh; From 6b80b0cfb9fba83e88aa964a6ea5685d7bffcd09 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Tue, 24 Feb 2026 11:21:18 +0000 Subject: [PATCH 028/141] Modify errorlog initialisation to add separate default value --- modules/libcom/src/error/errlog.c | 5 +++-- modules/libcom/src/error/errlog.h | 8 ++++++-- modules/libcom/src/iocsh/libComRegister.c | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 75c6e63c1..3aff8e2ec 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -41,7 +41,8 @@ #include "osiUnistd.h" -#define MIN_BUFFER_SIZE 1280 +#define MIN_BUFFER_SIZE 2560 +#define DEFAULT_MAX_MSG_SIZE 512 #define MIN_MESSAGE_SIZE 256 #define MAX_MESSAGE_SIZE 0x00ffffff @@ -608,7 +609,7 @@ int errlogInit2(int bufsize, int maxMsgSize) int errlogInit(int bufsize) { - return errlogInit2(bufsize, MIN_MESSAGE_SIZE); + return errlogInit2(bufsize, DEFAULT_MAX_MSG_SIZE); } void errlogFlush(void) diff --git a/modules/libcom/src/error/errlog.h b/modules/libcom/src/error/errlog.h index a3392e6aa..a204bec87 100644 --- a/modules/libcom/src/error/errlog.h +++ b/modules/libcom/src/error/errlog.h @@ -205,18 +205,22 @@ LIBCOM_API int eltc(int yesno); LIBCOM_API int errlogSetConsole(FILE *stream); /** - * Can be used to initialize the error logging system with a larger buffer. The default buffer size is 1280 bytes. + * Can be used to initialize the error logging system with a larger buffer. The default buffer size is 2560 bytes. * * \param bufsize The desired buffer size + * + * \since UNRELEASED the default buffer size is 2560. */ LIBCOM_API int errlogInit(int bufsize); /** * errlogInit2 can be used to initialize the error logging system with a larger buffer and maximum message size. - * The default buffer size is 1280 bytes, and the default maximum message size is 256. + * The default buffer size is 2560 bytes, and the default maximum message size is 512. * * \param bufsize The desired buffer size * \param maxMsgSize The desired max message size + * + * \since UNRELEASED The default buffer size is 2560 and the default maximum message size is 512. */ LIBCOM_API int errlogInit2(int bufsize, int maxMsgSize); diff --git a/modules/libcom/src/iocsh/libComRegister.c b/modules/libcom/src/iocsh/libComRegister.c index fd17acccb..709452473 100644 --- a/modules/libcom/src/iocsh/libComRegister.c +++ b/modules/libcom/src/iocsh/libComRegister.c @@ -267,7 +267,7 @@ static const iocshArg * const errlogInitArgs[1] = {&errlogInitArg0}; static const iocshFuncDef errlogInitFuncDef = { "errlogInit",1,errlogInitArgs, "Initialize error log client buffer size\n" - " bufSize - size of circular buffer (default = 1280 bytes)\n" + " bufSize - size of circular buffer (default = 2560 bytes)\n" }; static void errlogInitCallFunc(const iocshArgBuf *args) { @@ -282,8 +282,8 @@ static const iocshArg * const errlogInit2Args[] = static const iocshFuncDef errlogInit2FuncDef = { "errlogInit2", 2, errlogInit2Args, "Initialize error log client buffer size and maximum message size\n" - " bufSize - size of circular buffer (default = 1280 bytes)\n" - " maxMsgSize - maximum size of error message (default = 256 bytes)\n" + " bufSize - size of circular buffer (default = 2560 bytes)\n" + " maxMsgSize - maximum size of error message (default = 512 bytes)\n" }; static void errlogInit2CallFunc(const iocshArgBuf *args) { From a03d1fbe45f04a5fa168f40a457ebd1aa3e551f9 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Tue, 24 Feb 2026 13:53:14 +0000 Subject: [PATCH 029/141] Add commandline utility to resize buffer after being initialised --- modules/libcom/src/error/errlog.c | 29 +++++++++++++++++++++++ modules/libcom/src/error/errlog.h | 9 +++++++ modules/libcom/src/iocsh/libComRegister.c | 17 +++++++++++++ 3 files changed, 55 insertions(+) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 3aff8e2ec..b5678fcba 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -77,6 +77,7 @@ typedef struct { } buffer_t; static struct { + epicsMutexId bufSizeLock; /* const after errlogInit() */ size_t maxMsgSize; /* alloc size of both buffer_t::base */ @@ -548,6 +549,7 @@ static void errlogInitPvt(void *arg) */ pvt.errlogInitFailed = TRUE; + pvt.bufSizeLock = epicsMutexCreate(); pvt.bufSize = pconfig->bufsize; pvt.maxMsgSize = pconfig->maxMsgSize; ellInit(&pvt.listenerList); @@ -566,6 +568,7 @@ static void errlogInitPvt(void *arg) errSymBld(); /* Better not to do this lazily... */ if(pvt.waitForWork + && pvt.bufSizeLock && pvt.listenerLock && pvt.msgQueueLock && pvt.waitForSeq @@ -612,6 +615,32 @@ int errlogInit(int bufsize) return errlogInit2(bufsize, DEFAULT_MAX_MSG_SIZE); } +void errlogBufResize(int bufsize, int maxMsgSize) +{ + if (bufsize < MIN_BUFFER_SIZE) + bufsize = MIN_BUFFER_SIZE; + if (maxMsgSize < MIN_MESSAGE_SIZE) + maxMsgSize = MIN_MESSAGE_SIZE; + else if (maxMsgSize > MAX_MESSAGE_SIZE) + maxMsgSize = MAX_MESSAGE_SIZE; + + errlogFlush(); + + epicsMutexMustLock(pvt.bufSizeLock); + epicsMutexMustLock(pvt.msgQueueLock); + + pvt.bufSize = bufsize; + pvt.maxMsgSize = maxMsgSize; + + free(pvt.log->base); + pvt.log->base = callocMustSucceed(1, pvt.bufSize, "Failed to allocate memory for errorlog buffer"); + free(pvt.print->base); + pvt.print->base = callocMustSucceed(1, pvt.bufSize, "Failed to allocate memory for errorlog buffer"); + + epicsMutexUnlock(pvt.msgQueueLock); + epicsMutexUnlock(pvt.bufSizeLock); +} + void errlogFlush(void) { /* wait for both buffers to be handled to know that all currently diff --git a/modules/libcom/src/error/errlog.h b/modules/libcom/src/error/errlog.h index a204bec87..aea8437da 100644 --- a/modules/libcom/src/error/errlog.h +++ b/modules/libcom/src/error/errlog.h @@ -224,6 +224,15 @@ LIBCOM_API int errlogInit(int bufsize); */ LIBCOM_API int errlogInit2(int bufsize, int maxMsgSize); +/** + * errlogBufResize can be used to reinitialize the error logging system with a larger buffer and maximum message size. + * The default buffer size is 1280 bytes, and the default maximum message size is 256. + * + * \param bufsize The desired buffer size + * \param maxMsgSize The desired max message size + */ +LIBCOM_API void errlogBufResize(int bufsize, int maxMsgSize); + /** Wakes up the errlog task and then waits until all messages are flushed from the queue. */ LIBCOM_API void errlogFlush(void); diff --git a/modules/libcom/src/iocsh/libComRegister.c b/modules/libcom/src/iocsh/libComRegister.c index 709452473..844ee14e2 100644 --- a/modules/libcom/src/iocsh/libComRegister.c +++ b/modules/libcom/src/iocsh/libComRegister.c @@ -290,6 +290,22 @@ static void errlogInit2CallFunc(const iocshArgBuf *args) errlogInit2(args[0].ival, args[1].ival); } +/* errlogBufResize */ +static const iocshArg errlogBufResizeArg0 = { "bufSize",iocshArgInt}; +static const iocshArg errlogBufResizeArg1 = { "maxMsgSize",iocshArgInt}; +static const iocshArg * const errlogBufResizeArgs[] = + {&errlogBufResizeArg0, &errlogBufResizeArg1}; +static const iocshFuncDef errlogBufResizeFuncDef = { + "errlogBufResize", 2, errlogBufResizeArgs, + "Reinitialize error log client buffer size and maximum message size\n" + " bufSize - size of circular buffer (default = 1280 bytes)\n" + " maxMsgSize - maximum size of error message (default = 256 bytes)\n" +}; +static void errlogBufResizeCallFunc(const iocshArgBuf *args) +{ + errlogBufResize(args[0].ival, args[1].ival); +} + /* errlog */ IOCSH_STATIC_FUNC void errlog(const char *message) { @@ -500,6 +516,7 @@ void epicsStdCall libComRegister(void) iocshRegister(&eltcFuncDef, eltcCallFunc); iocshRegister(&errlogInitFuncDef,errlogInitCallFunc); iocshRegister(&errlogInit2FuncDef,errlogInit2CallFunc); + iocshRegister(&errlogBufResizeFuncDef,errlogBufResizeCallFunc); iocshRegister(&errlogFuncDef, errlogCallFunc); iocshRegister(&iocLogPrefixFuncDef, iocLogPrefixCallFunc); From bb5f12b2fa4ae4887fb51bfeb60107d751a5636d Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Tue, 24 Feb 2026 14:53:33 +0000 Subject: [PATCH 030/141] Add command to show errlog buffer contents --- modules/libcom/src/error/errlog.c | 28 +++++++++++++++++++++++ modules/libcom/src/error/errlog.h | 9 -------- modules/libcom/src/error/errlogPvt.h | 26 +++++++++++++++++++++ modules/libcom/src/iocsh/libComRegister.c | 17 ++++++++++++++ 4 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 modules/libcom/src/error/errlogPvt.h diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index b5678fcba..c4362f763 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -641,6 +641,34 @@ void errlogBufResize(int bufsize, int maxMsgSize) epicsMutexUnlock(pvt.bufSizeLock); } +void errlogShow(int level) +{ + epicsMutexMustLock(pvt.bufSizeLock); + printf("Error log:\n"); + printf(" buffer size: %zu\n", pvt.bufSize); + printf(" max message size: %zu\n", pvt.maxMsgSize); + epicsMutexUnlock(pvt.bufSizeLock); + + if (level > 0) + { + epicsMutexMustLock(pvt.listenerLock); + printf(" number of listeners: %u\n", pvt.listenerList.count); + epicsMutexUnlock(pvt.listenerLock); + } + + if (level > 1) + { + epicsMutexMustLock(pvt.msgQueueLock); + printf(" buffer(log) contents:\n"); + printf("%s\n", pvt.log->base); + printf("%*s^\n", (int)pvt.log->pos, ""); + printf(" buffer(print) contents:\n"); + printf("%s\n", pvt.print->base); + printf("%*s^\n", (int)pvt.print->pos, ""); + epicsMutexUnlock(pvt.msgQueueLock); + } +} + void errlogFlush(void) { /* wait for both buffers to be handled to know that all currently diff --git a/modules/libcom/src/error/errlog.h b/modules/libcom/src/error/errlog.h index aea8437da..a204bec87 100644 --- a/modules/libcom/src/error/errlog.h +++ b/modules/libcom/src/error/errlog.h @@ -224,15 +224,6 @@ LIBCOM_API int errlogInit(int bufsize); */ LIBCOM_API int errlogInit2(int bufsize, int maxMsgSize); -/** - * errlogBufResize can be used to reinitialize the error logging system with a larger buffer and maximum message size. - * The default buffer size is 1280 bytes, and the default maximum message size is 256. - * - * \param bufsize The desired buffer size - * \param maxMsgSize The desired max message size - */ -LIBCOM_API void errlogBufResize(int bufsize, int maxMsgSize); - /** Wakes up the errlog task and then waits until all messages are flushed from the queue. */ LIBCOM_API void errlogFlush(void); diff --git a/modules/libcom/src/error/errlogPvt.h b/modules/libcom/src/error/errlogPvt.h new file mode 100644 index 000000000..c65220769 --- /dev/null +++ b/modules/libcom/src/error/errlogPvt.h @@ -0,0 +1,26 @@ +/*************************************************************************\ +* Copyright (c) 2026 European Spallation Source ERIC +* SPDX-License-Identifier: EPICS +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#ifndef INC_errlogPvt_H +#define INC_errlogPvt_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * errlogShow is used to display the contents of the error log buffers + * + * \param level How much detail to print out + */ +void errlogShow(int level); + +#ifdef __cplusplus +} +#endif + +#endif /*INC_errlogPvt_H*/ diff --git a/modules/libcom/src/iocsh/libComRegister.c b/modules/libcom/src/iocsh/libComRegister.c index 844ee14e2..cbf262608 100644 --- a/modules/libcom/src/iocsh/libComRegister.c +++ b/modules/libcom/src/iocsh/libComRegister.c @@ -22,6 +22,7 @@ #include "osiUnistd.h" #include "logClient.h" #include "errlog.h" +#include "errlogPvt.h" #include "taskwd.h" #include "registry.h" #include "epicsGeneralTime.h" @@ -306,6 +307,21 @@ static void errlogBufResizeCallFunc(const iocshArgBuf *args) errlogBufResize(args[0].ival, args[1].ival); } +/* errlogShow */ +static const iocshArg errlogShowArg0 = { "level",iocshArgInt}; +static const iocshArg * const errlogShowArgs[1] = {&errlogShowArg0}; +static const iocshFuncDef errlogShowFuncDef = { + "errlogShow",1,errlogShowArgs, + "Show the contents of the error log private data\n" + "level 0 - Show the size of the buffers and max message size\n" + " 1 - Show the number of listeners\n" + " 2 - Show the contents of the buffer\n" +}; +static void errlogShowCallFunc(const iocshArgBuf *args) +{ + errlogShow(args[0].ival); +} + /* errlog */ IOCSH_STATIC_FUNC void errlog(const char *message) { @@ -517,6 +533,7 @@ void epicsStdCall libComRegister(void) iocshRegister(&errlogInitFuncDef,errlogInitCallFunc); iocshRegister(&errlogInit2FuncDef,errlogInit2CallFunc); iocshRegister(&errlogBufResizeFuncDef,errlogBufResizeCallFunc); + iocshRegister(&errlogShowFuncDef,errlogShowCallFunc); iocshRegister(&errlogFuncDef, errlogCallFunc); iocshRegister(&iocLogPrefixFuncDef, iocLogPrefixCallFunc); From b334ec80bb7412bb658c78f648bb8d76fa566ea3 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Tue, 24 Feb 2026 16:45:05 +0000 Subject: [PATCH 031/141] Update the error log functionality to avoid losing writes --- modules/libcom/src/error/errlog.c | 32 +++++++++++++++++------ modules/libcom/src/error/errlog.h | 9 +++++++ modules/libcom/src/iocsh/libComRegister.c | 2 +- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index c4362f763..7dbfe519d 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -615,28 +615,44 @@ int errlogInit(int bufsize) return errlogInit2(bufsize, DEFAULT_MAX_MSG_SIZE); } -void errlogBufResize(int bufsize, int maxMsgSize) +int errlogBufResize(int bufsize, int maxMsgSize) { + char* logbuf = NULL; + char* printbuf = NULL; + + epicsMutexMustLock(pvt.bufSizeLock); + + // Only increasing the buffer size is allowed! + if (bufsize < pvt.bufSize) { + epicsMutexUnlock(pvt.bufSizeLock); + fprintf(stderr, "Shrinking the errorlog buffer is not allowed.\n"); + return -1; + } + if (bufsize < MIN_BUFFER_SIZE) bufsize = MIN_BUFFER_SIZE; + if (maxMsgSize < MIN_MESSAGE_SIZE) maxMsgSize = MIN_MESSAGE_SIZE; else if (maxMsgSize > MAX_MESSAGE_SIZE) maxMsgSize = MAX_MESSAGE_SIZE; - errlogFlush(); + logbuf = calloc(1, bufsize); + printbuf = calloc(1, bufsize); - epicsMutexMustLock(pvt.bufSizeLock); epicsMutexMustLock(pvt.msgQueueLock); + memcpy(logbuf, pvt.log->base, pvt.bufSize); + free(pvt.log->base); + pvt.log->base = logbuf; + + memcpy(printbuf, &pvt.print->base, pvt.bufSize); + free(pvt.print->base); + pvt.print->base = printbuf; + pvt.bufSize = bufsize; pvt.maxMsgSize = maxMsgSize; - free(pvt.log->base); - pvt.log->base = callocMustSucceed(1, pvt.bufSize, "Failed to allocate memory for errorlog buffer"); - free(pvt.print->base); - pvt.print->base = callocMustSucceed(1, pvt.bufSize, "Failed to allocate memory for errorlog buffer"); - epicsMutexUnlock(pvt.msgQueueLock); epicsMutexUnlock(pvt.bufSizeLock); } diff --git a/modules/libcom/src/error/errlog.h b/modules/libcom/src/error/errlog.h index a204bec87..2fe01cf7e 100644 --- a/modules/libcom/src/error/errlog.h +++ b/modules/libcom/src/error/errlog.h @@ -224,6 +224,15 @@ LIBCOM_API int errlogInit(int bufsize); */ LIBCOM_API int errlogInit2(int bufsize, int maxMsgSize); +/** + * errlogBufResize can be used to reinitialize the error logging system with a larger buffer and maximum message size. + * The default buffer size is 1280 bytes, and the default maximum message size is 256. + * + * \param bufsize The desired buffer size + * \param maxMsgSize The desired max message size + */ +LIBCOM_API int errlogBufResize(int bufsize, int maxMsgSize); + /** Wakes up the errlog task and then waits until all messages are flushed from the queue. */ LIBCOM_API void errlogFlush(void); diff --git a/modules/libcom/src/iocsh/libComRegister.c b/modules/libcom/src/iocsh/libComRegister.c index cbf262608..30f5917f5 100644 --- a/modules/libcom/src/iocsh/libComRegister.c +++ b/modules/libcom/src/iocsh/libComRegister.c @@ -304,7 +304,7 @@ static const iocshFuncDef errlogBufResizeFuncDef = { }; static void errlogBufResizeCallFunc(const iocshArgBuf *args) { - errlogBufResize(args[0].ival, args[1].ival); + iocshSetError(errlogBufResize(args[0].ival, args[1].ival)); } /* errlogShow */ From 3b7a5b51066382a0ba8e4cd788f818447813ddc4 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Tue, 24 Feb 2026 17:07:12 +0000 Subject: [PATCH 032/141] Make the maximum message size dependent on the buffer size --- modules/libcom/src/error/errlog.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 7dbfe519d..24324e8cd 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -44,7 +44,7 @@ #define MIN_BUFFER_SIZE 2560 #define DEFAULT_MAX_MSG_SIZE 512 #define MIN_MESSAGE_SIZE 256 -#define MAX_MESSAGE_SIZE 0x00ffffff +#define MAX_MESSAGE_SIZE(bufsize) ((bufsize) / 5) /* errlog buffers contain null terminated strings, each prefixed * with a 1 byte header containing flags. @@ -596,10 +596,10 @@ int errlogInit2(int bufsize, int maxMsgSize) bufsize = MIN_BUFFER_SIZE; config.bufsize = bufsize; + if (maxMsgSize > MAX_MESSAGE_SIZE(bufsize)) + maxMsgSize = MAX_MESSAGE_SIZE(bufsize); if (maxMsgSize < MIN_MESSAGE_SIZE) maxMsgSize = MIN_MESSAGE_SIZE; - else if (maxMsgSize > MAX_MESSAGE_SIZE) - maxMsgSize = MAX_MESSAGE_SIZE; config.maxMsgSize = maxMsgSize; epicsThreadOnce(&errlogOnceFlag, errlogInitPvt, &config); @@ -632,10 +632,10 @@ int errlogBufResize(int bufsize, int maxMsgSize) if (bufsize < MIN_BUFFER_SIZE) bufsize = MIN_BUFFER_SIZE; + if (maxMsgSize > MAX_MESSAGE_SIZE(bufsize)) + maxMsgSize = MAX_MESSAGE_SIZE(bufsize); if (maxMsgSize < MIN_MESSAGE_SIZE) maxMsgSize = MIN_MESSAGE_SIZE; - else if (maxMsgSize > MAX_MESSAGE_SIZE) - maxMsgSize = MAX_MESSAGE_SIZE; logbuf = calloc(1, bufsize); printbuf = calloc(1, bufsize); From f7c74a04b113fe1b963dd9877d17ba77c8357ec3 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Wed, 25 Feb 2026 09:18:55 +0000 Subject: [PATCH 033/141] Add warning if errorlog configuration has been clamped --- modules/libcom/src/error/errlog.c | 58 ++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 24324e8cd..75d9518ba 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -583,6 +583,33 @@ static void errlogInitPvt(void *arg) } } +static +int errlogClampConfig(struct initArgs *config, int bufsize, int maxMsgSize) +{ + int clamped = 0; + + if (bufsize < MIN_BUFFER_SIZE) + { + // This is to deal with the fact that errlogInit() is often called with arg 0 + clamped = bufsize == 0 ? 0 : 1; + bufsize = MIN_BUFFER_SIZE; + } + config->bufsize = bufsize; + + if (maxMsgSize > MAX_MESSAGE_SIZE(bufsize)) + { + clamped = 1; + maxMsgSize = MAX_MESSAGE_SIZE(bufsize); + } + if (maxMsgSize < MIN_MESSAGE_SIZE) + { + clamped = 1; + maxMsgSize = MIN_MESSAGE_SIZE; + } + config->maxMsgSize = maxMsgSize; + + return clamped; +} int errlogInit2(int bufsize, int maxMsgSize) { @@ -592,15 +619,9 @@ int errlogInit2(int bufsize, int maxMsgSize) if (pvt.atExit) return 0; - if (bufsize < MIN_BUFFER_SIZE) - bufsize = MIN_BUFFER_SIZE; - config.bufsize = bufsize; - - if (maxMsgSize > MAX_MESSAGE_SIZE(bufsize)) - maxMsgSize = MAX_MESSAGE_SIZE(bufsize); - if (maxMsgSize < MIN_MESSAGE_SIZE) - maxMsgSize = MIN_MESSAGE_SIZE; - config.maxMsgSize = maxMsgSize; + if (errlogClampConfig(&config, bufsize, maxMsgSize)) { + fprintf(stderr, "Warning: errlog config clamped from (%zu, %zu) to (%zu, %zu)\n", bufsize, maxMsgSize, config.bufsize, config.maxMsgSize); + } epicsThreadOnce(&errlogOnceFlag, errlogInitPvt, &config); if (pvt.errlogInitFailed) { @@ -619,6 +640,7 @@ int errlogBufResize(int bufsize, int maxMsgSize) { char* logbuf = NULL; char* printbuf = NULL; + struct initArgs config; epicsMutexMustLock(pvt.bufSizeLock); @@ -629,16 +651,12 @@ int errlogBufResize(int bufsize, int maxMsgSize) return -1; } - if (bufsize < MIN_BUFFER_SIZE) - bufsize = MIN_BUFFER_SIZE; + if (errlogClampConfig(&config, bufsize, maxMsgSize)) { + fprintf(stderr, "Warning: errlog config clamped from (%zu, %zu) to (%zu, %zu)\n", bufsize, maxMsgSize, config.bufsize, config.maxMsgSize); + } - if (maxMsgSize > MAX_MESSAGE_SIZE(bufsize)) - maxMsgSize = MAX_MESSAGE_SIZE(bufsize); - if (maxMsgSize < MIN_MESSAGE_SIZE) - maxMsgSize = MIN_MESSAGE_SIZE; - - logbuf = calloc(1, bufsize); - printbuf = calloc(1, bufsize); + logbuf = calloc(1, config.bufsize); + printbuf = calloc(1, config.bufsize); epicsMutexMustLock(pvt.msgQueueLock); @@ -650,8 +668,8 @@ int errlogBufResize(int bufsize, int maxMsgSize) free(pvt.print->base); pvt.print->base = printbuf; - pvt.bufSize = bufsize; - pvt.maxMsgSize = maxMsgSize; + pvt.bufSize = config.bufsize; + pvt.maxMsgSize = config.maxMsgSize; epicsMutexUnlock(pvt.msgQueueLock); epicsMutexUnlock(pvt.bufSizeLock); From 68763a9ae97004bda256a6552fb46865c6527097 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Wed, 25 Feb 2026 10:30:51 +0000 Subject: [PATCH 034/141] Remove errlogBufResize in favour of allowing errlogInit[2] to be called repeatedly --- modules/libcom/src/error/errlog.c | 140 ++++++++++++---------- modules/libcom/src/error/errlog.h | 9 -- modules/libcom/src/iocsh/libComRegister.c | 17 --- 3 files changed, 75 insertions(+), 91 deletions(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 75d9518ba..a95dcb4df 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -534,9 +534,37 @@ struct initArgs { size_t maxMsgSize; }; +static +int errlogClampConfig(struct initArgs *config) +{ + int clamped = 0; + + if (config->bufsize < MIN_BUFFER_SIZE) + { + clamped = 1; + config->bufsize = MIN_BUFFER_SIZE; + } + + if (config->maxMsgSize > MAX_MESSAGE_SIZE(config->bufsize)) + { + clamped = 1; + config->maxMsgSize = MAX_MESSAGE_SIZE(config->bufsize); + } + if (config->maxMsgSize < MIN_MESSAGE_SIZE) + { + clamped = 1; + config->maxMsgSize = MIN_MESSAGE_SIZE; + } + + return clamped; +} + static void errlogInitPvt(void *arg) { struct initArgs *pconfig = (struct initArgs *) arg; + + errlogClampConfig(pconfig); + epicsThreadId tid = NULL; epicsThreadOpts topts = EPICS_THREAD_OPTS_INIT; @@ -583,81 +611,33 @@ static void errlogInitPvt(void *arg) } } +// This function must be called with pvt.bufSizeLock held static -int errlogClampConfig(struct initArgs *config, int bufsize, int maxMsgSize) +void errlogBufResize(struct initArgs config) { - int clamped = 0; - - if (bufsize < MIN_BUFFER_SIZE) - { - // This is to deal with the fact that errlogInit() is often called with arg 0 - clamped = bufsize == 0 ? 0 : 1; - bufsize = MIN_BUFFER_SIZE; + if (config.bufsize < pvt.bufSize) { + fprintf(stderr, "Warning: Cannot shrink buffer size.\n"); + return; } - config->bufsize = bufsize; - if (maxMsgSize > MAX_MESSAGE_SIZE(bufsize)) - { - clamped = 1; - maxMsgSize = MAX_MESSAGE_SIZE(bufsize); - } - if (maxMsgSize < MIN_MESSAGE_SIZE) - { - clamped = 1; - maxMsgSize = MIN_MESSAGE_SIZE; - } - config->maxMsgSize = maxMsgSize; - - return clamped; -} - -int errlogInit2(int bufsize, int maxMsgSize) -{ - static epicsThreadOnceId errlogOnceFlag = EPICS_THREAD_ONCE_INIT; - struct initArgs config; - - if (pvt.atExit) - return 0; - - if (errlogClampConfig(&config, bufsize, maxMsgSize)) { + size_t bufsize = config.bufsize; + size_t maxMsgSize = config.maxMsgSize; + if (errlogClampConfig(&config)) { fprintf(stderr, "Warning: errlog config clamped from (%zu, %zu) to (%zu, %zu)\n", bufsize, maxMsgSize, config.bufsize, config.maxMsgSize); } - epicsThreadOnce(&errlogOnceFlag, errlogInitPvt, &config); - if (pvt.errlogInitFailed) { - fprintf(stderr,"errlogInit failed\n"); - exit(1); + char *logbuf = calloc(1, config.bufsize); + if (!logbuf) { + fprintf(stderr, ERL_ERROR ": Failed to allocated errlog log buffer.\n"); + return; } - return 0; -} - -int errlogInit(int bufsize) -{ - return errlogInit2(bufsize, DEFAULT_MAX_MSG_SIZE); -} - -int errlogBufResize(int bufsize, int maxMsgSize) -{ - char* logbuf = NULL; - char* printbuf = NULL; - struct initArgs config; - - epicsMutexMustLock(pvt.bufSizeLock); - - // Only increasing the buffer size is allowed! - if (bufsize < pvt.bufSize) { - epicsMutexUnlock(pvt.bufSizeLock); - fprintf(stderr, "Shrinking the errorlog buffer is not allowed.\n"); - return -1; + char *printbuf = calloc(1, config.bufsize); + if (!printbuf) { + free(logbuf); + fprintf(stderr, ERL_ERROR ": Failed to allocated errlog print buffer.\n"); + return; } - if (errlogClampConfig(&config, bufsize, maxMsgSize)) { - fprintf(stderr, "Warning: errlog config clamped from (%zu, %zu) to (%zu, %zu)\n", bufsize, maxMsgSize, config.bufsize, config.maxMsgSize); - } - - logbuf = calloc(1, config.bufsize); - printbuf = calloc(1, config.bufsize); - epicsMutexMustLock(pvt.msgQueueLock); memcpy(logbuf, pvt.log->base, pvt.bufSize); @@ -672,7 +652,37 @@ int errlogBufResize(int bufsize, int maxMsgSize) pvt.maxMsgSize = config.maxMsgSize; epicsMutexUnlock(pvt.msgQueueLock); +} + +int errlogInit2(int bufsize, int maxMsgSize) +{ + static epicsThreadOnceId errlogOnceFlag = EPICS_THREAD_ONCE_INIT; + struct initArgs config = {bufsize, maxMsgSize}; + + if (pvt.atExit) + return 0; + + epicsThreadOnce(&errlogOnceFlag, errlogInitPvt, &config); + if (pvt.errlogInitFailed) { + fprintf(stderr,"errlogInit failed\n"); + exit(1); + } + + // Don't resize the buffer for any of the calls to errlogInit(0) + if (bufsize == 0) return 0; + + epicsMutexMustLock(pvt.bufSizeLock); + if (pvt.bufSize != config.bufsize || pvt.maxMsgSize != config.maxMsgSize) { + // We are resizing the buffer after initialisation + errlogBufResize(config); + } epicsMutexUnlock(pvt.bufSizeLock); + return 0; +} + +int errlogInit(int bufsize) +{ + return errlogInit2(bufsize, DEFAULT_MAX_MSG_SIZE); } void errlogShow(int level) diff --git a/modules/libcom/src/error/errlog.h b/modules/libcom/src/error/errlog.h index 2fe01cf7e..a204bec87 100644 --- a/modules/libcom/src/error/errlog.h +++ b/modules/libcom/src/error/errlog.h @@ -224,15 +224,6 @@ LIBCOM_API int errlogInit(int bufsize); */ LIBCOM_API int errlogInit2(int bufsize, int maxMsgSize); -/** - * errlogBufResize can be used to reinitialize the error logging system with a larger buffer and maximum message size. - * The default buffer size is 1280 bytes, and the default maximum message size is 256. - * - * \param bufsize The desired buffer size - * \param maxMsgSize The desired max message size - */ -LIBCOM_API int errlogBufResize(int bufsize, int maxMsgSize); - /** Wakes up the errlog task and then waits until all messages are flushed from the queue. */ LIBCOM_API void errlogFlush(void); diff --git a/modules/libcom/src/iocsh/libComRegister.c b/modules/libcom/src/iocsh/libComRegister.c index 30f5917f5..5c2dea7bf 100644 --- a/modules/libcom/src/iocsh/libComRegister.c +++ b/modules/libcom/src/iocsh/libComRegister.c @@ -291,22 +291,6 @@ static void errlogInit2CallFunc(const iocshArgBuf *args) errlogInit2(args[0].ival, args[1].ival); } -/* errlogBufResize */ -static const iocshArg errlogBufResizeArg0 = { "bufSize",iocshArgInt}; -static const iocshArg errlogBufResizeArg1 = { "maxMsgSize",iocshArgInt}; -static const iocshArg * const errlogBufResizeArgs[] = - {&errlogBufResizeArg0, &errlogBufResizeArg1}; -static const iocshFuncDef errlogBufResizeFuncDef = { - "errlogBufResize", 2, errlogBufResizeArgs, - "Reinitialize error log client buffer size and maximum message size\n" - " bufSize - size of circular buffer (default = 1280 bytes)\n" - " maxMsgSize - maximum size of error message (default = 256 bytes)\n" -}; -static void errlogBufResizeCallFunc(const iocshArgBuf *args) -{ - iocshSetError(errlogBufResize(args[0].ival, args[1].ival)); -} - /* errlogShow */ static const iocshArg errlogShowArg0 = { "level",iocshArgInt}; static const iocshArg * const errlogShowArgs[1] = {&errlogShowArg0}; @@ -532,7 +516,6 @@ void epicsStdCall libComRegister(void) iocshRegister(&eltcFuncDef, eltcCallFunc); iocshRegister(&errlogInitFuncDef,errlogInitCallFunc); iocshRegister(&errlogInit2FuncDef,errlogInit2CallFunc); - iocshRegister(&errlogBufResizeFuncDef,errlogBufResizeCallFunc); iocshRegister(&errlogShowFuncDef,errlogShowCallFunc); iocshRegister(&errlogFuncDef, errlogCallFunc); iocshRegister(&iocLogPrefixFuncDef, iocLogPrefixCallFunc); From bf5e39976f205975ebc97f233e911e5a68196af0 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Thu, 26 Feb 2026 11:20:59 +0000 Subject: [PATCH 035/141] Change initial errlogprintfs to printfs RTEMS performs a few early errlogPrintf calls. This initialises the errlog buffers to some default values blocking certain tests from re-initialising the error log later. --- modules/libcom/RTEMS/posix/rtems_init.c | 12 ++++++------ modules/libcom/RTEMS/score/rtems_init.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/libcom/RTEMS/posix/rtems_init.c b/modules/libcom/RTEMS/posix/rtems_init.c index 0aef8bf13..146e5d832 100644 --- a/modules/libcom/RTEMS/posix/rtems_init.c +++ b/modules/libcom/RTEMS/posix/rtems_init.c @@ -126,10 +126,10 @@ logReset (void) if (fp) { char buf[80]; fp(buf, sizeof buf); - errlogPrintf ("Startup after %s.\n", buf); + printf ("Startup after %s.\n", buf); } else { - errlogPrintf ("Startup.\n"); + printf ("Startup.\n"); } } @@ -169,7 +169,7 @@ LogFatal (const char *msg, ...) void LogRtemsFatal (const char *msg, rtems_status_code sc) { - errlogPrintf ("%s: %s\n", msg, rtems_status_text (sc)); + printf ("%s: %s\n", msg, rtems_status_text (sc)); delayedPanic (msg); } @@ -179,7 +179,7 @@ LogRtemsFatal (const char *msg, rtems_status_code sc) void LogNetFatal (const char *msg, int err) { - errlogPrintf ("%s: %d\n", msg, err); + printf ("%s: %d\n", msg, err); delayedPanic (msg); } @@ -411,7 +411,7 @@ initialize_remote_filesystem(char **argv, int hasLocalFilesystem) argv[1] = abspath; } } - errlogPrintf("nfsMount(\"%s\", \"%s\", \"%s\")\n", + printf("nfsMount(\"%s\", \"%s\", \"%s\")\n", server_name, server_path, mount_point); nfsMount(server_name, server_path, mount_point); #endif @@ -484,7 +484,7 @@ set_directory (const char *commandline) if (chdir (directoryPath) < 0) LogFatal ("Can't set initial directory(%s): %s\n", directoryPath, strerror(errno)); else - errlogPrintf("chdir(\"%s\")\n", directoryPath); + printf("chdir(\"%s\")\n", directoryPath); free(directoryPath); } diff --git a/modules/libcom/RTEMS/score/rtems_init.c b/modules/libcom/RTEMS/score/rtems_init.c index d291ea1f9..2516a8319 100644 --- a/modules/libcom/RTEMS/score/rtems_init.c +++ b/modules/libcom/RTEMS/score/rtems_init.c @@ -63,10 +63,10 @@ logReset (void) if (fp) { char buf[80]; fp(buf, sizeof buf); - errlogPrintf ("Startup after %s.\n", buf); + printf ("Startup after %s.\n", buf); } else { - errlogPrintf ("Startup.\n"); + printf ("Startup.\n"); } } @@ -341,7 +341,7 @@ initialize_remote_filesystem(char **argv, int hasLocalFilesystem) argv[1] = abspath; } } - errlogPrintf("nfsMount(\"%s\", \"%s\", \"%s\")\n", + printf("nfsMount(\"%s\", \"%s\", \"%s\")\n", server_name, server_path, mount_point); nfsMount(server_name, server_path, mount_point); #endif @@ -414,7 +414,7 @@ set_directory (const char *commandline) if (chdir (directoryPath) < 0) LogFatal ("Can't set initial directory(%s): %s\n", directoryPath, strerror(errno)); else - errlogPrintf("chdir(\"%s\")\n", directoryPath); + printf("chdir(\"%s\")\n", directoryPath); free(directoryPath); } From a3d76ef8fbfe4af45b48cbd5e9144afbfbc7a617 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Thu, 26 Feb 2026 13:37:21 +0000 Subject: [PATCH 036/141] Stop flushing the errorlog during init --- modules/libcom/RTEMS/posix/rtems_init.c | 1 - modules/libcom/RTEMS/score/rtems_init.c | 1 - 2 files changed, 2 deletions(-) diff --git a/modules/libcom/RTEMS/posix/rtems_init.c b/modules/libcom/RTEMS/posix/rtems_init.c index 146e5d832..e8afba06b 100644 --- a/modules/libcom/RTEMS/posix/rtems_init.c +++ b/modules/libcom/RTEMS/posix/rtems_init.c @@ -1164,7 +1164,6 @@ POSIX_Init ( void *argument __attribute__((unused))) set_directory (argv[1]); epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]); atexit(exitHandler); - errlogFlush(); printf ("***** Starting EPICS application *****\n"); diff --git a/modules/libcom/RTEMS/score/rtems_init.c b/modules/libcom/RTEMS/score/rtems_init.c index 2516a8319..cd8872c4b 100644 --- a/modules/libcom/RTEMS/score/rtems_init.c +++ b/modules/libcom/RTEMS/score/rtems_init.c @@ -684,7 +684,6 @@ Init (rtems_task_argument ignored) set_directory (argv[1]); epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]); atexit(exitHandler); - errlogFlush(); printf ("***** Starting EPICS application *****\n"); result = main ((sizeof argv / sizeof argv[0]) - 1, argv); printf ("***** IOC application terminating *****\n"); From 5037f55ad7de0432fc2851ad9ac668d048989e30 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Thu, 26 Feb 2026 17:49:13 +0000 Subject: [PATCH 037/141] Add release note --- documentation/new-notes/PR-801.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 documentation/new-notes/PR-801.md diff --git a/documentation/new-notes/PR-801.md b/documentation/new-notes/PR-801.md new file mode 100644 index 000000000..6cdece7f5 --- /dev/null +++ b/documentation/new-notes/PR-801.md @@ -0,0 +1,7 @@ +### errlogInit can be run more than once + +Previously, running `errlogInit` after initialisation would silently fail. It is +now possible to call `errlogInit` or `errlogInit2` multiple times in order to +increase the buffer size. + +Note that it is not possible to _shrink_ the buffer size. From 73b89cbcd9057241af4d38386a4f7b144f555577 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Fri, 27 Feb 2026 10:32:44 +0000 Subject: [PATCH 038/141] Move frees out of mutex lock --- modules/libcom/src/error/errlog.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index a95dcb4df..8b1724e18 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -639,19 +639,22 @@ void errlogBufResize(struct initArgs config) } epicsMutexMustLock(pvt.msgQueueLock); + char *oldlogbuf = pvt.log->base; + char *oldprintbuf = pvt.print->base; memcpy(logbuf, pvt.log->base, pvt.bufSize); - free(pvt.log->base); pvt.log->base = logbuf; memcpy(printbuf, &pvt.print->base, pvt.bufSize); - free(pvt.print->base); pvt.print->base = printbuf; pvt.bufSize = config.bufsize; pvt.maxMsgSize = config.maxMsgSize; epicsMutexUnlock(pvt.msgQueueLock); + + free(oldlogbuf); + free(oldprintbuf); } int errlogInit2(int bufsize, int maxMsgSize) From 70e34a7a2e6cc74086bec3b6a6339418c45fe762 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Fri, 27 Feb 2026 10:48:22 +0000 Subject: [PATCH 039/141] Call errlogClampConfig only a single time --- modules/libcom/src/error/errlog.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 8b1724e18..8fdddad15 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -563,8 +563,6 @@ static void errlogInitPvt(void *arg) { struct initArgs *pconfig = (struct initArgs *) arg; - errlogClampConfig(pconfig); - epicsThreadId tid = NULL; epicsThreadOpts topts = EPICS_THREAD_OPTS_INIT; @@ -620,12 +618,6 @@ void errlogBufResize(struct initArgs config) return; } - size_t bufsize = config.bufsize; - size_t maxMsgSize = config.maxMsgSize; - if (errlogClampConfig(&config)) { - fprintf(stderr, "Warning: errlog config clamped from (%zu, %zu) to (%zu, %zu)\n", bufsize, maxMsgSize, config.bufsize, config.maxMsgSize); - } - char *logbuf = calloc(1, config.bufsize); if (!logbuf) { fprintf(stderr, ERL_ERROR ": Failed to allocated errlog log buffer.\n"); @@ -665,6 +657,11 @@ int errlogInit2(int bufsize, int maxMsgSize) if (pvt.atExit) return 0; + if (errlogClampConfig(&config) && (bufsize != 0)) { + // No sense warning for every call to errlogInit(0) + fprintf(stderr, "Warning: errlog config clamped from (%d, %d) to (%zu, %zu)\n", bufsize, maxMsgSize, config.bufsize, config.maxMsgSize); + } + epicsThreadOnce(&errlogOnceFlag, errlogInitPvt, &config); if (pvt.errlogInitFailed) { fprintf(stderr,"errlogInit failed\n"); From 8834727b5bcd1b3e0f785da768de6befaba26e0d Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Fri, 6 Mar 2026 10:36:08 +0100 Subject: [PATCH 040/141] Lock buffer size changes while running thread --- modules/libcom/src/error/errlog.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 8fdddad15..55697d3cd 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -78,10 +78,10 @@ typedef struct { static struct { epicsMutexId bufSizeLock; - /* const after errlogInit() */ + /* guarded by bufSizeLock, allowing them to be resized after initialisation */ size_t maxMsgSize; - /* alloc size of both buffer_t::base */ size_t bufSize; + int errlogInitFailed; epicsMutexId listenerLock; @@ -726,6 +726,7 @@ void errlogFlush(void) static void errlogThread(void) { int wakeFlusher; + epicsMutexMustLock(pvt.bufSizeLock); epicsMutexMustLock(pvt.msgQueueLock); while (1) { pvt.flushSeq++; @@ -735,9 +736,17 @@ static void errlogThread(void) break; wakeFlusher = pvt.nFlushers!=0; epicsMutexUnlock(pvt.msgQueueLock); + // Allow the buffer size to be modified only at this point + epicsMutexUnlock(pvt.bufSizeLock); + if(wakeFlusher) epicsEventMustTrigger(pvt.waitForSeq); + epicsEventMustWait(pvt.waitForWork); + + // Block resizing the buffer size + epicsMutexMustLock(pvt.bufSizeLock); + epicsMutexMustLock(pvt.msgQueueLock); } else { @@ -755,6 +764,8 @@ static void errlogThread(void) } pvt.nLost = 0u; + // Note that we are intentionally still holding the buffer size lock + // here. The buffer can only be resized when this thread is idle. epicsMutexUnlock(pvt.msgQueueLock); while(pos < print->pos) { @@ -818,6 +829,7 @@ static void errlogThread(void) } wakeFlusher = pvt.nFlushers!=0; epicsMutexUnlock(pvt.msgQueueLock); + epicsMutexUnlock(pvt.bufSizeLock); if(wakeFlusher) epicsEventMustTrigger(pvt.waitForSeq); } From cb5c540c4ea2f29827c58c24373d1aa34c5d5a21 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Wed, 11 Mar 2026 12:37:06 +0100 Subject: [PATCH 041/141] Block resizes from listener callbacks --- modules/libcom/src/error/errlog.c | 14 ++++++++++---- modules/libcom/src/error/errlog.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 55697d3cd..ac1e18c71 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -77,6 +77,7 @@ typedef struct { } buffer_t; static struct { + epicsThreadId tid; epicsMutexId bufSizeLock; /* guarded by bufSizeLock, allowing them to be resized after initialisation */ size_t maxMsgSize; @@ -563,7 +564,6 @@ static void errlogInitPvt(void *arg) { struct initArgs *pconfig = (struct initArgs *) arg; - epicsThreadId tid = NULL; epicsThreadOpts topts = EPICS_THREAD_OPTS_INIT; topts.priority = epicsThreadPriorityLow; @@ -574,6 +574,7 @@ static void errlogInitPvt(void *arg) * cantProceed() calls us. */ + pvt.tid = NULL; pvt.errlogInitFailed = TRUE; pvt.bufSizeLock = epicsMutexCreate(); pvt.bufSize = pconfig->bufsize; @@ -601,11 +602,11 @@ static void errlogInitPvt(void *arg) && pvt.log->base && pvt.print->base ) { - tid = epicsThreadCreateOpt("errlog", (EPICSTHREADFUNC)errlogThread, 0, &topts); + pvt.tid = epicsThreadCreateOpt("errlog", (EPICSTHREADFUNC)errlogThread, 0, &topts); } - if (tid) { + if (pvt.tid) { pvt.errlogInitFailed = FALSE; - epicsAtExit(errlogExitHandler, tid); + epicsAtExit(errlogExitHandler, pvt.tid); } } @@ -671,6 +672,11 @@ int errlogInit2(int bufsize, int maxMsgSize) // Don't resize the buffer for any of the calls to errlogInit(0) if (bufsize == 0) return 0; + if (epicsThreadGetIdSelf() == pvt.tid) { + fprintf(stderr, "Cannot resize buffer from callback function.\n"); + return -1; + } + epicsMutexMustLock(pvt.bufSizeLock); if (pvt.bufSize != config.bufsize || pvt.maxMsgSize != config.maxMsgSize) { // We are resizing the buffer after initialisation diff --git a/modules/libcom/src/error/errlog.h b/modules/libcom/src/error/errlog.h index a204bec87..a608f0395 100644 --- a/modules/libcom/src/error/errlog.h +++ b/modules/libcom/src/error/errlog.h @@ -208,6 +208,7 @@ LIBCOM_API int errlogSetConsole(FILE *stream); * Can be used to initialize the error logging system with a larger buffer. The default buffer size is 2560 bytes. * * \param bufsize The desired buffer size + * \return 0 if successful, -1 if called from callback function * * \since UNRELEASED the default buffer size is 2560. */ @@ -219,6 +220,7 @@ LIBCOM_API int errlogInit(int bufsize); * * \param bufsize The desired buffer size * \param maxMsgSize The desired max message size + * \return 0 if successful, -1 if called from callback function * * \since UNRELEASED The default buffer size is 2560 and the default maximum message size is 512. */ From c0117c4b1d0d083d10fa2c440880cb5368eff30b Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Wed, 18 Mar 2026 16:57:54 +0100 Subject: [PATCH 042/141] Add unrelease for errloginit2 change --- modules/libcom/src/error/errlog.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/libcom/src/error/errlog.h b/modules/libcom/src/error/errlog.h index a608f0395..a81c2a258 100644 --- a/modules/libcom/src/error/errlog.h +++ b/modules/libcom/src/error/errlog.h @@ -222,7 +222,8 @@ LIBCOM_API int errlogInit(int bufsize); * \param maxMsgSize The desired max message size * \return 0 if successful, -1 if called from callback function * - * \since UNRELEASED The default buffer size is 2560 and the default maximum message size is 512. + * \since UNRELEASED It is possible to enlarge the error log buffer size after initialisation. + * The default buffer size is 2560 and the default maximum message size is 512. */ LIBCOM_API int errlogInit2(int bufsize, int maxMsgSize); From 5122fabf7436d36827e2835d10338448309b1019 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Thu, 19 Mar 2026 09:44:18 +0100 Subject: [PATCH 043/141] Add error/warning ANSI prefixes to error/warning messages --- modules/libcom/src/error/errlog.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index ac1e18c71..6239f1921 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -615,7 +615,7 @@ static void errlogBufResize(struct initArgs config) { if (config.bufsize < pvt.bufSize) { - fprintf(stderr, "Warning: Cannot shrink buffer size.\n"); + fprintf(stderr, ERL_WARNING ": Cannot shrink buffer size.\n"); return; } @@ -660,12 +660,12 @@ int errlogInit2(int bufsize, int maxMsgSize) if (errlogClampConfig(&config) && (bufsize != 0)) { // No sense warning for every call to errlogInit(0) - fprintf(stderr, "Warning: errlog config clamped from (%d, %d) to (%zu, %zu)\n", bufsize, maxMsgSize, config.bufsize, config.maxMsgSize); + fprintf(stderr, ERL_WARNING ": errlog config clamped from (%d, %d) to (%zu, %zu)\n", bufsize, maxMsgSize, config.bufsize, config.maxMsgSize); } epicsThreadOnce(&errlogOnceFlag, errlogInitPvt, &config); if (pvt.errlogInitFailed) { - fprintf(stderr,"errlogInit failed\n"); + fprintf(stderr, ERL_ERROR ": errlogInit failed\n"); exit(1); } @@ -673,7 +673,7 @@ int errlogInit2(int bufsize, int maxMsgSize) if (bufsize == 0) return 0; if (epicsThreadGetIdSelf() == pvt.tid) { - fprintf(stderr, "Cannot resize buffer from callback function.\n"); + fprintf(stderr, ERL_ERROR ": Cannot resize buffer from callback function.\n"); return -1; } @@ -781,7 +781,7 @@ static void errlogThread(void) int stripped = 0; if((base[0]&ERL_STATE_MASK) != ERL_STATE_READY || mlen>=pvt.bufSize - pos) { - fprintf(stderr, "Logic Error: errlog buffer corruption. %02x, %zu\n", + fprintf(stderr, ERL_ERROR ": errlog buffer corruption. %02x, %zu\n", (unsigned)base[0], mlen); /* try to reset and recover */ break; From d1705d46f24fc1bb8ff3ccc51ffe67a2e3978994 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Mon, 23 Mar 2026 16:13:07 +0100 Subject: [PATCH 044/141] Refactor tests and add test that errlogInit() can be run more than once --- modules/libcom/test/epicsErrlogTest.c | 219 +++++++++++++++++--------- 1 file changed, 144 insertions(+), 75 deletions(-) diff --git a/modules/libcom/test/epicsErrlogTest.c b/modules/libcom/test/epicsErrlogTest.c index 91c2fb095..c3c9035b9 100644 --- a/modules/libcom/test/epicsErrlogTest.c +++ b/modules/libcom/test/epicsErrlogTest.c @@ -61,7 +61,8 @@ const char longmsg[]="A0123456789abcdef" STATIC_ASSERT(NELEMENTS(longmsg)==324); static -const char truncmsg[]="A0123456789abcdef" +const char truncmsg256[]= + "A0123456789abcdef" "B0123456789abcdef" "C0123456789abcdef" "D0123456789abcdef" @@ -77,7 +78,28 @@ const char truncmsg[]="A0123456789abcdef" "N0123456789abcdef" "O01<>\n" ; -STATIC_ASSERT(NELEMENTS(truncmsg)==256); +STATIC_ASSERT(NELEMENTS(truncmsg256)==256); + +static +const char truncmsg273[]= + "A0123456789abcdef" + "B0123456789abcdef" + "C0123456789abcdef" + "D0123456789abcdef" + "E0123456789abcdef" + "F0123456789abcdef" + "G0123456789abcdef" + "H0123456789abcdef" + "I0123456789abcdef" + "J0123456789abcdef" + "K0123456789abcdef" + "L0123456789abcdef" + "M0123456789abcdef" + "N0123456789abcdef" + "O0123456789abcdef" + "P01<>\n" + ; +STATIC_ASSERT(NELEMENTS(truncmsg273)==273); typedef struct { unsigned int count; @@ -198,67 +220,42 @@ void testANSIStrip(void) #undef testEscape } -static void testErrorMessageMatches(long status, const char *expected) +static void testLogSizeTrunc(int bufsize, int maxMsgSize, const char *truncmsg) { - const char *msg = errSymMsg(status); - testOk(strcmp(msg, expected) == 0, - "Error code %ld returns \"%s\", expected message \"%s\"", status, - msg, expected - ); -} - -static void testGettingExistingErrorSymbol() -{ - testErrorMessageMatches(S_err_invCode, "Invalid error symbol code"); -} - -static void testGettingNonExistingErrorSymbol() -{ - long invented_code = (0x7999 << 16) | 0x9998; - testErrorMessageMatches(invented_code, ""); -} - -static void testAddingErrorSymbol() -{ - long invented_code = (0x7999 << 16) | 0x9999; - errSymbolAdd(invented_code, "Invented Error Message"); - testErrorMessageMatches(invented_code, "Invented Error Message"); -} - -static void testAddingInvalidErrorSymbol() -{ - long invented_code = (500 << 16) | 0x1; - testOk(errSymbolAdd(invented_code, "No matter"), - "Adding error symbol with module code < 501 should fail"); -} - -static void testAddingExistingErrorSymbol() -{ - testOk(errSymbolAdd(S_err_invCode, "Duplicate"), - "Adding an error symbol with an existing error code should fail"); -} - -static void testAddingExistingErrorSymbolWithSameMessage() -{ - long invented_code = (0x7999 << 16) | 0x9997; - errSymbolAdd(invented_code, "Invented Error Message"); - testOk(!errSymbolAdd(invented_code, "Invented Error Message"), - "Adding identical error symbol shouldn't fail"); -} - -MAIN(epicsErrlogTest) -{ - size_t mlen, i, N; - char msg[256]; - clientPvt pvt, pvt2; - - testPlan(54); - - testANSIStrip(); - + char msg[324]; + clientPvt pvt; strcpy(msg, truncmsg); - errlogInit2(LOGBUFSIZE, 256); + errlogInit2(bufsize, maxMsgSize); + + errlogAddListener(&logClient, &pvt); + + testDiag("Check truncation"); + + pvt.count = 0; + pvt.jam = 0; + pvt.jammer = epicsEventMustCreate(epicsEventEmpty); + pvt.done = epicsEventMustCreate(epicsEventEmpty); + + pvt.expect = truncmsg; + pvt.checkLen = maxMsgSize - 1; + + errlogPrintfNoConsole("%s", longmsg); + errlogFlush(); + + epicsEventMustWait(pvt.done); + + testEqInt(pvt.count, 1); + + /* Clean up */ + testOk(1 == errlogRemoveListeners(&logClient, &pvt), "Removed one listener"); + + epicsEventDestroy(pvt.jammer); + epicsEventDestroy(pvt.done); +} + +static void testLogListeners() { + clientPvt pvt, pvt2; pvt.count = 0; pvt2.count = 0; @@ -337,39 +334,47 @@ MAIN(epicsErrlogTest) testEqInt(pvt.count, 2); testEqInt(pvt2.count, 2); - /* Re-add one listener */ - errlogAddListener(&logClient, &pvt); + testOk(0 == errlogRemoveListeners(&logClient, &pvt), + "No listener 1 to remove"); - testDiag("Check truncation"); + epicsEventDestroy(pvt.jammer); + epicsEventDestroy(pvt.done); + epicsEventDestroy(pvt2.jammer); + epicsEventDestroy(pvt2.done); +} - pvt.expect = truncmsg; - pvt.checkLen = 255; - - errlogPrintfNoConsole("%s", longmsg); - errlogFlush(); - - epicsEventMustWait(pvt.done); - testEqInt(pvt.count, 3); +static void testLogJammed() { + size_t mlen, i, N; + char msg[324]; + clientPvt pvt; + strcpy(msg, longmsg); + pvt.count = 0; pvt.expect = NULL; - - testDiag("Check priority"); + pvt.checkLen = 0; /* For the following tests it is important that * the buffer should not flush until we request it */ pvt.jam = 1; + pvt.jammer = epicsEventMustCreate(epicsEventEmpty); + pvt.done = epicsEventMustCreate(epicsEventEmpty); + + /* Re-add one listener */ + errlogAddListener(&logClient, &pvt); + + testDiag("Check priority"); errlogPrintfNoConsole("%s", longmsg); testOk(epicsEventWaitWithTimeout(pvt.done, 0.5) == epicsEventWaitTimeout, "%d: Listener 1 didn't run", __LINE__); - testEqInt(pvt.count, 3); + testEqInt(pvt.count, 0); epicsEventSignal(pvt.jammer); errlogFlush(); epicsEventMustWait(pvt.done); - testEqInt(pvt.count, 4); + testEqInt(pvt.count, 1); testDiag("Find buffer capacity (%u theoretical)",LOGBUFSIZE); @@ -459,6 +464,70 @@ MAIN(epicsErrlogTest) testOk(1 == errlogRemoveListeners(&logClient, &pvt), "Removed 1 listener"); + epicsEventDestroy(pvt.jammer); + epicsEventDestroy(pvt.done); +} + +static void testErrorMessageMatches(long status, const char *expected) +{ + const char *msg = errSymMsg(status); + testOk(strcmp(msg, expected) == 0, + "Error code %ld returns \"%s\", expected message \"%s\"", status, + msg, expected + ); +} + +static void testGettingExistingErrorSymbol() +{ + testErrorMessageMatches(S_err_invCode, "Invalid error symbol code"); +} + +static void testGettingNonExistingErrorSymbol() +{ + long invented_code = (0x7999 << 16) | 0x9998; + testErrorMessageMatches(invented_code, ""); +} + +static void testAddingErrorSymbol() +{ + long invented_code = (0x7999 << 16) | 0x9999; + errSymbolAdd(invented_code, "Invented Error Message"); + testErrorMessageMatches(invented_code, "Invented Error Message"); +} + +static void testAddingInvalidErrorSymbol() +{ + long invented_code = (500 << 16) | 0x1; + testOk(errSymbolAdd(invented_code, "No matter"), + "Adding error symbol with module code < 501 should fail"); +} + +static void testAddingExistingErrorSymbol() +{ + testOk(errSymbolAdd(S_err_invCode, "Duplicate"), + "Adding an error symbol with an existing error code should fail"); +} + +static void testAddingExistingErrorSymbolWithSameMessage() +{ + long invented_code = (0x7999 << 16) | 0x9997; + errSymbolAdd(invented_code, "Invented Error Message"); + testOk(!errSymbolAdd(invented_code, "Invented Error Message"), + "Adding identical error symbol shouldn't fail"); +} + +MAIN(epicsErrlogTest) +{ + testPlan(59); + errlogInit(0); + + testANSIStrip(); + + testLogListeners(); + testLogSizeTrunc(LOGBUFSIZE, 256, truncmsg256); + testLogSizeTrunc(LOGBUFSIZE, 273, truncmsg273); + testLogJammed(); + osiSockAttach(); testLogPrefix(); osiSockRelease(); From 87ee088728cb31100129015f0a41cb9f986fcf46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20B=C3=B6gershausen?= Date: Mon, 18 May 2026 06:33:31 +0200 Subject: [PATCH 045/141] dbAccess.c: Improve logging of illegal field_type Debugging a problem and looking at the message recGblDbaddrError: dbPut: Request type is 0 Illegal Database Request Type... does not help very much: request type 0 is a legal value. Improve the message to show the field type as well: recGblDbaddrError: dbPut: dbrType = 0 field_type = DBF_INLIK (14)... Do the same for both dbPut and dbGet. --- modules/database/src/ioc/db/dbAccess.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/database/src/ioc/db/dbAccess.c b/modules/database/src/ioc/db/dbAccess.c index a34177e28..42ba83f22 100644 --- a/modules/database/src/ioc/db/dbAccess.c +++ b/modules/database/src/ioc/db/dbAccess.c @@ -956,7 +956,9 @@ long dbGet(DBADDR *paddr, short dbrType, if (INVALID_DB_REQ(dbrType) || field_type > DBF_DEVICE) { char message[80]; - sprintf(message, "dbGet: Request type is %d\n", dbrType); + sprintf(message, "dbGet: dbrType = %d, field_type = %.12s (%d).", + dbrType, dbGetFieldTypeString(field_type), field_type); + recGblDbaddrError(S_db_badDbrtype, paddr, message); status = S_db_badDbrtype; goto done; @@ -1338,7 +1340,9 @@ long dbPut(DBADDR *paddr, short dbrType, } else if (INVALID_DB_REQ(dbrType) || field_type > DBF_DEVICE) { char message[80]; - sprintf(message, "dbPut: Request type is %d", dbrType); + sprintf(message, "dbPut: dbrType = %d, field_type = %.12s (%d).", + dbrType, dbGetFieldTypeString(field_type), field_type); + recGblDbaddrError(S_db_badDbrtype, paddr, message); return S_db_badDbrtype; } From 69b91e8074d1f43b0804b41634b823ac8e341736 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 5 Jun 2026 16:10:57 -0700 Subject: [PATCH 046/141] GHA churn --- .github/workflows/check-editorconfig.yml | 2 +- .github/workflows/ci-scripts-build.yml | 10 +++++----- .github/workflows/codeql.yml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-editorconfig.yml b/.github/workflows/check-editorconfig.yml index 927718762..9aa315149 100644 --- a/.github/workflows/check-editorconfig.yml +++ b/.github/workflows/check-editorconfig.yml @@ -8,6 +8,6 @@ jobs: editorconfig: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: EditorConfig-Action uses: greut/eclint-action@v0 diff --git a/.github/workflows/ci-scripts-build.yml b/.github/workflows/ci-scripts-build.yml index a8afb9b4a..78c32f5d9 100644 --- a/.github/workflows/ci-scripts-build.yml +++ b/.github/workflows/ci-scripts-build.yml @@ -210,7 +210,7 @@ jobs: configuration: default steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: submodules: true - name: Automatic core dumper analysis @@ -228,7 +228,7 @@ jobs: run: python .ci/cue.py -T 60M test - name: Upload tapfiles Artifact if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: tapfiles ${{ matrix.name }} path: '**/O.*/*.tap' @@ -286,7 +286,7 @@ jobs: dnf -y install python3 gdb make perl gcc-c++ glibc-devel readline-devel ncurses-devel perl-devel perl-Test-Simple git --version || dnf -y install git python3 --version - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: submodules: true - name: Automatic core dumper analysis @@ -299,7 +299,7 @@ jobs: run: python3 .ci/cue.py -T 20M test - name: Upload tapfiles Artifact if: ${{ always() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: tapfiles ${{ matrix.name }} path: '**/O.*/*.tap' @@ -316,7 +316,7 @@ jobs: BCFG: default steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: submodules: true diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 65fa4ce1b..22215d9d8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -34,7 +34,7 @@ jobs: steps: - name: Checkout Repositories - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: submodules: false From 7e18b8cff0f9e6f85376f762732a6063e3c27a97 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 12 May 2026 18:44:00 -0700 Subject: [PATCH 047/141] asDump* quote UAG and HAG entries --- modules/libcom/src/as/asLibRoutines.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/libcom/src/as/asLibRoutines.c b/modules/libcom/src/as/asLibRoutines.c index 089c86797..f2b2f0854 100644 --- a/modules/libcom/src/as/asLibRoutines.c +++ b/modules/libcom/src/as/asLibRoutines.c @@ -20,6 +20,7 @@ #include "epicsStdio.h" #include "dbDefs.h" #include "epicsThread.h" +#include "epicsString.h" #include "cantProceed.h" #include "epicsMutex.h" #include "errlog.h" @@ -656,6 +657,14 @@ next_rule: } return(0); } + +static +void asDumpQuoted(FILE *fp, const char *s) +{ + fprintf(fp, "\""); + (void)epicsStrPrintEscaped(fp, s, strlen(s)); + fprintf(fp, "\""); +} int epicsStdCall asDumpUag(const char *uagname) { @@ -679,7 +688,7 @@ int epicsStdCall asDumpUagFP(FILE *fp,const char *uagname) puagname = (UAGNAME *)ellFirst(&puag->list); if(puagname) fprintf(fp," {"); else fprintf(fp,"\n"); while(puagname) { - fprintf(fp,"%s",puagname->user); + asDumpQuoted(fp, puagname->user); puagname = (UAGNAME *)ellNext(&puagname->node); if(puagname) fprintf(fp,","); else fprintf(fp,"}\n"); } @@ -710,7 +719,7 @@ int epicsStdCall asDumpHagFP(FILE *fp,const char *hagname) phagname = (HAGNAME *)ellFirst(&phag->list); if(phagname) fprintf(fp," {"); else fprintf(fp,"\n"); while(phagname) { - fprintf(fp,"%s",phagname->host); + asDumpQuoted(fp, phagname->host); phagname = (HAGNAME *)ellNext(&phagname->node); if(phagname) fprintf(fp,","); else fprintf(fp,"}\n"); } From 31405196cf99feb0f917af271cae49af39545f1b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 15 May 2026 17:05:12 -0500 Subject: [PATCH 048/141] Fix #859 in template CONFIG file Instructions on updating existing modules in the Notes entry. Also prints warning messages from the modules/Makefile if $(INSTALL_LOCATION) is empty. --- configure/RULES_MODULES | 11 ++++++++++- documentation/new-notes/PR-880.md | 21 +++++++++++++++++++++ src/template/base/top/configure/CONFIG | 8 ++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 documentation/new-notes/PR-880.md diff --git a/configure/RULES_MODULES b/configure/RULES_MODULES index 542a353fe..cfe75ba1f 100644 --- a/configure/RULES_MODULES +++ b/configure/RULES_MODULES @@ -25,11 +25,20 @@ # Add checked-out submodules to DIRS, unless INSTALL_LOCATION is empty LIVE_SUBMODULES = $(subst /Makefile,, \ $(wildcard $(addsuffix /Makefile, $(SUBMODULES)))) -live = $(if $(wildcard $(INSTALL_CONFIG)/RULES_TOP),LIVE,DEAD) +live := $(if $(wildcard $(INSTALL_CONFIG)/RULES_TOP),LIVE,DEAD) DIRS += $($(live)_SUBMODULES) include $(CONFIG)/RULES_DIRS +ifeq ($(live),DEAD) +ifneq ($(filter $(ACTIONS),$(MAKECMDGOALS)),) + $(info *** WARNING: The install directory $(INSTALL_LOCATION)) + $(info *** is absent or empty. The "make $(MAKECMDGOALS)" rule) + $(info *** cannot recurse into these external modules as a result:) + $(info *** $(LIVE_SUBMODULES)) +endif +endif + RELEASE_LOCAL := RELEASE.$(EPICS_HOST_ARCH).local # Ensure that RELEASE..local exists before doing anything else diff --git a/documentation/new-notes/PR-880.md b/documentation/new-notes/PR-880.md new file mode 100644 index 000000000..b5d07b612 --- /dev/null +++ b/documentation/new-notes/PR-880.md @@ -0,0 +1,21 @@ +### Template fix for modules with `cfg/RULES*` files + +EPICS modules that installed custom build `RULES*` files into +`$(INSTALL_CFG)` weren't loading them properly when the module +was built with `INSTALL_LOCATION` set in `configure/CONFIG_SITE` +or `configure/CONFIG_SITE.local`. +This release provides a fix in the template `configure/CONFIG` +file to solve the issue for new modules created from the +`makeBaseApp` template. + +Maintainers of old modules that provide special build rules for +IOC applications should check their `configure` directory. +Assuming a `configure/CONFIG` file is present, replace it with +the `templates/makeBaseApp/top/configure/CONFIG` file from this +release. If any changes were made to the old file they would +need to be merged into the new file. + +If the module's `configure` directory contains a file named +`CONFIG_APP` and no `CONFIG_SITE` file, the application must +date back to before March 2006; the files in the `configure` +directory should all be replaced in this case. diff --git a/src/template/base/top/configure/CONFIG b/src/template/base/top/configure/CONFIG index 752b62740..f22aa5432 100644 --- a/src/template/base/top/configure/CONFIG +++ b/src/template/base/top/configure/CONFIG @@ -47,3 +47,11 @@ ifdef T_A -include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A) endif +# Load our cfg/CONFIG* files if installing elsewhere +ifneq ($(INSTALL_LOCATION),$(TOP)) + TOP_CFG_CONFIGS := $(wildcard $(INSTALL_CFG)/CONFIG*) + ifneq ($(TOP_CFG_CONFIGS),) + include $(TOP_CFG_CONFIGS) + endif +endif + From 678092d0339b3d815413d7fc31e267195fdcee16 Mon Sep 17 00:00:00 2001 From: Abdalla Al-Dalleh <37416278+AbdallaDalleh@users.noreply.github.com> Date: Wed, 10 Jun 2026 17:53:31 +0300 Subject: [PATCH 049/141] biRecord.c/boRecord.c: Fix gcc -Wsizeof-pointer-memaccess (#887) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../rec/biRecord.c:191:42: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess] 191 | strncpy(pstring,prec->znam,sizeof(prec->znam)); | ^ Use memcpy instead of snprintf. STATIC_ASSERT is added to ensure znam and onam are sized enough. --- modules/database/src/std/rec/biRecord.c | 27 +++++++++++++---------- modules/database/src/std/rec/boRecord.c | 29 +++++++++++++++---------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/modules/database/src/std/rec/biRecord.c b/modules/database/src/std/rec/biRecord.c index e8bae6e86..3f9b2821c 100644 --- a/modules/database/src/std/rec/biRecord.c +++ b/modules/database/src/std/rec/biRecord.c @@ -185,16 +185,16 @@ static long get_enum_str(const DBADDR *paddr, char *pstring) index = dbGetFieldIndex(paddr); - if(index!=biRecordVAL) { - strcpy(pstring,"Illegal_Value"); - } else if(*pfield==0) { - strncpy(pstring,prec->znam,sizeof(prec->znam)); + if(index != biRecordVAL) { + strcpy(pstring, "Illegal_Value"); + } else if(*pfield == 0) { + memcpy(pstring, prec->znam, sizeof(prec->znam)); pstring[sizeof(prec->znam)] = 0; - } else if(*pfield==1) { - strncpy(pstring,prec->onam,sizeof(prec->onam)); + } else if(*pfield == 1) { + memcpy(pstring, prec->onam, sizeof(prec->onam)); pstring[sizeof(prec->onam)] = 0; } else { - strcpy(pstring,"Illegal_Value"); + strcpy(pstring, "Illegal_Value"); } return(0); } @@ -205,10 +205,15 @@ static long get_enum_strs(const DBADDR *paddr,struct dbr_enumStrs *pes) pes->no_str = 2; memset(pes->strs,'\0',sizeof(pes->strs)); - strncpy(pes->strs[0],prec->znam,sizeof(prec->znam)); - if(*prec->znam!=0) pes->no_str=1; - strncpy(pes->strs[1],prec->onam,sizeof(prec->onam)); - if(*prec->onam!=0) pes->no_str=2; + + STATIC_ASSERT(sizeof(prec->znam) <= sizeof(pes->strs[0])); + memcpy(pes->strs[0], prec->znam, sizeof(prec->znam)); + if(*prec->znam != 0) pes->no_str = 1; + + STATIC_ASSERT(sizeof(prec->onam) <= sizeof(pes->strs[1])); + memcpy(pes->strs[1], prec->onam, sizeof(prec->onam)); + if(*prec->onam != 0) pes->no_str = 2; + return(0); } diff --git a/modules/database/src/std/rec/boRecord.c b/modules/database/src/std/rec/boRecord.c index e2e9905eb..0b9c7057c 100644 --- a/modules/database/src/std/rec/boRecord.c +++ b/modules/database/src/std/rec/boRecord.c @@ -325,31 +325,36 @@ static long get_enum_str(const DBADDR *paddr, char *pstring) index = dbGetFieldIndex(paddr); - if(index!=indexof(VAL)) { - strcpy(pstring,"Illegal_Value"); - } else if(*pfield==0) { - strncpy(pstring,prec->znam,sizeof(prec->znam)); + if(index != indexof(VAL)) { + strcpy(pstring, "Illegal_Value"); + } else if(*pfield == 0) { + memcpy(pstring, prec->znam, sizeof(prec->znam)); pstring[sizeof(prec->znam)] = 0; - } else if(*pfield==1) { - strncpy(pstring,prec->onam,sizeof(prec->onam)); + } else if(*pfield == 1) { + memcpy(pstring, prec->onam, sizeof(prec->onam)); pstring[sizeof(prec->onam)] = 0; } else { - strcpy(pstring,"Illegal_Value"); + strcpy(pstring, "Illegal_Value"); } return(0); } static long get_enum_strs(const DBADDR *paddr,struct dbr_enumStrs *pes) { - boRecord *prec=(boRecord *)paddr->precord; + boRecord *prec = (boRecord *)paddr->precord; /*SETTING no_str=0 breaks channel access clients*/ pes->no_str = 2; memset(pes->strs,'\0',sizeof(pes->strs)); - strncpy(pes->strs[0],prec->znam,sizeof(pes->strs[0])); - if(*prec->znam!=0) pes->no_str=1; - strncpy(pes->strs[1],prec->onam,sizeof(pes->strs[1])); - if(*prec->onam!=0) pes->no_str=2; + + STATIC_ASSERT(sizeof(prec->znam) <= sizeof(pes->strs[0])); + memcpy(pes->strs[0], prec->znam, sizeof(pes->strs[0])); + if(*prec->znam != 0) pes->no_str = 1; + + STATIC_ASSERT(sizeof(prec->onam) <= sizeof(pes->strs[1])); + memcpy(pes->strs[1], prec->onam, sizeof(pes->strs[1])); + if(*prec->onam != 0) pes->no_str = 2; + return(0); } static long put_enum_str(const DBADDR *paddr, const char *pstring) From 27b1244e3cd0049328d4852d971bfde8a658c0d0 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 27 May 2026 14:57:25 +0200 Subject: [PATCH 050/141] fix RELEASE.$(EPICS_HOST_ARCH).local on Windows --- configure/RULES_MODULES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/RULES_MODULES b/configure/RULES_MODULES index cfe75ba1f..ce52ae3a6 100644 --- a/configure/RULES_MODULES +++ b/configure/RULES_MODULES @@ -52,7 +52,7 @@ $(RELEASE_LOCAL): Makefile $(CONFIG)/CONFIG_SITE \ $(wildcard $(CONFIG)/CONFIG_SITE.local) $(ECHO) "Creating $@ with" $(ECHO) " $(PARENT_MODULE) = $(INSTALL_ABSOLUTE)" - @echo "$(PARENT_MODULE) = $(INSTALL_ABSOLUTE)" > $@.stdout + @echo $(PARENT_MODULE) = $(INSTALL_ABSOLUTE)> $@.stdout @$(MV) $@.stdout $@ .PHONY: RELEASE.host From 7ceff6087d7e56744220a8966b3e3a70fe22f57a Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 28 May 2026 15:46:36 +0200 Subject: [PATCH 051/141] remove quotes causing problems with Windows cmd shell --- configure/RULES.Db | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/configure/RULES.Db b/configure/RULES.Db index bc39357d4..53dc81037 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -223,60 +223,60 @@ realclean: clean %Record.h$(DEP): $(COMMON_DIR)/%Record.dbd $(DBDTORECTYPEH_dep) @$(RM) $@ @$(DBTORECORDTYPEH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo "$(COMMONDEP_TARGET): ../Makefile" >> $@.stdout + @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout @$(MV) $@.stdout $@ %Record.h$(DEP): %Record.dbd $(DBDTORECTYPEH_dep) @$(RM) $@ @$(DBTORECORDTYPEH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo "$(COMMONDEP_TARGET): ../Makefile" >> $@.stdout + @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout @$(MV) $@.stdout $@ %Record.h$(DEP): ../%Record.dbd $(DBDTORECTYPEH_dep) @$(RM) $@ @$(DBTORECORDTYPEH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo "$(COMMONDEP_TARGET): ../Makefile" >> $@.stdout + @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout @$(MV) $@.stdout $@ menu%.h$(DEP): $(COMMON_DIR)/menu%.dbd $(DBDTOMENUH_dep) @$(RM) $@ @$(DBTOMENUH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo "$(COMMONDEP_TARGET): ../Makefile" >> $@.stdout + @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout @$(MV) $@.stdout $@ menu%.h$(DEP): menu%.dbd $(DBDTOMENUH_dep) @$(RM) $@ @$(DBTOMENUH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo "$(COMMONDEP_TARGET): ../Makefile" >> $@.stdout + @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout @$(MV) $@.stdout $@ menu%.h$(DEP): ../menu%.dbd $(DBDTOMENUH_dep) @$(RM) $@ @$(DBTOMENUH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo "$(COMMONDEP_TARGET): ../Makefile" >> $@.stdout + @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout @$(MV) $@.stdout $@ %.dbd$(DEP): %.dbd.pod @$(RM) $@ - @echo "$(COMMONDEP_TARGET): ../Makefile" > $@.stdout + @echo $(COMMONDEP_TARGET): ../Makefile > $@.stdout @$(MV) $@.stdout $@ %.dbd$(DEP): %Include.dbd @$(RM) $@ @$(DBEXPAND) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo "$(COMMONDEP_TARGET): ../Makefile" >> $@.stdout + @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout @$(MV) $@.stdout $@ %.dbd$(DEP): ../%Include.dbd @$(RM) $@ @$(DBEXPAND) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo "$(COMMONDEP_TARGET): ../Makefile" >> $@.stdout + @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout @$(MV) $@.stdout $@ %.dbd$(DEP): $($*_DBD) @$(RM) $@ @$(DBEXPAND) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $($*_DBD) > $@.stdout - @echo "$(COMMONDEP_TARGET): ../Makefile" >> $@.stdout + @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout @$(MV) $@.stdout $@ %.db$(DEP): %$(SUBST_SUFFIX) From a9444938ede8249eee5751fa1543c9d07c90a218 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Fri, 29 May 2026 10:40:44 +0200 Subject: [PATCH 052/141] run one Windows build with cmd shell --- .github/workflows/ci-scripts-build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-scripts-build.yml b/.github/workflows/ci-scripts-build.yml index 78c32f5d9..9ad6d688d 100644 --- a/.github/workflows/ci-scripts-build.yml +++ b/.github/workflows/ci-scripts-build.yml @@ -175,10 +175,11 @@ jobs: # Windows builds - - name: "Win-22 MSC-22" + - name: "Win-22 MSC-22 (cmd shell)" os: windows-2022 cmp: vs2022 configuration: default + extra: "SHELL=cmd" - name: "Win-22 MSC-22, static" os: windows-2022 From c5d1668895094bea44aee7655c386b2d9192cfa9 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Fri, 29 May 2026 10:51:39 +0200 Subject: [PATCH 053/141] print help without echo --- configure/RULES_TOP | 69 +++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/configure/RULES_TOP b/configure/RULES_TOP index 50079b446..94834988e 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -77,42 +77,43 @@ rm-failure-file: $(RM) $(TESTS_FAILED_PATH) help: - @echo "Usage: gnumake [options] [target] ..." - @echo "Targets supported by all Makefiles:" - @echo " all - Same as install (default rule)" - @echo " inc - Installs header, dbd and html files" - @echo " build - Builds and installs all targets" - @echo " install - Builds and installs all targets" - @echo " clean - Removes the O. dirs created by running make" - @echo " In O. dir, clean removes build created files" - @echo " realclean - Removes ALL O. dirs" - @echo " Cannot be used within an O. dir" - @echo " rebuild - Same as clean install" - @echo " archclean - Removes O. dirs but not O.Common dir" - @echo " depclean - Removes .d files from all O. dirs." - @echo " cvsclean - Removes backup files etc. from all dirs below" - @echo " runtests - Run self-tests, summarize results immediately" - @echo " tapfiles - Run self-tests, save to O./*.tap files" - @echo " test-results - Summarize all O./*.tap files" - @echo " clean-tests - Removes all O./*.tap files" - @echo "\"Partial\" build targets supported by Makefiles:" - @echo " host - Builds and installs $(EPICS_HOST_ARCH) only." - @echo " inc$(DIVIDER) - Installs only header files." - @echo " build$(DIVIDER) - Builds and installs only." - @echo " install$(DIVIDER) - Builds and installs only." - @echo " clean$(DIVIDER) - Cleans binaries in O. dirs only." - @echo "Targets supported by top level Makefile:" + $(info $()Usage: gnumake [options] [target] ...) + $(info $()Targets supported by all Makefiles:) + $(info $() all - Same as install (default rule)) + $(info $() inc - Installs header, dbd and html files) + $(info $() build - Builds and installs all targets) + $(info $() install - Builds and installs all targets) + $(info $() clean - Removes the O. dirs created by running make) + $(info $() In O. dir, clean removes build created files) + $(info $() realclean - Removes ALL O. dirs) + $(info $() Cannot be used within an O. dir) + $(info $() rebuild - Same as clean install) + $(info $() archclean - Removes O. dirs but not O.Common dir) + $(info $() depclean - Removes .d files from all O. dirs.) + $(info $() cvsclean - Removes backup files etc. from all dirs below) + $(info $() runtests - Run self-tests, summarize results immediately) + $(info $() tapfiles - Run self-tests, save to O./*.tap files) + $(info $() test-results - Summarize all O./*.tap files) + $(info $() clean-tests - Removes all O./*.tap files) + $(info $()"Partial" build targets supported by Makefiles:) + $(info $() host - Builds and installs $(EPICS_HOST_ARCH) only.) + $(info $() inc$(DIVIDER) - Installs only header files.) + $(info $() build$(DIVIDER) - Builds and installs only.) + $(info $() install$(DIVIDER) - Builds and installs only.) + $(info $() clean$(DIVIDER) - Cleans binaries in O. dirs only.) + $(info $()Targets supported by top level Makefile:) ifndef DISABLE_TOP_RULES - @echo " archuninstall - Remove bin & lib directories created by this hostarch." - @echo " uninstall$(DIVIDER) - Remove bin & lib directories for only." - @echo " uninstall - Remove install directories created by this hostarch." - @echo " realuninstall - Removes ALL install dirs" - @echo " distclean - Does realclean cvsclean realuninstall and deletes any" - @echo " generated modules/RELEASE..local files" + $(info $() archuninstall - Remove bin & lib directories created by this hostarch.) + $(info $() uninstall$(DIVIDER) - Remove bin & lib directories for only.) + $(info $() uninstall - Remove install directories created by this hostarch.) + $(info $() realuninstall - Removes ALL install dirs) + $(info $() distclean - Does realclean cvsclean realuninstall and deletes any) + $(info $() generated modules/RELEASE..local files) endif - @echo " help - Prints this list of valid make targets " - @echo "Object targets are supported by the O. level Makefile .e.g" - @echo " xxxRecord.o" + $(info $() help - Prints this list of valid make targets ) + $(info $()Object targets are supported by the O. level Makefile .e.g) + $(info $() xxxRecord.o) + @: .PHONY: distclean uninstall rm-failure-file help .PHONY: realuninstall archuninstall uninstallDirs From 987b21f68aabc33e7262d166dc29d5778fd8c42c Mon Sep 17 00:00:00 2001 From: rhong Date: Tue, 5 May 2026 10:52:11 -0500 Subject: [PATCH 054/141] Slow search_reply_udp in RTEMS IOCs (#836) * Use malloc_free_space() instead of malloc_info( &info ) in osiSufficentSpaceInPool --- modules/libcom/src/osi/os/RTEMS-posix/osdPoolStatus.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/libcom/src/osi/os/RTEMS-posix/osdPoolStatus.c b/modules/libcom/src/osi/os/RTEMS-posix/osdPoolStatus.c index e4ddb350b..06c68d5c1 100644 --- a/modules/libcom/src/osi/os/RTEMS-posix/osdPoolStatus.c +++ b/modules/libcom/src/osi/os/RTEMS-posix/osdPoolStatus.c @@ -33,11 +33,7 @@ LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize */ LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t contiguousBlockSize ) { - unsigned long n; - Heap_Information_block info; - - malloc_info( &info ); - n = info.Stats.size - (unsigned long)(info.Stats.lifetime_allocated - info.Stats.lifetime_freed); + size_t n = malloc_free_space(); return (n > (50000 + contiguousBlockSize)); } #endif From 58152f6a4219ba13246c44ab9e76a168e110151e Mon Sep 17 00:00:00 2001 From: mdavidsaver Date: Sun, 21 Jun 2026 07:09:43 -0700 Subject: [PATCH 055/141] configure: fail hard if RPATH ORIGIN requested, but makeRPath errors out (#890) * configure: fail hard if RPATH ORIGIN requested, but makeRPath errors out The $(shell ...) construct stores the numeric exit code in $(.SHELLSTATUS). Map zero to empty string, so that non-zero values select $(error ...). --- configure/os/CONFIG.Common.linuxCommon | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure/os/CONFIG.Common.linuxCommon b/configure/os/CONFIG.Common.linuxCommon index 24b1a0c33..68159a91f 100644 --- a/configure/os/CONFIG.Common.linuxCommon +++ b/configure/os/CONFIG.Common.linuxCommon @@ -25,13 +25,15 @@ STATIC_LDLIBS_YES= -Wl,-Bdynamic # Set runtime path for shared libraries if LINKER_USE_RPATH=YES SHRLIBDIR_RPATH_LDFLAGS_YES = $(SHRLIB_DEPLIB_DIRS:%=-Wl,-rpath,%) -SHRLIBDIR_RPATH_LDFLAGS_ORIGIN = $(shell $(MAKERPATH) -O '\$$ORIGIN' -F $(FINAL_DIR) -R $(LINKER_ORIGIN_ROOT) $(SHRLIB_DEPLIB_DIRS)) +SHRLIBDIR_RPATH_LDFLAGS_ORIGIN = $(shell $(MAKERPATH) -O '\$$ORIGIN' -F $(FINAL_DIR) -R $(LINKER_ORIGIN_ROOT) $(SHRLIB_DEPLIB_DIRS)) \ + $(if $(filter-out 0,$(.SHELLSTATUS)), $(error $(MAKERPATH) failed)) SHRLIBDIR_LDFLAGS += \ $(SHRLIBDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) # Set runtime path for products if LINKER_USE_RPATH=YES PRODDIR_RPATH_LDFLAGS_YES = $(PROD_DEPLIB_DIRS:%=-Wl,-rpath,%) -PRODDIR_RPATH_LDFLAGS_ORIGIN = $(shell $(MAKERPATH) -O '\$$ORIGIN' -F $(FINAL_DIR) -R $(LINKER_ORIGIN_ROOT) $(PROD_DEPLIB_DIRS)) +PRODDIR_RPATH_LDFLAGS_ORIGIN = $(shell $(MAKERPATH) -O '\$$ORIGIN' -F $(FINAL_DIR) -R $(LINKER_ORIGIN_ROOT) $(PROD_DEPLIB_DIRS)) \ + $(if $(filter-out 0,$(.SHELLSTATUS)), $(error $(MAKERPATH) failed)) PRODDIR_LDFLAGS += \ $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) From 4b03e97d7b24cbbb9825ea09dc3e8046f73b24d0 Mon Sep 17 00:00:00 2001 From: mdavidsaver Date: Sun, 21 Jun 2026 07:18:08 -0700 Subject: [PATCH 056/141] Embed GDB helper * Add GDB helper script Pretty printing of some common argument types Need to add a line to ~/.gdbinit > add-auto-load-safe-path /path/to/base/checkout/ afterwards verify at GDB shell with > info auto-load python-scripts > info pretty-printer Tested with GDB 16.3 circa Debian 13 Add $rcast(dbCommon) to up-cast Add $record("name") to lookup record Add $elln(ELLLIST,#) to index into list --- documentation/Makefile | 1 + documentation/gdb.md | 114 ++++++++++ documentation/index.rst | 1 + documentation/new-notes/PR-110.md | 7 + modules/database/src/ioc/dbStatic/RULES | 3 + .../database/src/ioc/dbStatic/dbStaticLib.c | 21 ++ modules/database/src/ioc/epics-gdb-helper.py | 201 ++++++++++++++++++ 7 files changed, 348 insertions(+) create mode 100644 documentation/gdb.md create mode 100644 documentation/new-notes/PR-110.md create mode 100644 modules/database/src/ioc/epics-gdb-helper.py diff --git a/documentation/Makefile b/documentation/Makefile index 6555ce278..517c294e6 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -23,6 +23,7 @@ DOCS += README.md DOCS += ca-cli.md DOCS += RELEASE_NOTES.md DOCS += ReleaseChecklist.md +DOCS += gdb.md OLD_NOTES = $(wildcard ../RELEASE-*.md) DOCS += $(OLD_NOTES:../%=%) diff --git a/documentation/gdb.md b/documentation/gdb.md new file mode 100644 index 000000000..9922bd23e --- /dev/null +++ b/documentation/gdb.md @@ -0,0 +1,114 @@ +# Debugging with GDB + +Starts a process in [GDB](https://sourceware.org/gdb/current/onlinedocs/gdb.html/): + +```sh +gdb --args ../../bin/linux-x86_64-debug/myioc ./st.cmd +``` + +Attach to a running process by numeric PID: + +```sh +gdb --pid=## +``` + +Shorthand if only one instance is running: + +```sh +gdb --pid=`pgrep myioc` +``` + +## GDB shell Cheat sheet + +Print stack traces of all threads. Optionally with pagination disabled: + +```gdb +(gdb) set pagination off + +(gdb) thread apply all backtrace + +(gdb) set pagination on +``` + +Note: consider sending or posting this very long output as an attachment file. + +Break when a certain record begins processing: + +```gdb +(gdb) break dbProcess if $_streq(precord.name, "my:record") +``` + +Break when a `PACT` field changes: + +```gdb +(gdb) watch -l $record("my:record").pact +``` + +Note: Uses custom `$record()` helper. See below. + +## Helpers + +If the bundled `epics-gdb-helper.py` is [enabled](#helper-enable), +then a set of pretty printers are registered for some common database types. +eg. `dbCommon*` will show the record name. +`DBLINK*` will show the associated record name, and the link target. +Also, several convenience are available. + + +Use `$record()` to lookup a record by name: + +```gdb +(gdb) print $record("my:record") +$1 = (calcRecord*)(0x55555562f6f8, "my:record") +``` + +Note: `$record()` may only be called after record allocation during `iocInit()`. + +Use `$rcast()` to up-cast `dbCommon*` to the specific record type: + +```gdb +(gdb) print precord +$1 = (dbCommon*)(0x55555562f6f8, "my:record") +(gdb) print $rcast(precord) +$2 = (calcRecord*)(0x55555562f6f8, "my:record") +``` + +Use `$elln()` to index into `ELLLIST` linked lists. + +```gdb +(gdb) print $elln(pdbbase.recordTypeList, 2) +``` + +### Enable (helper-enable) + + +To automatically [enable](https://sourceware.org/gdb/current/onlinedocs/gdb.html/Auto_002dloading-safe-path.html), +add a line to `~/.gdbinit`. + +``` +add-auto-load-safe-path /path/to/base/checkout/ +``` + +Or each time run: + +``` +(gdb) source /path/to/base/checkout/modules/database/src/ioc/epics-gdb-helper.py +``` + +Note: Entries in the `safe-path` list may be files (`.so` or `.py`), or directories. + When a directory is included, sub-directories are also trusted. + eg. `add-auto-load-safe-path /opt/epics` would also trust a `/opt/epics/lib`. + +Afterwards verify at GDB shell by running: + +```gdb +(gdb) info auto-load python-scripts +Loaded Script +... +Yes epics-gdb-helper.py + +(gdb) info pretty-printer +global pretty-printers: + EPICS +... +``` diff --git a/documentation/index.rst b/documentation/index.rst index a84446ba7..d5d894730 100644 --- a/documentation/index.rst +++ b/documentation/index.rst @@ -14,6 +14,7 @@ EPICS Base Documentation README RELEASE_NOTES ACF-Language + gdb .. toctree:: :maxdepth: 2 diff --git a/documentation/new-notes/PR-110.md b/documentation/new-notes/PR-110.md new file mode 100644 index 000000000..2c2ecc1e7 --- /dev/null +++ b/documentation/new-notes/PR-110.md @@ -0,0 +1,7 @@ +## Add GDB Helper Script + +Add [Debugging with GDB](gdb.md) section in documentation. + +Add GDB helper script to pretty print some common database types. +Tested with GDB 16.3. +Compatible with python 3. diff --git a/modules/database/src/ioc/dbStatic/RULES b/modules/database/src/ioc/dbStatic/RULES index 70e2cdaee..0e5525a0b 100644 --- a/modules/database/src/ioc/dbStatic/RULES +++ b/modules/database/src/ioc/dbStatic/RULES @@ -11,3 +11,6 @@ # dbLexRoutines.c is included in dbYacc.c dbYacc.c: dbLex.c $(IOCDIR)/dbStatic/dbLexRoutines.c + +dbStaticLib$(DEP): ../epics-gdb-helper.py +dbStaticLib$(OBJ): ../epics-gdb-helper.py diff --git a/modules/database/src/ioc/dbStatic/dbStaticLib.c b/modules/database/src/ioc/dbStatic/dbStaticLib.c index cbdcea5fa..c6bf1c1ff 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticLib.c +++ b/modules/database/src/ioc/dbStatic/dbStaticLib.c @@ -3664,3 +3664,24 @@ void dbReportDeviceConfig(dbBase *pdbbase, FILE *report) finishOutstream(stream); return; } + +#if defined(__GNUC__) && defined(__ELF__) && defined(__linux__) +/* Loading of GDB python helper script. + * + * Need to include the following line in ~/.gdbinit + * + * add-auto-load-safe-path /path/to/base + * + * after libCom.so is loaded (eg. break on main() ) run in the GDB shell: + * + * info auto-load python-scripts + */ +__asm__( + ".pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n" + ".byte 4 /* Python text */\n" + ".ascii \"epics-gdb-helper.py\\n\"\n" + ".incbin \"epics-gdb-helper.py\"\n" + ".byte 0\n" + ".popsection \n" + ); +#endif diff --git a/modules/database/src/ioc/epics-gdb-helper.py b/modules/database/src/ioc/epics-gdb-helper.py new file mode 100644 index 000000000..a7f55de68 --- /dev/null +++ b/modules/database/src/ioc/epics-gdb-helper.py @@ -0,0 +1,201 @@ +#************************************************************************* +# SPDX-License-Identifier: EPICS +# EPICS BASE is distributed subject to a Software License Agreement found +# in file LICENSE that is included with this distribution. +#************************************************************************* + +# see https://sourceware.org/gdb/current/onlinedocs/gdb.html/Python.html +# also documentation/gdb.md in epics-base +# +# Troubleshooting: +# (gdb) set python print-stack full + +import time + +import gdb +import gdb.printing + +voidp = gdb.lookup_type('void').pointer() + +def ellIter(plist : gdb.Value, cast :gdb.Type =None): # -> ELLNODE* + # Iterate an ELLLIST* + if plist.type.code == gdb.TYPE_CODE_PTR: + plist = plist.dereference() + pnode = plist['node']['next'] + + while pnode: + yield pnode if cast is None else pnode.cast(cast) + pnode = pnode.dereference()['next'] + +class Wrapper(object): + def __init__(self, val: gdb.Value): + self._v = val + def to_string(self) -> str: + raise NotImplementedError() + +class epicsTimeStamp(Wrapper): + def to_string(self): + sec = int(self._v['secPastEpoch']) + ns = int(self._v['nsec']) + T = sec + 631152000 + 1e-9*ns + return f'epicsTimeStamp(secPastEpoch = {sec}, ns = {ns}, {time.ctime(T)!r})' + +class dbCommon(Wrapper): + def __init__(self, val: gdb.Value, name='dbCommon'): + self._v, self._name = val, name + def to_string(self): + try: + return '(%s*)(%s, "%s")'%(self._name, self._v.address.cast(voidp), self._v['name'].string()) + except Exception: + raise ValueError(self._v.type) + +class dbAddr(Wrapper): + def to_string(self): + v = self._v # Value + rec = v['precord'].dereference()['name'].string() + fld = v['pfldDes'].dereference()['name'].string() + return '(dbAddr*)(%s, "%s.%s")'%(self._v.address.cast(voidp), rec, fld) + +class dbChannel(Wrapper): + def to_string(self): + v = self._v # Value + rec = v['addr']['precord'].dereference()['name'].string() + fld = v['addr']['pfldDes'].dereference()['name'].string() + return '(dbChannel*)(%s, "%s.%s")'%(self._v.address.cast(voidp), rec, fld) + +class dbLink(Wrapper): + def to_string(self): + v = self._v # Value + + # size_t offset = (char*)&v - (char*)v.precord + offset = int(v.address) - int(v['precord']) + # dbRecordType& rdes = *v.precord->rdes + rdes = v['precord'].dereference()['rdes'].dereference() + + no_links = int(rdes['no_links']) + link_ind = rdes['link_ind'] # array of indicies of link fields + papFldDes = rdes['papFldDes'] # main array of field descriptions + + for idx in range(no_links): + idx = link_ind[idx] + fdes = papFldDes[idx].dereference() # dbFldDes + if int(fdes['offset']) == offset: + fld = fdes['name'].string() + break + else: + fld = '???' + + rec = v['precord'].dereference()['name'].string() + ltype = int(v['type']) + if ltype in (10, 11): + target = ', target="%s"'%v['value']['pv_link']['pvname'].string() + elif ltype==12: + target = ', target="@%s"'%v['value']['instio']['string'].string() + else: + ltype = { + 0: 'CONSTANT', + 1: 'PV_LINK', + 10: 'DB_LINK', + 11: 'CA_LINK', + 12: 'INST_IO', + }.get(ltype, 'LINK(%s)'%ltype) + target = ', type=%s'%ltype + + return '(link*)(%s, src="%s.%s"%s)'%(self._v.cast(voidp), rec, fld, target) + +class EPICSPrinter(gdb.printing.PrettyPrinter): + _pointers = { + 'epicsTimeStamp': epicsTimeStamp, + 'dbCommon': dbCommon, + 'dbChannel': dbChannel, + 'dbAddr': dbAddr, + 'DBADDR': dbAddr, + 'link': dbLink, + } + _values = { + 'epicsTimeStamp': epicsTimeStamp, + 'link': dbLink, + } + def __init__(self): + gdb.printing.PrettyPrinter.__init__(self, 'EPICS') + @classmethod + def __call__(klass, val: gdb.Value) -> Wrapper: + isptr = val.type.code == gdb.TYPE_CODE_PTR + if isptr: + if val.type==voidp or not val: # NULL + return + val = val.dereference() + tbl = klass._pointers + else: + tbl = klass._values + + tname = val.type.unqualified().strip_typedefs().name # str + printer = tbl.get(tname) + + if isptr and printer is None and tname is not None and tname.endswith('Record'): + # exclude eg. lockRecord and processNotifyRecord which are not record types + # which are all too small to be records + if val.type.sizeof >= gdb.lookup_type('dbCommon').sizeof: + return dbCommon(val, str(tname)) + if printer is not None: + return printer(val) + +gdb.printing.register_pretty_printer(None, EPICSPrinter(), replace=True) + +class RCast(gdb.Function): + #Cast dbCommon* to specific record type + def __init__(self): + super(RCast, self).__init__("rcast") + @staticmethod + def invoke(prec: gdb.Value) -> gdb.Value: + if prec.type.code!=gdb.TYPE_CODE_PTR: + return prec + + ptype = prec.type.target().unqualified().strip_typedefs() + if ptype.name=='dbCommon': + rname = prec.dereference()['rdes'].dereference()['name'].string() # eg. 'calc' + rtype = gdb.lookup_type(f'{rname}Record') + return prec.cast(rtype.pointer()) + + return prec +RCast() + +class Rec(gdb.Function): + #Lookup record by name + def __init__(self): + super(Rec, self).__init__("record") + @staticmethod + def invoke(prec: gdb.Value) -> gdb.Value: + target = prec.string() + pdbbase = gdb.lookup_global_symbol('pdbbase').value() # dbBase* + if not pdbbase: + raise RuntimeError('Process database not yet initialized. Load some records first.') + pdbbase = pdbbase.dereference() + dbRecordType = gdb.lookup_type('dbRecordType').pointer() + dbRecordNode = gdb.lookup_type('dbRecordNode').pointer() + dbCommon = gdb.lookup_type('dbCommon').pointer() + + for rtype in ellIter(pdbbase['recordTypeList'].address, dbRecordType): + for rnode in ellIter(rtype.dereference()['recList'].address, dbRecordNode): + precname = rnode.dereference()['recordname'].string() + if precname==target: + return RCast.invoke(rnode.dereference()['precord'].cast(dbCommon)) + + raise RuntimeError(f'No record {target!r}') +Rec() + +class EllNth(gdb.Function): + # Fetch entry in list + def __init__(self): + super(EllNth, self).__init__("elln") + @staticmethod + def invoke(plist: gdb.Value, idx: gdb.Value) -> gdb.Value: + idx = int(idx) + if idx < 0: + raise ValueError('Negative index') + + it = ellIter(plist) + for _n in range(idx): + next(it) # discard + return next(it) +EllNth() From 45a1edcfac2a9ea47bc4ec849e6dc0f1c2a73a1d Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 21 Apr 2026 14:19:26 +0200 Subject: [PATCH 057/141] minor --- modules/database/src/ioc/db/callback.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/database/src/ioc/db/callback.c b/modules/database/src/ioc/db/callback.c index cf6a7b467..f6238335f 100644 --- a/modules/database/src/ioc/db/callback.c +++ b/modules/database/src/ioc/db/callback.c @@ -83,14 +83,14 @@ static int cbState; // holdscbState_t, use atomic ops static epicsEventId startStopEvent; /* Static data */ -static char *threadNamePrefix[NUM_CALLBACK_PRIORITIES] = { +static const char *threadNamePrefix[NUM_CALLBACK_PRIORITIES] = { "cbLow", "cbMedium", "cbHigh" }; #define FULL_MSG(name) "callbackRequest: " ERL_ERROR " " name " ring buffer full\n" -static char *fullMessage[NUM_CALLBACK_PRIORITIES] = { +static const char *fullMessage[NUM_CALLBACK_PRIORITIES] = { FULL_MSG("cbLow"), FULL_MSG("cbMedium"), FULL_MSG("cbHigh") }; -static unsigned int threadPriority[NUM_CALLBACK_PRIORITIES] = { +static const unsigned int threadPriority[NUM_CALLBACK_PRIORITIES] = { epicsThreadPriorityScanLow - 1, epicsThreadPriorityScanLow + 4, epicsThreadPriorityScanHigh + 1 From db67227a96e25fa41b28fc1fe45ea7e16ff6bd9b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 21 Jun 2026 08:46:20 -0700 Subject: [PATCH 058/141] dbScan one more NUM_TIME_EVENTS --- modules/database/src/ioc/db/dbScan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/db/dbScan.c b/modules/database/src/ioc/db/dbScan.c index f016f0200..d9922b56e 100644 --- a/modules/database/src/ioc/db/dbScan.c +++ b/modules/database/src/ioc/db/dbScan.c @@ -488,7 +488,7 @@ event_list *eventNameToHandle(const char *eventname) */ if (epicsParseDouble(eventname, &eventnumber, NULL) == 0) { - if (eventnumber >= 0 && eventnumber < 256) + if (eventnumber >= 0 && eventnumber < NUM_TIME_EVENTS) { if (eventnumber < 1) return NULL; /* 0 is no event */ From 46ab847d8ad9953226b5b60fadadcca2eff0f6db Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 21 Apr 2026 14:34:53 +0200 Subject: [PATCH 059/141] Document dbScan.h --- documentation/Makefile.headers | 1 + modules/database/src/ioc/db/dbScan.c | 3 ++ modules/database/src/ioc/db/dbScan.h | 77 ++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/documentation/Makefile.headers b/documentation/Makefile.headers index 44499f50c..7d841a31d 100644 --- a/documentation/Makefile.headers +++ b/documentation/Makefile.headers @@ -75,6 +75,7 @@ database_HEADERS += dbEvent database_HEADERS += dbExtractArray database_HEADERS += dbLink database_HEADERS += dbLock +database_HEADERS += dbScan database_HEADERS += dbServer database_HEADERS += dbState database_HEADERS += dbStaticLib diff --git a/modules/database/src/ioc/db/dbScan.c b/modules/database/src/ioc/db/dbScan.c index d9922b56e..9f8681799 100644 --- a/modules/database/src/ioc/db/dbScan.c +++ b/modules/database/src/ioc/db/dbScan.c @@ -115,6 +115,9 @@ typedef struct event_list { struct event_list *next; char eventname[1]; /* actually arbitrary size */ } event_list; +/* All event_list are singly linked from pevent_list[0] via next. + * Numbered events are also stored in pevent_list[1..255]. + */ static event_list * volatile pevent_list[NUM_TIME_EVENTS]; static epicsMutexId event_lock; diff --git a/modules/database/src/ioc/db/dbScan.h b/modules/database/src/ioc/db/dbScan.h index 2439fd45f..3295fb3d1 100644 --- a/modules/database/src/ioc/db/dbScan.h +++ b/modules/database/src/ioc/db/dbScan.h @@ -56,8 +56,26 @@ DBCORE_API void scanPause(void); DBCORE_API void scanStop(void); DBCORE_API void scanCleanup(void); +/** @brief Lookup, or create, named Event record list + * @param event Name + * @return Record list handle, or NULL on allocation failure. + * + * @since 3.15.0.1 + */ DBCORE_API EVENTPVT eventNameToHandle(const char* event); +/** @brief Request scan of Event record list + * @param epvt Event list handle + * + * Queue request for callback worker thread(s) to scan records. + * Lookup named event list with eventNameToHandle() . + * + * @since 3.15.0.1 + */ DBCORE_API void postEvent(EVENTPVT epvt); +/** @brief Process numbered Event record list + * @param event Event number in the range 1 through `NUM_TIME_EVENTS-1` (255) inclusive. + * @deprecated In favor of postEvent() + */ DBCORE_API void post_event(int event); DBCORE_API void scanAdd(struct dbCommon *); DBCORE_API void scanDelete(struct dbCommon *); @@ -75,6 +93,8 @@ DBCORE_API int scanOnce(struct dbCommon *prec); * Does not wait for async record completion. * @param usr Argumentfor cb * @return Zero on success. Non-zero if the request could not be queued. + * + * @since 3.16.0.1 Added */ DBCORE_API int scanOnceCallback(struct dbCommon *prec, once_complete cb, void *usr); /** @brief Set Once queue size @@ -136,4 +156,61 @@ DBCORE_API void scanIoSetComplete(IOSCANPVT, io_scan_complete, void *usr); } #endif +/** @file dbScan.h + * + * Mechanics for interacting with Process Database record scanning + * utilities. + * + * @section dbscanoverflow Scan Queue Overflow + * + * Several of the thread backed scanning mechanisms have work + * queues which may overflow. + * Well written EPICS drivers should avoid this as described below. + * + * @section dbscaniointr I/O Intr scanning + * + * An EPICS driver may use scanIoInit() to allocate a scan list. + * This scan list is associated with a record through dset::get_ioint_info , + * and triggered with scanIoRequest() (asynchronous) + * or scanIoImmediate() (synchronous). + * + * scanIoSetComplete() may be used to request notification after + * any records on the list have begun processing. + * This may be used to defer future scanIoRequest() until + * past requests have been satisfied, + * which avoids possible overflowing of the underlying queue + * of the worker thread. + * + * @section dbscanname Named Event scanning + * + * Event names may appear in the `EVNT` field of any record. + * When SCAN is also set to `Event`, the that record will process + * each time this Event occurs. + * + * An eventRecord provides one way to trigger scanning. + * + * eventNameToHandle() may be used by an EPICS driver to lookup/create + * a process-wide named scan list. + * Then call postEvent() to trigger scanning. + * + * Legacy applications may use post_event() for the special numbered + * Events (1 through 255). + * `post_event(1)` is equivalent to `eventNameToHandle("1")` + * followed by a postEvent(). + * + * There is no way for a caller of postEvent() to avoid scan + * queue overflow. + * + * @section dbscanonce Once Queue + * + * The "once" queue is meant for special cases of one-time + * processing. eg. the initial PINI scanning. + * EPICS drivers may call scanOnceCallback() explicitly, + * but are encouraged where practical to call dbProcess() from + * a driver managed worker thread. + * + * The process-wide "once" queue has a fixed size, which may be + * modified by scanOnceSetQueueSize() . + */ + #endif From 499fec412045fbb8fdcab7d730a9fb6cbc3d44af Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 21 Jun 2026 12:26:15 -0700 Subject: [PATCH 060/141] doc devSup.h --- modules/database/src/ioc/dbStatic/devSup.h | 57 ++++++++++++---------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/modules/database/src/ioc/dbStatic/devSup.h b/modules/database/src/ioc/dbStatic/devSup.h index 799569927..6e2edeb19 100644 --- a/modules/database/src/ioc/dbStatic/devSup.h +++ b/modules/database/src/ioc/dbStatic/devSup.h @@ -34,33 +34,36 @@ struct link; /* aka DBLINK */ * Recommended usage: * * In Makefile: - @code - USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET - @endcode + * @code + * USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET + * @endcode * * In C source file: - @code - #include - #include // For IOCSCANPVT - ... - #include // defines epicsExportSharedSymbols - ... - static long init_record(dbCommon *prec); - static long get_iointr_info(int detach, dbCommon *prec, IOCSCANPVT* pscan); - static long longin_read(longinRecord *prec); - - longindset devLiDevName = { - { - 5, // 4 from dset + 1 from longinRecord - NULL, - NULL, - &init_record, - &get_iointr_info - }, - &longin_read - }; - epicsExportAddress(dset, devLiDevName); - @endcode + * @code + * #include + * #include // For IOCSCANPVT + * ... + * #include // defines epicsExportSharedSymbols + * ... + * static long init_record(dbCommon *prec) { + * DBLINK *link = dbGetDevLink(prec); // INP + * ... + * } + * static long get_iointr_info(int detach, dbCommon *prec, IOCSCANPVT* pscan); + * static long longin_read(longinRecord *prec); + * + * longindset devLiDevName = { + * { + * 5, // 4 from dset + 1 from longinRecord + * NULL, + * NULL, + * &init_record, + * &get_iointr_info + * }, + * &longin_read + * }; + * epicsExportAddress(dset, devLiDevName); + * @endcode */ typedef struct typed_dset { /** Number of function pointers which follow. @@ -157,6 +160,10 @@ typedef dset unambiguous_dset; /** Fetch INP or OUT link (or NULL if record type has neither). * * Recommended for use in device support init_record() + * to provide access to the INP/OUT link from `dbCommon*` + * without casting to the specific record type. + * + * @since 7.0.6 */ DBCORE_API struct link* dbGetDevLink(struct dbCommon* prec); From 4240bc89f92e0aaf4aaf0e8594bd09c9cd6af150 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 21 Jun 2026 12:22:10 -0700 Subject: [PATCH 061/141] RtD show typed APIs --- documentation/Doxyfile@ | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/documentation/Doxyfile@ b/documentation/Doxyfile@ index ef2377119..252a21da5 100644 --- a/documentation/Doxyfile@ +++ b/documentation/Doxyfile@ @@ -1999,7 +1999,10 @@ PREDEFINED = __cplusplus \ epicsShareClass \ epicsShareFunc \ epicsShareAPI \ - epicsStdCall + epicsStdCall \ + USE_TYPED_RSET \ + USE_TYPED_DSET \ + USE_TYPED_DBEVENT # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The From 35a91eed8d254388ccea27d9ec9c90df284bccee Mon Sep 17 00:00:00 2001 From: Jeremy Lorelli Date: Wed, 24 Jun 2026 16:46:20 -0700 Subject: [PATCH 062/141] database: Replace epicsEventMustSignal -> epicsEventMustTrigger in comments --- modules/database/src/ioc/db/dbUnitTest.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/database/src/ioc/db/dbUnitTest.h b/modules/database/src/ioc/db/dbUnitTest.h index ba19684e0..71852600c 100644 --- a/modules/database/src/ioc/db/dbUnitTest.h +++ b/modules/database/src/ioc/db/dbUnitTest.h @@ -322,7 +322,7 @@ DBCORE_API void testGlobalUnlock(void); * epicsMutex, ...) and use of epicsThreadMustJoin() is impractical. * * For example. The following has a subtle race where the event may be - * destroyed (free()'d) before the call to epicsEventMustSignal() has + * destroyed (free()'d) before the call to epicsEventMustTrigger() has * returned. On some targets this leads to a use after free() error. * * @code @@ -335,7 +335,7 @@ DBCORE_API void testGlobalUnlock(void); * } * // ... * void thread2() { - * epicsEventMustSignal(evt); // <- Racer + * epicsEventMustTrigger(evt); // <- Racer * } * @endcode * @@ -356,12 +356,12 @@ DBCORE_API void testGlobalUnlock(void); * epicsEventDestroy(evt); * } * void thread2() { - * epicsEventMustSignal(evt); + * epicsEventMustTrigger(evt); * } * @endcode * * Another way to avoid this race is to use a global mutex to ensure - * that epicsEventMustSignal() has returned before destroying the event. + * that epicsEventMustTrigger() has returned before destroying the event. * testGlobalLock() and testGlobalUnlock() provide access to such a mutex. * * @code{.c} @@ -377,7 +377,7 @@ DBCORE_API void testGlobalUnlock(void); * // ... * void thread2() { * testGlobalLock(); // <-- added - * epicsEventMustSignal(evt); + * epicsEventMustTrigger(evt); * testGlobalUnlock(); // <-- added * } * @endcode From f634d3d88591d7f13bc9b4a14ab443dfa95cd689 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Jun 2026 13:42:36 -0700 Subject: [PATCH 063/141] fix last LOCAL --- modules/database/src/ioc/rsrv/camessage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index 721b6a451..d6398f722 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -1295,7 +1295,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp, * * (called by the db call back thread) */ - LOCAL int write_notify_put_callback(processNotify *ppn,notifyPutType type) + static int write_notify_put_callback(processNotify *ppn,notifyPutType type) { struct channel_in_use * pciu = (struct channel_in_use *) ppn->usrPvt; struct rsrv_put_notify *pNotify; @@ -1317,7 +1317,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp, * * (called by the db call back thread) */ - LOCAL void write_notify_done_callback(processNotify *ppn) + static void write_notify_done_callback(processNotify *ppn) { struct channel_in_use * pciu = (struct channel_in_use *) ppn->usrPvt; struct client * pClient; From 07da9aeb32d89dd7265ece6c0297b8c4d7bbd56b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Jun 2026 09:39:39 -0700 Subject: [PATCH 064/141] minor --- modules/database/src/ioc/rsrv/camsgtask.c | 2 +- modules/database/src/ioc/rsrv/server.h | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/database/src/ioc/rsrv/camsgtask.c b/modules/database/src/ioc/rsrv/camsgtask.c index b69a39458..8a10823f9 100644 --- a/modules/database/src/ioc/rsrv/camsgtask.c +++ b/modules/database/src/ioc/rsrv/camsgtask.c @@ -114,7 +114,7 @@ void camsgtask ( void *pParm ) client->recv.cnt += ( unsigned ) nchars; status = camessage ( client ); - if (status == 0) { + if (status == RSRV_OK) { /* * if there is a partial message * align it with the start of the buffer diff --git a/modules/database/src/ioc/rsrv/server.h b/modules/database/src/ioc/rsrv/server.h index 604880c12..b674fe79c 100644 --- a/modules/database/src/ioc/rsrv/server.h +++ b/modules/database/src/ioc/rsrv/server.h @@ -55,10 +55,19 @@ typedef struct caHdrLargeArray { enum messageBufferType { mbtUDP, mbtSmallTCP, mbtLargeTCP }; struct message_buffer { char *buf; - /*! points to first filled byte in buffer */ + /* Invariants: stk <= cnt <= maxstk + * + * buf : |-*****-----| + * ^ ^ ^ + * | | \- maxstk + * | \------ cnt + * \----------- stk + */ + /* points to first filled byte in buffer */ unsigned stk; + /* allocated capacity of buffer */ unsigned maxstk; - /*! points to first unused byte in buffer (after filled bytes) */ + /* points to first unused byte in buffer (after filled bytes) */ unsigned cnt; enum messageBufferType type; }; From cf85a1a5eb86928323d4c62d4d3c553f362a7d04 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Jun 2026 12:42:11 -0700 Subject: [PATCH 065/141] rsrv: log_header paddr= Currently prints dbChannel** --- modules/database/src/ioc/rsrv/camessage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index d6398f722..9a0b9a0e7 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -293,7 +293,7 @@ static void log_header ( 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 ? &pciu->dbch : NULL)); + hostName, mp->m_available, mnum, (pciu ? pciu->dbch : NULL)); if (mp->m_cmmd==CA_PROTO_WRITE && mp->m_dataType==DBF_STRING && pPayLoad ) { epicsPrintf ( "CAS: Request from %s => Wrote string \"%s\"\n", From b87b6c91fff64c22408faf997ea0f1419654dbd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Fri, 3 Jul 2026 19:29:48 -0300 Subject: [PATCH 066/141] Fix UAF in caRepeaterThread The ca_repeater function has some failure cases which can cause it to return. In such a situation, a reference to the current thread's epicsThreadId is kept in the taskwd, causing an eventual use-after-free when the taskwd tries to determine the task's status. We fix this problem by removing the thread from the taskwd if ca_repeater ever returns. --- modules/ca/src/client/repeater.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ca/src/client/repeater.cpp b/modules/ca/src/client/repeater.cpp index 9ccf071e3..832d03b17 100644 --- a/modules/ca/src/client/repeater.cpp +++ b/modules/ca/src/client/repeater.cpp @@ -645,6 +645,7 @@ extern "C" void caRepeaterThread ( void * /* pDummy */ ) { taskwdInsert ( epicsThreadGetIdSelf(), NULL, NULL ); ca_repeater (); + taskwdRemove ( 0 ); } From cd6d2ed0426e2ab8c80c7bd5947969610d575902 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 30 Jun 2026 12:53:38 -0500 Subject: [PATCH 067/141] Move -DUSE_TYPED_DRVET to USR_CPPFLAGS Also fixes an issue in the generated registerRecordDeviceDriver code. --- modules/database/src/ioc/Makefile | 2 +- modules/database/src/ioc/dbStatic/Makefile | 2 -- modules/database/src/tools/registerRecordDeviceDriver.pl | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/database/src/ioc/Makefile b/modules/database/src/ioc/Makefile index 15894cd0d..5d823095f 100644 --- a/modules/database/src/ioc/Makefile +++ b/modules/database/src/ioc/Makefile @@ -11,7 +11,7 @@ TOP = ../../../.. include $(TOP)/configure/CONFIG -USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET +USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET -DUSE_TYPED_DRVET # Shared library ABI version. SHRLIB_VERSION = $(EPICS_DATABASE_MAJOR_VERSION).$(EPICS_DATABASE_MINOR_VERSION).$(EPICS_DATABASE_MAINTENANCE_VERSION) diff --git a/modules/database/src/ioc/dbStatic/Makefile b/modules/database/src/ioc/dbStatic/Makefile index bb178df41..e9bd95b8d 100644 --- a/modules/database/src/ioc/dbStatic/Makefile +++ b/modules/database/src/ioc/dbStatic/Makefile @@ -11,8 +11,6 @@ SRC_DIRS += $(IOCDIR)/dbStatic -USR_CFLAGS += -DUSE_TYPED_DRVET - INC += dbBase.h INC += dbFldTypes.h INC += dbStaticLib.h diff --git a/modules/database/src/tools/registerRecordDeviceDriver.pl b/modules/database/src/tools/registerRecordDeviceDriver.pl index 940b422d9..4cb39fbba 100644 --- a/modules/database/src/tools/registerRecordDeviceDriver.pl +++ b/modules/database/src/tools/registerRecordDeviceDriver.pl @@ -164,7 +164,7 @@ if (%drivers) { print $out "};\n\n"; # List of pointers to each drvet - print $out "static struct drvet *drvsl[] = {\n"; + print $out "static drvet *drvsl[] = {\n"; print $out join(",\n", map {" pvar_drvet_$_"} @drivers); print $out "};\n\n"; } From 605542ece79e0dcceadc1510a70e3858584e6948 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 30 Jun 2026 16:06:34 -0500 Subject: [PATCH 068/141] Release notes, add a drvet to the example template --- documentation/new-notes/PR-902.md | 20 +++++ .../src/template/top/exampleApp/src/Makefile | 2 +- .../template/top/exampleApp/src/devXxxSoft.c | 73 ++++++++++++------- .../top/exampleApp/src/xxxSupport.dbd | 2 + 4 files changed, 68 insertions(+), 29 deletions(-) create mode 100644 documentation/new-notes/PR-902.md diff --git a/documentation/new-notes/PR-902.md b/documentation/new-notes/PR-902.md new file mode 100644 index 000000000..2cd0863c9 --- /dev/null +++ b/documentation/new-notes/PR-902.md @@ -0,0 +1,20 @@ +### Fix registration of DRVETs + +The C++ code generated in an IOC's `RecordDeviceDriver.cpp` file can fail +to compile if the Makefile building the IOC defines the `USE_TYPED_DRVET` +macro. Compiler errors caused by this bug will look something like this: + +``` +test_registerRecordDeviceDriver.cpp:198:15: error: +typedef 'drvet' cannot be referenced with the 'struct' specifier + 198 | static struct drvet *drvsl[] = { + | ^ +/epics/base-7.0/include/drvSup.h:38:21: note: declared here + 38 | typedef typed_drvet drvet; + | ^ +1 error generated. +``` + +[This PR](https://github.com/epics-base/epics-base/pull/902) +modifies the generated C++ code to resolve that problem, and adds a +driver to the example IOC template to catch regressions. diff --git a/modules/database/src/template/top/exampleApp/src/Makefile b/modules/database/src/template/top/exampleApp/src/Makefile index cf9e8cd8f..fac2eb207 100644 --- a/modules/database/src/template/top/exampleApp/src/Makefile +++ b/modules/database/src/template/top/exampleApp/src/Makefile @@ -9,7 +9,7 @@ include $(TOP)/configure/CONFIG # ADD MACRO DEFINITIONS BELOW HERE # Use typed rset structure (see 3.16.1 release notes) -USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET +USR_CPPFLAGS += -DUSE_TYPED_RSET -DUSE_TYPED_DSET -DUSE_TYPED_DRVET # xxxRecord.h will be created from xxxRecord.dbd DBDINC += xxxRecord diff --git a/modules/database/src/template/top/exampleApp/src/devXxxSoft.c b/modules/database/src/template/top/exampleApp/src/devXxxSoft.c index f7befadc5..e9e2186a7 100644 --- a/modules/database/src/template/top/exampleApp/src/devXxxSoft.c +++ b/modules/database/src/template/top/exampleApp/src/devXxxSoft.c @@ -1,50 +1,67 @@ -/* SPDX-FileCopyrightText: 1998 Argonne National Laboratory */ - +/* SPDX-FileCopyrightText: 2026 UChicago Argonne LLC */ /* SPDX-License-Identifier: EPICS */ /* devXxxSoft.c */ -/* Example device support module */ -#include -#include -#include -#include +/* Sample device & driver support interfaces */ -#include "alarm.h" -#include "cvtTable.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" +#include +#include +#include +#include +#include +#include +#include #include "xxxRecord.h" -#include "epicsExport.h" +#include -static long init_record(dbCommon *prec) +/* Device Support Routines */ + +static long init_record(dbCommon *pcommon) { - struct xxxRecord *pxxx = (struct xxxRecord *) prec; + struct xxxRecord *prec = (struct xxxRecord *) pcommon; - if (recGblInitConstantLink(&pxxx->inp, DBF_DOUBLE, &pxxx->val)) - pxxx->udf = FALSE; + if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val)) + prec->udf = FALSE; return 0; } - -static long read_xxx(struct xxxRecord *pxxx) -{ - long status = dbGetLink(&(pxxx->inp), DBF_DOUBLE, &(pxxx->val), 0, 0); - /* If get was successful VAL is now defined */ +static long read_xxx(struct xxxRecord *prec) +{ + long status = dbGetLink(&prec->inp, DBF_DOUBLE, &prec->val, 0, 0); + + /* If get was successful VAL is now defined */ if (!status) - pxxx->udf = FALSE; + prec->udf = FALSE; return 0; } -/*Create the dset for devXxxSoft */ +/* devXxxSoft Device Entry Table */ xxxdset devXxxSoft = { - { 5, NULL, NULL, init_record, NULL }, + { 5, NULL /* report */, NULL /* init */, + init_record, NULL /* get_ioint_info */ }, read_xxx, }; epicsExportAddress(dset, devXxxSoft); + + +/* Driver Routines */ + +/* The report method is called by the iocsh command 'dbior'. + * Use level to show more or different information about + * the state of the driver software, connections etc. + */ +static long xxxReport(int level) { + printf("xxxDriver: Report called, level %d\n", level); + return 0; +} + +/* xxxDriver Entry Table */ +drvet xxxDriver = { + 2, + xxxReport, + NULL /* init, rarely used */ +}; +epicsExportAddress(drvet, xxxDriver); diff --git a/modules/database/src/template/top/exampleApp/src/xxxSupport.dbd b/modules/database/src/template/top/exampleApp/src/xxxSupport.dbd index dea0eebbf..78356bcf4 100644 --- a/modules/database/src/template/top/exampleApp/src/xxxSupport.dbd +++ b/modules/database/src/template/top/exampleApp/src/xxxSupport.dbd @@ -2,5 +2,7 @@ # # SPDX-License-Identifier: EPICS +driver(xxxDriver) + include "xxxRecord.dbd" device(xxx,CONSTANT,devXxxSoft,"Soft Channel") From ec0ae7d831f4a34518e176681eece4f765f1d786 Mon Sep 17 00:00:00 2001 From: Jacqueline Garrahan Date: Tue, 14 Jul 2026 15:22:30 -0700 Subject: [PATCH 069/141] errlog: fix out-of-bounds read when resizing the print buffer errlogBufResize copied the print buffer from &pvt.print->base (the address of the char* field inside the buffer_t struct) instead of pvt.print->base (the buffer it points to), reading bufSize bytes from an ~8-byte struct field. Drop the stray & so it reads the actual buffer, matching the adjacent log-buffer copy. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/libcom/src/error/errlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libcom/src/error/errlog.c b/modules/libcom/src/error/errlog.c index 6239f1921..4e7222952 100644 --- a/modules/libcom/src/error/errlog.c +++ b/modules/libcom/src/error/errlog.c @@ -638,7 +638,7 @@ void errlogBufResize(struct initArgs config) memcpy(logbuf, pvt.log->base, pvt.bufSize); pvt.log->base = logbuf; - memcpy(printbuf, &pvt.print->base, pvt.bufSize); + memcpy(printbuf, pvt.print->base, pvt.bufSize); pvt.print->base = printbuf; pvt.bufSize = config.bufsize; From 4a69f8f3395d14826545f2eed6fd2f05d892e795 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 16 Jul 2026 17:05:56 -0500 Subject: [PATCH 070/141] macOS: Drop the XCode -flat_namespace flag when possible (#897) Exactly when this flag was no longer required is unclear, see some discussion in the linked issue. Adds Release Notes entry. Fixes #895. --- configure/os/CONFIG.darwinCommon.darwinCommon | 4 +++- documentation/new-notes/PR-897.md | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 documentation/new-notes/PR-897.md diff --git a/configure/os/CONFIG.darwinCommon.darwinCommon b/configure/os/CONFIG.darwinCommon.darwinCommon index d6a7ff11a..643b4d80f 100644 --- a/configure/os/CONFIG.darwinCommon.darwinCommon +++ b/configure/os/CONFIG.darwinCommon.darwinCommon @@ -60,7 +60,9 @@ GNU = NO # # Darwin shared libraries # -SHRLIB_LDFLAGS = -dynamiclib -flat_namespace \ +FLAT_NAMESPACE = $(shell \ + test $(or $(CLANG_MAJOR),99) -lt 15 && echo -flat_namespace) +SHRLIB_LDFLAGS = -dynamiclib $(FLAT_NAMESPACE) \ -install_name $(abspath $(INSTALL_LIB))/$@ \ $(addprefix -compatibility_version , $(SHRLIB_VERSION)) \ $(addprefix -current_version , $(SHRLIB_VERSION)) diff --git a/documentation/new-notes/PR-897.md b/documentation/new-notes/PR-897.md new file mode 100644 index 000000000..886fa3d32 --- /dev/null +++ b/documentation/new-notes/PR-897.md @@ -0,0 +1,9 @@ +### macOS: Drop the `-flat_namespace` linker flag + +It's not clear when this flag was no longer required on macOS, we +tried dropping it +[in 2019](https://github.com/epics-base/epics-base/commit/cbb13bf6b170c6ba6660d594bdd9ca44a5bdaea5) +but had to [restore it](https://github.com/epics-base/epics-base/commit/8c3c5a9731887c6d8b1918394090564af38461b5). +XCode 15 seems a safe version though. See discussion in issue +[#895](https://github.com/epics-base/epics-base/issues/895) for +more details. From 848f121339294fbcfd51557161a7ed79c7018acf Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 25 Jun 2026 20:06:22 -0700 Subject: [PATCH 071/141] rsrv: USE_TYPED_DBEVENT --- modules/database/src/ioc/rsrv/camessage.c | 2 ++ modules/database/src/ioc/rsrv/server.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index 9a0b9a0e7..fd40f5ce0 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -17,6 +17,8 @@ * Ralph Lange */ +#define USE_TYPED_DBEVENT + #include #include #include diff --git a/modules/database/src/ioc/rsrv/server.h b/modules/database/src/ioc/rsrv/server.h index b674fe79c..5ddae8779 100644 --- a/modules/database/src/ioc/rsrv/server.h +++ b/modules/database/src/ioc/rsrv/server.h @@ -150,7 +150,7 @@ struct event_ext { ELLNODE node; caHdrLargeArray msg; struct channel_in_use *pciu; - struct event_block *pdbev; /* ptr to db event block */ + struct evSubscrip *pdbev; /* ptr to db event block */ unsigned size; /* for speed */ unsigned mask; char modified; /* mod & ev flw ctrl enbl */ From ef06b34ee463f17308e8c3c10b9032edc30a4ec1 Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Fri, 17 Jul 2026 01:32:18 +0900 Subject: [PATCH 072/141] selRecord: fix the precision reported for the A-L and LA-LL fields get_precision() walks pvalue and plvalue over the A-L and LA-LL fields, then compares paddr->pfield against &pvalue and &plvalue -- the addresses of the two local pointer variables, not of the fields they point at. Those are stack addresses, so neither test has ever matched and every A-L or LA-LL precision request falls through to recGblGetPrec(). The line just above gets it right: prec->val is a field and needs the &, whereas pvalue and plvalue are already pointers. Both tests date from e87551df24, the commit that added the loop, and have been dead ever since, so every release since R3.12 has this. They carried a (void *) cast until 6d85a36397 removed it, which is why the compiler was never shown a double ** to complain about. That the fields were meant to be covered is not in doubt: this record's get_graphic_double() and get_control_double() both name A-L and LA-LL. This changes what those fields report. recGblGetPrec() substitutes 15 for a DOUBLE precision outside 0 to 15, so today A-L and LA-LL answer 15 for a PREC of 17 while VAL answers 17. They now answer PREC unclamped, which is what VAL has always done. Add selTest, reading the precision of VAL, A, L, LA, LL and HIHI from a record with PREC=17. The four A-L and LA-LL cases report 15 before this fix; VAL and HIHI pin the two paths either side of them. --- modules/database/src/std/rec/selRecord.c | 4 +- modules/database/test/std/rec/Makefile | 7 +++ modules/database/test/std/rec/selTest.c | 68 ++++++++++++++++++++++++ modules/database/test/std/rec/selTest.db | 3 ++ 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 modules/database/test/std/rec/selTest.c create mode 100644 modules/database/test/std/rec/selTest.db diff --git a/modules/database/src/std/rec/selRecord.c b/modules/database/src/std/rec/selRecord.c index b173abe34..5125be1f3 100644 --- a/modules/database/src/std/rec/selRecord.c +++ b/modules/database/src/std/rec/selRecord.c @@ -156,8 +156,8 @@ static long get_precision(const DBADDR *paddr, long *precision) pvalue = &prec->a; plvalue = &prec->la; for(i=0; ipfield==&pvalue - || paddr->pfield==&plvalue){ + if(paddr->pfield==pvalue + || paddr->pfield==plvalue){ return(0); } } diff --git a/modules/database/test/std/rec/Makefile b/modules/database/test/std/rec/Makefile index 9debe231d..56a5d5030 100644 --- a/modules/database/test/std/rec/Makefile +++ b/modules/database/test/std/rec/Makefile @@ -93,6 +93,13 @@ testHarness_SRCS += seqTest.c TESTFILES += ../seqTest.db TESTS += seqTest +TESTPROD_HOST += selTest +selTest_SRCS += selTest.c +selTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp +testHarness_SRCS += selTest.c +TESTFILES += ../selTest.db +TESTS += selTest + TESTPROD_HOST += longoutTest longoutTest_SRCS += longoutTest.c longoutTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp diff --git a/modules/database/test/std/rec/selTest.c b/modules/database/test/std/rec/selTest.c new file mode 100644 index 000000000..f7011a4fa --- /dev/null +++ b/modules/database/test/std/rec/selTest.c @@ -0,0 +1,68 @@ +/*************************************************************************\ +* SPDX-License-Identifier: EPICS +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include "dbUnitTest.h" +#include "testMain.h" +#include "errlog.h" +#include "dbAccess.h" + +void recTestIoc_registerRecordDeviceDriver(struct dbBase *); + +static +void testPrecEqual(const char *pv, long expected){ + DBADDR addr; + struct { + DBRprecision + epicsFloat64 value; + } buf; + long options = DBR_PRECISION; + long nRequest = 1; + + if (dbNameToAddr(pv, &addr) || + dbGetField(&addr, DBR_DOUBLE, &buf, &options, &nRequest, NULL)) { + testFail("Can't read the precision of %s", pv); + return; + } + testOk(buf.precision.dp == expected, "%s precision (%ld) == %ld", + pv, buf.precision.dp, expected); +} + +/* + * PREC gives the precision of VAL and of the A-L and LA-LL fields. + * The remaining DOUBLE fields get theirs from recGblGetPrec(), which + * substitutes 15 for a PREC outside the range it can print. + * */ +static +void testSelPrecision(void){ + testPrecEqual("sel0.VAL", 17); + testPrecEqual("sel0.A", 17); + testPrecEqual("sel0.L", 17); + testPrecEqual("sel0.LA", 17); + testPrecEqual("sel0.LL", 17); + testPrecEqual("sel0.HIHI", 15); +} + +MAIN(selTest) { + testPlan(6); + + testdbPrepare(); + + testdbReadDatabase("recTestIoc.dbd", NULL, NULL); + recTestIoc_registerRecordDeviceDriver(pdbbase); + + testdbReadDatabase("selTest.db", NULL, NULL); + + eltc(0); + testIocInitOk(); + eltc(1); + + testSelPrecision(); + + testIocShutdownOk(); + testdbCleanup(); + + return testDone(); +} diff --git a/modules/database/test/std/rec/selTest.db b/modules/database/test/std/rec/selTest.db new file mode 100644 index 000000000..4d143d8fd --- /dev/null +++ b/modules/database/test/std/rec/selTest.db @@ -0,0 +1,3 @@ +record(sel, "sel0"){ + field(PREC, "17") +} From 00173ac03c2b9a79aff97b8ac77f8ab9fdfa8d73 Mon Sep 17 00:00:00 2001 From: Jacqueline Garrahan Date: Tue, 14 Jul 2026 15:26:18 -0700 Subject: [PATCH 073/141] dbJLink: fix assignment-instead-of-compare in dbJLinkMapAll The guard used recname[0] = '\0' (assignment) instead of == , which wrote a NUL into the caller's string, truncating it to "", and evaluated to 0 so recname was left non-NULL pointing at "". Every record then failed the name comparison and nothing was mapped. Use ==, matching dbjlr. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/database/src/ioc/db/dbJLink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/db/dbJLink.c b/modules/database/src/ioc/db/dbJLink.c index d3aacf060..c710d5002 100644 --- a/modules/database/src/ioc/db/dbJLink.c +++ b/modules/database/src/ioc/db/dbJLink.c @@ -551,7 +551,7 @@ long dbJLinkMapAll(char *recname, jlink_map_fn rtn, void *ctx) DBENTRY * const pdbentry = &dbentry; long status; - if (recname && (recname[0] = '\0' || !strcmp(recname, "*"))) + if (recname && (recname[0] == '\0' || !strcmp(recname, "*"))) recname = NULL; dbInitEntry(pdbbase, pdbentry); From b03213ea7ae77b746fd09043d0dad0ec50ea1e37 Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Fri, 17 Jul 2026 00:12:32 +0900 Subject: [PATCH 074/141] seqRecord: fix upper display limit of the DLYn fields get_graphic_double() assigns lower_disp_limit twice and never writes upper_disp_limit, so a DBR_GR_DOUBLE read of any DLYn field reports the inverted range lower=10, upper=0. The second assignment was evidently meant for the upper limit; the 0 in the upper slot is the zeroed buffer dbAccess.c hands to the RSET, not a chosen value. Both assignments date from commit 27e80be2e5 which introduced the DLYn limits, so every release since 3.14.11 reports the inverted range over both CA (DBR_GR/CTRL) and PVA (display.limitLow/High). Extend seqTest with a DBR_GR_DOUBLE read of DLY0; the new cases fail with lower=10, upper=0 before this fix. --- modules/database/src/std/rec/seqRecord.c | 2 +- modules/database/test/std/rec/seqTest.c | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/modules/database/src/std/rec/seqRecord.c b/modules/database/src/std/rec/seqRecord.c index 44d8599c4..d0160677e 100644 --- a/modules/database/src/std/rec/seqRecord.c +++ b/modules/database/src/std/rec/seqRecord.c @@ -327,7 +327,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd) switch (fieldOffset & 3) { case 0: /* DLYn */ pgd->lower_disp_limit = 0.0; - pgd->lower_disp_limit = 10.0; + pgd->upper_disp_limit = 10.0; return 0; case 2: /* DOn */ dbGetGraphicLimits(get_dol(prec, fieldOffset), diff --git a/modules/database/test/std/rec/seqTest.c b/modules/database/test/std/rec/seqTest.c index 1febda78a..5c0dfa994 100644 --- a/modules/database/test/std/rec/seqTest.c +++ b/modules/database/test/std/rec/seqTest.c @@ -13,6 +13,27 @@ void recTestIoc_registerRecordDeviceDriver(struct dbBase *); +/* + * The DLYn fields advertise a display range of 0 to 10 seconds + * */ +static +void testSeqDlyLimits(void){ + DBADDR addr; + struct { + DBRgrDouble + epicsFloat64 value; + } buf; + long options = DBR_GR_DOUBLE; + long nRequest = 1; + + testOk1(!dbNameToAddr("seq0.DLY0", &addr)); + testOk1(!dbGetField(&addr, DBR_DOUBLE, &buf, &options, &nRequest, NULL)); + testOk(buf.lower_disp_limit == 0.0, + "DLY0 lower_disp_limit (%g) == 0", buf.lower_disp_limit); + testOk(buf.upper_disp_limit == 10.0, + "DLY0 upper_disp_limit (%g) == 10", buf.upper_disp_limit); +} + /* * This test verifies the behavior of seq using Specified for SELM * The behavior should be the same for all the DOLx @@ -34,7 +55,7 @@ void testSeqSpecified(void){ MAIN(eventTest) { - testPlan(4*16); + testPlan(4*16 + 4); testdbPrepare(); @@ -47,6 +68,7 @@ MAIN(eventTest) { testIocInitOk(); eltc(1); + testSeqDlyLimits(); testSeqSpecified(); testIocShutdownOk(); From 9cd87f21aa5340889b7cd632ff6d462e6525b6b8 Mon Sep 17 00:00:00 2001 From: Jacqueline Garrahan Date: Tue, 14 Jul 2026 15:24:00 -0700 Subject: [PATCH 075/141] dbConvert: fix UInt64->String conversion truncating to 32 bits putUInt64String used cvtUlongToString, which is cvtUInt32ToString, so the 64-bit source was narrowed to its low 32 bits (e.g. 0x1_0000_0007 printed as "7"). Use cvtUInt64ToString, matching getUInt64String and every other width-specific putXxxString. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/database/src/ioc/db/dbConvert.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/database/src/ioc/db/dbConvert.c b/modules/database/src/ioc/db/dbConvert.c index 2592c90fc..eeccb3635 100644 --- a/modules/database/src/ioc/db/dbConvert.c +++ b/modules/database/src/ioc/db/dbConvert.c @@ -1528,12 +1528,12 @@ static long putUInt64String(dbAddr *paddr, if (nRequest==1 && offset==0) { - cvtUlongToString(*psrc, pdst); + cvtUInt64ToString(*psrc, pdst); return 0; } pdst += (size*offset); while (nRequest--) { - cvtUlongToString(*psrc, pdst); + cvtUInt64ToString(*psrc, pdst); psrc++; if (++offset == no_elements) pdst = (char *) paddr->pfield; From 50f4eaa9c0da28a1dd7a2a72a12d29ae190ce992 Mon Sep 17 00:00:00 2001 From: Jacqueline Garrahan Date: Tue, 14 Jul 2026 15:23:08 -0700 Subject: [PATCH 076/141] iocsh: fix inverted parse test in 'on error wait ' epicsParseDouble returns 0 on success and non-zero on failure, but the branches were swapped: a valid delay printed "Invalid 'on error wait' delay" and the usage text, while an invalid delay was silently accepted with timeout forced to 5.0. Report the error on parse failure and accept the value on success. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/libcom/src/iocsh/iocsh.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index 3182a57b2..1af03c041 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -1559,13 +1559,14 @@ static void onCallFunc(const iocshArgBuf *args) USAGE(); } else if (epicsParseDouble(args->aval.av[3], &context->scope->timeout, NULL)) { - context->scope->timeout = 5.0; - } else { + /* epicsParseDouble returns non-zero on failure */ USAGE(); fprintf(epicsGetStderr(), ANSI_RED("Invalid 'on error wait' delay '%s'.") "\n", args->aval.av[3]); + context->scope->timeout = 5.0; } + /* else parse succeeded and timeout has been set */ } else { USAGE(); From 7dc46f21682316c8b2cd68c2d972c52b4830a8e6 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 20 Jul 2026 10:36:58 -0500 Subject: [PATCH 077/141] caget missing NULL check --- modules/ca/src/tools/caget.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/ca/src/tools/caget.c b/modules/ca/src/tools/caget.c index 82a276592..0d5c1d3e0 100644 --- a/modules/ca/src/tools/caget.c +++ b/modules/ca/src/tools/caget.c @@ -126,10 +126,15 @@ static void event_handler (evargs args) ppv->status = args.status; if (args.status == ECA_NORMAL) { + epicsUInt32 nBytes = dbr_size_n(args.type, args.count); ppv->dbrType = args.type; - ppv->value = calloc(1, dbr_size_n(args.type, args.count)); - memcpy(ppv->value, args.dbr, dbr_size_n(args.type, args.count)); - ppv->nElems = args.count; + ppv->value = calloc(1, nBytes); + if (ppv->value) { + memcpy(ppv->value, args.dbr, nBytes); + ppv->nElems = args.count; + } else { + ppv->status = ECA_ALLOCMEM; + } nRead++; } } From ae029e46a5e732dcb7d43a72b1fb158dc4215970 Mon Sep 17 00:00:00 2001 From: Jacqueline Garrahan Date: Tue, 14 Jul 2026 15:20:36 -0700 Subject: [PATCH 078/141] printfRecord: fix one-byte VAL overflow in %ls conversion In the long-string (%ls) branch dbGetLink(DBR_CHAR) / dbLoadLinkLS can leave n at vspace+1, so pval[n] = 0 writes at pval[vspace+1], one byte past the sizv-byte VAL buffer (pval + vspace + 1 == prec->val + sizv). Clamp n to vspace immediately before writing the terminator. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/database/src/std/rec/printfRecord.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/database/src/std/rec/printfRecord.c b/modules/database/src/std/rec/printfRecord.c index 64cf7b291..c09b460ba 100644 --- a/modules/database/src/std/rec/printfRecord.c +++ b/modules/database/src/std/rec/printfRecord.c @@ -250,6 +250,8 @@ static void doPrintf(printfRecord *prec) int padding; /* Terminate string and measure its length */ + if (n > vspace) + n = vspace; pval[n] = 0; added = strlen(pval); padding = width - added; From a8180003e9bdde7edc394725913bf8f1cd23d864 Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Sun, 19 Jul 2026 17:36:31 +0900 Subject: [PATCH 079/141] cac: reject a non-positive or non-finite EPICS_CA_CONN_TMO A successful parse of EPICS_CA_CONN_TMO stored the value into connTMO unchecked, so EPICS_CA_CONN_TMO=-5 or =0 left the connection-verify watchdog deadline permanently in the past. The watchdog then fires continuously, flooding stderr with "Virtual circuit unresponsive" and pinning a CPU while updates still arrive. NaN and inf (which epicsScanDouble also accepts) slip past any ordering comparison: a NaN period leaves the watchdog deadline arithmetic undefined, and an infinite period silently disables circuit verification. Fold the validity check into the existing parse-failure branch, so an unparsable, non-finite, or non-positive value takes the same path: warn once and fall back to the 30 s CA_CONN_VERIFY_PERIOD default. This mirrors the sibling EPICS_CA_MAX_ARRAY_BYTES handling a few lines below, which already gates a parse failure and an out-of-range value in one condition, and matches the finite() gate on EPICS_CA_MAX_SEARCH_PERIOD in udpiiu.cpp. --- modules/ca/src/client/cac.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ca/src/client/cac.cpp b/modules/ca/src/client/cac.cpp index 13ef7514c..7b059a6f5 100644 --- a/modules/ca/src/client/cac.cpp +++ b/modules/ca/src/client/cac.cpp @@ -33,6 +33,7 @@ #include "epicsSignal.h" #include "envDefs.h" #include "locationException.h" +#include "epicsMath.h" #include "errlog.h" #include "epicsExport.h" @@ -186,10 +187,10 @@ cac::cac ( static_cast (CA_SERVER_PORT) ); status = envGetDoubleConfigParam ( &EPICS_CA_CONN_TMO, &this->connTMO ); - if ( status ) { + if ( status || ! finite ( this->connTMO ) || this->connTMO <= 0.0 ) { this->connTMO = CA_CONN_VERIFY_PERIOD; epicsGuard < epicsMutex > cbGuard ( this->cbMutex ); - errlogPrintf ( "EPICS \"%s\" double fetch failed\n", EPICS_CA_CONN_TMO.name ); + errlogPrintf ( "EPICS \"%s\" was not a positive real number\n", EPICS_CA_CONN_TMO.name ); errlogPrintf ( "Defaulting \"%s\" = %f\n", EPICS_CA_CONN_TMO.name, this->connTMO ); } From ce775a80cfac9c24b69353762a6e84d62dd99e6d Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Sun, 19 Jul 2026 17:38:55 +0900 Subject: [PATCH 080/141] udpiiu: reject a non-finite or non-positive EPICS_CA_MAX_SEARCH_PERIOD epicsScanDouble accepts "inf" and "nan", so envGetDoubleConfigParam returns success for them and the parsed value flows into getMaxPeriod's only range gate, maxPeriod < maxSearchPeriodLowerLimit. That comparison is false for both inf and NaN, so a non-finite period reaches getNTimers(), whose static_cast of 1 + log(maxPeriod/...)/log2 is an undefined float->unsigned conversion: inf aborts the client in malloc via a garbage nTimers allocation, and NaN drives the search-timer wheel off a NaN period where every deadline comparison is false. Gate the parsed value on finite() (from epicsMath.h) and positivity alongside the parse status, and fall back to the default period. A non-positive period is not a "low" period to be clamped up to the 60 s lower limit; it takes the same invalid-input path as inf/NaN. getMaxPeriod() is getNTimers()'s only caller, so this makes the conversion finite and positive by construction. --- modules/ca/src/client/udpiiu.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/ca/src/client/udpiiu.cpp b/modules/ca/src/client/udpiiu.cpp index e2c7a43f2..56f8592ba 100644 --- a/modules/ca/src/client/udpiiu.cpp +++ b/modules/ca/src/client/udpiiu.cpp @@ -30,6 +30,7 @@ #include "osiProcess.h" #include "osiWireFormat.h" #include "epicsAlgorithm.h" +#include "epicsMath.h" #include "errlog.h" #include "locationException.h" @@ -73,7 +74,7 @@ double getMaxPeriod() if ( envGetConfigParamPtr ( & EPICS_CA_MAX_SEARCH_PERIOD ) ) { long longStatus = envGetDoubleConfigParam ( & EPICS_CA_MAX_SEARCH_PERIOD, & maxPeriod ); - if ( ! longStatus ) { + if ( ! longStatus && finite ( maxPeriod ) && maxPeriod > 0.0 ) { if ( maxPeriod < maxSearchPeriodLowerLimit ) { epicsPrintf ( "\"%s\" out of range (low)\n", EPICS_CA_MAX_SEARCH_PERIOD.name ); @@ -83,7 +84,9 @@ double getMaxPeriod() } } else { - epicsPrintf ( "EPICS \"%s\" wasn't a real number\n", + /* Reset to default on parse error or out of range value */ + maxPeriod = maxSearchPeriodDefault; + epicsPrintf ( "EPICS \"%s\" was not a positive real number\n", EPICS_CA_MAX_SEARCH_PERIOD.name ); epicsPrintf ( "Setting \"%s\" = %f seconds\n", EPICS_CA_MAX_SEARCH_PERIOD.name, maxPeriod ); From 2ab1bb14c54f9125d79eb1ea40b9f1ffa10057ff Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Sun, 19 Jul 2026 17:54:51 +0900 Subject: [PATCH 081/141] calcRecord: drop unhandled special(SPC_MOD) from INPM..INPU INPM..INPU each declared special(SPC_MOD), but calcRecord's special() only implements SPC_CALC and returns S_db_badChoice for anything else. Every dbPutField/caput to one of those nine link fields therefore ran special(after=TRUE), hit the fall-through, and failed with S_db_badChoice ("bad special value") -- nine documented input links were unwritable at run time. The twelve sibling links INPA..INPL carry no special and accept writes, and calcRecord (unlike calcoutRecord) does no run-time link re-initialization, so there is no handler for SPC_MOD to reach. Remove the erroneous attribute from the nine fields so they match INPA..INPL; special() then runs only for CALC, which is the only field that still carries a special. --- modules/database/src/std/rec/calcRecord.dbd.pod | 9 --------- 1 file changed, 9 deletions(-) diff --git a/modules/database/src/std/rec/calcRecord.dbd.pod b/modules/database/src/std/rec/calcRecord.dbd.pod index 886345b65..d1e77b6c1 100644 --- a/modules/database/src/std/rec/calcRecord.dbd.pod +++ b/modules/database/src/std/rec/calcRecord.dbd.pod @@ -636,55 +636,46 @@ manner for the VAL field. } field(INPM,DBF_INLINK) { prompt("Input M") - special(SPC_MOD) promptgroup("43 - Input M-R") interest(1) } field(INPN,DBF_INLINK) { prompt("Input N") - special(SPC_MOD) promptgroup("43 - Input M-R") interest(1) } field(INPO,DBF_INLINK) { prompt("Input O") - special(SPC_MOD) promptgroup("43 - Input M-R") interest(1) } field(INPP,DBF_INLINK) { prompt("Input P") - special(SPC_MOD) promptgroup("43 - Input M-R") interest(1) } field(INPQ,DBF_INLINK) { prompt("Input Q") - special(SPC_MOD) promptgroup("43 - Input M-R") interest(1) } field(INPR,DBF_INLINK) { prompt("Input R") - special(SPC_MOD) promptgroup("43 - Input M-R") interest(1) } field(INPS,DBF_INLINK) { prompt("Input S") - special(SPC_MOD) promptgroup("44 - Input S-U") interest(1) } field(INPT,DBF_INLINK) { prompt("Input T") - special(SPC_MOD) promptgroup("44 - Input S-U") interest(1) } field(INPU,DBF_INLINK) { prompt("Input U") - special(SPC_MOD) promptgroup("44 - Input S-U") interest(1) } From 484eab57c9c93585a78bfa6c0e6514affb4053c6 Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Tue, 21 Jul 2026 08:26:20 +0900 Subject: [PATCH 082/141] rsrv: reject a non-finite beacon period The beacon-period gate in online_notify already rejected a parse failure and a non-positive value, but epicsScanDouble parses "nan" and "inf", and maxPeriod<=0.0 is false for both, so a non-finite period reached the beacon delay loop. A NaN maxdelay makes delay Date: Tue, 14 Jul 2026 15:19:32 -0700 Subject: [PATCH 083/141] histogramRecord: fix heap OOB write when SGNL approaches ULIM The bin-search loop in add_count() assumes nelm*wdth == ulim-llim, but wdth is a rounded quotient so nelm*wdth can be strictly less than ulim-llim. A SGNL value just below ULIM then leaves the loop with i == nelm+1, and pdest = bptr + nelm writes one epicsUInt32 past the nelm-element buffer. This is reachable over Channel Access by putting a value near ULIM to the SGNL field (special SPC_MOD). Clamp the index to nelm. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/database/src/std/rec/histogramRecord.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/database/src/std/rec/histogramRecord.c b/modules/database/src/std/rec/histogramRecord.c index 18ae57d12..6418e10ba 100644 --- a/modules/database/src/std/rec/histogramRecord.c +++ b/modules/database/src/std/rec/histogramRecord.c @@ -338,7 +338,8 @@ static long add_count(histogramRecord *prec) return 0; temp = prec->sgnl - prec->llim; - for (i = 1; i <= prec->nelm; i++){ + /* stop at nelm-1 so a rounded wdth can't push i past the last bin */ + for (i = 1; i < prec->nelm; i++){ if (temp <= (double) i * prec->wdth) break; } From 1732c7dbd7828bda8d1619c0105afd23aeafe60c Mon Sep 17 00:00:00 2001 From: Jacqueline Garrahan Date: Tue, 14 Jul 2026 15:21:04 -0700 Subject: [PATCH 084/141] epicsRingBytes: fix reversed operands in ResetHighWaterMark The used-bytes count is nextPut - nextGet everywhere else in this file (epicsRingBytesPut, epicsRingBytesUsedBytes), but epicsRingBytesResetHighWaterMark computed nextGet - nextPut. For a ring holding u bytes it therefore stored size-u; since Put only raises the mark, the high-water mark stayed permanently inflated and wrong. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/libcom/src/ring/epicsRingBytes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libcom/src/ring/epicsRingBytes.c b/modules/libcom/src/ring/epicsRingBytes.c index 2164ebed4..eb02e085a 100644 --- a/modules/libcom/src/ring/epicsRingBytes.c +++ b/modules/libcom/src/ring/epicsRingBytes.c @@ -244,7 +244,7 @@ LIBCOM_API void epicsStdCall epicsRingBytesResetHighWaterMark(epicsRingBytesId i ringPvt *pring = (ringPvt *)id; int used; if (pring->lock) epicsSpinLock(pring->lock); - used = pring->nextGet - pring->nextPut; + used = pring->nextPut - pring->nextGet; if (used < 0) used += pring->size; pring->highWaterMark = used; if (pring->lock) epicsSpinUnlock(pring->lock); From c411030f737ea49c3b11925b27eedeba8844e376 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 15 Jul 2026 18:57:51 -0500 Subject: [PATCH 085/141] Add better tests of the ResetHighWaterMark API --- modules/libcom/test/ringBytesTest.c | 18 +++++++++++++++++- modules/libcom/test/ringPointerTest.c | 16 +++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/modules/libcom/test/ringBytesTest.c b/modules/libcom/test/ringBytesTest.c index c81e466ac..5bd730567 100644 --- a/modules/libcom/test/ringBytesTest.c +++ b/modules/libcom/test/ringBytesTest.c @@ -60,7 +60,7 @@ MAIN(ringBytesTest) char get[RINGSIZE+1]; epicsRingBytesId ring; - testPlan(292); + testPlan(314); pinfo = calloc(1,sizeof(info)); if (!pinfo) { @@ -99,6 +99,8 @@ MAIN(ringBytesTest) n = epicsRingBytesPut(ring, put+RINGSIZE, 1); testOk(n==0, "put to full ring"); check(ring, 0, RINGSIZE); + epicsRingBytesResetHighWaterMark(ring); + check(ring, 0, RINGSIZE); for(i = 0 ; i < RINGSIZE ; i++) { n = epicsRingBytesGet(ring, get+i, 1); testOk(n==1, "ring get 1, %d", i); @@ -124,6 +126,20 @@ MAIN(ringBytesTest) testOk(n==1, "ring get %d", 1); check(ring, RINGSIZE, 1); + /* Reset must lower a grown mark to the current non-zero usage. + * Fill the ring (mark -> RINGSIZE), drain half so usage < mark, + * then reset and confirm the mark drops to the half that remains. + */ + epicsRingBytesResetHighWaterMark(ring); + n = epicsRingBytesPut(ring, put, RINGSIZE); + testOk(n==RINGSIZE, "ring put %d", RINGSIZE); + check(ring, 0, RINGSIZE); + n = epicsRingBytesGet(ring, get, RINGSIZE/2); + testOk(n==RINGSIZE/2, "ring get %d", RINGSIZE/2); + check(ring, RINGSIZE/2, RINGSIZE); + epicsRingBytesResetHighWaterMark(ring); + check(ring, RINGSIZE/2, RINGSIZE/2); + epicsRingBytesDelete(ring); epicsEventDestroy(consumerEvent); free(pinfo); diff --git a/modules/libcom/test/ringPointerTest.c b/modules/libcom/test/ringPointerTest.c index 987a881fd..077eae034 100644 --- a/modules/libcom/test/ringPointerTest.c +++ b/modules/libcom/test/ringPointerTest.c @@ -117,6 +117,20 @@ static void testSingle(void) testOk1(epicsRingPointerGetUsed(ring)==0); testOk1(epicsRingPointerGetHighWaterMark(ring)==rsize); + testDiag("Reset lowers a grown mark to the current non-zero usage"); + /* Mark is still rsize from the fill above; push half so that + * usage < mark, then reset and confirm the mark drops to usage + * (not to zero, not left unchanged, not the reversed complement). + */ + for(i=0; i 0. * Start a new thread since main() is a "non-epics" From 57903120d3520ffae7af0e6e9885751a16c262ea Mon Sep 17 00:00:00 2001 From: Jacqueline Garrahan Date: Tue, 14 Jul 2026 15:24:34 -0700 Subject: [PATCH 086/141] dbStaticLib: fix dbGetStringNum reading UINT64 through a 32-bit pointer The DBF_UINT64 case dereferenced the 8-byte field as *(epicsUInt32 *), reading only its low 32 bits, so large UINT64 values printed wrong (e.g. 0x1_0000_0000 as "0") and save/restore round-tripping broke. Cast to epicsUInt64*, matching the adjacent DBF_INT64 case. Co-Authored-By: Claude Opus 4.8 (1M context) --- modules/database/src/ioc/dbStatic/dbStaticLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/database/src/ioc/dbStatic/dbStaticLib.c b/modules/database/src/ioc/dbStatic/dbStaticLib.c index c6bf1c1ff..73d627a78 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticLib.c +++ b/modules/database/src/ioc/dbStatic/dbStaticLib.c @@ -2118,9 +2118,9 @@ char *dbGetStringNum(DBENTRY *pdbentry) break; case DBF_UINT64: if (cvttype==CT_DECIMAL) - cvtUInt64ToString(*(epicsUInt32 *) pfield, message); + cvtUInt64ToString(*(epicsUInt64 *) pfield, message); else - cvtUInt64ToHexString(*(epicsUInt32 *) pfield, message); + cvtUInt64ToHexString(*(epicsUInt64 *) pfield, message); break; case DBF_FLOAT: floatToString(*(epicsFloat32 *) pfield, message); From 93b4598dcdb38b8a5501b3a366c44c15d26799f2 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Wed, 22 Jul 2026 17:45:45 +0200 Subject: [PATCH 087/141] Add a SECURITY.md file (fixes #898) --- SECURITY.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..6b6f7e54f --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,49 @@ +# Security Policy + +## Supported Versions + +Security updates and patches are typically applied +to the latest active release series of EPICS Base. +Older, end-of-life release series +do not receive security backports +unless specifically maintained by community contributions. + +| Version | Supported | +| ------- | ------------------ | +| 7.0.x | :white_check_mark: | +| 3.15.x | :white_check_mark: | +| < 3.15 | :x: | + +--- + +## Reporting a Vulnerability + +**Please do not report security vulnerabilities +through public GitHub issues, discussions, pull requests, +or by using EPICS mailing lists.** + +If you discover a security vulnerability within EPICS Base, +please report it privately first, +so that it can be addressed responsibly before public disclosure: + +- **Primary Method:** + Please file a **Private Security** report or issue + via the project's tracking systems + or reach out directly to the EPICS Core developers via the + [EPICS Security email address](mailto:security@epics-controls.org) + or core development contacts. +- **Details to Include:** + - A description of the vulnerability and its potential impact. + - Step-by-step instructions + or proof-of-concept code to reproduce the issue. + - The specific version(s) of EPICS Base affected. +- **AI-Generated Reports:** + - Please double-check findings for hallucinations + before reporting them. + - With the wide availability of AI-based tools, + we will treat many of those reports as public bugs. + However, we still prefer the first report to be private. + +You can expect an acknowledgment of your report, +followed by coordination +on a timeline for investigation and public patching. From c6ad5614c6e263e2e545dbe011e1e2f7b28d4cd6 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Jun 2026 11:31:06 -0700 Subject: [PATCH 088/141] rsrv: old TCP client tar pit A short message could underflow, leaving a too old client stuck in a tar pit. An acceptable outcome, but not intended. Instead, send back errors to each message. --- modules/database/src/ioc/rsrv/camessage.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index fd40f5ce0..736c39303 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -2437,9 +2437,15 @@ int camessage ( struct client *client ) SEND_UNLOCK(client); log_header ( "CAS: Client version too old", client, &msg, 0, nmsg ); - client->recvBytesToDrain = msgsize - bytes_left; - client->recv.stk = client->recv.cnt; - status = RSRV_OK; + if (msgsize >= bytes_left) { + client->recvBytesToDrain = msgsize - bytes_left; + client->recv.stk = client->recv.cnt; + status = RSRV_OK; + break; + } else { // msgsize < bytes_left + client->recv.stk += msgsize; + continue; + } } else { /* silently ignore UDP from old clients */ status = RSRV_ERROR; From 7ea5602bc6d504a9d78c0849df5cbd27b9fca824 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Jun 2026 11:56:47 -0700 Subject: [PATCH 089/141] rsrv: catch overflow of extended message size Treat as corruption, and ignore/close --- modules/database/src/ioc/rsrv/camessage.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index 736c39303..e399c5f21 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -2417,6 +2417,14 @@ int camessage ( struct client *client ) } msg.m_postsize = ntohl ( pLW[0] ); msg.m_count = ntohl ( pLW[1] ); + if (msg.m_postsize >= 0xffffffff - (sizeof(*mp) + 2 * sizeof ( *pLW ))) { + if(CASDEBUG>0) { + errlogPrintf("Client ext msg size too large 0x%08x\n", + (unsigned)msg.m_postsize); + } + status = RSRV_ERROR; + break; + } msgsize = msg.m_postsize + sizeof(*mp) + 2 * sizeof ( *pLW ); pBody = pLW + 2; } From 5eaa984c0ce2ed818e5721262aa6734a285a2841 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Jun 2026 15:19:19 -0700 Subject: [PATCH 090/141] rsrv: prevent use of CID between clients In this context "CID" means Channel ID, in this case meaning the server assigned identifier. While in other contexts this is called SID (Server ID), to distinguish from the Client ID (also CID :( ) --- modules/database/src/ioc/rsrv/camessage.c | 32 ++++++++++++++--------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index e399c5f21..97bdbc517 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -119,13 +119,21 @@ static void *casCalloc(size_t count, size_t size) * * used to be a macro */ -static struct channel_in_use *MPTOPCIU (const caHdrLargeArray *mp) +static struct channel_in_use *MPTOPCIU (const caHdrLargeArray *mp, + struct client *client) { struct channel_in_use *pciu; const unsigned id = mp->m_cid; LOCK_CLIENTQ; pciu = bucketLookupItemUnsignedId (pCaBucket, &id); + + if (pciu && pciu->client != client) { + /* reject attempt to use server assigned ID from another client + */ + pciu = NULL; + } + UNLOCK_CLIENTQ; return pciu; @@ -161,7 +169,7 @@ va_list args case CA_PROTO_READ_NOTIFY: case CA_PROTO_WRITE: case CA_PROTO_WRITE_NOTIFY: - pciu = MPTOPCIU(curp); + pciu = MPTOPCIU(curp, client); if(pciu){ cid = pciu->cid; } @@ -284,7 +292,7 @@ static void log_header ( ipAddrToDottedIP (&client->addr, hostName, sizeof(hostName)); - pciu = MPTOPCIU(mp); + pciu = MPTOPCIU(mp, client); if (pContext) { epicsPrintf ("CAS: request from %s => %s\n", @@ -600,7 +608,7 @@ static void read_reply ( void *pArg, struct dbChannel *dbch, */ static int read_action ( caHdrLargeArray *mp, void *pPayloadIn, struct client *pClient ) { - struct channel_in_use *pciu = MPTOPCIU ( mp ); + struct channel_in_use *pciu = MPTOPCIU ( mp, pClient ); int readAccess; ca_uint32_t payloadSize; void *pPayload; @@ -698,7 +706,7 @@ static int read_notify_action ( caHdrLargeArray *mp, void *pPayload, struct clie return RSRV_ERROR; } - pciu = MPTOPCIU ( mp ); + pciu = MPTOPCIU ( mp, client ); if ( !pciu ) { logBadId ( client, mp, pPayload ); return RSRV_ERROR; @@ -734,7 +742,7 @@ static int write_action ( caHdrLargeArray *mp, long dbStatus; void *asWritePvt; - pciu = MPTOPCIU(mp); + pciu = MPTOPCIU(mp, client); if(!pciu){ logBadId(client, mp, pPayload); return RSRV_ERROR; @@ -1640,7 +1648,7 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, int status; struct channel_in_use *pciu; - pciu = MPTOPCIU(mp); + pciu = MPTOPCIU(mp, client); if(!pciu){ logBadId ( client, mp, pPayload ); return RSRV_ERROR; @@ -1772,7 +1780,7 @@ static int event_add_action (caHdrLargeArray *mp, void *pPayload, struct client return RSRV_ERROR; } - pciu = MPTOPCIU ( mp ); + pciu = MPTOPCIU ( mp, client ); if ( ! pciu ) { logBadId ( client, mp, pPayload ); return RSRV_ERROR; @@ -1882,8 +1890,8 @@ static int clear_channel_reply ( caHdrLargeArray *mp, * Verify the channel * */ - pciu = MPTOPCIU(mp); - if(pciu?pciu->client!=client:TRUE){ + pciu = MPTOPCIU(mp, client); + if(!pciu){ logBadId ( client, mp, pPayload ); return RSRV_ERROR; } @@ -1991,8 +1999,8 @@ static int event_cancel_reply ( caHdrLargeArray *mp, void *pPayload, struct clie * Verify the channel * */ - pciu = MPTOPCIU(mp); - if (pciu?pciu->client!=client:TRUE) { + pciu = MPTOPCIU(mp, client); + if (!pciu) { logBadId ( client, mp, pPayload ); return RSRV_ERROR; } From 28d540638538ddc5fb0803f3ecb554f0efff5dc9 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 25 Jun 2026 07:51:43 -0700 Subject: [PATCH 091/141] rsrv: clarify bucketID locking Make clear that bucketID is guarded by clientQlock --- modules/database/src/ioc/rsrv/camessage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index 97bdbc517..ee04d907f 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -972,7 +972,6 @@ struct dbChannel *dbch, unsigned cid ) { - static unsigned bucketID; unsigned *pCID; struct channel_in_use *pchannel; int status; @@ -1005,6 +1004,7 @@ unsigned cid LOCK_CLIENTQ; do { + static unsigned bucketID; /* * bypass read only warning */ From 4128a7c078a313c98608618cda3723ff8749d60b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 Jun 2026 08:00:48 -0700 Subject: [PATCH 092/141] rsrv: cross-check m_count message field with payload buffer length Bounds check m_count / element count against dbChannel. For write_notify_action only. Bounds check DBR data size against received payload buffer length For write_action, add pre-test with dbr_size_n() before caNetConvert() --- modules/database/src/ioc/rsrv/camessage.c | 37 +++++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index ee04d907f..37f723eee 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -628,6 +628,9 @@ static int read_action ( caHdrLargeArray *mp, void *pPayloadIn, struct client *p SEND_UNLOCK ( pClient ); return RSRV_ERROR; } + if (mp->m_count > dbChannelFinalElements(pciu->dbch)) { + mp->m_count = dbChannelFinalElements(pciu->dbch); + } payloadSize = dbr_size_n ( mp->m_dataType, mp->m_count ); status = cas_copy_in_header ( pClient, mp->m_cmmd, payloadSize, @@ -712,6 +715,10 @@ static int read_notify_action ( caHdrLargeArray *mp, void *pPayload, struct clie return RSRV_ERROR; } + if (mp->m_count > dbChannelFinalElements(pciu->dbch)) { + mp->m_count = dbChannelFinalElements(pciu->dbch); + } + evext.msg = *mp; evext.pciu = pciu; evext.pdbev = NULL; @@ -741,6 +748,7 @@ static int write_action ( caHdrLargeArray *mp, int status; long dbStatus; void *asWritePvt; + unsigned size; pciu = MPTOPCIU(mp, client); if(!pciu){ @@ -748,6 +756,19 @@ static int write_action ( caHdrLargeArray *mp, return RSRV_ERROR; } + if (INVALID_DB_REQ(mp->m_dataType)) { + log_header ("bad put data type", client, mp, pPayload, 0); + return RSRV_ERROR; + } + if (mp->m_count > dbChannelFinalElements(pciu->dbch)) { + mp->m_count = dbChannelFinalElements(pciu->dbch); + } + + size = dbr_size_n (mp->m_dataType, mp->m_count); + if (size > mp->m_postsize) { + return RSRV_ERROR; + } + if(!rsrvCheckPut(pciu)){ status = ECA_NOWTACCESS; SEND_LOCK(client); @@ -1654,11 +1675,14 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, return RSRV_ERROR; } - if (mp->m_dataType > LAST_BUFFER_TYPE) { + if (INVALID_DB_REQ(mp->m_dataType)) { log_header ("bad put notify data type", client, mp, pPayload, 0); putNotifyErrorReply (client, mp, ECA_BADTYPE); return RSRV_ERROR; } + if (mp->m_count > dbChannelFinalElements(pciu->dbch)) { + mp->m_count = dbChannelFinalElements(pciu->dbch); + } if(!rsrvCheckPut(pciu)){ putNotifyErrorReply (client, mp, ECA_NOWTACCESS); @@ -1666,6 +1690,9 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, } size = dbr_size_n (mp->m_dataType, mp->m_count); + if (size > mp->m_postsize) { + return RSRV_ERROR; + } if ( pciu->pPutNotify ) { @@ -1776,7 +1803,7 @@ static int event_add_action (caHdrLargeArray *mp, void *pPayload, struct client struct channel_in_use *pciu; struct event_ext *pevext; - if ( INVALID_DB_REQ(mp->m_dataType) ) { + if ( INVALID_DB_REQ(mp->m_dataType) || mp->m_postsize < sizeof(*pmi) ) { return RSRV_ERROR; } @@ -1810,6 +1837,10 @@ static int event_add_action (caHdrLargeArray *mp, void *pPayload, struct client return RSRV_ERROR; } + if (mp->m_count > dbChannelFinalElements(pciu->dbch)) { + mp->m_count = dbChannelFinalElements(pciu->dbch); + } + pevext->msg = *mp; pevext->pciu = pciu; pevext->size = dbr_size_n(mp->m_dataType, mp->m_count); @@ -2425,7 +2456,7 @@ int camessage ( struct client *client ) } msg.m_postsize = ntohl ( pLW[0] ); msg.m_count = ntohl ( pLW[1] ); - if (msg.m_postsize >= 0xffffffff - (sizeof(*mp) + 2 * sizeof ( *pLW ))) { + if (msg.m_postsize >= ca_uint32_max - (sizeof(*mp) + 2 * sizeof ( *pLW ))) { if(CASDEBUG>0) { errlogPrintf("Client ext msg size too large 0x%08x\n", (unsigned)msg.m_postsize); From 33f4d15ff340d4af428d2b111e9d84bbaadf5087 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 25 Jun 2026 20:34:15 -0700 Subject: [PATCH 093/141] rsrv: log_header don't log string specially payload may not be null terminated --- modules/database/src/ioc/rsrv/camessage.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index 37f723eee..73e3c75b6 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -304,11 +304,6 @@ static void log_header ( epicsPrintf ( "CAS: Request from %s => available=0x%x \tN=%u paddr=%p\n", hostName, mp->m_available, mnum, (pciu ? pciu->dbch : NULL)); - - if (mp->m_cmmd==CA_PROTO_WRITE && mp->m_dataType==DBF_STRING && pPayLoad ) { - epicsPrintf ( "CAS: Request from %s => Wrote string \"%s\"\n", - hostName, (char *)pPayLoad ); - } } /* From c896bc48d291b066c8d4df767c24c75fbcd4465c Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Thu, 23 Jul 2026 23:58:59 +0900 Subject: [PATCH 094/141] RTEMS-posix: free the epicsEventOSD in epicsEventDestroy() epicsEventCreate() mallocs the wrapper but epicsEventDestroy() only destroys the embedded rtems_binary_semaphore, leaking one heap block per event lifecycle on every RTEMS >= 5 build. --- modules/libcom/src/osi/os/RTEMS-posix/osdEvent.c | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/libcom/src/osi/os/RTEMS-posix/osdEvent.c b/modules/libcom/src/osi/os/RTEMS-posix/osdEvent.c index 8c2c81e3e..51ed2bd35 100644 --- a/modules/libcom/src/osi/os/RTEMS-posix/osdEvent.c +++ b/modules/libcom/src/osi/os/RTEMS-posix/osdEvent.c @@ -45,6 +45,7 @@ LIBCOM_API void epicsEventDestroy(epicsEventId pSem) { rtems_binary_semaphore_destroy(&pSem->rbs); + free(pSem); } LIBCOM_API epicsEventStatus From b2d2758ccab08535352378fb121f5a46a6262e5e Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 25 Jun 2026 12:41:53 -0700 Subject: [PATCH 095/141] db: dbPutNotifyBlocker type check --- modules/database/src/ioc/db/dbPutNotifyBlocker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp b/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp index 62fc44612..635012171 100644 --- a/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp +++ b/modules/database/src/ioc/db/dbPutNotifyBlocker.cpp @@ -164,7 +164,7 @@ void dbPutNotifyBlocker::initiatePutNotify ( throw cacChannel::outOfBounds(); } - if ( type > SHRT_MAX ) { + if ( INVALID_DB_REQ(type) ) { throw cacChannel::badType(); } From bc1b965f90cf3ee14de630a49a7f83ffcb3fab3b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 3 Aug 2026 16:30:19 -0700 Subject: [PATCH 096/141] remove unused .tools/adjustver.py --- .tools/adjustver.py | 102 -------------------------------------------- 1 file changed, 102 deletions(-) delete mode 100755 .tools/adjustver.py diff --git a/.tools/adjustver.py b/.tools/adjustver.py deleted file mode 100755 index 5f8de29ee..000000000 --- a/.tools/adjustver.py +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env python3 - -import logging -import sys -import re -from io import StringIO - -_log = logging.getLogger(__name__) - -def main(args): - logging.basicConfig(level=args.level) - - if args.dev is True: - actions=[ - ('DEVELOPMENT_FLAG', '1'), - ('DEV_SNAPSHOT', '-DEV'), - ] - - elif args.dev is False: - actions=[ - ('DEVELOPMENT_FLAG', '0'), - ('DEV_SNAPSHOT', ''), - ] - - elif args.version: - M=re.match(r'R?(\d+).(\d+).(\d+)(?:.(\d+))?(-.*)?', args.version) - actions=[ - ('SITE_VERSION', None), - ('SHORT_VERSION', None), - - ('MINOR_VERSION', M[2]), - ('REVISION', M[2]), - - ('MODIFICATION', M[3]), - ('MAINTENANCE_VERSION', M[3]), - - ('PATCH_LEVEL', M[4] or '0'), - - ('DEVELOPMENT_FLAG', '1' if (M[5] or '').upper().endswith('-DEV') else '0'), - ('DEV_SNAPSHOT', M[5] or ''), - - ('MAJOR_VERSION', M[1]), - ('VERSION', M[1]), # plain _VERSION must be last to resolve ambiguity - ] - - elif args.dry_run: - _log.debug('Print existing') - for fname in args.conf: - print('# ', fname) - with open(fname, 'r') as F: - sys.stdout.write(F.read()) - return - - else: - print('One of --version, --release, --dev, or --dry-run is required') - sys.exit(1) - - for name, val in actions: - _log.debug('Pattern "%s" -> "%s"', name, val) - - for fname in args.conf: - OUT=StringIO() - - with open(fname, 'r') as F: - for line in F: - _log.debug('Line: %s', repr(line)) - for name, val in actions: - M = re.match(r'(\s*[A-Z_]+' + name + r'\s*=[\t ]*)(\S*)(\s*)', line) - if M and val is None: - _log.debug('Ignore') - OUT.write(line) - break - elif M: - _log.debug(' Match %s -> %s', M.re.pattern, M.groups()) - OUT.write(M[1]+val+M[3]) - break - else: - _log.debug('No match') - OUT.write(line) - - if args.dry_run: - print('# ', fname) - print(OUT.getvalue()) - else: - with open(fname, 'w') as F: - F.write(OUT.getvalue()) - -def getargs(): - from argparse import ArgumentParser - P = ArgumentParser() - P.add_argument('-n','--dry-run', action='store_true', default=False) - P.add_argument('-d','--debug', dest='level', action='store_const', - const=logging.DEBUG, default=logging.INFO) - P.add_argument('-V', '--version', help='A version in R1.2.3-xyz or 1.2.3 form') - P.add_argument('-D', '--dev', action='store_true', default=None) - P.add_argument('-R', '--release', dest='dev', action='store_false') - P.add_argument('conf', nargs='+', - help='A configure/CONFIG_*_VERSION file name') - return P - -if __name__=='__main__': - main(getargs().parse_args()) From 6b866ddc67135ba47c3d3bf26b9af8891a98ca6d Mon Sep 17 00:00:00 2001 From: Brendan Chandler <75751770+brendanchandler@users.noreply.github.com> Date: Tue, 4 Aug 2026 17:22:18 -0500 Subject: [PATCH 097/141] Configure Static IP with RTEMS libbsd (#853) * Add RTEMS libbsd static network config for motload nvram setBootConfigFromNVRAM() now configures static networking via the libbsd rtems_bsd_ifconfig() API when building against RTEMS with libbsd. It only uses static networking if it can find a configured IP and netmask from GEV or the mot script boot parameters, otherwise it falls back to DHCP. Also note, NTP was part of setBootConfigFromNVRAM() when using legacy RTEMS networking, but is handled outside this function for LibBSD. To preserve the legacy behavior, setBootConfigFromNVRAM() still pulls out NTP server info, but now stores it in an output parameter for outside code to use. * Wait for link to come up when starting RTEMS/libbsd/static IP When configuring a static IP on RTEMS/libbsd, we need to intentionally wait for the link to come up before continuing to configure ntp, etc. * Separate common network setup from BSP specific implementations All the BSP setBootConfigFromNVRAM() functions ultimately configured the RTEMS networking the same way. The common networking code has been pulled out into a separate function now called from BSP specific code. All networking setup is now included and optionally used only when the BSP sets the field appropriately. This lets the setBootConfigFromNVRAM functions be independent of the network stack, just focussing on collecting the configuration from each BSP as appropriate. * Fix unused function warnings for functions unused on certain BSPs * Remove old comments about if MY_BOOTP * Added release note entry -- Co-authored-by: Brendan Chandler --- documentation/new-notes/PR-853.md | 17 ++ modules/libcom/RTEMS/posix/rtems_config.c | 4 +- modules/libcom/RTEMS/posix/rtems_init.c | 152 ++++++++--- modules/libcom/RTEMS/score/rtems_init.c | 4 +- modules/libcom/RTEMS/setBootConfigFromNVRAM.c | 249 +++++++++++++----- 5 files changed, 319 insertions(+), 107 deletions(-) create mode 100644 documentation/new-notes/PR-853.md diff --git a/documentation/new-notes/PR-853.md b/documentation/new-notes/PR-853.md new file mode 100644 index 000000000..e35c17563 --- /dev/null +++ b/documentation/new-notes/PR-853.md @@ -0,0 +1,17 @@ +### Static network configuration for RTEMS targets using libBSD + +GitHub [PR #853](https://github.com/epics-base/epics-base/pull/853) + +RTEMS targets built against the libBSD network stack can now use a static +network configuration in addition to DHCP. + +When a static IP address and netmask can be read from the board's boot +configuration, the first non-loopback interface is configured with that static +address; otherwise the target falls back to DHCP as before. + +The boot configuration is read using the mechanism appropriate to the board: + + * MOTLOAD boards read the NVRAM Global Environment Variables (GEV), falling + back to the parameters in the `mot-script-boot` boot script. + * PPCBUG boards read their PPCBUG NVRAM. + * ColdFire (`mcf528x`) boards read their bootloader environment variables. diff --git a/modules/libcom/RTEMS/posix/rtems_config.c b/modules/libcom/RTEMS/posix/rtems_config.c index b3c42097f..5b5fe9a6b 100644 --- a/modules/libcom/RTEMS/posix/rtems_config.c +++ b/modules/libcom/RTEMS/posix/rtems_config.c @@ -47,9 +47,7 @@ extern void *POSIX_Init(void *argument); #ifndef RTEMS_LEGACY_STACK #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM -/* - * Configure LibBSD. - */ + //#define RTEMS_BSD_CONFIG_NET_PF_UNIX //#define RTEMS_BSD_CONFIG_NET_IF_BRIDGE //#define RTEMS_BSD_CONFIG_NET_IF_LAGG diff --git a/modules/libcom/RTEMS/posix/rtems_init.c b/modules/libcom/RTEMS/posix/rtems_init.c index e8afba06b..a709f8915 100644 --- a/modules/libcom/RTEMS/posix/rtems_init.c +++ b/modules/libcom/RTEMS/posix/rtems_init.c @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include #include #include @@ -65,6 +67,8 @@ #include #include #include +#include +#include #endif #include @@ -873,6 +877,50 @@ default_network_dhcpcd(void) sc = rtems_dhcpcd_start(NULL); assert(sc == RTEMS_SUCCESSFUL); } + +/* + * Block until the named interface reports link up via an RTM_IFINFO routing + * message, or until timeout_secs elapses. + * + * route_sock must already be open (opened before the interface was configured + * so that no RTM_IFINFO event can be missed). + * + * This function was modeled after the RTM_IFINFO handling in + * rtems-libbsd/dhcpcd/if-bsd.c (manage_link). There's a + * simpler implementation in a test that uses a sleep loop in + * rtems-libbsd/testsuite/include/rtems/bsd/test/default-init.h, but + * we chose this more responsive event based implementation. + * + * Returns 0 if link came up, -1 on timeout or error. + */ +static int +wait_for_link_up(int route_sock, const char *ifname, int timeout_secs) +{ + printf("Waiting for link on %s (timeout %ds)...\n", ifname, timeout_secs); + + struct timeval tv = { .tv_sec = timeout_secs, .tv_usec = 0 }; + setsockopt(route_sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + + char buf[sizeof(struct if_msghdr) + sizeof(struct sockaddr_dl)]; + ssize_t n; + while ((n = recv(route_sock, buf, sizeof(buf), 0)) > 0) { + struct rt_msghdr *rtm = (struct rt_msghdr *)(void *)buf; + if (rtm->rtm_type == RTM_IFINFO) { + struct if_msghdr *ifm = (struct if_msghdr *)(void *)buf; + char name[IFNAMSIZ]; + if (if_indextoname(ifm->ifm_index, name) != NULL && + strcmp(name, ifname) == 0 && + ifm->ifm_data.ifi_link_state == LINK_STATE_UP) { + return 0; + } + } + } + + /* recv returned <= 0: SO_RCVTIMEO expired (EAGAIN) or socket error */ + printf("Warning: link did not come up on %s within %ds\n", + ifname, timeout_secs); + return -1; +} #endif // not RTEMS_LEGACY_STACK #if __RTEMS_MAJOR__>4 @@ -990,8 +1038,8 @@ POSIX_Init ( void *argument __attribute__((unused))) if (epicsRtemsInitPreSetBootConfigFromNVRAM(&rtems_bsdnet_config) != 0) delayedPanic("epicsRtemsInitPreSetBootConfigFromNVRAM"); if (rtems_bsdnet_config.bootp == NULL) { - extern void setBootConfigFromNVRAM(void); - setBootConfigFromNVRAM(); + extern int setBootConfigFromNVRAM(char *, size_t); + setBootConfigFromNVRAM(NULL, 0); } if (epicsRtemsInitPostSetBootConfigFromNVRAM(&rtems_bsdnet_config) != 0) delayedPanic("epicsRtemsInitPostSetBootConfigFromNVRAM"); @@ -1047,41 +1095,75 @@ POSIX_Init ( void *argument __attribute__((unused))) printf("\n***** ifconfig lo0 *****\n"); rtems_bsd_ifconfig_lo0(); - printf("\n***** add dhcpcd hook *****\n"); - dhcpDone = epicsEventMustCreate(epicsEventEmpty); - rtems_dhcpcd_add_hook(&dhcpcd_hook); + /* Check whether global environment static network config exists. + * If so, use that, else, fall back to DHCP. */ + extern int setBootConfigFromNVRAM(char *, size_t); - printf("\n***** Start default network dhcpcd *****\n"); - // if MY_BOOTP??? - default_network_dhcpcd(); + /* Open route socket before configuring the interface so that no + * events are missed. */ + int route_sock = socket(PF_ROUTE, SOCK_RAW, 0); + if (route_sock < 0) + printf("Warning: could not open PF_ROUTE socket: %s\n", strerror(errno)); - /* this seems to be hard coded in the BSP -> Sebastian Huber ? */ - printf("\n--Info (hpj)-- bsd task prio IRQS: %d -----\n", rtems_bsd_get_task_priority("IRQS")); - printf("\n--Info (hpj)-- bsd task prio TIME: %d -----\n", rtems_bsd_get_task_priority("TIME")); + printf("\n***** checking for static network configuration *****\n"); + int status = setBootConfigFromNVRAM(rtemsInit_NTP_server_ip, + sizeof(rtemsInit_NTP_server_ip)); + bool try_dhcp = status != 0; + + if (try_dhcp) { + /* Route socket not needed — DHCP path has its own event mechanism */ + if (route_sock >= 0) { + close(route_sock); + route_sock = -1; + } + + printf("\n***** add dhcpcd hook *****\n"); + dhcpDone = epicsEventMustCreate(epicsEventEmpty); + rtems_dhcpcd_add_hook(&dhcpcd_hook); + + printf("\n***** Start default network dhcpcd *****\n"); + default_network_dhcpcd(); + + /* this seems to be hard coded in the BSP -> Sebastian Huber ? */ + printf("\n--Info (hpj)-- bsd task prio IRQS: %d -----\n", rtems_bsd_get_task_priority("IRQS")); + printf("\n--Info (hpj)-- bsd task prio TIME: %d -----\n", rtems_bsd_get_task_priority("TIME")); - // wait for dhcp done ... should be if SYNCDHCP is used - epicsEventWaitStatus stat; - printf("\n ---- Waiting for DHCP ...\n"); - stat = epicsEventWaitWithTimeout(dhcpDone, 600); - if (stat == epicsEventOK) - epicsEventDestroy(dhcpDone); - else if (stat == epicsEventWaitTimeout) - printf("\n ---- DHCP timed out!\n"); - else - printf("\n ---- dhcpDone Event Unknown state %d\n", stat); + // wait for dhcp done ... should be if SYNCDHCP is used + epicsEventWaitStatus stat; + printf("\n ---- Waiting for DHCP ...\n"); + stat = epicsEventWaitWithTimeout(dhcpDone, 600); + if (stat == epicsEventOK) + epicsEventDestroy(dhcpDone); + else if (stat == epicsEventWaitTimeout) + printf("\n ---- DHCP timed out!\n"); + else + printf("\n ---- dhcpDone Event Unknown state %d\n", stat); + } else { + /* Static IP: block until the physical link comes up before + * proceeding to NTP and NFS, analogous to the DHCP event wait. */ + if (route_sock >= 0) { + char ifnamebuf[IF_NAMESIZE]; + char *ifname = if_indextoname(1, ifnamebuf); + if (ifname != NULL) + wait_for_link_up(route_sock, ifname, 30); + close(route_sock); + } + } - const char* ifconfg_args[] = { - "ifconfig", NULL - }; - const char* netstat_args[] = { - "netstat", "-rn", NULL - }; + { // Dump ifconfig and netstat info to stdout + const char* ifconfg_args[] = { + "ifconfig", NULL + }; + const char* netstat_args[] = { + "netstat", "-rn", NULL + }; - printf("-------------- IFCONFIG -----------------\n"); - rtems_bsd_command_ifconfig(1, (char**) ifconfg_args); - printf("-------------- NETSTAT ------------------\n"); - rtems_bsd_command_netstat(2, (char**) netstat_args); + printf("-------------- IFCONFIG -----------------\n"); + rtems_bsd_command_ifconfig(1, (char**) ifconfg_args); + printf("-------------- NETSTAT ------------------\n"); + rtems_bsd_command_netstat(2, (char**) netstat_args); + } /* until now there is no NTP support in libbsd -> Sebastian Huber ... */ printf("\n***** Until now no NTP support in RTEMS 5 with rtems-libbsd *****\n"); @@ -1159,6 +1241,14 @@ POSIX_Init ( void *argument __attribute__((unused))) // printf (" telnetd initialized with result %d\n", result); #endif +#if 0 +// Start an rtems shell before main, for debugging RTEMS system issues + rtems_shell_init("SHLL", RTEMS_MINIMUM_STACK_SIZE * 4, + 100, "/dev/console", + false, true, + NULL); +#endif + printf ("***** Preparing EPICS application *****\n"); iocshRegisterRTEMS (); set_directory (argv[1]); diff --git a/modules/libcom/RTEMS/score/rtems_init.c b/modules/libcom/RTEMS/score/rtems_init.c index cd8872c4b..77e2e3368 100644 --- a/modules/libcom/RTEMS/score/rtems_init.c +++ b/modules/libcom/RTEMS/score/rtems_init.c @@ -591,8 +591,8 @@ Init (rtems_task_argument ignored) if (epicsRtemsInitPreSetBootConfigFromNVRAM(&rtems_bsdnet_config) != 0) delayedPanic("epicsRtemsInitPreSetBootConfigFromNVRAM"); if (rtems_bsdnet_config.bootp == NULL) { - extern void setBootConfigFromNVRAM(void); - setBootConfigFromNVRAM(); + extern int setBootConfigFromNVRAM(char *, size_t); + setBootConfigFromNVRAM(NULL, 0); } if (epicsRtemsInitPostSetBootConfigFromNVRAM(&rtems_bsdnet_config) != 0) delayedPanic("epicsRtemsInitPostSetBootConfigFromNVRAM"); diff --git a/modules/libcom/RTEMS/setBootConfigFromNVRAM.c b/modules/libcom/RTEMS/setBootConfigFromNVRAM.c index ecdbe5291..439980ae2 100644 --- a/modules/libcom/RTEMS/setBootConfigFromNVRAM.c +++ b/modules/libcom/RTEMS/setBootConfigFromNVRAM.c @@ -14,6 +14,11 @@ #include #ifdef RTEMS_LEGACY_STACK #include +#else +#include +#include +#include +#include #endif #include #include @@ -28,6 +33,8 @@ char *env_nfsServer; char *env_nfsPath; char *env_nfsMountPoint; +#if defined(HAVE_MOTLOAD) || defined(HAVE_PPCBUG) || defined(__mcf528x__) + extern char* rtems_bsdnet_bootp_cmdline; /* * Split argument string of form nfs_server:nfs_export: @@ -66,6 +73,7 @@ splitRtemsBsdnetBootpCmdline(void) } } +#if defined(HAVE_MOTLOAD) || defined(__mcf528x__) /* * Split NFS mount information of the form nfs_server:host_path:local_path */ @@ -91,6 +99,74 @@ splitNfsMountPath(char *nfsString) } } } +#endif /* HAVE_MOTLOAD || __mcf528x__ */ + +struct boot_net_config { + char *ip_address; /* static IP address of this device */ + char *netmask; /* subnet mask */ + char *gateway; /* default gateway */ + char *server; /* boot server; used as NTP/DNS fallback if not overridden */ + char *ntp_server; /* NTP server (falls back to server if NULL) */ + char *hostname; /* this device's hostname */ + char *dns_server; /* DNS resolver (falls back to server if NULL) */ + char *domainname; /* DNS domain name */ + char *bootp_boot_file; /* boot filename reported via BOOTP */ + uint32_t bootp_server_addr; /* server IPv4 address as stored in PPCBUG NVRAM */ +}; + +/* Configure network from boot_net_config. + * RTEMS_LEGACY_STACK: populate rtems_bsdnet_config fields. + * libbsd: configure the first hardware interface (index 1) with a static IP. + * Returns 0 on success, -1 on failure. */ +static int +applyNetConfig(const struct boot_net_config *cfg, + char *ntp_server_ip, size_t ntp_server_ip_size) +{ +#ifdef RTEMS_LEGACY_STACK + (void)ntp_server_ip; + (void)ntp_server_ip_size; + rtems_bsdnet_bootp_server_name = cfg->server; + rtems_bsdnet_config.name_server[0] = cfg->dns_server ? cfg->dns_server : cfg->server; + rtems_bsdnet_config.ntp_server[0] = cfg->ntp_server ? cfg->ntp_server : cfg->server; + rtems_bsdnet_config.gateway = cfg->gateway; + rtems_bsdnet_config.ifconfig->ip_netmask = cfg->netmask; + rtems_bsdnet_config.ifconfig->ip_address = cfg->ip_address; + rtems_bsdnet_config.hostname = cfg->hostname ? cfg->hostname : cfg->ip_address; + if (cfg->domainname) + rtems_bsdnet_config.domainname = cfg->domainname; + if (cfg->bootp_boot_file) + rtems_bsdnet_bootp_boot_file_name = cfg->bootp_boot_file; + if (cfg->bootp_server_addr) + rtems_bsdnet_bootp_server_address.s_addr = cfg->bootp_server_addr; +#else + char ifnamebuf[IF_NAMESIZE]; + char *ifname = if_indextoname(1, ifnamebuf); + if (ifname == NULL) { + printf("No network interface found\n"); + return -1; + } + printf("Configuring ifconfig with ip=%s, netmask=%s, gateway=%s\n", + cfg->ip_address ? cfg->ip_address : "NULL", + cfg->netmask ? cfg->netmask : "NULL", + cfg->gateway ? cfg->gateway : "NULL"); + if (cfg->ip_address && cfg->netmask) { + int exit_code = rtems_bsd_ifconfig(ifname, cfg->ip_address, + cfg->netmask, cfg->gateway); + if (exit_code != EX_OK) { + printf("rtems_bsd_ifconfig failed (exit code %d)\n", exit_code); + return -1; + } + } else { + printf("Skipping static IP address and netmask from NVRAM\n"); + return -1; + } + if (ntp_server_ip != NULL && ntp_server_ip_size > 0 && cfg->ntp_server != NULL) + snprintf(ntp_server_ip, ntp_server_ip_size, "%s", cfg->ntp_server); +#endif + return 0; +} + +#endif /* HAVE_MOTLOAD || HAVE_PPCBUG || __mcf528x__ */ #if defined(HAVE_MOTLOAD) @@ -158,12 +234,12 @@ motScriptParm(const char *mot_script_boot, char parm) return NULL; } -void -setBootConfigFromNVRAM(void) +int +setBootConfigFromNVRAM(char *ntp_server_ip, size_t ntp_server_ip_size) { - char *cp; const char *mot_script_boot; volatile char *nvp; + struct boot_net_config cfg = {0}; # if defined(BSP_NVRAM_BASE_ADDR) nvp = (volatile char *)(BSP_NVRAM_BASE_ADDR+0x70f8); @@ -172,12 +248,13 @@ setBootConfigFromNVRAM(void) int fd; if ((fd = open(BSP_I2C_VPD_EEPROM_DEV_NAME, 0)) < 0) { printf("Can't open %s: %s\n", BSP_I2C_VPD_EEPROM_DEV_NAME, strerror(errno)); - return; + return -1; } lseek(fd, 0x10f8, SEEK_SET); if (read(fd, gev_buf, sizeof gev_buf) != sizeof gev_buf) { printf("Can't read %s: %s\n", BSP_I2C_VPD_EEPROM_DEV_NAME, strerror(errno)); - return; + close(fd); + return -1; } close(fd); nvp = gev_buf; @@ -185,39 +262,57 @@ setBootConfigFromNVRAM(void) # error "No way to read GEV!" # endif - if (rtems_bsdnet_config.bootp != NULL) - return; mot_script_boot = gev("mot-script-boot", nvp); - if ((rtems_bsdnet_bootp_server_name = gev("mot-/dev/enet0-sipa", nvp)) == NULL) - rtems_bsdnet_bootp_server_name = motScriptParm(mot_script_boot, 's'); - if ((rtems_bsdnet_config.gateway = gev("mot-/dev/enet0-gipa", nvp)) == NULL) - rtems_bsdnet_config.gateway = motScriptParm(mot_script_boot, 'g'); - if ((rtems_bsdnet_config.ifconfig->ip_netmask = gev("mot-/dev/enet0-snma", nvp)) == NULL) - rtems_bsdnet_config.ifconfig->ip_netmask = motScriptParm(mot_script_boot, 'm'); - rtems_bsdnet_config.name_server[0] = gev("rtems-dns-server", nvp); - if (rtems_bsdnet_config.name_server[0] == NULL) - rtems_bsdnet_config.name_server[0] = rtems_bsdnet_bootp_server_name; - cp = gev("rtems-dns-domainname", nvp); - if (cp) - rtems_bsdnet_config.domainname = cp; + /* + * Read network parameters from NVRAM + */ + if ((cfg.ip_address = gev("mot-/dev/enet0-cipa", nvp)) == NULL) { + cfg.ip_address = motScriptParm(mot_script_boot, 'c'); + } - if ((rtems_bsdnet_config.ifconfig->ip_address = gev("mot-/dev/enet0-cipa", nvp)) == NULL) - rtems_bsdnet_config.ifconfig->ip_address = motScriptParm(mot_script_boot, 'c'); - rtems_bsdnet_config.hostname = gev("rtems-client-name", nvp); - if (rtems_bsdnet_config.hostname == NULL) - rtems_bsdnet_config.hostname = rtems_bsdnet_config.ifconfig->ip_address; + if ((cfg.netmask = gev("mot-/dev/enet0-snma", nvp)) == NULL) { + cfg.netmask = motScriptParm(mot_script_boot, 'm'); + } + if ((cfg.gateway = gev("mot-/dev/enet0-gipa", nvp)) == NULL) { + cfg.gateway = motScriptParm(mot_script_boot, 'g'); + } + + if ((cfg.server = gev("mot-/dev/enet0-sipa", nvp)) == NULL) { + cfg.server = motScriptParm(mot_script_boot, 's'); + } + + + { + char *ntp_gev = gev("epics-ntpserver", nvp); + cfg.ntp_server = ntp_gev ? ntp_gev : cfg.server; + } + cfg.hostname = gev("rtems-client-name", nvp); + cfg.dns_server = gev("rtems-dns-server", nvp); + cfg.domainname = gev("rtems-dns-domainname", nvp); + cfg.bootp_boot_file = gev("mot-/dev/enet0-file", nvp); + if (cfg.bootp_boot_file == NULL) + cfg.bootp_boot_file = motScriptParm(mot_script_boot, 'f'); + + /* + * Apply network configuration + */ +#ifdef RTEMS_LEGACY_STACK + if (rtems_bsdnet_config.bootp != NULL) + return 0; +#endif + if (applyNetConfig(&cfg, ntp_server_ip, ntp_server_ip_size) != 0) + return -1; - if ((rtems_bsdnet_bootp_boot_file_name = gev("mot-/dev/enet0-file", nvp)) == NULL) - rtems_bsdnet_bootp_boot_file_name = motScriptParm(mot_script_boot, 'f'); rtems_bsdnet_bootp_cmdline = gev("epics-script", nvp); splitRtemsBsdnetBootpCmdline(); splitNfsMountPath(gev("epics-nfsmount", nvp)); - rtems_bsdnet_config.ntp_server[0] = gev("epics-ntpserver", nvp); - if (rtems_bsdnet_config.ntp_server[0] == NULL) - rtems_bsdnet_config.ntp_server[0] = rtems_bsdnet_bootp_server_name; - if ((cp = gev("epics-tz", nvp)) != NULL) - epicsEnvSet("TZ", cp); + { + char *tz = gev("epics-tz", nvp); + if (tz != NULL) + epicsEnvSet("TZ", tz); + } + return 0; } #elif defined(HAVE_PPCBUG) @@ -254,8 +349,8 @@ static char *addr(char *cbuf, uint32_t addr) return (char *)inet_ntop(AF_INET, &a, cbuf, INET_ADDRSTRLEN); } -void -setBootConfigFromNVRAM(void) +int +setBootConfigFromNVRAM(char *ntp_server_ip, size_t ntp_server_ip_size) { static struct ppcbug_nvram nvram; static char ip_address[INET_ADDRSTRLEN]; @@ -263,9 +358,6 @@ setBootConfigFromNVRAM(void) static char server[INET_ADDRSTRLEN]; static char gateway[INET_ADDRSTRLEN]; - if (rtems_bsdnet_config.bootp != NULL) - return; - /* * Get network configuration from PPCBUG. * The 'correct' way to do this would be to issue a .NETCFIG PPCBUG @@ -299,25 +391,30 @@ setBootConfigFromNVRAM(void) *d++ = *s++; } #endif - /* - * Assume that the boot server is also the name, log and ntp server! - */ - rtems_bsdnet_config.name_server[0] = - rtems_bsdnet_config.ntp_server[0] = - rtems_bsdnet_bootp_server_name = addr(server, nvram.ServerIPAddress); - rtems_bsdnet_bootp_server_address.s_addr = nvram.ServerIPAddress; - /* - * Nothing better to use as host name! - */ - rtems_bsdnet_config.ifconfig->ip_address = - rtems_bsdnet_config.hostname = addr(ip_address, nvram.ClientIPAddress); - rtems_bsdnet_config.gateway = addr(gateway, nvram.GatewayIPAddress); - rtems_bsdnet_config.ifconfig->ip_netmask = addr(ip_netmask, nvram.SubnetIPAddressMask); + char * serverp = addr(server, nvram.ServerIPAddress); + struct boot_net_config cfg = { + addr(ip_address, nvram.ClientIPAddress), + addr(ip_netmask, nvram.SubnetIPAddressMask), + addr(gateway, nvram.GatewayIPAddress), + serverp, + serverp, /* ntp_server defaults to server */ + NULL, /* hostname */ + NULL, /* dns_server */ + NULL, /* domainname */ + nvram.BootFilenameString, /* bootp_boot_file */ + nvram.ServerIPAddress, /* bootp_server_addr */ + }; - rtems_bsdnet_bootp_boot_file_name = nvram.BootFilenameString; +#ifdef RTEMS_LEGACY_STACK + if (rtems_bsdnet_config.bootp != NULL) + return 0; +#endif + if (applyNetConfig(&cfg, ntp_server_ip, ntp_server_ip_size) != 0) + return -1; rtems_bsdnet_bootp_cmdline = nvram.ArgumentFilenameString; splitRtemsBsdnetBootpCmdline(); + return 0; } #elif defined(__mcf528x__) @@ -336,39 +433,49 @@ env(const char *parm, const char *defaultValue) return epicsStrDup(cp); } -void -setBootConfigFromNVRAM(void) +int +setBootConfigFromNVRAM(char *ntp_server_ip, size_t ntp_server_ip_size) { - const char *cp1; + char *server_str = env("SERVER", "192.168.0.1"); + struct boot_net_config cfg = { + env("IPADDR0", "192.168.0.2"), + env("NETMASK", "255.255.252.0"), + env("GATEWAY", NULL), + server_str, + env("NTPSERVER", server_str), + env("HOSTNAME", "iocNobody"), + env("NAMESERVER", server_str), + env("DOMAIN", NULL), + env("BOOTFILE", "uC5282App.boot"), + 0, /* bootp_server_addr */ + }; +#ifdef RTEMS_LEGACY_STACK if (rtems_bsdnet_config.bootp != NULL) - return; - rtems_bsdnet_config.gateway = env("GATEWAY", NULL); - rtems_bsdnet_config.ifconfig->ip_netmask = env("NETMASK", "255.255.252.0"); - - rtems_bsdnet_bootp_server_name = env("SERVER", "192.168.0.1"); - rtems_bsdnet_config.name_server[0] = env("NAMESERVER", rtems_bsdnet_bootp_server_name); - rtems_bsdnet_config.ntp_server[0] = env("NTPSERVER", rtems_bsdnet_bootp_server_name); - cp1 = env("DOMAIN", NULL); - if (cp1 != NULL) - rtems_bsdnet_config.domainname = cp1; - rtems_bsdnet_config.hostname = env("HOSTNAME", "iocNobody"); - rtems_bsdnet_config.ifconfig->ip_address = env("IPADDR0", "192.168.0.2"); - rtems_bsdnet_bootp_boot_file_name = env("BOOTFILE", "uC5282App.boot"); + return 0; +#endif + if (applyNetConfig(&cfg, ntp_server_ip, ntp_server_ip_size) != 0) + return -1; rtems_bsdnet_bootp_cmdline = env("CMDLINE", "epics/iocBoot/iocNobody/st.cmd"); + splitRtemsBsdnetBootpCmdline(); splitNfsMountPath(env("NFSMOUNT", NULL)); - if ((cp1 = env("TZ", NULL)) != NULL) - epicsEnvSet("TZ", cp1); + { + char *tz = env("TZ", NULL); + if (tz != NULL) + epicsEnvSet("TZ", tz); + } + return 0; } #else /* * Placeholder for systems without NVRAM */ -void -setBootConfigFromNVRAM(void) +int +setBootConfigFromNVRAM(char *ntp_server_ip, size_t ntp_server_ip_size) { printf("SYSTEM HAS NO NON-VOLATILE RAM!\n"); printf("YOU MUST USE SOME OTHER METHOD TO OBTAIN NETWORK CONFIGURATION\n"); + return -1; } #endif From c1a26edb6e886656e292cf3cc08128cafb28f477 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Wed, 5 Aug 2026 18:52:54 +0200 Subject: [PATCH 098/141] db: fix dbChannel_put() for DBR_TIME_STRING DBR_TIME is the option mask 0x10 from dbAccessDefs.h, not a field data type --- modules/database/src/ioc/db/db_access.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/db/db_access.c b/modules/database/src/ioc/db/db_access.c index 62e8ffe3c..8b1ac8265 100644 --- a/modules/database/src/ioc/db/db_access.c +++ b/modules/database/src/ioc/db/db_access.c @@ -877,7 +877,7 @@ int dbChannel_put(struct dbChannel *chan, int src_type, break; case(oldDBR_TIME_STRING): - status = dbChannelPutField(chan, DBR_TIME, + status = dbChannelPutField(chan, DBR_STRING, ((const struct dbr_time_string *)psrc)->value, no_elements); break; /* case(oldDBR_TIME_INT): */ From c592587de89818678dc0cbd50227442cfaa4b2ab Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 3 Jul 2026 12:37:32 -0700 Subject: [PATCH 099/141] doc --- .../src/ioc/registry/registryFunction.h | 6 ++++++ modules/libcom/src/misc/epicsExport.h | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/modules/database/src/ioc/registry/registryFunction.h b/modules/database/src/ioc/registry/registryFunction.h index baa6d5080..5c6b97018 100644 --- a/modules/database/src/ioc/registry/registryFunction.h +++ b/modules/database/src/ioc/registry/registryFunction.h @@ -25,6 +25,12 @@ typedef struct registryFunctionRef { } registryFunctionRef; +/** @brief Add named function to global registry + * + * Most users will prefer epicsRegisterFunction() + * + * @return 1 on success, 0 on error + */ DBCORE_API int registryFunctionAdd( const char *name, REGISTRYFUNCTION func); DBCORE_API REGISTRYFUNCTION registryFunctionFind( diff --git a/modules/libcom/src/misc/epicsExport.h b/modules/libcom/src/misc/epicsExport.h index 356d62b39..52825ab30 100644 --- a/modules/libcom/src/misc/epicsExport.h +++ b/modules/libcom/src/misc/epicsExport.h @@ -116,12 +116,19 @@ typedef void (*REGISTRAR)(void); * * The epicsRegisterFunction() macro must be used to declare and register * a function that is named in a DBD \c function statement and called by - * one or more subroutine or aSub records. For example: - \code - epicsRegisterFunction(mySubInit); - epicsRegisterFunction(mySubProcess); - \endcode -* + * one or more subroutine or aSub records. For example in C code: + * \code{.c} + * epicsRegisterFunction(mySubInit); + * epicsRegisterFunction(mySubProcess); + * \endcode + * + * Place matching entries in a DBD file. + * + * \code{.dbd} + * registrar(mySubInit) + * registrar(mySubProcess) + * \endcode + * * \param fun Function's name */ #ifdef __cplusplus From da27db55c42e875d7de5d5ffeb744fe4e15c2f64 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 5 Aug 2026 10:58:18 -0700 Subject: [PATCH 100/141] dbCaLinkTest: test dbr_size_n --- modules/database/test/ioc/db/dbCACTest.cpp | 29 +++++++++++++++++++++ modules/database/test/ioc/db/dbCaLinkTest.c | 4 ++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/modules/database/test/ioc/db/dbCACTest.cpp b/modules/database/test/ioc/db/dbCACTest.cpp index e008fb0db..502dc799c 100644 --- a/modules/database/test/ioc/db/dbCACTest.cpp +++ b/modules/database/test/ioc/db/dbCACTest.cpp @@ -83,3 +83,32 @@ void dbCaLinkTest_testCAC(void) testAbort("Unexpected exception in testCAC: %s", e.what()); } } + +extern "C" +void dbCaLinkTest_testMacros() +{ +#define testEq(A,B) do { \ + epicsInt64 a = (A), b = (B); \ + testOk(a==b, #A " (%lld) == " #B " (%lld)", a, b); \ +}while(0) + testEq(dbr_size_n(DBR_STRING, 2), 2*MAX_STRING_SIZE); + testEq(dbr_size_n(DBR_STRING, 1), MAX_STRING_SIZE); + testEq(dbr_size_n(DBR_STRING, 0), 0); + testTodoBegin("overflow"); + testEq(dbr_size_n(DBR_INT, 0xffffffff), 0x1fffffffellu); // result truncated to 0xfffffffe + testEq(dbr_size_n(DBR_INT, 0x7fffffff), 0xfffffffe); // underflows in intermediate, on some targets + testTodoEnd(); + testEq(dbr_size_n(DBR_INT, 0x3fffffff), 0x7ffffffe); + testEq(dbr_size_n(DBR_INT, 2), 4); + testEq(dbr_size_n(DBR_INT, 1), 2); + testEq(dbr_size_n(DBR_INT, 0), 0); + testEq(dbr_size_n(DBR_STS_INT, 2), 4+2*2); + testEq(dbr_size_n(DBR_STS_INT, 1), 4+2); + testEq(dbr_size_n(DBR_STS_INT, 0), 4); + testEq(dbr_size_n(DBR_CHAR, 0xffffffff), 0xffffffff); + testEq(dbr_size_n(DBR_CHAR, 0x7fffffff), 0x7fffffff); + testEq(dbr_size_n(DBR_CHAR, 2), 2); + testEq(dbr_size_n(DBR_CHAR, 1), 1); + testEq(dbr_size_n(DBR_CHAR, 0), 0); +#undef testEq +} diff --git a/modules/database/test/ioc/db/dbCaLinkTest.c b/modules/database/test/ioc/db/dbCaLinkTest.c index bb7eaf79c..e41ff5ce6 100644 --- a/modules/database/test/ioc/db/dbCaLinkTest.c +++ b/modules/database/test/ioc/db/dbCaLinkTest.c @@ -561,6 +561,7 @@ static void testreTargetTypeChange(void) } void dbCaLinkTest_testCAC(void); +void dbCaLinkTest_testMacros(void); static void testCAC(void) { @@ -590,6 +591,7 @@ static void testCAC(void) buftarg2= ptarg2->bptr; dbCaLinkTest_testCAC(); + dbCaLinkTest_testMacros(); testIocShutdownOk(); @@ -605,7 +607,7 @@ static void testCAC(void) MAIN(dbCaLinkTest) { - testPlan(101); + testPlan(118); testNativeLink(); testStringLink(); testCP(); From 6cf9fe9d832cb7324008bebb404d44e43c351e31 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 7 Aug 2026 13:11:28 -0500 Subject: [PATCH 101/141] Silence Repeater announcement in non-debug mode --- modules/ca/src/client/repeater.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ca/src/client/repeater.cpp b/modules/ca/src/client/repeater.cpp index 832d03b17..e697ae66b 100644 --- a/modules/ca/src/client/repeater.cpp +++ b/modules/ca/src/client/repeater.cpp @@ -580,7 +580,8 @@ void ca_repeater ( int setDebug ) } #endif - debugPrintf ( ( "CA Repeater: Attached and initialized\n" ) ); + if ( debug ) + debugPrintf ( ( "CA Repeater: Attached and initialized\n" ) ); while ( true ) { osiSocklen_t from_size = sizeof ( from ); From 0cc912b178555f9328f6ffa16ec2b1e85f01df95 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 10 Aug 2026 13:35:56 -0500 Subject: [PATCH 102/141] Use sort to compare RTEMS_VERSION --- configure/os/CONFIG.Common.RTEMS-mvme2700 | 14 +++++++++++--- configure/os/CONFIG.Common.RTEMS-pc386 | 4 ++-- configure/os/CONFIG.Common.RTEMS-pc686 | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/configure/os/CONFIG.Common.RTEMS-mvme2700 b/configure/os/CONFIG.Common.RTEMS-mvme2700 index 3b43ae45b..b782e1f7f 100644 --- a/configure/os/CONFIG.Common.RTEMS-mvme2700 +++ b/configure/os/CONFIG.Common.RTEMS-mvme2700 @@ -1,6 +1,12 @@ +# CONFIG.Common.RTEMS-mvme2700 +# +# Definitions for the RTEMS-mvme2700 target +# Site-specific overrides go in CONFIG_SITE.Common.RTEMS-mvme2700 # # Author: Matt Rippa # +#------------------------------------------------------- + RTEMS_TARGET_CPU = powerpc ARCH_DEP_CFLAGS += -DMY_DO_BOOTP=NULL ARCH_DEP_CFLAGS += -DHAVE_PPCBUG @@ -23,8 +29,10 @@ endef include $(CONFIG)/os/CONFIG.Common.RTEMS -ifeq ($(shell test $(RTEMS_VERSION) -ge 5; echo $$?),0) -RTEMS_BSP = mvme2700 +ifeq ($(sort $(RTEMS_VERSION) 5),$(RTEMS_VERSION) 5) + # RTEMS 4.x used this BSP name + RTEMS_BSP = mvme2307 else -RTEMS_BSP = mvme2307 + # RTEMS 5+ support our name + RTEMS_BSP = mvme2700 endif diff --git a/configure/os/CONFIG.Common.RTEMS-pc386 b/configure/os/CONFIG.Common.RTEMS-pc386 index 77867f004..e68056e44 100644 --- a/configure/os/CONFIG.Common.RTEMS-pc386 +++ b/configure/os/CONFIG.Common.RTEMS-pc386 @@ -25,8 +25,8 @@ include $(CONFIG)/os/CONFIG.Common.RTEMS OP_SYS_LDFLAGS += -Wl,-Ttext,0x100000 # This check must appear after the above include -ifeq ($(shell test $(RTEMS_VERSION) -ge 5; echo $$?),0) +ifneq ($(sort $(RTEMS_VERSION) 5),$(RTEMS_VERSION) 5) $(info *** This target is not compatible with the configured RTEMS version.) - $(info *** Build the RTEMS-pc686 (-qemu) target for RTEMS 5.x) + $(info *** Build the RTEMS-pc686 (-qemu) target for RTEMS 5 and later) $(error Can't continue) endif diff --git a/configure/os/CONFIG.Common.RTEMS-pc686 b/configure/os/CONFIG.Common.RTEMS-pc686 index 5d30b17d8..ec67a8a34 100644 --- a/configure/os/CONFIG.Common.RTEMS-pc686 +++ b/configure/os/CONFIG.Common.RTEMS-pc686 @@ -31,7 +31,7 @@ OP_SYS_LDFLAGS += -Wl,-Ttext,0x100000 -Wl,--gc-sections # This check must appear after the above include -ifeq ($(shell test $(RTEMS_VERSION) -lt 5; echo $$?),0) +ifeq ($(sort $(RTEMS_VERSION) 5),$(RTEMS_VERSION) 5) $(info *** This target is not compatible with the configured RTEMS version.) $(info *** Build the RTEMS-pc386 (-qemu) target for RTEMS 4.x) $(error Can't continue) From 67f7ee55bdc089a536b10a69f1a1ceefb4bef5b9 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 21 Aug 2026 10:15:28 -0500 Subject: [PATCH 103/141] Fix PR-110 release note heading ## -> ### Also expanded the wording slightly --- documentation/new-notes/PR-110.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/documentation/new-notes/PR-110.md b/documentation/new-notes/PR-110.md index 2c2ecc1e7..0adc2276a 100644 --- a/documentation/new-notes/PR-110.md +++ b/documentation/new-notes/PR-110.md @@ -1,7 +1,10 @@ -## Add GDB Helper Script +### Add GDB Helper Script -Add [Debugging with GDB](gdb.md) section in documentation. +A new [Debugging with GDB](gdb.md) document which is linked under the +"General Information" heading in the side-bar provides information on +how to debug C/C++ code in an IOC running on a workstation OS. -Add GDB helper script to pretty print some common database types. +This release added a GDB helper script that pretty-prints some of the +common database types. Tested with GDB 16.3. Compatible with python 3. From df57d1040805d059bd04bf5d947b1a762335437b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 Aug 2026 18:05:42 -0700 Subject: [PATCH 104/141] rsrv: remove pPayload for debug logging Unused since 33f4d15ff340d4af428d2b111e9d84bbaadf5087. Now make clear that this is so. --- modules/database/src/ioc/rsrv/camessage.c | 76 +++++++++++------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index 73e3c75b6..95c23e217 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -57,8 +57,8 @@ static EVENTFUNC read_reply; -#define logBadId(CLIENT, MP, PPL)\ -logBadIdWithFileAndLineno(CLIENT, MP, PPL, __FILE__, __LINE__) +#define logBadId(CLIENT, MP)\ +logBadIdWithFileAndLineno(CLIENT, MP, __FILE__, __LINE__) /* * for tracking db put notifies @@ -283,7 +283,6 @@ static void log_header ( const char *pContext, struct client *client, const caHdrLargeArray *mp, - const void *pPayLoad, unsigned mnum ) { @@ -312,12 +311,11 @@ static void log_header ( static void logBadIdWithFileAndLineno( struct client *client, caHdrLargeArray *mp, -const void *pPayload, char *pFileName, unsigned lineno ) { - log_header ( "bad resource ID", client, mp, pPayload, 0 ); + log_header ( "bad resource ID", client, mp, 0 ); SEND_LOCK ( client ); send_err ( mp, ECA_INTERNAL, client, "Bad Resource ID at %s.%d", pFileName, lineno ); @@ -330,9 +328,10 @@ unsigned lineno static int bad_udp_cmd_action ( caHdrLargeArray *mp, void *pPayload, struct client *pClient ) { + (void)pPayload; if (CASDEBUG > 0) log_header ("invalid (damaged?) request code from UDP", - pClient, mp, pPayload, 0); + pClient, mp, 0); return RSRV_ERROR; } @@ -343,7 +342,8 @@ static int bad_tcp_cmd_action ( caHdrLargeArray *mp, void *pPayload, struct client *client ) { const char *pCtx = "invalid (damaged?) request code from TCP"; - log_header ( pCtx, client, mp, pPayload, 0 ); + (void)pPayload; + log_header ( pCtx, client, mp, 0 ); /* * by default, clients don't recover @@ -611,7 +611,7 @@ static int read_action ( caHdrLargeArray *mp, void *pPayloadIn, struct client *p db_field_log *pfl = NULL; if ( ! pciu ) { - logBadId ( pClient, mp, 0 ); + logBadId ( pClient, mp ); return RSRV_ERROR; } readAccess = asCheckGet ( pciu->asClientPVT ); @@ -706,7 +706,7 @@ static int read_notify_action ( caHdrLargeArray *mp, void *pPayload, struct clie pciu = MPTOPCIU ( mp, client ); if ( !pciu ) { - logBadId ( client, mp, pPayload ); + logBadId ( client, mp ); return RSRV_ERROR; } @@ -747,12 +747,12 @@ static int write_action ( caHdrLargeArray *mp, pciu = MPTOPCIU(mp, client); if(!pciu){ - logBadId(client, mp, pPayload); + logBadId(client, mp); return RSRV_ERROR; } if (INVALID_DB_REQ(mp->m_dataType)) { - log_header ("bad put data type", client, mp, pPayload, 0); + log_header ("bad put data type", client, mp, 0); return RSRV_ERROR; } if (mp->m_count > dbChannelFinalElements(pciu->dbch)) { @@ -780,7 +780,7 @@ static int write_action ( caHdrLargeArray *mp, mp->m_dataType, pPayload, pPayload, FALSE /* net -> host format */, mp->m_count ); if ( status != ECA_NORMAL ) { - log_header ("invalid data type", client, mp, pPayload, 0); + log_header ("invalid data type", client, mp, 0); SEND_LOCK(client); send_err( mp, @@ -850,7 +850,7 @@ static int host_name_action ( caHdrLargeArray *mp, void *pPayload, size = epicsStrnLen(pName, mp->m_postsize)+1; if (size > 512 || size > mp->m_postsize) { log_header ( "bad (very long) host name", - client, mp, pPayload, 0 ); + client, mp, 0 ); SEND_LOCK(client); send_err( mp, @@ -875,7 +875,7 @@ static int host_name_action ( caHdrLargeArray *mp, void *pPayload, pMalloc = malloc(size); if(!pMalloc){ log_header ( "no space in pool for new host name", - client, mp, pPayload, 0 ); + client, mp, 0 ); SEND_LOCK(client); send_err( mp, @@ -937,7 +937,7 @@ static int client_name_action ( caHdrLargeArray *mp, void *pPayload, size = epicsStrnLen(pName, mp->m_postsize)+1; if (size > 512 || size > mp->m_postsize) { log_header ("a very long user name was specified", - client, mp, pPayload, 0); + client, mp, 0); SEND_LOCK(client); send_err( mp, @@ -954,7 +954,7 @@ static int client_name_action ( caHdrLargeArray *mp, void *pPayload, pMalloc = malloc(size); if(!pMalloc){ log_header ("no memory for new user name", - client, mp, pPayload, 0); + client, mp, 0); SEND_LOCK(client); send_err( mp, @@ -1229,7 +1229,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp, */ if (mp->m_postsize<=1) { log_header ( "empty PV name in UDP search request?", - client, mp, pPayload, 0 ); + client, mp, 0 ); return RSRV_OK; } pName[mp->m_postsize-1] = '\0'; @@ -1254,7 +1254,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp, mp->m_cid); if (!pciu) { log_header ("no memory to create new channel", - client, mp, pPayload, 0); + client, mp, 0); SEND_LOCK(client); send_err(mp, ECA_ALLOCMEM, @@ -1276,7 +1276,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp, client->pHostName ? client->pHostName : ""); if(status != 0 && status != S_asLib_asNotActive){ log_header ("No room for security table", - client, mp, pPayload, 0); + client, mp, 0); SEND_LOCK(client); send_err(mp, ECA_ALLOCMEM, client, "No room for security table"); SEND_UNLOCK(client); @@ -1306,7 +1306,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp, } else if (status!=0) { log_header ("No room for access security state change subscription", - client, mp, pPayload, 0); + client, mp, 0); SEND_LOCK(client); send_err(mp, ECA_ALLOCMEM, client, "No room for access security state change subscription"); @@ -1666,12 +1666,12 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, pciu = MPTOPCIU(mp, client); if(!pciu){ - logBadId ( client, mp, pPayload ); + logBadId ( client, mp ); return RSRV_ERROR; } if (INVALID_DB_REQ(mp->m_dataType)) { - log_header ("bad put notify data type", client, mp, pPayload, 0); + log_header ("bad put notify data type", client, mp, 0); putNotifyErrorReply (client, mp, ECA_BADTYPE); return RSRV_ERROR; } @@ -1728,7 +1728,7 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, if ( busyTmp ) { log_header("put call back time out", client, - &pciu->pPutNotify->msg, pciu->pPutNotify->pbuffer, 0); + &pciu->pPutNotify->msg, 0); asTrapWriteAfter ( asWritePvtTmp ); putNotifyErrorReply (client, &pciu->pPutNotify->msg, ECA_PUTCBINPROG); } @@ -1745,7 +1745,7 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, * if there isn't enough memory left */ log_header ( "no memory to initiate put notify", - client, mp, pPayload, 0 ); + client, mp, 0 ); putNotifyErrorReply (client, mp, ECA_ALLOCMEM); return RSRV_ERROR; } @@ -1753,7 +1753,7 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, if ( ! rsrvExpandPutNotify ( pciu->pPutNotify, size ) ) { log_header ( "no memory to initiate vector put notify", - client, mp, pPayload, 0 ); + client, mp, 0 ); putNotifyErrorReply ( client, mp, ECA_ALLOCMEM ); return RSRV_ERROR; } @@ -1767,7 +1767,7 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, mp->m_dataType, pPayload, pciu->pPutNotify->pbuffer, FALSE /* net -> host format */, mp->m_count ); if ( status != ECA_NORMAL ) { - log_header ("invalid data type", client, mp, pPayload, 0); + log_header ("invalid data type", client, mp, 0); putNotifyErrorReply ( client, mp, status ); return RSRV_ERROR; } @@ -1804,7 +1804,7 @@ static int event_add_action (caHdrLargeArray *mp, void *pPayload, struct client pciu = MPTOPCIU ( mp, client ); if ( ! pciu ) { - logBadId ( client, mp, pPayload ); + logBadId ( client, mp ); return RSRV_ERROR; } @@ -1821,7 +1821,7 @@ static int event_add_action (caHdrLargeArray *mp, void *pPayload, struct client if (!pevext) { log_header ("no memory to add subscription", - client, mp, pPayload, 0); + client, mp, 0); SEND_LOCK(client); send_err( mp, @@ -1849,7 +1849,7 @@ static int event_add_action (caHdrLargeArray *mp, void *pPayload, struct client read_reply, pevext, pevext->mask); if (pevext->pdbev == NULL) { log_header ("no memory to add subscription to db", - client, mp, pPayload, 0); + client, mp, 0); SEND_LOCK(client); send_err (mp, ECA_ALLOCMEM, client, "subscription install into record %s failed", @@ -1918,7 +1918,7 @@ static int clear_channel_reply ( caHdrLargeArray *mp, */ pciu = MPTOPCIU(mp, client); if(!pciu){ - logBadId ( client, mp, pPayload ); + logBadId ( client, mp ); return RSRV_ERROR; } @@ -1994,7 +1994,7 @@ static int clear_channel_reply ( caHdrLargeArray *mp, if(status != S_bucket_success){ UNLOCK_CLIENTQ; errMessage (status, "Bad resource id during channel clear"); - logBadId ( client, mp, pPayload ); + logBadId ( client, mp ); return RSRV_ERROR; } rsrvChannelCount--; @@ -2027,7 +2027,7 @@ static int event_cancel_reply ( caHdrLargeArray *mp, void *pPayload, struct clie */ pciu = MPTOPCIU(mp, client); if (!pciu) { - logBadId ( client, mp, pPayload ); + logBadId ( client, mp ); return RSRV_ERROR; } @@ -2194,7 +2194,7 @@ static int search_reply_udp ( caHdrLargeArray *mp, void *pPayload, struct client */ if (mp->m_postsize<=1) { log_header ("empty PV name in UDP search request?", - client, mp, pPayload, 0); + client, mp, 0); return RSRV_OK; } pName[mp->m_postsize-1] = '\0'; @@ -2281,7 +2281,7 @@ static int search_reply_tcp ( */ if (mp->m_postsize<=1) { log_header ("empty PV name in UDP search request?", - client, mp, pPayload, 0); + client, mp, 0); return RSRV_OK; } pName[mp->m_postsize-1] = '\0'; @@ -2478,7 +2478,7 @@ int camessage ( struct client *client ) "CAS: Client version %u too old", client->minor_version_number ); SEND_UNLOCK(client); log_header ( "CAS: Client version too old", - client, &msg, 0, nmsg ); + client, &msg, nmsg ); if (msgsize >= bytes_left) { client->recvBytesToDrain = msgsize - bytes_left; client->recv.stk = client->recv.cnt; @@ -2506,7 +2506,7 @@ int camessage ( struct client *client ) "CAS: Missaligned protocol rejected" ); SEND_UNLOCK(client); log_header ( "CAS: Missaligned protocol rejected", - client, &msg, 0, nmsg ); + client, &msg, nmsg ); } status = RSRV_ERROR; break; @@ -2528,7 +2528,7 @@ int camessage ( struct client *client ) rsrvSizeofLargeBufTCP ); SEND_UNLOCK(client); log_header ( "CAS: server unable to load large request message", - client, &msg, 0, nmsg ); + client, &msg, nmsg ); } assert ( client->recv.cnt <= client->recv.maxstk ); assert ( msgsize >= bytes_left ); @@ -2550,7 +2550,7 @@ int camessage ( struct client *client ) nmsg++; if ( CASDEBUG > 2 ) - log_header (NULL, client, &msg, pBody, nmsg); + log_header (NULL, client, &msg, nmsg); if ( client->proto==IPPROTO_UDP ) { if ( msg.m_cmmd < NELEMENTS ( udpJumpTable ) ) { From f7ad63f56ec138b2d17e3bd0080d02aa503708db Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 6 Aug 2026 08:04:05 -0700 Subject: [PATCH 105/141] dbPut/dbPutField check nRequest --- modules/database/src/ioc/db/dbAccess.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/database/src/ioc/db/dbAccess.c b/modules/database/src/ioc/db/dbAccess.c index 42ba83f22..daf63e522 100644 --- a/modules/database/src/ioc/db/dbAccess.c +++ b/modules/database/src/ioc/db/dbAccess.c @@ -1087,11 +1087,16 @@ static long dbPutFieldLink(DBADDR *paddr, switch (dbrType) { case DBR_CHAR: case DBR_UCHAR: - if (pstring[nRequest - 1] != '\0') + if (nRequest == 0) { + pstring = pbuffer = ""; // treat zero bytes the same as one null byte + } else if (pstring[nRequest - 1] != '\0') { return S_db_badDbrtype; + } break; case DBR_STRING: + if (nRequest != 1) + return S_db_onlyOne; break; default: @@ -1253,6 +1258,8 @@ long dbPutField(DBADDR *paddr, short dbrType, if (special == SPC_ATTRIBUTE) return S_db_noMod; + if (nRequest < 0) + return S_db_badChoice; /*check for putField disabled*/ if (precord->disp && paddr->pfield != &precord->disp) @@ -1332,6 +1339,8 @@ long dbPut(DBADDR *paddr, short dbrType, if (special == SPC_ATTRIBUTE) return S_db_noMod; + if (nRequest < 0) + return S_db_badChoice; if (dbrType == DBR_PUT_ACKT && field_type <= DBF_DEVICE) { return putAckt(paddr, pbuffer, 1, 1, 0); From 9b7f932b5c4b056354e62f319d22f2844d77081e Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 Aug 2026 18:06:02 -0700 Subject: [PATCH 106/141] rsrv: special case PUT with scalar string When dataType==DBR_STRING && count==1, libca may optimize by sending less than 40 bytes. Add a special scratch buffer for this case so that downstream code can continue to assume MAX_STRING_SIZE. --- modules/database/src/ioc/rsrv/camessage.c | 16 +++++++++++++--- modules/database/src/ioc/rsrv/caservertask.c | 1 + modules/database/src/ioc/rsrv/server.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index 95c23e217..3d692e99f 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -743,7 +743,6 @@ static int write_action ( caHdrLargeArray *mp, int status; long dbStatus; void *asWritePvt; - unsigned size; pciu = MPTOPCIU(mp, client); if(!pciu){ @@ -759,8 +758,19 @@ static int write_action ( caHdrLargeArray *mp, mp->m_count = dbChannelFinalElements(pciu->dbch); } - size = dbr_size_n (mp->m_dataType, mp->m_count); - if (size > mp->m_postsize) { + if (mp->m_dataType == DBR_STRING && mp->m_count == 1 && mp->m_postsize < MAX_STRING_SIZE + && (client->sssb || !!(client->sssb = malloc(MAX_STRING_SIZE)))) { + // client sent DBR_STRING with truncated body. This is allowed when count==1. + // we copy into a temporary buffer. + // copy into [0, postsize) + memcpy(client->sssb, pPayload, mp->m_postsize); + // zero remaining [postsize, max_string_size) + memset(client->sssb + mp->m_postsize, 0, MAX_STRING_SIZE - mp->m_postsize); + // use instead of socket buffer + pPayload = client->sssb; + + } else if (dbr_size_n (mp->m_dataType, mp->m_count) > mp->m_postsize) { + log_header ( "truncated body", client, mp, 0); return RSRV_ERROR; } diff --git a/modules/database/src/ioc/rsrv/caservertask.c b/modules/database/src/ioc/rsrv/caservertask.c index 740cd4b4e..c4a74038c 100644 --- a/modules/database/src/ioc/rsrv/caservertask.c +++ b/modules/database/src/ioc/rsrv/caservertask.c @@ -1136,6 +1136,7 @@ void destroy_client ( struct client *client ) free ( client->pHostName ); } + free ( client->sssb ); freeListFree ( rsrvClientFreeList, client ); } diff --git a/modules/database/src/ioc/rsrv/server.h b/modules/database/src/ioc/rsrv/server.h index 5ddae8779..5810162ac 100644 --- a/modules/database/src/ioc/rsrv/server.h +++ b/modules/database/src/ioc/rsrv/server.h @@ -102,6 +102,7 @@ typedef struct client { unsigned recvBytesToDrain; unsigned priority; char disconnect; /* disconnect detected */ + char *sssb; // scalar string scratch buffer } client; /* Channel state shows which struct client list a From 53b0fc99af3e562b6581732828e20d4a2f4297a0 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 25 Aug 2026 18:12:39 -0700 Subject: [PATCH 107/141] rsrv: special case PUT with callback with scalar string When dataType==DBR_STRING && count==1, libca may optimize by sending less than 40 bytes. Re-arrange write_notify_action() so that this case can copy directly into the put notify buffer. Factor out write_notify_cancel() to make clear that the current message header / pBuffer are not used. Also, call out magic 60 second timeout. --- modules/database/src/ioc/rsrv/camessage.c | 143 ++++++++++++---------- 1 file changed, 81 insertions(+), 62 deletions(-) diff --git a/modules/database/src/ioc/rsrv/camessage.c b/modules/database/src/ioc/rsrv/camessage.c index 3d692e99f..6f8f1a2ff 100644 --- a/modules/database/src/ioc/rsrv/camessage.c +++ b/modules/database/src/ioc/rsrv/camessage.c @@ -1664,6 +1664,60 @@ void rsrvFreePutNotify ( client *pClient, } } +/* Only one concurrent write_notify (aka. put with callback) is allowed for each client. + * If a second write_notify is attempted before the first has completed, then wait for + * some time for the first to complete. Then cancel the first. + */ +static const double write_notify_timeout = 60.0; + +// wait for in-progress put notify to complete, or cancel after some time +static void write_notify_cancel(const struct channel_in_use *pciu) +{ + struct client* client = pciu->client; + // serialize concurrent put notifies + epicsMutexMustLock(client->putNotifyLock); + while(pciu->pPutNotify->busy){ + epicsMutexUnlock(client->putNotifyLock); + epicsEventStatus status = epicsEventWaitWithTimeout(client->blockSem, write_notify_timeout); + if ( status != epicsEventWaitOK ) { // timeout + char busyTmp; + void * asWritePvtTmp = 0; + + epicsMutexMustLock(client->putNotifyLock); + busyTmp = pciu->pPutNotify->busy; + epicsMutexUnlock(client->putNotifyLock); + + /* if any possibility of put notify still running + * then cancel it + */ + if ( busyTmp ) { + dbNotifyCancel(&pciu->pPutNotify->dbPutNotify); + } + epicsMutexMustLock(client->putNotifyLock); + busyTmp = pciu->pPutNotify->busy; + if ( busyTmp ) { + if ( pciu->pPutNotify->onExtraLaborQueue ) { + ellDelete ( &client->putNotifyQue, + &pciu->pPutNotify->node ); + } + pciu->pPutNotify->busy = FALSE; + asWritePvtTmp = pciu->pPutNotify->asWritePvt; + pciu->pPutNotify->asWritePvt = 0; + } + epicsMutexUnlock(client->putNotifyLock); + + if ( busyTmp ) { + log_header("put call back time out", client, + &pciu->pPutNotify->msg, 0); + asTrapWriteAfter ( asWritePvtTmp ); + putNotifyErrorReply (client, &pciu->pPutNotify->msg, ECA_PUTCBINPROG); + } + } + epicsMutexMustLock(client->putNotifyLock); + } + epicsMutexUnlock(client->putNotifyLock); +} + /* * write_notify_action() */ @@ -1694,60 +1748,10 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, return RSRV_OK; } - size = dbr_size_n (mp->m_dataType, mp->m_count); - if (size > mp->m_postsize) { - return RSRV_ERROR; - } - if ( pciu->pPutNotify ) { + write_notify_cancel(pciu); - /* - * serialize concurrent put notifies - */ - epicsMutexMustLock(client->putNotifyLock); - while(pciu->pPutNotify->busy){ - epicsMutexUnlock(client->putNotifyLock); - status = epicsEventWaitWithTimeout(client->blockSem,60.0); - if ( status != epicsEventWaitOK ) { - char busyTmp; - void * asWritePvtTmp = 0; - - epicsMutexMustLock(client->putNotifyLock); - busyTmp = pciu->pPutNotify->busy; - epicsMutexUnlock(client->putNotifyLock); - - /* - * if any possibility of put notify still running - * then cancel it - */ - if ( busyTmp ) { - dbNotifyCancel(&pciu->pPutNotify->dbPutNotify); - } - epicsMutexMustLock(client->putNotifyLock); - busyTmp = pciu->pPutNotify->busy; - if ( busyTmp ) { - if ( pciu->pPutNotify->onExtraLaborQueue ) { - ellDelete ( &client->putNotifyQue, - &pciu->pPutNotify->node ); - } - pciu->pPutNotify->busy = FALSE; - asWritePvtTmp = pciu->pPutNotify->asWritePvt; - pciu->pPutNotify->asWritePvt = 0; - } - epicsMutexUnlock(client->putNotifyLock); - - if ( busyTmp ) { - log_header("put call back time out", client, - &pciu->pPutNotify->msg, 0); - asTrapWriteAfter ( asWritePvtTmp ); - putNotifyErrorReply (client, &pciu->pPutNotify->msg, ECA_PUTCBINPROG); - } - } - epicsMutexMustLock(client->putNotifyLock); - } - epicsMutexUnlock(client->putNotifyLock); - } - else { + } else { pciu->pPutNotify = rsrvAllocPutNotify ( pciu ); if ( ! pciu->pPutNotify ) { /* @@ -1761,6 +1765,8 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, } } + size = dbr_size_n (mp->m_dataType, mp->m_count); + if ( ! rsrvExpandPutNotify ( pciu->pPutNotify, size ) ) { log_header ( "no memory to initiate vector put notify", client, mp, 0 ); @@ -1768,20 +1774,33 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, return RSRV_ERROR; } + if (mp->m_dataType == DBR_STRING && mp->m_count == 1 && mp->m_postsize < size) { + // client sent DBR_STRING with truncated body. This is allowed when count==1. + // put notify buffer has sufficient capacity, so copy in directly + char *pPNbuf = pciu->pPutNotify->pbuffer; + memcpy(pPNbuf , pPayload, mp->m_postsize); + memset(pPNbuf + mp->m_postsize, 0 , size - mp->m_postsize); + + } else if (mp->m_postsize < size) { + log_header ( "truncated body", client, mp, 0); + return RSRV_ERROR; + + } else { + // copy/convert to host endian + status = caNetConvert ( + mp->m_dataType, pPayload, pciu->pPutNotify->pbuffer, + FALSE /* net -> host format */, mp->m_count ); + if ( status != ECA_NORMAL ) { + log_header ("invalid data type", client, mp, 0); + putNotifyErrorReply ( client, mp, status ); + return RSRV_ERROR; + } + } + pciu->pPutNotify->busy = TRUE; pciu->pPutNotify->onExtraLaborQueue = FALSE; pciu->pPutNotify->msg = *mp; pciu->pPutNotify->nRequest = mp->m_count; - - status = caNetConvert ( - mp->m_dataType, pPayload, pciu->pPutNotify->pbuffer, - FALSE /* net -> host format */, mp->m_count ); - if ( status != ECA_NORMAL ) { - log_header ("invalid data type", client, mp, 0); - putNotifyErrorReply ( client, mp, status ); - return RSRV_ERROR; - } - pciu->pPutNotify->dbrType = mp->m_dataType; pciu->pPutNotify->asWritePvt = asTrapWriteWithData ( From 7d0b9625a7df6365ece37309ca8021e650874391 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 15 Jul 2026 14:48:11 +0200 Subject: [PATCH 108/141] Add search path for epics-gdb-helper.py to assembler options Gcc before version 4.7 does not pass -I options to the assembler automatically. --- modules/database/src/ioc/dbStatic/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/database/src/ioc/dbStatic/Makefile b/modules/database/src/ioc/dbStatic/Makefile index e9bd95b8d..e3851f4fc 100644 --- a/modules/database/src/ioc/dbStatic/Makefile +++ b/modules/database/src/ioc/dbStatic/Makefile @@ -30,4 +30,6 @@ dbCore_SRCS += dbStaticRun.c dbCore_SRCS += dbStaticIocRegister.c dbCore_SRCS += dbCompleteRecord.cpp +dbStaticLib_CFLAGS_Linux = -Wa,-I,.. + CLEANS += dbLex.c dbYacc.c From 9edb40d2acdda5a17816e51795d42a511af0293a Mon Sep 17 00:00:00 2001 From: Jeremy Lorelli Date: Wed, 24 Jun 2026 16:58:09 -0700 Subject: [PATCH 109/141] libcom: Switch epicsThreadMustCreate to cantProceed() --- modules/libcom/src/osi/epicsThread.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/libcom/src/osi/epicsThread.cpp b/modules/libcom/src/osi/epicsThread.cpp index 5de8fd99b..c0b4d72ec 100644 --- a/modules/libcom/src/osi/epicsThread.cpp +++ b/modules/libcom/src/osi/epicsThread.cpp @@ -26,8 +26,8 @@ #include "epicsAlgorithm.h" #include "epicsTime.h" #include "epicsThread.h" -#include "epicsAssert.h" #include "epicsGuard.h" +#include "cantProceed.h" #include "errlog.h" using namespace std; @@ -345,7 +345,8 @@ extern "C" { { epicsThreadId id = epicsThreadCreate ( name, priority, stackSize, funptr, parm ); - assert ( id ); + if ( !id ) + cantProceed("epicsThreadMustCreate: epicsThreadCreate failed\n"); return id; } } // extern "C" From 849cff8698d1a4c21a0a1ad4f8808cc8927f0698 Mon Sep 17 00:00:00 2001 From: Jeremy Lorelli Date: Wed, 24 Jun 2026 16:58:31 -0700 Subject: [PATCH 110/141] libcom: Switch epicsMutexMustLock() to cantProceed() --- modules/libcom/src/osi/epicsMutex.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/libcom/src/osi/epicsMutex.h b/modules/libcom/src/osi/epicsMutex.h index 117767a48..c88f57e74 100644 --- a/modules/libcom/src/osi/epicsMutex.h +++ b/modules/libcom/src/osi/epicsMutex.h @@ -41,6 +41,7 @@ #ifndef epicsMutexh #define epicsMutexh +#include "cantProceed.h" #include "epicsAssert.h" #include "libComAPI.h" @@ -212,9 +213,12 @@ LIBCOM_API epicsMutexLockStatus epicsStdCall epicsMutexLock( * This routine does not return if the identifier is invalid. * \param ID The mutex identifier. **/ -#define epicsMutexMustLock(ID) { \ - epicsMutexLockStatus status = epicsMutexLock(ID); \ - assert(status == epicsMutexLockOK); \ +#define epicsMutexMustLock(ID) { \ + epicsMutexLockStatus status = epicsMutexLock(ID); \ + if(status != epicsMutexLockOK) { \ + cantProceed("epicsMutexMustLock() failed at %s:%d", \ + __FILE__, __LINE__); \ + } \ } /**\brief Similar to epicsMutexLock() except that the call returns immediately, From 3206c817c8ff10402126bdb8e5ed68312dea3053 Mon Sep 17 00:00:00 2001 From: Jeremy Lorelli Date: Wed, 24 Jun 2026 17:01:05 -0700 Subject: [PATCH 111/141] libcom: Make EPICS_ABORT_ON_ASSERT affect cantProceed EPICS_ABORT_ON_ASSERT was introduced to kill the entire IOC instead of suspending an individual thread on assert failure. This behavior, however, was not implemented for cantProceed, which left most of the epicsMustBlah APIs with the suspention behavior (except for a couple APIs that called assert() instead). --- modules/libcom/src/misc/cantProceed.c | 19 +++++++++++++++---- modules/libcom/src/osi/epicsMutex.h | 12 ++++++------ .../libcom/src/osi/os/RTEMS-score/osdTime.cpp | 5 +++-- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/modules/libcom/src/misc/cantProceed.c b/modules/libcom/src/misc/cantProceed.c index 7afb4750c..19faca45b 100644 --- a/modules/libcom/src/misc/cantProceed.c +++ b/modules/libcom/src/misc/cantProceed.c @@ -15,6 +15,7 @@ #include #include "errlog.h" +#include "envDefs.h" #include "cantProceed.h" #include "epicsThread.h" #include "epicsStackTrace.h" @@ -53,20 +54,30 @@ LIBCOM_API void * mallocMustSucceed(size_t size, const char *msg) LIBCOM_API void cantProceed(const char *msg, ...) { + int shouldAbort = 0; va_list pvar; va_start(pvar, msg); if (msg) errlogVprintf(msg, pvar); va_end(pvar); - errlogPrintf(ANSI_RED("CRITICAL ERROR") " Thread %s (%p) can't proceed, suspending.\n", - epicsThreadGetNameSelf(), epicsThreadGetIdSelf()); + envGetBoolConfigParam(&EPICS_ABORT_ON_ASSERT, &shouldAbort); + + errlogPrintf(ANSI_RED("CRITICAL ERROR") " Thread %s (%p) can't proceed, %s.\n", + epicsThreadGetNameSelf(), epicsThreadGetIdSelf(), shouldAbort ? "aborting" : "suspending"); epicsStackTrace(); errlogFlush(); epicsThreadSleep(1.0); - while (1) - epicsThreadSuspendSelf(); + + if (shouldAbort) { + errlogPrintf("cantProceed() Calling abort()\n"); + errlogFlush(); + abort(); + } else { + while (1) + epicsThreadSuspendSelf(); + } } diff --git a/modules/libcom/src/osi/epicsMutex.h b/modules/libcom/src/osi/epicsMutex.h index c88f57e74..2b0e1ec40 100644 --- a/modules/libcom/src/osi/epicsMutex.h +++ b/modules/libcom/src/osi/epicsMutex.h @@ -213,12 +213,12 @@ LIBCOM_API epicsMutexLockStatus epicsStdCall epicsMutexLock( * This routine does not return if the identifier is invalid. * \param ID The mutex identifier. **/ -#define epicsMutexMustLock(ID) { \ - epicsMutexLockStatus status = epicsMutexLock(ID); \ - if(status != epicsMutexLockOK) { \ - cantProceed("epicsMutexMustLock() failed at %s:%d", \ - __FILE__, __LINE__); \ - } \ +#define epicsMutexMustLock(ID) { \ + epicsMutexLockStatus status = epicsMutexLock(ID); \ + if(status != epicsMutexLockOK) { \ + cantProceed("epicsMutexMustLock() failed at %s:%d\n", \ + __FILE__, __LINE__); \ + } \ } /**\brief Similar to epicsMutexLock() except that the call returns immediately, diff --git a/modules/libcom/src/osi/os/RTEMS-score/osdTime.cpp b/modules/libcom/src/osi/os/RTEMS-score/osdTime.cpp index b8527d756..36fdeb252 100644 --- a/modules/libcom/src/osi/os/RTEMS-score/osdTime.cpp +++ b/modules/libcom/src/osi/os/RTEMS-score/osdTime.cpp @@ -15,19 +15,20 @@ #define EPICS_EXPOSE_LIBCOM_MONOTONIC_PRIVATE #include -#include #include #include #include #include #include -#include #include "epicsTime.h" #include "osdTime.h" #include "osiNTPTime.h" #include "osiClockTime.h" #include "generalTimeSup.h" +#include +#include + extern "C" { extern rtems_interval rtemsTicksPerSecond; From 013d97b5a61034f8e11a7697adfb290e577a8dcc Mon Sep 17 00:00:00 2001 From: Jeremy Lorelli Date: Thu, 2 Jul 2026 19:01:55 -0700 Subject: [PATCH 112/141] libcom: Update doc comment for cantProceed --- modules/libcom/src/misc/cantProceed.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/libcom/src/misc/cantProceed.h b/modules/libcom/src/misc/cantProceed.h index 910ace1fe..82cb4af64 100644 --- a/modules/libcom/src/misc/cantProceed.h +++ b/modules/libcom/src/misc/cantProceed.h @@ -34,12 +34,14 @@ extern "C" { #endif -/** \brief Suspend this thread, the caller cannot continue or return. +/** \brief Suspend this thread or call abort(), the caller cannot continue + * or return. * * The effect of calling this is to print the error message followed by - * the name of the thread that is being suspended. A stack trace will + * the name of the thread that can't proceed. A stack trace will * also be shown if supported by the OS, and the thread is suspended - * inside an infinite loop. + * inside an infinite loop, or the process aborted, depending on + * EPICS_ABORT_ON_ASSERT. * \param errorMessage A printf-style error message describing the error. * \param ... Any parameters required for the error message. */ From 0b25bd505c9c867c326dee70ce3ffb05f6a761c5 Mon Sep 17 00:00:00 2001 From: Simon Rose Date: Tue, 22 Sep 2026 14:24:59 +0200 Subject: [PATCH 113/141] Fix tiny typo --- modules/database/src/ioc/misc/miscIocRegister.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/misc/miscIocRegister.c b/modules/database/src/ioc/misc/miscIocRegister.c index 5e764b708..68b6e79e8 100644 --- a/modules/database/src/ioc/misc/miscIocRegister.c +++ b/modules/database/src/ioc/misc/miscIocRegister.c @@ -47,7 +47,7 @@ static void iocRunCallFunc(const iocshArgBuf *args) /* iocPause */ static const iocshFuncDef iocPauseFuncDef = {"iocPause",0,NULL, "Brings a running IOC to a quiescent state with all record processing frozen.\n" - "See more: iocBuild, iocRub, iocInit\n"}; + "See more: iocBuild, iocRun, iocInit\n"}; static void iocPauseCallFunc(const iocshArgBuf *args) { iocshSetError(iocPause()); From e699b75ba3f18a632feb4bd544dbe4149685ef68 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 5 Oct 2026 15:04:44 -0700 Subject: [PATCH 114/141] Com: note ACF name lookup error and action --- modules/libcom/src/as/asLibRoutines.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libcom/src/as/asLibRoutines.c b/modules/libcom/src/as/asLibRoutines.c index f2b2f0854..f510022a5 100644 --- a/modules/libcom/src/as/asLibRoutines.c +++ b/modules/libcom/src/as/asLibRoutines.c @@ -1243,7 +1243,7 @@ static long asHagAddHost(HAG *phag,const char *host) if(aToIPAddr(host, 0, &addr)) { static const char unresolved[] = "unresolved:"; - errlogPrintf("ACF: Unable to resolve host '%s'\n", host); + errlogPrintf(ERL_ERROR ": ACF: Unable to resolve host '%s'. Ignoring.\n", host); phagname = asCalloc(1, sizeof(*phagname) + sizeof(unresolved)-1+strlen(host)); strcpy(phagname->host, unresolved); From 4c9b32b7af44b30392efb15cf3eb732fa8f3a63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Thu, 8 Oct 2026 18:15:36 -0300 Subject: [PATCH 115/141] Fix release note typo --- documentation/RELEASE-7.0.9.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/RELEASE-7.0.9.md b/documentation/RELEASE-7.0.9.md index 71883905d..8b31f0fdf 100644 --- a/documentation/RELEASE-7.0.9.md +++ b/documentation/RELEASE-7.0.9.md @@ -60,7 +60,7 @@ field actually changed. There are two changes to `msi` included here. -`msi` now treats files included by .template or .substutiions files in a more +`msi` now treats files included by .template or .substitutions files in a more consistent way: for relative paths, it will always look relative to the current working directory if no `-I` flags are passed, and if they are passed then it will search for the _relative_ path from each of those flags. That is, the From 81adbe388a0fb46bc84fee60ef889616ac78e36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Thu, 8 Oct 2026 18:16:03 -0300 Subject: [PATCH 116/141] Add retroactive release note for dbLoadTemplate in 7.0.9 This change was implemented in 1cd141c54 (dbLoadTemplate: error propagation and more context on .db syntax error, 2022-02-24), but its effects weren't documented then. --- documentation/RELEASE-7.0.9.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/documentation/RELEASE-7.0.9.md b/documentation/RELEASE-7.0.9.md index 8b31f0fdf..fd60a9cbc 100644 --- a/documentation/RELEASE-7.0.9.md +++ b/documentation/RELEASE-7.0.9.md @@ -114,6 +114,12 @@ already be conditionally casting to/from the appropriate type. This release fixes the false positives failures when building with `_FORTIFY_SOURCE` level 3. The override introduced in 7.0.8.1 has been removed. +### Improve error propagation in `dbLoadTemplate` + +If an error occurs while processing a `.substitutions` file (e.g. a syntax +error in a `.template` file), `dbLoadTemplate` will stop processing that file +and return an error. This means that further substitutions won't occur. + ### Other - genVersionHeader: work with git submodules and worktrees. From d606ed927b0b933ee2912cd2e56f655d229fd7d2 Mon Sep 17 00:00:00 2001 From: Sang-Woo Kim Date: Mon, 12 Oct 2026 07:54:48 +0900 Subject: [PATCH 117/141] dbNotify: honour processRequest in processNotifyCommon (#988) * dbNotify: honour processRequest in processNotifyCommon dbNotify.h:132-137 documents that a process request is issued when the requester asked for one and the record is passive, but 056304409 added that rule and the enumerator while testing only processGetRequest, so processRequest has always yielded no put, no process, and notifyOK. --- modules/database/src/ioc/db/dbNotify.c | 3 +- modules/database/test/ioc/db/Makefile | 7 + modules/database/test/ioc/db/dbNotifyTest.c | 144 ++++++++++++++++++ modules/database/test/ioc/db/dbNotifyTest.db | 7 + .../database/test/ioc/db/epicsRunDbTests.c | 2 + 5 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 modules/database/test/ioc/db/dbNotifyTest.c create mode 100644 modules/database/test/ioc/db/dbNotifyTest.db diff --git a/modules/database/src/ioc/db/dbNotify.c b/modules/database/src/ioc/db/dbNotify.c index 22f993555..60f7ef31b 100644 --- a/modules/database/src/ioc/db/dbNotify.c +++ b/modules/database/src/ioc/db/dbNotify.c @@ -245,7 +245,8 @@ static void processNotifyCommon(processNotify *ppn, dbCommon *precord, int first (dbChannelFldDes(ppn->chan)->process_passive && precord->scan == 0))) doProcess = 1; else - if (ppn->requestType == processGetRequest && + if ((ppn->requestType == processRequest || + ppn->requestType == processGetRequest) && precord->scan == 0) doProcess = 1; diff --git a/modules/database/test/ioc/db/Makefile b/modules/database/test/ioc/db/Makefile index f6f009de7..43e73ad15 100644 --- a/modules/database/test/ioc/db/Makefile +++ b/modules/database/test/ioc/db/Makefile @@ -49,6 +49,13 @@ dbScanTest_SRCS += dbTestIoc_registerRecordDeviceDriver.cpp testHarness_SRCS += dbScanTest.c TESTS += dbScanTest +TESTPROD_HOST += dbNotifyTest +dbNotifyTest_SRCS += dbNotifyTest.c +dbNotifyTest_SRCS += dbTestIoc_registerRecordDeviceDriver.cpp +testHarness_SRCS += dbNotifyTest.c +TESTFILES += ../dbNotifyTest.db +TESTS += dbNotifyTest + TESTPROD_HOST += dbShutdownTest dbShutdownTest_SRCS += dbShutdownTest.c dbShutdownTest_SRCS += dbTestIoc_registerRecordDeviceDriver.cpp diff --git a/modules/database/test/ioc/db/dbNotifyTest.c b/modules/database/test/ioc/db/dbNotifyTest.c new file mode 100644 index 000000000..477c12e57 --- /dev/null +++ b/modules/database/test/ioc/db/dbNotifyTest.c @@ -0,0 +1,144 @@ +/*************************************************************************\ +* SPDX-License-Identifier: EPICS +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +/* Which requestType leads dbProcessNotify() to process the record, per the + * three rules stated in dbNotify.h. + */ + +#include + +#include "dbAccess.h" +#include "dbChannel.h" +#include "dbNotify.h" +#include "epicsEvent.h" +#include "errlog.h" + +#include "dbUnitTest.h" +#include "testMain.h" + +void dbTestIoc_registerRecordDeviceDriver(struct dbBase *); + +typedef struct { + processNotify notify; + epicsEventId done; + int puts; /* putCallback calls */ + int gets; /* getCallback calls */ + int didPut; /* what putCallback reports back */ + /* Read in doneCallback: dbNotifyCancel() overwrites notify.status. */ + notifyStatus status; + int wasProcessed; +} request; + +static int putCallback(processNotify *ppn, notifyPutType type) +{ + request *r = (request *) ppn->usrPvt; + epicsUInt8 one = 1; + + r->puts++; + if (!r->didPut) + return 0; + if (dbChannelPut(ppn->chan, DBR_UCHAR, &one, 1)) + ppn->status = notifyError; + return 1; +} + +static void getCallback(processNotify *ppn, notifyGetType type) +{ + request *r = (request *) ppn->usrPvt; + epicsUInt8 scratch; + long count = 1; + + r->gets++; + dbChannelGet(ppn->chan, DBR_UCHAR, &scratch, NULL, &count, NULL); +} + +static void doneCallback(processNotify *ppn) +{ + request *r = (request *) ppn->usrPvt; + + r->status = ppn->status; + r->wasProcessed = ppn->wasProcessed; + epicsEventMustTrigger(r->done); +} + +/* One complete request against pv, run to its doneCallback. */ +static void run(request *r, const char *what, const char *pv, + notifyRequestType type, int didPut) +{ + memset(r, 0, sizeof(*r)); + r->didPut = didPut; + r->done = epicsEventMustCreate(epicsEventEmpty); + r->notify.requestType = type; + r->notify.putCallback = putCallback; + r->notify.getCallback = getCallback; + r->notify.doneCallback = doneCallback; + r->notify.usrPvt = r; + r->notify.chan = dbChannelCreate(pv); + if (!r->notify.chan || dbChannelOpen(r->notify.chan)) + testAbort("dbChannelCreate(\"%s\") failed", pv); + + testDiag("%s: %s", what, pv); + dbProcessNotify(&r->notify); + testOk(epicsEventWaitWithTimeout(r->done, 10.0) == epicsEventWaitOK, + "doneCallback ran"); + + dbNotifyCancel(&r->notify); + dbChannelDelete(r->notify.chan); + epicsEventDestroy(r->done); +} + +MAIN(dbNotifyTest) +{ + request r; + + testPlan(19); + + testdbPrepare(); + testdbReadDatabase("dbTestIoc.dbd", NULL, NULL); + dbTestIoc_registerRecordDeviceDriver(pdbbase); + testdbReadDatabase("dbNotifyTest.db", NULL, NULL); + + eltc(0); + testIocInitOk(); + eltc(1); + + run(&r, "rule 1, process request on a passive record", + "passive.VAL", processRequest, 0); + testOk1(r.wasProcessed == 1); + testOk1(r.status == notifyOK); + testOk(r.puts == 0 && r.gets == 0, + "processRequest calls neither the put nor the get callback"); + + run(&r, "rule 1 does not apply when the record is not passive", + "scanned.VAL", processRequest, 0); + testOk1(r.wasProcessed == 0); + testOk1(r.status == notifyOK); + + run(&r, "rule 2, a put through PROC", + "passive.PROC", putProcessRequest, 1); + testOk1(r.wasProcessed == 1); + testOk1(r.puts == 1); + + run(&r, "rule 2 needs the put to have happened", + "passive.PROC", putProcessRequest, 0); + testOk1(r.wasProcessed == 0); + testOk1(r.puts == 1); + + run(&r, "rule 2 needs PROC or a process-passive field", + "passive.VAL", putProcessRequest, 1); + testOk1(r.wasProcessed == 0); + testOk1(r.puts == 1); + + run(&r, "rule 3, processGet on a passive record", + "passive.VAL", processGetRequest, 0); + testOk1(r.wasProcessed == 1); + testOk1(r.gets == 1); + + testIocShutdownOk(); + testdbCleanup(); + + return testDone(); +} diff --git a/modules/database/test/ioc/db/dbNotifyTest.db b/modules/database/test/ioc/db/dbNotifyTest.db new file mode 100644 index 000000000..0e7d2bf07 --- /dev/null +++ b/modules/database/test/ioc/db/dbNotifyTest.db @@ -0,0 +1,7 @@ +record(x, "passive") { +} + +record(x, "scanned") { + field(SCAN, "Event") + field(EVNT, "neverTriggered") +} diff --git a/modules/database/test/ioc/db/epicsRunDbTests.c b/modules/database/test/ioc/db/epicsRunDbTests.c index 6c7ce84c9..8d68ecf03 100644 --- a/modules/database/test/ioc/db/epicsRunDbTests.c +++ b/modules/database/test/ioc/db/epicsRunDbTests.c @@ -25,6 +25,7 @@ int dbServerTest(void); int dbCaStatsTest(void); int dbShutdownTest(void); int dbScanTest(void); +int dbNotifyTest(void); int scanIoTest(void); int dbLockTest(void); int dbPutLinkTest(void); @@ -48,6 +49,7 @@ void epicsRunDbTests(void) runTest(dbCaStatsTest); runTest(dbShutdownTest); runTest(dbScanTest); + runTest(dbNotifyTest); runTest(scanIoTest); runTest(dbLockTest); runTest(dbPutLinkTest); From c74d4363d9a12bff39c8ec72261c59ddc7bbf4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rea=20Domitrovi=C4=87?= Date: Mon, 12 Oct 2026 00:56:17 +0200 Subject: [PATCH 118/141] Added disclaimer for default behaviour of SHFT and OFFS fields (#989) --- .../database/src/std/rec/fanoutRecord.dbd.pod | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/database/src/std/rec/fanoutRecord.dbd.pod b/modules/database/src/std/rec/fanoutRecord.dbd.pod index 7363f8162..a313f09e1 100644 --- a/modules/database/src/std/rec/fanoutRecord.dbd.pod +++ b/modules/database/src/std/rec/fanoutRecord.dbd.pod @@ -80,16 +80,28 @@ If bit 0 (LSB) is set, LNK0 is processed. =item * -If bit 1 is set, LNK2 is processed. +If bit 1 is set, LNK1 is processed. =item * -If bit 2 is set, LNK3 is processed, etc. +If bit 2 is set, LNK2 is processed, etc. =back =back +If not set, the SHFT field is set to -1, so bits from SELN are shifted left by 1. + +=head4 Note about SHFT and OFFS fields + +The first versions of the fanout record had LNK fields starting with index ONE +(LNK1). The fanout record now supports 16 links, starting from index ZERO (LNK0). +The default behaviour of the SHFT and OFFS fields was introduced for compatibility +with old databases that used fanout records with links indexed from one. + +B + SELN reads its value from SELL. SELL can be a constant, a database link, or a channel access link. If a constant, SELN is initialized with the constant value and can be changed via dbPuts. For database/channel access links, SELN is From e3fc2bbcbeb33211437dedd08a919c4681f82f32 Mon Sep 17 00:00:00 2001 From: pheest Date: Thu, 15 Oct 2026 03:17:15 +0100 Subject: [PATCH 119/141] Fix confusion in the mbbiDirect and mbboDirect record code & docs The mbbiDirect Record code and docs were using both read_mbbi() and read_mbbiDirect() for the dset routine name, similar for mbboDirect. (#963) --- modules/database/src/std/dev/devMbbiDirectSoft.c | 6 +++--- modules/database/src/std/dev/devMbbiDirectSoftRaw.c | 6 +++--- modules/database/src/std/dev/devMbboDirectSoft.c | 4 ++-- modules/database/src/std/dev/devMbboDirectSoftCallback.c | 4 ++-- modules/database/src/std/dev/devMbboDirectSoftRaw.c | 4 ++-- modules/database/src/std/rec/mbbiDirectRecord.c | 8 ++++---- modules/database/src/std/rec/mbbiDirectRecord.dbd.pod | 4 ++-- modules/database/src/std/rec/mbboDirectRecord.c | 8 ++++---- modules/database/src/std/rec/mbboDirectRecord.dbd.pod | 2 +- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/database/src/std/dev/devMbbiDirectSoft.c b/modules/database/src/std/dev/devMbbiDirectSoft.c index 2d02eee80..bd68bcca3 100644 --- a/modules/database/src/std/dev/devMbbiDirectSoft.c +++ b/modules/database/src/std/dev/devMbbiDirectSoft.c @@ -27,11 +27,11 @@ /* Create the dset for devMbbiDirectSoft */ static long init_record(dbCommon *pcommon); -static long read_mbbi(mbbiDirectRecord *prec); +static long read_mbbiDirect(mbbiDirectRecord *prec); mbbidirectdset devMbbiDirectSoft = { {5, NULL, NULL, init_record, NULL}, - read_mbbi + read_mbbiDirect }; epicsExportAddress(dset, devMbbiDirectSoft); @@ -60,7 +60,7 @@ static long readLocked(struct link *pinp, void *dummy) return 2; } -static long read_mbbi(mbbiDirectRecord *prec) +static long read_mbbiDirect(mbbiDirectRecord *prec) { long status = dbLinkDoLocked(&prec->inp, readLocked, NULL); diff --git a/modules/database/src/std/dev/devMbbiDirectSoftRaw.c b/modules/database/src/std/dev/devMbbiDirectSoftRaw.c index 1edc420ea..1724b063c 100644 --- a/modules/database/src/std/dev/devMbbiDirectSoftRaw.c +++ b/modules/database/src/std/dev/devMbbiDirectSoftRaw.c @@ -27,11 +27,11 @@ /* Create the dset for devMbbiDirectSoftRaw */ static long init_record(dbCommon *pcommon); -static long read_mbbi(mbbiDirectRecord *prec); +static long read_mbbiDirect(mbbiDirectRecord *prec); mbbidirectdset devMbbiDirectSoftRaw = { {5, NULL, NULL, init_record, NULL}, - read_mbbi + read_mbbiDirect }; epicsExportAddress(dset, devMbbiDirectSoftRaw); @@ -49,7 +49,7 @@ static long init_record(dbCommon *pcommon) return 0; } -static long read_mbbi(mbbiDirectRecord *prec) +static long read_mbbiDirect(mbbiDirectRecord *prec) { if (!dbGetLink(&prec->inp, DBR_ULONG, &prec->rval, 0, 0)) { prec->rval &= prec->mask; diff --git a/modules/database/src/std/dev/devMbboDirectSoft.c b/modules/database/src/std/dev/devMbboDirectSoft.c index 4c362a852..406da9388 100644 --- a/modules/database/src/std/dev/devMbboDirectSoft.c +++ b/modules/database/src/std/dev/devMbboDirectSoft.c @@ -20,7 +20,7 @@ #include "mbboDirectRecord.h" #include "epicsExport.h" -static long write_mbbo(mbboDirectRecord *prec) +static long write_mbboDirect(mbboDirectRecord *prec) { dbPutLink(&prec->out, DBR_ULONG, &prec->val, 1); return 0; @@ -29,6 +29,6 @@ static long write_mbbo(mbboDirectRecord *prec) /* Create the dset for devMbboDirectSoft */ mbbodirectdset devMbboDirectSoft = { {5, NULL, NULL, NULL, NULL}, - write_mbbo + write_mbboDirect }; epicsExportAddress(dset, devMbboDirectSoft); diff --git a/modules/database/src/std/dev/devMbboDirectSoftCallback.c b/modules/database/src/std/dev/devMbboDirectSoftCallback.c index 861e7fbec..b63d201ef 100644 --- a/modules/database/src/std/dev/devMbboDirectSoftCallback.c +++ b/modules/database/src/std/dev/devMbboDirectSoftCallback.c @@ -22,7 +22,7 @@ #include "mbboDirectRecord.h" #include "epicsExport.h" -static long write_mbbo(mbboDirectRecord *prec) +static long write_mbboDirect(mbboDirectRecord *prec) { struct link *plink = &prec->out; long status; @@ -42,6 +42,6 @@ static long write_mbbo(mbboDirectRecord *prec) /* Create the dset for devMbboDirectSoftCallback */ mbbodirectdset devMbboDirectSoftCallback = { {5, NULL, NULL, NULL, NULL}, - write_mbbo + write_mbboDirect }; epicsExportAddress(dset, devMbboDirectSoftCallback); diff --git a/modules/database/src/std/dev/devMbboDirectSoftRaw.c b/modules/database/src/std/dev/devMbboDirectSoftRaw.c index 876ec65fb..db861eaa8 100644 --- a/modules/database/src/std/dev/devMbboDirectSoftRaw.c +++ b/modules/database/src/std/dev/devMbboDirectSoftRaw.c @@ -33,7 +33,7 @@ static long init_record(dbCommon *pcommon) return 2; /* Don't convert */ } -static long write_mbbo(mbboDirectRecord *prec) +static long write_mbboDirect(mbboDirectRecord *prec) { epicsUInt32 data; @@ -45,6 +45,6 @@ static long write_mbbo(mbboDirectRecord *prec) /* Create the dset for devMbboDirectSoftRaw */ mbbodirectdset devMbboDirectSoftRaw = { {5, NULL, NULL, init_record, NULL}, - write_mbbo + write_mbboDirect }; epicsExportAddress(dset, devMbboDirectSoftRaw); diff --git a/modules/database/src/std/rec/mbbiDirectRecord.c b/modules/database/src/std/rec/mbbiDirectRecord.c index 2903c6b4f..4cd91e484 100644 --- a/modules/database/src/std/rec/mbbiDirectRecord.c +++ b/modules/database/src/std/rec/mbbiDirectRecord.c @@ -100,7 +100,7 @@ static long init_record(struct dbCommon *pcommon, int pass) return S_dev_noDSET; } - if ((pdset->common.number < 5) || (pdset->read_mbbi == NULL)) { + if ((pdset->common.number < 5) || (pdset->read_mbbiDirect == NULL)) { recGblRecordError(S_dev_missingSup, prec, "mbbiDirect: init_record"); return S_dev_missingSup; } @@ -137,9 +137,9 @@ static long process(struct dbCommon *pcommon) long status; int pact = prec->pact; - if ((pdset == NULL) || (pdset->read_mbbi == NULL)) { + if ((pdset == NULL) || (pdset->read_mbbiDirect == NULL)) { prec->pact = TRUE; - recGblRecordError(S_dev_missingSup, prec, "read_mbbi"); + recGblRecordError(S_dev_missingSup, prec, "read_mbbiDirect"); return S_dev_missingSup; } @@ -250,7 +250,7 @@ static long readValue(mbbiDirectRecord *prec) switch (prec->simm) { case menuSimmNO: - status = pdset->read_mbbi(prec); + status = pdset->read_mbbiDirect(prec); break; case menuSimmYES: diff --git a/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod b/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod index 43d45352c..46e033ef7 100644 --- a/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod +++ b/modules/database/src/std/rec/mbbiDirectRecord.dbd.pod @@ -87,7 +87,7 @@ Parameters> for more on the record name (NAME) and description (DESC) fields. %struct mbbiDirectRecord; %typedef struct mbbidirectdset { % dset common; /* init_record returns: (-1,0) => (failure, success)*/ - % long (*read_mbbi)(struct mbbiDirectRecord *prec); /* (0, 2) => (success, success no convert)*/ + % long (*read_mbbiDirect)(struct mbbiDirectRecord *prec); /* (0, 2) => (success, success no convert)*/ %} mbbidirectdset; %#define HAS_mbbidirectdset % @@ -591,7 +591,7 @@ read_mbbiDirect calls recGblGetLinkValue to read the current value of VAL. See L for a further explanation. -If the return status of recGblGetLinkValue is zero, then read_mbbi sets UDF to +If the return status of recGblGetLinkValue is zero, then read_mbbiDirect sets UDF to FALSE. The status of recGblGetLinkValue is returned. =head4 Raw Soft Channel diff --git a/modules/database/src/std/rec/mbboDirectRecord.c b/modules/database/src/std/rec/mbboDirectRecord.c index 6d3347abb..c52b43135 100644 --- a/modules/database/src/std/rec/mbboDirectRecord.c +++ b/modules/database/src/std/rec/mbboDirectRecord.c @@ -109,7 +109,7 @@ static long init_record(struct dbCommon *pcommon, int pass) return S_dev_noDSET; } - if ((pdset->common.number < 5) || (pdset->write_mbbo == NULL)) { + if ((pdset->common.number < 5) || (pdset->write_mbboDirect == NULL)) { recGblRecordError(S_dev_missingSup, prec, "mbboDirect: init_record"); return S_dev_missingSup; } @@ -170,9 +170,9 @@ static long process(struct dbCommon *pcommon) long status = 0; int pact = prec->pact; - if ((pdset == NULL) || (pdset->write_mbbo == NULL)) { + if ((pdset == NULL) || (pdset->write_mbboDirect == NULL)) { prec->pact = TRUE; - recGblRecordError(S_dev_missingSup, prec, "write_mbbo"); + recGblRecordError(S_dev_missingSup, prec, "write_mbboDirect"); return S_dev_missingSup; } @@ -360,7 +360,7 @@ static long writeValue(mbboDirectRecord *prec) switch (prec->simm) { case menuSimmNO: - status = pdset->write_mbbo(prec); + status = pdset->write_mbboDirect(prec); break; case menuSimmYES: diff --git a/modules/database/src/std/rec/mbboDirectRecord.dbd.pod b/modules/database/src/std/rec/mbboDirectRecord.dbd.pod index b7cff9e49..a473edaa7 100644 --- a/modules/database/src/std/rec/mbboDirectRecord.dbd.pod +++ b/modules/database/src/std/rec/mbboDirectRecord.dbd.pod @@ -130,7 +130,7 @@ Parameters> for more on the record name (NAME) and description (DESC) fields. %struct mbboDirectRecord; %typedef struct mbbodirectdset { % dset common; /*init_record returns: (0, 2)=>(success, success no convert)*/ - % long (*write_mbbo)(struct mbboDirectRecord *prec); /*returns: (0, 2)=>(success, success no convert)*/ + % long (*write_mbboDirect)(struct mbboDirectRecord *prec); /*returns: (0, 2)=>(success, success no convert)*/ %} mbbodirectdset; %#define HAS_mbbodirectdset % From 476627da07d71f34404c2b67a705b7ed133a9c79 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 10 Apr 2026 16:47:27 -0700 Subject: [PATCH 120/141] configure: no more silent rules! --- configure/RULES.Db | 248 +++++++++++----------- configure/RULES_BUILD | 117 +++++----- configure/RULES_EXPAND | 10 +- configure/RULES_FILE_TYPE | 6 +- configure/RULES_MODULES | 6 +- configure/RULES_OCTAVE | 2 +- documentation/Makefile | 16 +- modules/ca/src/perl/Makefile | 2 +- modules/database/src/ioc/db/RULES | 6 +- modules/database/src/std/rec/RULES | 2 +- modules/database/src/tools/Makefile | 4 +- modules/libcom/src/misc/RULES | 4 +- src/template/ext/top/configure/RULES_IDL | 4 +- src/template/ext/top/configure/RULES_JAVA | 22 +- 14 files changed, 224 insertions(+), 225 deletions(-) diff --git a/configure/RULES.Db b/configure/RULES.Db index 53dc81037..efc8d78c8 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -209,9 +209,9 @@ build: $(COMMON_DBS) $(INSTALL_DBS) \ clean: db_clean db_clean: - @$(RM) $(COMMONS) $(DBDDEPENDS_FILES) - @$(RM) *_registerRecordDeviceDriver.cpp - @$(RM) $(TARGETS) + $(RM) $(COMMONS) $(DBDDEPENDS_FILES) + $(RM) *_registerRecordDeviceDriver.cpp + $(RM) $(TARGETS) .PHONY: db_clean @@ -221,91 +221,91 @@ realclean: clean # Dependency files %Record.h$(DEP): $(COMMON_DIR)/%Record.dbd $(DBDTORECTYPEH_dep) - @$(RM) $@ - @$(DBTORECORDTYPEH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout - @$(MV) $@.stdout $@ + $(RM) $@ + $(DBTORECORDTYPEH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout + echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout + $(MV) $@.stdout $@ %Record.h$(DEP): %Record.dbd $(DBDTORECTYPEH_dep) - @$(RM) $@ - @$(DBTORECORDTYPEH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout - @$(MV) $@.stdout $@ + $(RM) $@ + $(DBTORECORDTYPEH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout + echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout + $(MV) $@.stdout $@ %Record.h$(DEP): ../%Record.dbd $(DBDTORECTYPEH_dep) - @$(RM) $@ - @$(DBTORECORDTYPEH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout - @$(MV) $@.stdout $@ + $(RM) $@ + $(DBTORECORDTYPEH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout + echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout + $(MV) $@.stdout $@ menu%.h$(DEP): $(COMMON_DIR)/menu%.dbd $(DBDTOMENUH_dep) - @$(RM) $@ - @$(DBTOMENUH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout - @$(MV) $@.stdout $@ + $(RM) $@ + $(DBTOMENUH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout + echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout + $(MV) $@.stdout $@ menu%.h$(DEP): menu%.dbd $(DBDTOMENUH_dep) - @$(RM) $@ - @$(DBTOMENUH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout - @$(MV) $@.stdout $@ + $(RM) $@ + $(DBTOMENUH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout + echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout + $(MV) $@.stdout $@ menu%.h$(DEP): ../menu%.dbd $(DBDTOMENUH_dep) - @$(RM) $@ - @$(DBTOMENUH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout - @$(MV) $@.stdout $@ + $(RM) $@ + $(DBTOMENUH) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout + echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout + $(MV) $@.stdout $@ %.dbd$(DEP): %.dbd.pod - @$(RM) $@ - @echo $(COMMONDEP_TARGET): ../Makefile > $@.stdout - @$(MV) $@.stdout $@ + $(RM) $@ + echo $(COMMONDEP_TARGET): ../Makefile > $@.stdout + $(MV) $@.stdout $@ %.dbd$(DEP): %Include.dbd - @$(RM) $@ - @$(DBEXPAND) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout - @$(MV) $@.stdout $@ + $(RM) $@ + $(DBEXPAND) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout + echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout + $(MV) $@.stdout $@ %.dbd$(DEP): ../%Include.dbd - @$(RM) $@ - @$(DBEXPAND) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout - @$(MV) $@.stdout $@ + $(RM) $@ + $(DBEXPAND) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout + echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout + $(MV) $@.stdout $@ %.dbd$(DEP): $($*_DBD) - @$(RM) $@ - @$(DBEXPAND) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $($*_DBD) > $@.stdout - @echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout - @$(MV) $@.stdout $@ + $(RM) $@ + $(DBEXPAND) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $($*_DBD) > $@.stdout + echo $(COMMONDEP_TARGET): ../Makefile >> $@.stdout + $(MV) $@.stdout $@ %.db$(DEP): %$(SUBST_SUFFIX) - @$(RM) $@ + $(RM) $@ $(MSI3_15) -D $(DBFLAGS) -o $(COMMONDEP_TARGET) -S$< $(TEMPLATE_FILENAME) > $@.stdout - @$(MV) $@.stdout $@ + $(MV) $@.stdout $@ %.db$(DEP): ../%$(SUBST_SUFFIX) - @$(RM) $@ + $(RM) $@ $(MSI3_15) -D $(DBFLAGS) -o $(COMMONDEP_TARGET) -S$< $(TEMPLATE_FILENAME) > $@.stdout - @$(MV) $@.stdout $@ + $(MV) $@.stdout $@ %.db$(DEP): %$(TEMPL_SUFFIX) - @$(RM) $@ + $(RM) $@ $(MSI3_15) -D $(DBFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @$(MV) $@.stdout $@ + $(MV) $@.stdout $@ %.db$(DEP): ../%$(TEMPL_SUFFIX) - @$(RM) $@ + $(RM) $@ $(MSI3_15) -D $(DBFLAGS) -o $(COMMONDEP_TARGET) $< > $@.stdout - @$(MV) $@.stdout $@ + $(MV) $@.stdout $@ %.acf$(DEP): %.acs - @$(RM) $@ - @$(ACFDEPENDS_CMD) + $(RM) $@ + $(ACFDEPENDS_CMD) %.acf$(DEP): ../%.acs - @$(RM) $@ - @$(ACFDEPENDS_CMD) + $(RM) $@ + $(ACFDEPENDS_CMD) .PRECIOUS: %$(DEP) @@ -317,17 +317,17 @@ menu%.h$(DEP): ../menu%.dbd $(DBDTOMENUH_dep) ifdef CREATESUBSTITUTIONS $(COMMON_DIR)/%$(SUBST_SUFFIX): $(ECHO) "Create substitutions" - @$(RM) $@ + $(RM) $@ $(CREATESUBSTITUTIONS) $@ endif $(INSTALL_DB)/%$(SUBST_SUFFIX): %$(SUBST_SUFFIX) $(ECHO) "Installing substitution file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) $(INSTALL_DB)/%$(SUBST_SUFFIX): ../%$(SUBST_SUFFIX) $(ECHO) "Installing substitution file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) .PRECIOUS: $(COMMON_DIR)/%$(SUBST_SUFFIX) @@ -336,11 +336,11 @@ $(INSTALL_DB)/%$(SUBST_SUFFIX): ../%$(SUBST_SUFFIX) $(INSTALL_DB)/%$(TEMPL_SUFFIX): %$(TEMPL_SUFFIX) $(ECHO) "Installing template file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) $(INSTALL_DB)/%$(TEMPL_SUFFIX): ../%$(TEMPL_SUFFIX) $(ECHO) "Installing template file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) .PRECIOUS: $(COMMON_DIR)/%$(TEMPL_SUFFIX) @@ -348,34 +348,34 @@ $(INSTALL_DB)/%$(TEMPL_SUFFIX): ../%$(TEMPL_SUFFIX) # INC files $(COMMON_DIR)/%Record.h: $(COMMON_DIR)/%Record.dbd $(DBDTORECTYPEH_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBTORECORDTYPEH) $(DBDFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%Record.h: %Record.dbd $(DBDTORECTYPEH_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBTORECORDTYPEH) $(DBDFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%Record.h: ../%Record.dbd $(DBDTORECTYPEH_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBTORECORDTYPEH) $(DBDFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/menu%.h: $(COMMON_DIR)/menu%.dbd $(DBDTOMENUH_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBTOMENUH) $(DBDFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/menu%.h: menu%.dbd $(DBDTOMENUH_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBTOMENUH) $(DBDFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/menu%.h: ../menu%.dbd $(DBDTOMENUH_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBTOMENUH) $(DBDFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ .PRECIOUS: $(COMMON_DIR)/%.h @@ -384,26 +384,26 @@ $(COMMON_DIR)/menu%.h: ../menu%.dbd $(DBDTOMENUH_dep) $(COMMON_DIR)/bpt%.dbd: bpt%.data $(ECHO) "Converting data from $<" - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(MAKEBPT) $< $(notdir $@) - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.dbd: %.dbd.pod - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(PERL) $(TOOLS)/podRemove.pl -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.dbd: %Include.dbd $(ECHO) "Expanding dbd file $<" - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.dbd: ../%Include.dbd $(ECHO) "Expanding dbd file $<" - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ # Make DBDCAT file x depend on x_DBD source files define DBDCAT_template @@ -413,32 +413,32 @@ $(foreach name,$(subst .dbd,,$(DBDCAT)), $(eval $(call DBDCAT_template,$(name))) $(COMMON_DBDCATS):$(COMMON_DIR)/%.dbd: $(ECHO) "Creating dbd file $(notdir $@)" - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBDCAT_COMMAND) - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.dbd: $($*_DBD) $(ECHO) "Creating dbd file $(notdir $@)" - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $($*_DBD) - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(INSTALL_DBD)/%: $(COMMON_DIR)/% $(ECHO) "Installing created dbd file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) $(INSTALL_DBD)/%: % $(ECHO) "Installing dbd file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) $(INSTALL_DBD)/%: ../% $(ECHO) "Installing dbd file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) define DBD_INSTALLS_template $$(INSTALL_DBD)/$$(notdir $(1)): $(1) $(ECHO) "Installing $$@" - @$$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$^ $$(INSTALL_DBD) + $$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$^ $$(INSTALL_DBD) endef $(foreach file, $(DBD_INSTALLS), $(eval $(call DBD_INSTALLS_template, $(file)))) @@ -448,19 +448,19 @@ $(foreach file, $(DBD_INSTALLS), $(eval $(call DBD_INSTALLS_template, $(file)))) # Markdown files $(COMMON_DIR)/%.md: %.dbd.pod $(DBDTOMD_pl) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBDTOMD) $(DBDFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.md: %.pod $(PODTOMD_pl) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(PODTOMD) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.md: ../%.pl $(PODTOMD_pl) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(PODTOMD) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ .PRECIOUS: $(COMMON_DIR)/%.md @@ -468,30 +468,30 @@ $(COMMON_DIR)/%.md: ../%.pl $(PODTOMD_pl) # HTML files $(COMMON_DIR)/%.html: %.dbd.pod $(DBDTOHTML_pl) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBDTOHTML) $(DBDFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.html: %.pod $(PODTOHTML_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(PODTOHTML) -s -s -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.html: %.pm $(PODTOHTML_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(PODTOHTML) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.html: ../%.pm $(PODTOHTML_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(PODTOHTML) -s -o $(notdir $@) $< - @$(MKDIR) $(dir $@) - @$(MV) $(notdir $@) $@ + $(MKDIR) $(dir $@) + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.html: ../%.pl $(PODTOHTML_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(PODTOHTML) -s -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ .PRECIOUS: $(COMMON_DIR)/%.html @@ -500,62 +500,62 @@ $(COMMON_DIR)/%.html: ../%.pl $(PODTOHTML_dep) $(COMMON_DIR)/%.db: $(COMMON_DIR)/%.edf $(E2DB) $(E2DB_SYSFLAGS) $(E2DB_FLAGS) -n $*.VAR $< - @$(REPLACEVAR) < $*.VAR > $@.stdout - @$(RM) $*.VAR - @$(MV) $@.stdout $@ + $(REPLACEVAR) < $*.VAR > $@.stdout + $(RM) $*.VAR + $(MV) $@.stdout $@ $(COMMON_DIR)/%.db: %$(SUBST_SUFFIX) $(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)" - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(MSI3_15) $(DBFLAGS) -o $(notdir $@) -S$< $(TEMPLATE_FILENAME) - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.db: ../%$(SUBST_SUFFIX) $(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)" - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(MSI3_15) $(DBFLAGS) -o $(notdir $@) -S$< $(TEMPLATE_FILENAME) - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.db: %$(TEMPL_SUFFIX) $(ECHO) "Inflating database from $<" - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(MSI3_15) $(DBFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.db: ../%$(TEMPL_SUFFIX) $(ECHO) "Inflating database from $<" - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(MSI3_15) $(DBFLAGS) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/%.acf: %.acs $(ECHO) "Creating acf file $@" - @$(RM) $@ + $(RM) $@ $(ACF_CMD) $(COMMON_DIR)/%.acf: ../%.acs $(ECHO) "Creating acf file $@" - @$(RM) $@ + $(RM) $@ $(ACF_CMD) .PRECIOUS: $(COMMON_DIR)/%.acf $(INSTALL_DB)/%: % $(ECHO) "Installing $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) $(INSTALL_DB)/%: ../% $(ECHO) "Installing $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) $(INSTALL_DB)/%.db: $(COMMON_DIR)/%.db $(ECHO) "Installing created db file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) define DB_INSTALLS_template $$(INSTALL_DB)/$$(notdir $(1)): $(1) $(ECHO) "Installing $$@" - @$$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$^ $$(INSTALL_DB) + $$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$^ $$(INSTALL_DB) endef $(foreach file, $(DB_INSTALLS), $(eval $(call DB_INSTALLS_template, $(file)))) @@ -566,17 +566,17 @@ $(foreach file, $(DB_INSTALLS), $(eval $(call DB_INSTALLS_template, $(file)))) # register record,device,driver support %_registerRecordDeviceDriver.cpp: $(COMMON_DIR)/%.dbd $(REGRECDEVDRV_dep) - @$(RM) $@ + $(RM) $@ $(REGISTERRECORDDEVICEDRIVER) $(REGRDDFLAGS) -o $@ \ $< $(basename $@) $(IOCS_APPL_TOP) %_registerRecordDeviceDriver.cpp: %.dbd $(REGRECDEVDRV_dep) - @$(RM) $@ + $(RM) $@ $(REGISTERRECORDDEVICEDRIVER) $(REGRDDFLAGS) -o $@ \ $< $(basename $@) $(IOCS_APPL_TOP) %_registerRecordDeviceDriver.cpp: ../%.dbd $(REGRECDEVDRV_dep) - @$(RM) $@ + $(RM) $@ $(REGISTERRECORDDEVICEDRIVER) $(REGRDDFLAGS) -o $@ \ $< $(basename $@) $(IOCS_APPL_TOP) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index e58aabdd2..759b16310 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -180,7 +180,7 @@ clean: build_clean build_clean: $(ECHO) "Cleaning" - @$(RM) *.i *$(OBJ) *.a \ + $(RM) *.i *$(OBJ) *.a \ $(LIBNAME) $(TESTLIBNAME) $(SHRLIBNAME) $(TESTSHRLIBNAME) \ $(DLLSTUB_LIBNAME) $(TESTDLLSTUB_LIBNAME) \ $(LOADABLE_SHRLIBNAME) \ @@ -189,7 +189,7 @@ build_clean: $(COMMON_INC) $(HDEPENDS_FILES) $(PRODTARGETS) $(TESTPRODTARGETS) \ $(TESTSCRIPTS) $(TAPFILES) $(JUNITFILES) ifdef RES - @$(RM) *$(RES) + $(RM) *$(RES) endif # Sort directories to remove duplicates & make parents first @@ -228,24 +228,24 @@ $(LOADABLE_SHRLIBNAME): FINAL_DIR=$(INSTALL_SHRLIB) $(TESTPRODNAME) $(PRODNAME): $(PRODUCT_OBJS) $(PROD_RESS) $(PROD_DEPLIBS) $(TESTPRODNAME) $(PRODNAME): %$(EXE): | $(INSTALL_LIB) - @$(RM) $@ + $(RM) $@ $(LINK.cpp) $(MT_EXE_COMMAND) %_ctdt$(OBJ): %_ctdt.c - @$(RM) $@ + $(RM) $@ $(COMPILE.ctdt) $< %$(DEP):%.c - @$(RM) $@ + $(RM) $@ $(HDEPENDS.c) $< %$(DEP):%.cc - @$(RM) $@ + $(RM) $@ $(HDEPENDS.cpp) $< %$(DEP):%.cpp - @$(RM) $@ + $(RM) $@ $(HDEPENDS.cpp) $< # Cancel GNUMake's built-in rules, which don't have our _INC @@ -256,20 +256,20 @@ $(TESTPRODNAME) $(PRODNAME): %$(EXE): | $(INSTALL_LIB) # Include files are order-only prerequisites for compilation: %$(OBJ): %.c | $(COMMON_INC) $(INSTALL_INC) - @$(RM) $@ + $(RM) $@ $(COMPILE.c) -c $< %$(OBJ): %.cc | $(COMMON_INC) $(INSTALL_INC) - @$(RM) $@ + $(RM) $@ $(COMPILE.cpp) -c $< %$(OBJ): %.cpp | $(COMMON_INC) $(INSTALL_INC) - @$(RM) $@ + $(RM) $@ $(COMPILE.cpp) -c $< # Windows resource compiler %$(RES): %.rc - @$(RM) $@ + $(RM) $@ $(RCCMD) YACCOPT ?= $($*_YACCOPT) @@ -278,8 +278,8 @@ YACCOPT ?= $($*_YACCOPT) # are creating it # %.c: %.y - @$(RM) $*.tab.c - @$(RM) $*.tab.h + $(RM) $*.tab.c + $(RM) $*.tab.h $(YACC) -b$* $(YACCOPT) $< $(MV) $*.tab.c $*.c $(if $(findstring -d, $(YACCOPT)),$(MV) $*.tab.h $*.h,) @@ -289,7 +289,7 @@ YACCOPT ?= $($*_YACCOPT) %.h: %.c %.y %.c: %.l - @$(RM) $@ + $(RM) $@ $(LEX) $(LEXOPT) -o$@ $< #--------------------------------------------------------------- @@ -298,7 +298,7 @@ YACCOPT ?= $($*_YACCOPT) $(LIBNAME) $(TESTLIBNAME): $(LIBRARY_OBJS) $(filter-out $(DLLSTUB_LIBNAME) $(TESTDLLSTUB_LIBNAME), $(LIBNAME) $(TESTLIBNAME)): $(LIB_PREFIX)%$(LIB_SUFFIX): - @$(RM) $@ + $(RM) $@ $(ARCMD) ifneq ($(strip $(RANLIB)),) $(RANLIB) $@ @@ -313,26 +313,26 @@ $(SHRLIBNAME) $(DLLSTUB_LIBNAME) $(TESTSHRLIBNAME) $(TESTDLLSTUB_LIBNAME): \ # the target requires a separate stub library file. $(DLLSTUB_LIBNAME): | $(SHRLIBNAME); $(SHRLIBNAME): $(SHRLIB_PREFIX)%$(SHRLIB_SUFFIX): - @$(RM) $@ + $(RM) $@ $(LINK.shrlib) $(MT_DLL_COMMAND) $(TESTDLLSTUB_LIBNAME): | $(TESTSHRLIBNAME); $(TESTSHRLIBNAME): $(SHRLIB_PREFIX)%$(SHRLIB_SUFFIX): - @$(RM) $@ + $(RM) $@ $(LINK.shrlib) $(MT_DLL_COMMAND) $(LOADABLE_SHRLIBNAME): $(LIBRARY_OBJS) $(LIBRARY_RESS) $(SHRLIB_DEPLIBS) $(LOADABLE_SHRLIBNAME): $(LOADABLE_SHRLIB_PREFIX)%$(LOADABLE_SHRLIB_SUFFIX): - @$(RM) $@ + $(RM) $@ $(LINK.shrlib) $(MT_DLL_COMMAND) $(LIBNAME) $(SHRLIBNAME) $(LOADABLE_SHRLIBNAME): | $(INSTALL_LIB) $(INSTALL_LIB): - @$(MKDIR) $@ + $(MKDIR) $@ #--------------------------------------------------------------- # C++ munching for VxWorks @@ -342,33 +342,33 @@ $(INSTALL_LIB): $(MV) $@.stdout $@ %.nm: %$(OBJ) - @$(RM) $@ + $(RM) $@ $(NM) $< > $@.stdout $(MV) $@.stdout $@ %_ctdt.c: %.nm $(TOOLS)/munch.pl - @$(RM) $@ + $(RM) $@ $(PERL) $(TOOLS)/munch.pl -o $@ $< $(MUNCHNAME): %$(MUNCH_SUFFIX): $(MUNCH_DEPENDS) %$(EXE) - @$(RM) $@ + $(RM) $@ $(MUNCH_CMD) $(TESTMUNCHNAME): %$(MUNCH_SUFFIX): $(MUNCH_DEPENDS) %$(EXE) - @$(RM) $@ + $(RM) $@ $(MUNCH_CMD) #--------------------------------------------------------------- # GeSys modules for RTEMS $(MODNAME): %$(MODEXT): %$(EXE) @echo "Building module $@" - @$(RM) $@ + $(RM) $@ $(LINK.mod) #--------------------------------------------------------------- # Generate Perl include path module %ModuleDirs.pm: $(wildcard $(TOP)/configure/RELEASE*) - @$(MKDIR) $(dir $@) + $(MKDIR) $(dir $@) $(CONVERTRELEASE) -T $(TOP) $@ #--------------------------------------------------------------- @@ -378,8 +378,7 @@ runtests: run-tap-tests run-tap-tests: | build ifneq ($(TESTSCRIPTS.t),) ifdef RUNTESTS_ENABLED - $(ECHO) "$(PROVE) $(TESTSCRIPTS.t)" - @$(PROVE) $(TESTSCRIPTS.t) || $(PROVE_FAILURE) + $(PROVE) $(TESTSCRIPTS.t) || $(PROVE_FAILURE) endif endif @@ -393,7 +392,7 @@ tap-results: $(TAPFILES) ifneq ($(strip $(TAPFILES)),) ifdef RUNTESTS_ENABLED $(ECHO) "$(PROVE.tap) $(TAPFILES)" - @$(PROVE.tap) $(TAPFILES) || $(PROVE_FAILURE) + $(PROVE.tap) $(TAPFILES) || $(PROVE_FAILURE) endif CURRENT_TAPFILES := $(wildcard $(TAPFILES)) @@ -412,7 +411,7 @@ endif $(TAPFILES.t): %.tap: %.t | build ifdef RUNTESTS_ENABLED $(ECHO) "$(PERL) $< -tap > $@" - @$(PERL) $< -tap > $@ || $(TAPFILE_FAILURE) + $(PERL) $< -tap > $@ || $(TAPFILE_FAILURE) endif $(JUNITFILES.t): %-results.xml: %.tap @@ -420,13 +419,13 @@ $(JUNITFILES.t): %-results.xml: %.tap # If there's a perl test script (.plt) available, use it %.t: ../%.plt - @$(RM) $@ + $(RM) $@ $(EXPAND_TOOL) -t $(INSTALL_LOCATION) -a $(T_A) $< $@ # Test programs (.t files) must be written in Perl. # Generate a perl program to exec the real test binary. %.t: %$(EXE) $(TOOLS)/makeTestfile.pl - @$(RM) $@ + $(RM) $@ $(PERL) $(TOOLS)/makeTestfile.pl $(T_A) $(EPICS_HOST_ARCH) $@ $< #--------------------------------------------------------------- @@ -443,7 +442,7 @@ $(filter-out $(INSTALL_API_HEADERS), $(INSTALL_INC)) $(HDEPENDS_FILES): \ # How to make one $(COMMON_DIR)/%API.h: $(TOOLS)/makeAPIheader.pl - @$(RM) $@ + $(RM) $@ $(PERL) $(TOOLS)/makeAPIheader.pl -o $@ $(@:$(COMMON_DIR)/%API.h=%) endif @@ -460,14 +459,14 @@ endif define BIN_INSTALLS_template $$(INSTALL_BIN)/$$(notdir $(1)): $(1) $(ECHO) "Installing $$( $$@ + echo $1: > $$@ endef $(foreach asy, $(sort $(COMMON_ASSEMBLIES) $(ASSEMBLIES)), \ $(eval $(call ASSEMBLY_DEP_template,$(strip $(asy))))) diff --git a/configure/RULES_FILE_TYPE b/configure/RULES_FILE_TYPE index 5936fd5e0..63ceb97db 100644 --- a/configure/RULES_FILE_TYPE +++ b/configure/RULES_FILE_TYPE @@ -51,10 +51,10 @@ INSTALLS_$(1) = $$($(1):%=$$(INSTALL_$(1))/%) $$(INSTALL_$(1))/%: ../% $(ECHO) "Installing $(1) file $$@" - @$$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$< $$(dir $$@) + $$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$< $$(dir $$@) $$(INSTALL_$(1))/%: % $(ECHO) "Installing $(1) file $$@" - @$$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$< $$(dir $$@) + $$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$< $$(dir $$@) buildInstall: $$(INSTALLS_$(1)) endef @@ -66,6 +66,6 @@ $(foreach type, $(FILE_TYPE), \ clean: file_type_clean file_type_clean: - @$(RM) $(foreach type, $(FILE_TYPE), $($(type))) + $(RM) $(foreach type, $(FILE_TYPE), $($(type))) .PHONY : file_type_clean diff --git a/configure/RULES_MODULES b/configure/RULES_MODULES index ce52ae3a6..d53fa0841 100644 --- a/configure/RULES_MODULES +++ b/configure/RULES_MODULES @@ -52,8 +52,8 @@ $(RELEASE_LOCAL): Makefile $(CONFIG)/CONFIG_SITE \ $(wildcard $(CONFIG)/CONFIG_SITE.local) $(ECHO) "Creating $@ with" $(ECHO) " $(PARENT_MODULE) = $(INSTALL_ABSOLUTE)" - @echo $(PARENT_MODULE) = $(INSTALL_ABSOLUTE)> $@.stdout - @$(MV) $@.stdout $@ + echo $(PARENT_MODULE) = $(INSTALL_ABSOLUTE)> $@.stdout + $(MV) $@.stdout $@ .PHONY: RELEASE.host @@ -62,4 +62,4 @@ TESTS_FAILED_LOGS = $(wildcard $(addsuffix /$(TESTS_FAILED_LOG), \ $(LIVE_SUBMODULES))) runtests test-results: % : | $(addsuffix $(DIVIDER)%, $(LIVE_SUBMODULES)) $(if $(TESTS_FAILED_LOGS), \ - @$(CAT) $(TESTS_FAILED_LOGS)>> $(TESTS_FAILED_PATH)) + $(CAT) $(TESTS_FAILED_LOGS)>> $(TESTS_FAILED_PATH)) diff --git a/configure/RULES_OCTAVE b/configure/RULES_OCTAVE index 1ec4cc7b2..17c636e15 100644 --- a/configure/RULES_OCTAVE +++ b/configure/RULES_OCTAVE @@ -32,7 +32,7 @@ clean: octave_clean #This clean works from O.* dirs. octave_clean: - @$(RM) *.mex *.m + $(RM) *.mex *.m .PHONY: octave_clean diff --git a/documentation/Makefile b/documentation/Makefile index 517c294e6..7c5be52f9 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -85,7 +85,7 @@ else ifneq ($(NOTES_PATH),) $(NOTES_PATH): $(NEW_NOTES) $(MAKENOTES) - @$(RM) $@ + $(RM) $@ $(PERL) $(MAKENOTES) -o $@ -V $(EPICS_SHORT_VERSION) \ -d $(abspath $(NEW_DIR)) $(OLD_NOTES) release-git: $(NOTES_PATH) @@ -112,13 +112,13 @@ else ifeq ($(wildcard ../$(NOTES_FILE)),) # No RELEASE-.md file, add new-notes to RELEASE_NOTES.md $(COMMON_DIR)/RELEASE_NOTES.md: $(REL_DEPS) $(NEW_NOTES) $(MAKENOTES) - @$(RM) $@ + $(RM) $@ $(PERL) $(MAKENOTES) -o $@ -V $(EPICS_SHORT_VERSION) $(DEV_FLAG) \ -d $(abspath $(NEW_DIR)) $(OLD_NOTES) $(NOTES_PATH) else # RELEASE-.md exists, we're building a tagged version $(COMMON_DIR)/RELEASE_NOTES.md: ../$(NOTES_FILE) - @$(RM) $@ + $(RM) $@ $(PERL) $(MAKENOTES) -o $@ -V $(EPICS_SHORT_VERSION) $(OLD_NOTES) endif @@ -126,15 +126,15 @@ else $(EXPAND_TOOL) -t $(INSTALL_LOCATION) -DHEADER=$* $< $@ $(API_RST_FILES): %-api.rst: ../%-API.rst - @$(RM) $@ - @$(ECHO) Creating $@ - @$(CP) $< $@ - @$(foreach h, $($*_HEADERS), \ + $(ECHO) Creating $@ + $(RM) $@ + $(CP) $< $@ + $(foreach h, $($*_HEADERS), \ echo " $h_h.rst" >> $@;) DOX = doxygen doxygen: Doxyfile - @$(MKDIR) $(RTD_SRC) + $(MKDIR) $(RTD_SRC) $(DOXYGEN) # Use "make sphinx DOX=" to skip running doxygen diff --git a/modules/ca/src/perl/Makefile b/modules/ca/src/perl/Makefile index 77130d5b5..7914e5856 100644 --- a/modules/ca/src/perl/Makefile +++ b/modules/ca/src/perl/Makefile @@ -81,5 +81,5 @@ ifdef T_A $(INSTALL_PERL_MODULES)/$(PERL_ARCHPATH)/%: % $(ECHO) "Installing loadable shared library $@" - @$(INSTALL_LIBRARY) -d -m $(LIB_PERMISSIONS) $< $(INSTALL_PERL_MODULES)/$(PERL_ARCHPATH) + $(INSTALL_LIBRARY) -d -m $(LIB_PERMISSIONS) $< $(INSTALL_PERL_MODULES)/$(PERL_ARCHPATH) endif diff --git a/modules/database/src/ioc/db/RULES b/modules/database/src/ioc/db/RULES index 842596aa8..0c2c35a74 100644 --- a/modules/database/src/ioc/db/RULES +++ b/modules/database/src/ioc/db/RULES @@ -15,16 +15,16 @@ THESE_RULES := $(IOCDIR)/db/RULES dbCommon.h$(DEP): $(COMMON_DIR)/dbCommonRecord.dbd $(THESE_RULES) \ $(DBDTORECTYPEH_dep) - @$(DBTORECORDTYPEH) -D -I ../db -I $(COMMON_DIR) -o $(COMMONDEP_TARGET) $< > $@.stdout + $(DBTORECORDTYPEH) -D -I ../db -I $(COMMON_DIR) -o $(COMMONDEP_TARGET) $< > $@.stdout $(MV) $@.stdout $@ $(COMMON_DIR)/dbCommonRecord.html: ../db/dbCommon.dbd.pod $(COMMON_DIR)/dbCommon.h: $(COMMON_DIR)/dbCommonRecord.dbd $(THESE_RULES) \ $(DBDTORECTYPEH_dep) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(DBTORECORDTYPEH) -I ../db -I $(COMMON_DIR) -o $(notdir $@) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ $(COMMON_DIR)/menuGlobal.dbd: $(IOCDIR)/db/Makefile $(THESE_RULES) diff --git a/modules/database/src/std/rec/RULES b/modules/database/src/std/rec/RULES index dc1a61960..ea470a139 100644 --- a/modules/database/src/std/rec/RULES +++ b/modules/database/src/std/rec/RULES @@ -8,7 +8,7 @@ # This is a Makefile fragment, see src/ioc/Makefile. stdRecords.dbd$(DEP): $(STDDIR)/rec/Makefile $(STDDIR)/rec/RULES - @echo "$(COMMON_DIR)/stdRecords.dbd:" > $@.stdout + echo "$(COMMON_DIR)/stdRecords.dbd:" > $@.stdout $(MV) $@.stdout $@ $(COMMON_DIR)/stdRecords.dbd: $(STDDIR)/rec/Makefile $(STDDIR)/rec/RULES diff --git a/modules/database/src/tools/Makefile b/modules/database/src/tools/Makefile index 84229dca8..5bb781238 100644 --- a/modules/database/src/tools/Makefile +++ b/modules/database/src/tools/Makefile @@ -60,5 +60,5 @@ CLEANS += epics-base-$(T_A).pc@ include $(TOP)/configure/RULES epics-base-$(T_A).pc@: ../epics-base-arch.pc@ - @$(RM) $@ - @$(CP) $< $@ + $(RM) $@ + $(CP) $< $@ diff --git a/modules/libcom/src/misc/RULES b/modules/libcom/src/misc/RULES index 2ba358675..832ef4f4f 100644 --- a/modules/libcom/src/misc/RULES +++ b/modules/libcom/src/misc/RULES @@ -13,6 +13,6 @@ MAKEVERSION_FLAGS += $(if $(EPICS_SITE_VERSION),-v "$(EPICS_SITE_VERSION)") $(COMMON_DIR)/epicsVersion.h: $(CONFIG)/CONFIG_BASE_VERSION \ $(CONFIG)/CONFIG_SITE $(MAKEVERSION) - @$(RM) $(notdir $@) + $(RM) $(notdir $@) $(PERL) $(MAKEVERSION) $(MAKEVERSION_FLAGS) $< - @$(MV) $(notdir $@) $@ + $(MV) $(notdir $@) $@ diff --git a/src/template/ext/top/configure/RULES_IDL b/src/template/ext/top/configure/RULES_IDL index 0ee7693b0..29a1bdcbc 100644 --- a/src/template/ext/top/configure/RULES_IDL +++ b/src/template/ext/top/configure/RULES_IDL @@ -24,11 +24,11 @@ buildInstall : $(INSTALL_IDLS) $(INSTALL_IDL)/%: % @echo "Installing idl program $@" - @$(INSTALL_IDLFILE) -d -m 644 $< $(INSTALL_IDL) + $(INSTALL_IDLFILE) -d -m 644 $< $(INSTALL_IDL) $(INSTALL_IDL)/%: ../% @echo "Installing idl program $@" - @$(INSTALL_IDLFILE) -d -m 644 $< $(INSTALL_IDL) + $(INSTALL_IDLFILE) -d -m 644 $< $(INSTALL_IDL) endif endif diff --git a/src/template/ext/top/configure/RULES_JAVA b/src/template/ext/top/configure/RULES_JAVA index 88d397917..52b65f07d 100644 --- a/src/template/ext/top/configure/RULES_JAVA +++ b/src/template/ext/top/configure/RULES_JAVA @@ -98,9 +98,9 @@ buildInstall : $(INSTALL_JAR) $(INSTALL_JAVADOC) #This clean works only from O.* dirs. buildclean: - @$(RMDIR) $(INSTALL_CLASSES) $(PACKAGEDIRS) - @$(RM) $(INSTALL_JAR) $(INSTALL_JAVADOC) - @$(RM) $(COMMON_TESTCLASSES) $(COMMON_JAVAINC) + $(RMDIR) $(INSTALL_CLASSES) $(PACKAGEDIRS) + $(RM) $(INSTALL_JAR) $(INSTALL_JAVADOC) + $(RM) $(COMMON_TESTCLASSES) $(COMMON_JAVAINC) ifdef JAVA_DIRECTORY_TARGETS $(JAVA_DIRECTORY_TARGETS): @@ -109,40 +109,40 @@ endif $(COMMON_JAVAINC):$(JAVAINC_CLASSFILES) $(ECHO) Creating header files $(COMMON_JAVAINC) - @$(RM) $@ + $(RM) $@ $(JAVAHCMD) $(JAVAINC_CLASSNAMES) $(COMMON_TESTCLASSES): $(addprefix ../,$(DEPTESTJAVA)) $(ECHO) Creating test java class files $(COMMON_TESTCLASSES) - @$(RM) $@ + $(RM) $@ $(JAVACCMD) -d $(COMMON_DIR) $^ $(INSTALL_CLASSES): $(addprefix ../,$(JAVA)) $(ECHO) Creating java class files - @$(RM) $@ + $(RM) $@ $(JAVACCMD) -d $(INSTALL_JAVA) $^ $(INSTALL_JAVADOC): $(addprefix ../,$(JAVA)) $(ECHO) Creating java doc files - @$(RM) $@ + $(RM) $@ $(JAVADOCCMD) -d $(addprefix $(INSTALL_HTML)/,$(JAVADOC)) $^ $(COMMON_DIR)/%.jar: $(JARDEPFILES) $(ECHO) Creating java jar file $@ - @$(RM) $@ + $(RM) $@ $(JARCMD) $(INSTALL_JAVA)/%.jar: $(COMMON_DIR)/%.jar $(ECHO) "Installing java jar file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) $(INSTALL_JAVA)/%.jar: %.jar $(ECHO) "Installing java jar file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) $(addprefix $(INSTALL_JAVA)/, $(JARINPUT)): $(INSTALL_JAVA)/%: ../% $(ECHO) "Installing jar input file $@" - @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) + $(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) .PHONY: all install buildInstall rebuild clean build inc From c01382bb5e1f068004e0df1f5bf7567b189b75f1 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 20 Oct 2026 13:34:52 -0400 Subject: [PATCH 121/141] update PVA modules --- modules/pvAccess | 2 +- modules/pvData | 2 +- modules/pva2pva | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/pvAccess b/modules/pvAccess index c668f1223..ea48b8558 160000 --- a/modules/pvAccess +++ b/modules/pvAccess @@ -1 +1 @@ -Subproject commit c668f122362fe913ef68ee122a44839acccb3d56 +Subproject commit ea48b855809fd9b6ad1caca61fdaa2327874ea72 diff --git a/modules/pvData b/modules/pvData index f66492ce4..891052652 160000 --- a/modules/pvData +++ b/modules/pvData @@ -1 +1 @@ -Subproject commit f66492ce4bad7e513cf048e3d5c697a127d2c6ba +Subproject commit 891052652ee68cc11f5a570261c4f116bf632eac diff --git a/modules/pva2pva b/modules/pva2pva index 8fa231352..aba3490b3 160000 --- a/modules/pva2pva +++ b/modules/pva2pva @@ -1 +1 @@ -Subproject commit 8fa231352dac32c08734eb04cf4b12e76895a261 +Subproject commit aba3490b3ddbb40f8acdb12ffb890c457761a6bc From c1df48fe46fe0405324210db734ef380d0f4c9a7 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 20 Oct 2026 23:18:19 -0400 Subject: [PATCH 122/141] ci: use cmd shell for make in the native Windows MinGW job Since Git for Windows 2.56 (runner image win22/20261004), UCRT-based libstdc++-6.dll gets loaded instead of the Strawberry Perl one. Using SHELL=cmd keeps the PATH set up by ci-scripts. Developed with the assistance of generative AI. --- .github/workflows/ci-scripts-build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci-scripts-build.yml b/.github/workflows/ci-scripts-build.yml index 9ad6d688d..454b7a96d 100644 --- a/.github/workflows/ci-scripts-build.yml +++ b/.github/workflows/ci-scripts-build.yml @@ -221,6 +221,13 @@ jobs: sudo apt-get update sudo apt-get -y install qemu-system-x86 g++-mingw-w64-x86-64 gdb if: runner.os == 'Linux' + - name: "Use cmd shell for make" + # Git's sh.exe wrapper prepends Git's own MinGW runtime DLLs to PATH, + # which are incompatible with the Strawberry Perl compiler. + # SHELL from the environment is ignored, but make treats variable + # definitions in MAKEFLAGS like command line arguments (for all make calls). + run: '"MAKEFLAGS=SHELL=cmd" | Out-File -FilePath $env:GITHUB_ENV -Append' + if: runner.os == 'Windows' && matrix.cmp == 'gcc' - name: Prepare and compile dependencies run: python .ci/cue.py prepare - name: Build main module From 59414feceffbd156def3bc62e7c8f26390091214 Mon Sep 17 00:00:00 2001 From: Vijay Banerjee Date: Wed, 16 Sep 2026 15:23:09 -0500 Subject: [PATCH 123/141] configure: Add build dependency for rtemsCom libraries Closes #952 --- configure/os/CONFIG.Common.RTEMS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure/os/CONFIG.Common.RTEMS b/configure/os/CONFIG.Common.RTEMS index 9a2f4823b..432df25c5 100644 --- a/configure/os/CONFIG.Common.RTEMS +++ b/configure/os/CONFIG.Common.RTEMS @@ -149,6 +149,11 @@ OP_SYS_LDLIBS += -lrtemsCom -lCom OP_SYS_LDLIBS += $(OP_SYS_LDLIBS_$(OS_API)_NET_$(RTEMS_HAS_NETWORKING)) OP_SYS_LDLIBS += -lrtemscpu -lc -lm +OP_SYS_DEPLIBS = rtemsCom +PROD_DEPLIBS += $(foreach lib, $(OP_SYS_DEPLIBS), \ + $(firstword $(wildcard $(addsuffix /$(LIB_PREFIX)$(lib)$(LIB_SUFFIX), \ + $($(lib)_DIR) $(SHRLIB_SEARCH_DIRS))))) + OP_SYS_LDFLAGS_posix = -u POSIX_Init OP_SYS_LDFLAGS_score = -u Init \ $(PROJECT_RELEASE)/lib/no-dpmem.rel \ From aacb653264c28c79f38c9e5e7d09f141d3c0041c Mon Sep 17 00:00:00 2001 From: Vijay Banerjee Date: Wed, 16 Sep 2026 15:33:35 -0500 Subject: [PATCH 124/141] os/RTEMS: Make devLibVMEOSD accessible from posix and score branches RTEMS posix works with the existing devLibVMEOSD.c from RTEMS-score --- .../libcom/src/osi/os/RTEMS-posix/devLibVMEOSD.c | 6 ------ .../osi/os/{RTEMS-score => RTEMS}/devLibVMEOSD.c | 14 +++++++------- 2 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 modules/libcom/src/osi/os/RTEMS-posix/devLibVMEOSD.c rename modules/libcom/src/osi/os/{RTEMS-score => RTEMS}/devLibVMEOSD.c (97%) diff --git a/modules/libcom/src/osi/os/RTEMS-posix/devLibVMEOSD.c b/modules/libcom/src/osi/os/RTEMS-posix/devLibVMEOSD.c deleted file mode 100644 index 7cdcd7224..000000000 --- a/modules/libcom/src/osi/os/RTEMS-posix/devLibVMEOSD.c +++ /dev/null @@ -1,6 +0,0 @@ -#ifdef RTEMS_LEGACY_STACK -#include "os/RTEMS-score/devLibVMEOSD.c" -#else -#pragma message "\n VME Support requires the RTEMS Legacy stack\n" -#include "os/default/devLibVMEOSD.c" -#endif diff --git a/modules/libcom/src/osi/os/RTEMS-score/devLibVMEOSD.c b/modules/libcom/src/osi/os/RTEMS/devLibVMEOSD.c similarity index 97% rename from modules/libcom/src/osi/os/RTEMS-score/devLibVMEOSD.c rename to modules/libcom/src/osi/os/RTEMS/devLibVMEOSD.c index 83e6c3d0a..74d5557b3 100644 --- a/modules/libcom/src/osi/os/RTEMS-score/devLibVMEOSD.c +++ b/modules/libcom/src/osi/os/RTEMS/devLibVMEOSD.c @@ -93,12 +93,12 @@ static long rtemsDevWriteProbe (unsigned wordSize, volatile void *ptr, const voi static long rtemsDevConnectInterruptVME ( unsigned vectorNumber, - void (*pFunction)(), + void (*pFunction)(void *), void *parameter); static long rtemsDevDisconnectInterruptVME ( unsigned vectorNumber, - void (*pFunction)() + void (*pFunction)(void *) ); static long rtemsDevEnableInterruptLevelVME (unsigned level); @@ -140,7 +140,7 @@ rtemsDevInit(void) */ static long rtemsDevConnectInterruptVME ( unsigned vectorNumber, - void (*pFunction)(), + void (*pFunction)(void *), void *parameter) { int status; @@ -151,7 +151,7 @@ static long rtemsDevConnectInterruptVME ( } status = BSP_installVME_isr( vectorNumber, - pFunction, + (BSP_VME_ISR_t)pFunction, parameter); if (status) { return S_dev_vecInstlFail; @@ -173,10 +173,10 @@ static long rtemsDevConnectInterruptVME ( */ static long rtemsDevDisconnectInterruptVME ( unsigned vectorNumber, - void (*pFunction)() + void (*pFunction)(void *) ) { - void (*psub)(); + void (*psub)(void *); void *arg; int status; @@ -191,7 +191,7 @@ static long rtemsDevDisconnectInterruptVME ( status = BSP_removeVME_isr( vectorNumber, - psub, + (BSP_VME_ISR_t)psub, arg) || BSP_installVME_isr( vectorNumber, From 8770f172fced6c39d1290ef93ed2638935eccf06 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Wed, 21 Oct 2026 11:37:37 -0400 Subject: [PATCH 125/141] Revert "ci: use cmd shell for make in the native Windows MinGW job" This reverts commit c1df48fe46fe0405324210db734ef380d0f4c9a7. Going for an equivlent solution inside ci-scripts, so that downstream modules using ci-scripts do not have to change their workflows. --- .github/workflows/ci-scripts-build.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/ci-scripts-build.yml b/.github/workflows/ci-scripts-build.yml index 454b7a96d..9ad6d688d 100644 --- a/.github/workflows/ci-scripts-build.yml +++ b/.github/workflows/ci-scripts-build.yml @@ -221,13 +221,6 @@ jobs: sudo apt-get update sudo apt-get -y install qemu-system-x86 g++-mingw-w64-x86-64 gdb if: runner.os == 'Linux' - - name: "Use cmd shell for make" - # Git's sh.exe wrapper prepends Git's own MinGW runtime DLLs to PATH, - # which are incompatible with the Strawberry Perl compiler. - # SHELL from the environment is ignored, but make treats variable - # definitions in MAKEFLAGS like command line arguments (for all make calls). - run: '"MAKEFLAGS=SHELL=cmd" | Out-File -FilePath $env:GITHUB_ENV -Append' - if: runner.os == 'Windows' && matrix.cmp == 'gcc' - name: Prepare and compile dependencies run: python .ci/cue.py prepare - name: Build main module From e64d981e8f3a09cb7eb53d598f1d2ab4fa882946 Mon Sep 17 00:00:00 2001 From: Sang Woo Kim Date: Mon, 27 Jul 2026 15:56:25 +0900 Subject: [PATCH 126/141] RTEMS: don't fault when no startup script is provided epicsRtemsFSImage=NULL is the documented "none is needed" case, and it is the one initialize_local_filesystem() success path that leaves argv[1] unset, so set_directory() reached strrchr(NULL, '/') and killed the guest before main(). Same defect in the score/ and posix/ inits. --- modules/libcom/RTEMS/posix/rtems_init.c | 11 ++++++++--- modules/libcom/RTEMS/score/rtems_init.c | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/libcom/RTEMS/posix/rtems_init.c b/modules/libcom/RTEMS/posix/rtems_init.c index a709f8915..526117da7 100644 --- a/modules/libcom/RTEMS/posix/rtems_init.c +++ b/modules/libcom/RTEMS/posix/rtems_init.c @@ -1251,8 +1251,13 @@ POSIX_Init ( void *argument __attribute__((unused))) printf ("***** Preparing EPICS application *****\n"); iocshRegisterRTEMS (); - set_directory (argv[1]); - epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]); + /* No startup script when the application declares that it needs no + * filesystem (epicsRtemsFSImage == NULL). + */ + if (argv[1] != NULL) { + set_directory (argv[1]); + epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]); + } atexit(exitHandler); printf ("***** Starting EPICS application *****\n"); @@ -1270,7 +1275,7 @@ POSIX_Init ( void *argument __attribute__((unused))) NULL); #endif - result = main ((sizeof argv / sizeof argv[0]) - 1, argv); + result = main (argv[1] != NULL ? 2 : 1, argv); printf ("***** IOC application terminating *****\n"); epicsThreadSleep(1.0); epicsExit(result); diff --git a/modules/libcom/RTEMS/score/rtems_init.c b/modules/libcom/RTEMS/score/rtems_init.c index 77e2e3368..6ab677b67 100644 --- a/modules/libcom/RTEMS/score/rtems_init.c +++ b/modules/libcom/RTEMS/score/rtems_init.c @@ -681,11 +681,16 @@ Init (rtems_task_argument ignored) */ printf ("***** Preparing EPICS application *****\n"); iocshRegisterRTEMS (); - set_directory (argv[1]); - epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]); + /* No startup script when the application declares that it needs no + * filesystem (epicsRtemsFSImage == NULL). + */ + if (argv[1] != NULL) { + set_directory (argv[1]); + epicsEnvSet ("IOC_STARTUP_SCRIPT", argv[1]); + } atexit(exitHandler); printf ("***** Starting EPICS application *****\n"); - result = main ((sizeof argv / sizeof argv[0]) - 1, argv); + result = main (argv[1] != NULL ? 2 : 1, argv); printf ("***** IOC application terminating *****\n"); epicsThreadSleep(1.0); epicsExit(result); From 6f06228a286cd6cfa1e31a6587e92107bfea745f Mon Sep 17 00:00:00 2001 From: Heinz Junkes Date: Thu, 22 Oct 2026 16:21:06 +0200 Subject: [PATCH 127/141] epicsThreadTest: set priority before thread start Avoids a data race on osiPriority reported by helgrind (#495). --- modules/libcom/test/epicsThreadTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/libcom/test/epicsThreadTest.cpp b/modules/libcom/test/epicsThreadTest.cpp index 6d43e71dc..920d53af7 100644 --- a/modules/libcom/test/epicsThreadTest.cpp +++ b/modules/libcom/test/epicsThreadTest.cpp @@ -46,7 +46,6 @@ myThread::myThread(int arg,const char *name) : { argvalue = new int; *argvalue = arg; - thread.start(); } myThread::~myThread() {delete argvalue;} @@ -78,6 +77,8 @@ void testMyThread() if (i == 0) startPriority = myThreads[i]->thread.getPriority(); myThreads[i]->thread.setPriority(startPriority + i); + /* start after setPriority() to avoid racing with run() */ + myThreads[i]->thread.start(); } for (int i = 0; i < ntasks; i++) { From 4f04babf4320dce40c197d7babd0ee268fc821e0 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Fri, 23 Oct 2026 10:39:54 -0400 Subject: [PATCH 128/141] ci: update ci-scripts to v3.4.4 fixes the Windows-22 MinGW failures --- .ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci b/.ci index 261f218e0..b5dc0f98d 160000 --- a/.ci +++ b/.ci @@ -1 +1 @@ -Subproject commit 261f218e094e39550e3a7c54b98e34adcf42ad9b +Subproject commit b5dc0f98d43f2dfd66f22213c6dd70040271691c From 0191bd6b459317b3da2b117614f296db652cefbc Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 26 Oct 2026 16:13:58 -0500 Subject: [PATCH 129/141] Release notes on CA Server hardening --- documentation/new-notes/HARDENING-1.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 documentation/new-notes/HARDENING-1.md diff --git a/documentation/new-notes/HARDENING-1.md b/documentation/new-notes/HARDENING-1.md new file mode 100644 index 000000000..54aa36d93 --- /dev/null +++ b/documentation/new-notes/HARDENING-1.md @@ -0,0 +1,10 @@ +### CA Server Hardening + +In response to several independent reports of security vulnerabilities, +the CA server in the IOC (RSRV) will more strictly validate messages. +**These changes introduce an added risk of interoperability issues with +older CA clients.** + +Sites using older versions of libca or CAJ, +or with other CA client implementations, +are advised to do extra testing prior to deploying this release. From 0ec303c7d1f3cc0f7273906cf7bfbe8b0b5fc306 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 20 Oct 2026 13:34:52 -0400 Subject: [PATCH 130/141] Update git submodules for release --- modules/normativeTypes | 2 +- modules/pvAccess | 2 +- modules/pvData | 2 +- modules/pvDatabase | 2 +- modules/pva2pva | 2 +- modules/pvaClient | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/normativeTypes b/modules/normativeTypes index d0022ed5f..e67486c31 160000 --- a/modules/normativeTypes +++ b/modules/normativeTypes @@ -1 +1 @@ -Subproject commit d0022ed5f69df90b7668151c2077956e718a1f24 +Subproject commit e67486c3195af95ea62ff2b9a149f9874e051b77 diff --git a/modules/pvAccess b/modules/pvAccess index ea48b8558..6e41fb319 160000 --- a/modules/pvAccess +++ b/modules/pvAccess @@ -1 +1 @@ -Subproject commit ea48b855809fd9b6ad1caca61fdaa2327874ea72 +Subproject commit 6e41fb31921789b596ca2ea885040449061fbe13 diff --git a/modules/pvData b/modules/pvData index 891052652..7de3719b2 160000 --- a/modules/pvData +++ b/modules/pvData @@ -1 +1 @@ -Subproject commit 891052652ee68cc11f5a570261c4f116bf632eac +Subproject commit 7de3719b258ce1a9411e900077aae7c842c14084 diff --git a/modules/pvDatabase b/modules/pvDatabase index 48e6c9f5e..8cf550ff5 160000 --- a/modules/pvDatabase +++ b/modules/pvDatabase @@ -1 +1 @@ -Subproject commit 48e6c9f5ef731fb1e078d744dbef53b46997e83f +Subproject commit 8cf550ff57ab8b573a95af2e9602643b8af98110 diff --git a/modules/pva2pva b/modules/pva2pva index aba3490b3..fb7fb8c14 160000 --- a/modules/pva2pva +++ b/modules/pva2pva @@ -1 +1 @@ -Subproject commit aba3490b3ddbb40f8acdb12ffb890c457761a6bc +Subproject commit fb7fb8c1406c383c8f609bc979b1667ae4c23b97 diff --git a/modules/pvaClient b/modules/pvaClient index 429c47a34..65d2cce75 160000 --- a/modules/pvaClient +++ b/modules/pvaClient @@ -1 +1 @@ -Subproject commit 429c47a34af853e396e51535833e74c31536ec3f +Subproject commit 65d2cce75303ffeeda2ed9514e79e91abdcac7be From 2faca64e7d8846fe9b621212dddd9d6e397ee3fa Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 26 Oct 2026 15:47:06 -0500 Subject: [PATCH 131/141] Add submodule release note entries --- documentation/new-notes/pvAccess-7.1.9.md | 9 +++++++++ documentation/new-notes/pvData-8.0.9.md | 11 +++++++++++ documentation/new-notes/pva2pvs-1.4.2.md | 7 +++++++ 3 files changed, 27 insertions(+) create mode 100644 documentation/new-notes/pvAccess-7.1.9.md create mode 100644 documentation/new-notes/pvData-8.0.9.md create mode 100644 documentation/new-notes/pva2pvs-1.4.2.md diff --git a/documentation/new-notes/pvAccess-7.1.9.md b/documentation/new-notes/pvAccess-7.1.9.md new file mode 100644 index 000000000..375e3f7eb --- /dev/null +++ b/documentation/new-notes/pvAccess-7.1.9.md @@ -0,0 +1,9 @@ +### pvAccess Module + +Changes to this module since the previous release: + +#### Release 7.1.9 + +- pvget: Add `-S` option to `pvget` and `pvmonitor` to + stringify byte arrays (Jeremy Lorelli) + diff --git a/documentation/new-notes/pvData-8.0.9.md b/documentation/new-notes/pvData-8.0.9.md new file mode 100644 index 000000000..d885a0439 --- /dev/null +++ b/documentation/new-notes/pvData-8.0.9.md @@ -0,0 +1,11 @@ +### pvData Module + +Changes to this module since the previous release: + +#### Release 8.0.9 + +- Add a max string len param to + epics::pvData::SerializeHelper::deserializeString() (Andrew Johnson) +- Add method + epics::pvData::PVStructure::Formatter::arrayAsString() (Jeremy Lorelli) + diff --git a/documentation/new-notes/pva2pvs-1.4.2.md b/documentation/new-notes/pva2pvs-1.4.2.md new file mode 100644 index 000000000..fe71e27f0 --- /dev/null +++ b/documentation/new-notes/pva2pvs-1.4.2.md @@ -0,0 +1,7 @@ +### pva2pva Module + +Changes to this module since the previous release: + +#### Release 1.4.2 + +- Minor bug fixes From 3c0e70d9a8bac041a60b285ef43806c2e029928f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 26 Oct 2026 17:36:27 -0500 Subject: [PATCH 132/141] Replace UNRELEASED with 7.0.11 --- modules/database/src/std/rec/biRecord.dbd.pod | 2 +- modules/libcom/src/error/errlog.h | 4 ++-- modules/libcom/src/misc/epicsString.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/database/src/std/rec/biRecord.dbd.pod b/modules/database/src/std/rec/biRecord.dbd.pod index 8db4634a3..bd9b35616 100644 --- a/modules/database/src/std/rec/biRecord.dbd.pod +++ b/modules/database/src/std/rec/biRecord.dbd.pod @@ -107,7 +107,7 @@ C. The ZSV field holds the severity for the zero state; OSV, for the one state. COSV causes an alarm whenever the state changes between 0 and 1 and the severity is configured as MINOR or MAJOR. -Since UNRELEASED, the alarm filter time constant (AFTC) is available for the bi record. +Since 7.0.11, the alarm filter time constant (AFTC) is available for the bi record. The AFTC field sets the time constant on a low-pass filter that delays the reporting of limit alarms until the signal has been within the alarm range for that number of seconds (the default AFTC value of zero retains the previous diff --git a/modules/libcom/src/error/errlog.h b/modules/libcom/src/error/errlog.h index a81c2a258..72e2238c3 100644 --- a/modules/libcom/src/error/errlog.h +++ b/modules/libcom/src/error/errlog.h @@ -210,7 +210,7 @@ LIBCOM_API int errlogSetConsole(FILE *stream); * \param bufsize The desired buffer size * \return 0 if successful, -1 if called from callback function * - * \since UNRELEASED the default buffer size is 2560. + * \since 7.0.11 the default buffer size is 2560. */ LIBCOM_API int errlogInit(int bufsize); @@ -222,7 +222,7 @@ LIBCOM_API int errlogInit(int bufsize); * \param maxMsgSize The desired max message size * \return 0 if successful, -1 if called from callback function * - * \since UNRELEASED It is possible to enlarge the error log buffer size after initialisation. + * \since 7.0.11 It is possible to enlarge the error log buffer size after initialisation. * The default buffer size is 2560 and the default maximum message size is 512. */ LIBCOM_API int errlogInit2(int bufsize, int maxMsgSize); diff --git a/modules/libcom/src/misc/epicsString.h b/modules/libcom/src/misc/epicsString.h index 573efa692..ec97c4f68 100644 --- a/modules/libcom/src/misc/epicsString.h +++ b/modules/libcom/src/misc/epicsString.h @@ -121,7 +121,7 @@ LIBCOM_API char * epicsStrnDup(const char *s, size_t len); * \param n Length of string * \return Number of characters printed, or negative on error. * - * \since 7.0.8 until UNRELEASED, @code strlen(s) @endcode must be valid. + * \since 7.0.8 until 7.0.11, @code strlen(s) @endcode must be valid. */ LIBCOM_API int epicsStrPrintEscaped(FILE *fp, const char *s, size_t n); From 45d44cfc0346db4022a660270ddddb3b59ada533 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 26 Oct 2026 17:37:14 -0500 Subject: [PATCH 133/141] Set core version numbers for release --- configure/CONFIG_BASE_VERSION | 6 +++--- configure/CONFIG_CA_VERSION | 2 +- configure/CONFIG_DATABASE_VERSION | 6 +++--- configure/CONFIG_LIBCOM_VERSION | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index a05861956..f4b710e5d 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -48,15 +48,15 @@ EPICS_VERSION = 7 EPICS_REVISION = 0 # EPICS_MODIFICATION must be a number >=0 and <256 -EPICS_MODIFICATION = 10 +EPICS_MODIFICATION = 11 # EPICS_PATCH_LEVEL must be a number (win32 resource file requirement) # Not included in the official EPICS version number if zero -EPICS_PATCH_LEVEL = 1 +EPICS_PATCH_LEVEL = 0 # Immediately after an official release the EPICS_PATCH_LEVEL is incremented # and the -DEV suffix is added (similar to the Maven -SNAPSHOT versions) -EPICS_DEV_SNAPSHOT=-DEV +EPICS_DEV_SNAPSHOT= # No changes should be needed below here diff --git a/configure/CONFIG_CA_VERSION b/configure/CONFIG_CA_VERSION index de8fd6ba1..e8b38f57d 100644 --- a/configure/CONFIG_CA_VERSION +++ b/configure/CONFIG_CA_VERSION @@ -6,7 +6,7 @@ EPICS_CA_MAINTENANCE_VERSION = 1 # Development flag, set to zero for release versions -EPICS_CA_DEVELOPMENT_FLAG = 1 +EPICS_CA_DEVELOPMENT_FLAG = 0 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 diff --git a/configure/CONFIG_DATABASE_VERSION b/configure/CONFIG_DATABASE_VERSION index 94f4872e7..096c26d84 100644 --- a/configure/CONFIG_DATABASE_VERSION +++ b/configure/CONFIG_DATABASE_VERSION @@ -1,12 +1,12 @@ # Version number for the database APIs and shared library EPICS_DATABASE_MAJOR_VERSION = 3 -EPICS_DATABASE_MINOR_VERSION = 25 -EPICS_DATABASE_MAINTENANCE_VERSION = 1 +EPICS_DATABASE_MINOR_VERSION = 26 +EPICS_DATABASE_MAINTENANCE_VERSION = 0 # Development flag, set to zero for release versions -EPICS_DATABASE_DEVELOPMENT_FLAG = 1 +EPICS_DATABASE_DEVELOPMENT_FLAG = 0 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 diff --git a/configure/CONFIG_LIBCOM_VERSION b/configure/CONFIG_LIBCOM_VERSION index 405906813..555cbf8c9 100644 --- a/configure/CONFIG_LIBCOM_VERSION +++ b/configure/CONFIG_LIBCOM_VERSION @@ -6,7 +6,7 @@ EPICS_LIBCOM_MAINTENANCE_VERSION = 1 # Development flag, set to zero for release versions -EPICS_LIBCOM_DEVELOPMENT_FLAG = 1 +EPICS_LIBCOM_DEVELOPMENT_FLAG = 0 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 From e535f4ebd074f24820735b8bf0784a9f80dcf118 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 26 Oct 2026 17:54:39 -0500 Subject: [PATCH 134/141] Generate RELEASE-7.0.11.md notes file --- documentation/RELEASE-7.0.11.md | 363 ++++++++++++++++++++++ documentation/new-notes/HARDENING-1.md | 10 - documentation/new-notes/PR-110.md | 10 - documentation/new-notes/PR-359.md | 11 - documentation/new-notes/PR-768.md | 8 - documentation/new-notes/PR-788.md | 21 -- documentation/new-notes/PR-801.md | 7 - documentation/new-notes/PR-812.md | 16 - documentation/new-notes/PR-817.md | 13 - documentation/new-notes/PR-853.md | 17 - documentation/new-notes/PR-880.md | 21 -- documentation/new-notes/PR-897.md | 9 - documentation/new-notes/PR-902.md | 20 -- documentation/new-notes/pvAccess-7.1.9.md | 9 - documentation/new-notes/pvData-8.0.9.md | 11 - documentation/new-notes/pva2pvs-1.4.2.md | 7 - 16 files changed, 363 insertions(+), 190 deletions(-) create mode 100644 documentation/RELEASE-7.0.11.md delete mode 100644 documentation/new-notes/HARDENING-1.md delete mode 100644 documentation/new-notes/PR-110.md delete mode 100644 documentation/new-notes/PR-359.md delete mode 100644 documentation/new-notes/PR-768.md delete mode 100644 documentation/new-notes/PR-788.md delete mode 100644 documentation/new-notes/PR-801.md delete mode 100644 documentation/new-notes/PR-812.md delete mode 100644 documentation/new-notes/PR-817.md delete mode 100644 documentation/new-notes/PR-853.md delete mode 100644 documentation/new-notes/PR-880.md delete mode 100644 documentation/new-notes/PR-897.md delete mode 100644 documentation/new-notes/PR-902.md delete mode 100644 documentation/new-notes/pvAccess-7.1.9.md delete mode 100644 documentation/new-notes/pvData-8.0.9.md delete mode 100644 documentation/new-notes/pva2pvs-1.4.2.md diff --git a/documentation/RELEASE-7.0.11.md b/documentation/RELEASE-7.0.11.md new file mode 100644 index 000000000..cf4892657 --- /dev/null +++ b/documentation/RELEASE-7.0.11.md @@ -0,0 +1,363 @@ +# Release Notes + +This document describes the changes that were included in the release of EPICS +noted below. Release entries are now provided in a separate document for each +version in the EPICS 7 series, but all are combined into a single page for +publishing on the EPICS website. Separate release documents are also included +from the older Base 3.15 and 3.16 series. + +The external PVA submodules continue to maintain their own release notes files +as before, but the entries describing changes in those submodules since version +7.0.5 have been copied into the associated EPICS Release Notes files; they will +also be manually added to new EPICS Release Notes published in the future. + +## EPICS Release 7.0.11 + +The changes described below have been merged into EPICS +since the last published release. + +### CA Server Hardening + +In response to several independent reports of security vulnerabilities, +the CA server in the IOC (RSRV) will more strictly validate messages. +**These changes introduce an added risk of interoperability issues with +older CA clients.** + +Sites using older versions of libca or CAJ, +or with other CA client implementations, +are advised to do extra testing prior to deploying this release. + +### Add GDB Helper Script + +A new [Debugging with GDB](gdb.md) document which is linked under the +"General Information" heading in the side-bar provides information on +how to debug C/C++ code in an IOC running on a workstation OS. + +This release added a GDB helper script that pretty-prints some of the +common database types. +Tested with GDB 16.3. +Compatible with python 3. + +### Fix undefined timestamp for NORD field + +When monitoring non-val fields such as `NORD` for several record types updates +are not sent out correctly resulting in incorrect timestamps. This fixes this +for the record types `aai`, `aao`, `subArray`. + +Note that support modules that already implement this in the device support +layer will need to be updated to avoid doubled monitor updates. If those modules +are to be built against older versions of EPICS base then they will need to use +the defined macros `AAO_POSTS_NORD`, `AAI_POSTS_NORD`, `SA_POSTS_NORD`, or +`WF_POSTS_NORD` as appropriate to detect this change. + +### iocInit wait for local CA links to connect + +PR [768](https://github.com/epics-base/epics-base/pull/768) + +During iocInit(), wait for local CA links to connect. +With this change, database authors can be certain that +any local CA link is connected prior to `initHookAfterIocRunning` +and `field(PINI, RUNNING)`. + +### epicsThreadGetCPUs and callbackParallelThreads + +On systems that support it (e.g. recent Linux systems), `epicsThreadGetCPUs()` +now takes the current cpu affinity mask of the calling thread into acount. +That fixes the problem that an IOC which was started with a limited affinity +mask (e.g. using `taskset`) and that called `callbackParallelThreads` with an +argument of 0 in the startup script, had started more parallel callback +threads than it has CPU cores available. + +The iocsh function `callbackParallelThreads` now also accepts positive or +negative percentages for `count`, referring to the availabple number of cores +and always rounding the number of used cores down with a minimum of 1. + +#### Examples + +```text +# use up to 25% of available cpu cores for callback threads +callbackParallelThreads 25% +# keep at least 10% of available cpu cores unused for callback threads +callbackParallelThreads -10% +``` + +### errlogInit can be run more than once + +Previously, running `errlogInit` after initialisation would silently fail. It is +now possible to call `errlogInit` or `errlogInit2` multiple times in order to +increase the buffer size. + +Note that it is not possible to _shrink_ the buffer size. + +### Expose `dbCreateRecord` in IOC shell + +Add a new IOC shell command `dbCreateRecord` allowing for records to be created +from the shell. + +Only works when called before `iocInit` and will fail if called afterwards. + +The pdbbase variable, a record type, and the new record's name should be passed +as arguments. + +Example usage: + +```sh +dbCreateRecord(pdbbase, "ai", "example:ai") +iocInit() +``` + +### AFTC for bi record + +The bi record now also supports the AFTC parameter. +The AFTC field sets the time constant on a low-pass filter that delays the +reporting of limit alarms until the signal has been within the alarm range for +that number of seconds (the default AFTC value of zero retains the previous +behavior). One has to make sure that the bi record is processed at a reasonably fast rate +when using AFTC, so that the record can respond to changes in the input signal +within the time constant. + +### AFTC and LALM fix for mbbi record + +Fixed two issues in the mbbi record where the AFTC and LALM fields were not operating as expected. + +### Static network configuration for RTEMS targets using libBSD + +GitHub [PR #853](https://github.com/epics-base/epics-base/pull/853) + +RTEMS targets built against the libBSD network stack can now use a static +network configuration in addition to DHCP. + +When a static IP address and netmask can be read from the board's boot +configuration, the first non-loopback interface is configured with that static +address; otherwise the target falls back to DHCP as before. + +The boot configuration is read using the mechanism appropriate to the board: + + * MOTLOAD boards read the NVRAM Global Environment Variables (GEV), falling + back to the parameters in the `mot-script-boot` boot script. + * PPCBUG boards read their PPCBUG NVRAM. + * ColdFire (`mcf528x`) boards read their bootloader environment variables. + +### Template fix for modules with `cfg/RULES*` files + +EPICS modules that installed custom build `RULES*` files into +`$(INSTALL_CFG)` weren't loading them properly when the module +was built with `INSTALL_LOCATION` set in `configure/CONFIG_SITE` +or `configure/CONFIG_SITE.local`. +This release provides a fix in the template `configure/CONFIG` +file to solve the issue for new modules created from the +`makeBaseApp` template. + +Maintainers of old modules that provide special build rules for +IOC applications should check their `configure` directory. +Assuming a `configure/CONFIG` file is present, replace it with +the `templates/makeBaseApp/top/configure/CONFIG` file from this +release. If any changes were made to the old file they would +need to be merged into the new file. + +If the module's `configure` directory contains a file named +`CONFIG_APP` and no `CONFIG_SITE` file, the application must +date back to before March 2006; the files in the `configure` +directory should all be replaced in this case. + +### macOS: Drop the `-flat_namespace` linker flag + +It's not clear when this flag was no longer required on macOS, we +tried dropping it +[in 2019](https://github.com/epics-base/epics-base/commit/cbb13bf6b170c6ba6660d594bdd9ca44a5bdaea5) +but had to [restore it](https://github.com/epics-base/epics-base/commit/8c3c5a9731887c6d8b1918394090564af38461b5). +XCode 15 seems a safe version though. See discussion in issue +[#895](https://github.com/epics-base/epics-base/issues/895) for +more details. + +### Fix registration of DRVETs + +The C++ code generated in an IOC's `RecordDeviceDriver.cpp` file can fail +to compile if the Makefile building the IOC defines the `USE_TYPED_DRVET` +macro. Compiler errors caused by this bug will look something like this: + +``` +test_registerRecordDeviceDriver.cpp:198:15: error: +typedef 'drvet' cannot be referenced with the 'struct' specifier + 198 | static struct drvet *drvsl[] = { + | ^ +/epics/base-7.0/include/drvSup.h:38:21: note: declared here + 38 | typedef typed_drvet drvet; + | ^ +1 error generated. +``` + +[This PR](https://github.com/epics-base/epics-base/pull/902) +modifies the generated C++ code to resolve that problem, and adds a +driver to the example IOC template to catch regressions. + +### pvAccess Module + +Changes to this module since the previous release: + +#### Release 7.1.9 + +- pvget: Add `-S` option to `pvget` and `pvmonitor` to + stringify byte arrays (Jeremy Lorelli) + + +### pvData Module + +Changes to this module since the previous release: + +#### Release 8.0.9 + +- Add a max string len param to + epics::pvData::SerializeHelper::deserializeString() (Andrew Johnson) +- Add method + epics::pvData::PVStructure::Formatter::arrayAsString() (Jeremy Lorelli) + + +### pva2pva Module + +Changes to this module since the previous release: + +#### Release 1.4.2 + +- Minor bug fixes + +----- + +## EPICS Release 7.0.10 + +```{include} ../../RELEASE-7.0.10.md +:start-after: EPICS Release 7.0.10 +``` + +----- + +## EPICS Release 7.0.9 + +```{include} ../../RELEASE-7.0.9.md +:start-after: EPICS Release 7.0.9 +``` + +----- + +## EPICS Release 7.0.8.1 + +```{include} ../../RELEASE-7.0.8.1.md +:start-after: EPICS Release 7.0.8.1 +``` + +----- + +## EPICS Release 7.0.8 + +```{include} ../../RELEASE-7.0.8.md +:start-after: EPICS Release 7.0.8 +``` + +----- + +## EPICS Release 7.0.7 + +```{include} ../../RELEASE-7.0.7.md +:start-after: EPICS Release 7.0.7 +``` + +----- + +## EPICS Release 7.0.6.1 + +```{include} ../../RELEASE-7.0.6.1.md +:start-after: EPICS Release 7.0.6.1 +``` + +----- + +## EPICS Release 7.0.6 + +```{include} ../../RELEASE-7.0.6.md +:start-after: EPICS Release 7.0.6 +``` + +----- + +## EPICS Release 7.0.5 + +```{include} ../../RELEASE-7.0.5.md +:start-after: EPICS Release 7.0.5 +``` + +----- + +## EPICS Release 7.0.4.1 + +```{include} ../../RELEASE-7.0.4.1.md +:start-after: EPICS Release 7.0.4.1 +``` + +----- + +## EPICS Release 7.0.4 + +```{include} ../../RELEASE-7.0.4.md +:start-after: EPICS Release 7.0.4 +``` + +----- + +## EPICS Release 7.0.3.1 + +```{include} ../../RELEASE-7.0.3.1.md +:start-after: EPICS Release 7.0.3.1 +``` + +----- + +## EPICS Release 7.0.3 + +```{include} ../../RELEASE-7.0.3.md +:start-after: EPICS Release 7.0.3 +``` + +----- + +## EPICS Release 7.0.2.2 + +```{include} ../../RELEASE-7.0.2.2.md +:start-after: EPICS Release 7.0.2.2 +``` + +----- + +## EPICS Release 7.0.2.1 + +```{include} ../../RELEASE-7.0.2.1.md +:start-after: EPICS Release 7.0.2.1 +``` + +----- + +## EPICS Release 7.0.2 + +```{include} ../../RELEASE-7.0.2.md +:start-after: EPICS Release 7.0.2 +``` + +----- + +## EPICS Release 7.0.1.1 + +```{include} ../../RELEASE-7.0.1.1.md +:start-after: EPICS Release 7.0.1.1 +``` + +----- + +```{include} ../../RELEASE-3.16.md +:heading-offset: 1 +``` + +----- + +```{include} ../../RELEASE-3.15.md +:heading-offset: 1 +``` + diff --git a/documentation/new-notes/HARDENING-1.md b/documentation/new-notes/HARDENING-1.md deleted file mode 100644 index 54aa36d93..000000000 --- a/documentation/new-notes/HARDENING-1.md +++ /dev/null @@ -1,10 +0,0 @@ -### CA Server Hardening - -In response to several independent reports of security vulnerabilities, -the CA server in the IOC (RSRV) will more strictly validate messages. -**These changes introduce an added risk of interoperability issues with -older CA clients.** - -Sites using older versions of libca or CAJ, -or with other CA client implementations, -are advised to do extra testing prior to deploying this release. diff --git a/documentation/new-notes/PR-110.md b/documentation/new-notes/PR-110.md deleted file mode 100644 index 0adc2276a..000000000 --- a/documentation/new-notes/PR-110.md +++ /dev/null @@ -1,10 +0,0 @@ -### Add GDB Helper Script - -A new [Debugging with GDB](gdb.md) document which is linked under the -"General Information" heading in the side-bar provides information on -how to debug C/C++ code in an IOC running on a workstation OS. - -This release added a GDB helper script that pretty-prints some of the -common database types. -Tested with GDB 16.3. -Compatible with python 3. diff --git a/documentation/new-notes/PR-359.md b/documentation/new-notes/PR-359.md deleted file mode 100644 index 266823c07..000000000 --- a/documentation/new-notes/PR-359.md +++ /dev/null @@ -1,11 +0,0 @@ -### Fix undefined timestamp for NORD field - -When monitoring non-val fields such as `NORD` for several record types updates -are not sent out correctly resulting in incorrect timestamps. This fixes this -for the record types `aai`, `aao`, `subArray`. - -Note that support modules that already implement this in the device support -layer will need to be updated to avoid doubled monitor updates. If those modules -are to be built against older versions of EPICS base then they will need to use -the defined macros `AAO_POSTS_NORD`, `AAI_POSTS_NORD`, `SA_POSTS_NORD`, or -`WF_POSTS_NORD` as appropriate to detect this change. diff --git a/documentation/new-notes/PR-768.md b/documentation/new-notes/PR-768.md deleted file mode 100644 index 7815ee52b..000000000 --- a/documentation/new-notes/PR-768.md +++ /dev/null @@ -1,8 +0,0 @@ -### iocInit wait for local CA links to connect - -PR [768](https://github.com/epics-base/epics-base/pull/768) - -During iocInit(), wait for local CA links to connect. -With this change, database authors can be certain that -any local CA link is connected prior to `initHookAfterIocRunning` -and `field(PINI, RUNNING)`. diff --git a/documentation/new-notes/PR-788.md b/documentation/new-notes/PR-788.md deleted file mode 100644 index d5b83c296..000000000 --- a/documentation/new-notes/PR-788.md +++ /dev/null @@ -1,21 +0,0 @@ -### epicsThreadGetCPUs and callbackParallelThreads - -On systems that support it (e.g. recent Linux systems), `epicsThreadGetCPUs()` -now takes the current cpu affinity mask of the calling thread into acount. -That fixes the problem that an IOC which was started with a limited affinity -mask (e.g. using `taskset`) and that called `callbackParallelThreads` with an -argument of 0 in the startup script, had started more parallel callback -threads than it has CPU cores available. - -The iocsh function `callbackParallelThreads` now also accepts positive or -negative percentages for `count`, referring to the availabple number of cores -and always rounding the number of used cores down with a minimum of 1. - -#### Examples - -```text -# use up to 25% of available cpu cores for callback threads -callbackParallelThreads 25% -# keep at least 10% of available cpu cores unused for callback threads -callbackParallelThreads -10% -``` diff --git a/documentation/new-notes/PR-801.md b/documentation/new-notes/PR-801.md deleted file mode 100644 index 6cdece7f5..000000000 --- a/documentation/new-notes/PR-801.md +++ /dev/null @@ -1,7 +0,0 @@ -### errlogInit can be run more than once - -Previously, running `errlogInit` after initialisation would silently fail. It is -now possible to call `errlogInit` or `errlogInit2` multiple times in order to -increase the buffer size. - -Note that it is not possible to _shrink_ the buffer size. diff --git a/documentation/new-notes/PR-812.md b/documentation/new-notes/PR-812.md deleted file mode 100644 index a15eabcca..000000000 --- a/documentation/new-notes/PR-812.md +++ /dev/null @@ -1,16 +0,0 @@ -### Expose `dbCreateRecord` in IOC shell - -Add a new IOC shell command `dbCreateRecord` allowing for records to be created -from the shell. - -Only works when called before `iocInit` and will fail if called afterwards. - -The pdbbase variable, a record type, and the new record's name should be passed -as arguments. - -Example usage: - -```sh -dbCreateRecord(pdbbase, "ai", "example:ai") -iocInit() -``` diff --git a/documentation/new-notes/PR-817.md b/documentation/new-notes/PR-817.md deleted file mode 100644 index 3aa1370a1..000000000 --- a/documentation/new-notes/PR-817.md +++ /dev/null @@ -1,13 +0,0 @@ -### AFTC for bi record - -The bi record now also supports the AFTC parameter. -The AFTC field sets the time constant on a low-pass filter that delays the -reporting of limit alarms until the signal has been within the alarm range for -that number of seconds (the default AFTC value of zero retains the previous -behavior). One has to make sure that the bi record is processed at a reasonably fast rate -when using AFTC, so that the record can respond to changes in the input signal -within the time constant. - -### AFTC and LALM fix for mbbi record - -Fixed two issues in the mbbi record where the AFTC and LALM fields were not operating as expected. diff --git a/documentation/new-notes/PR-853.md b/documentation/new-notes/PR-853.md deleted file mode 100644 index e35c17563..000000000 --- a/documentation/new-notes/PR-853.md +++ /dev/null @@ -1,17 +0,0 @@ -### Static network configuration for RTEMS targets using libBSD - -GitHub [PR #853](https://github.com/epics-base/epics-base/pull/853) - -RTEMS targets built against the libBSD network stack can now use a static -network configuration in addition to DHCP. - -When a static IP address and netmask can be read from the board's boot -configuration, the first non-loopback interface is configured with that static -address; otherwise the target falls back to DHCP as before. - -The boot configuration is read using the mechanism appropriate to the board: - - * MOTLOAD boards read the NVRAM Global Environment Variables (GEV), falling - back to the parameters in the `mot-script-boot` boot script. - * PPCBUG boards read their PPCBUG NVRAM. - * ColdFire (`mcf528x`) boards read their bootloader environment variables. diff --git a/documentation/new-notes/PR-880.md b/documentation/new-notes/PR-880.md deleted file mode 100644 index b5d07b612..000000000 --- a/documentation/new-notes/PR-880.md +++ /dev/null @@ -1,21 +0,0 @@ -### Template fix for modules with `cfg/RULES*` files - -EPICS modules that installed custom build `RULES*` files into -`$(INSTALL_CFG)` weren't loading them properly when the module -was built with `INSTALL_LOCATION` set in `configure/CONFIG_SITE` -or `configure/CONFIG_SITE.local`. -This release provides a fix in the template `configure/CONFIG` -file to solve the issue for new modules created from the -`makeBaseApp` template. - -Maintainers of old modules that provide special build rules for -IOC applications should check their `configure` directory. -Assuming a `configure/CONFIG` file is present, replace it with -the `templates/makeBaseApp/top/configure/CONFIG` file from this -release. If any changes were made to the old file they would -need to be merged into the new file. - -If the module's `configure` directory contains a file named -`CONFIG_APP` and no `CONFIG_SITE` file, the application must -date back to before March 2006; the files in the `configure` -directory should all be replaced in this case. diff --git a/documentation/new-notes/PR-897.md b/documentation/new-notes/PR-897.md deleted file mode 100644 index 886fa3d32..000000000 --- a/documentation/new-notes/PR-897.md +++ /dev/null @@ -1,9 +0,0 @@ -### macOS: Drop the `-flat_namespace` linker flag - -It's not clear when this flag was no longer required on macOS, we -tried dropping it -[in 2019](https://github.com/epics-base/epics-base/commit/cbb13bf6b170c6ba6660d594bdd9ca44a5bdaea5) -but had to [restore it](https://github.com/epics-base/epics-base/commit/8c3c5a9731887c6d8b1918394090564af38461b5). -XCode 15 seems a safe version though. See discussion in issue -[#895](https://github.com/epics-base/epics-base/issues/895) for -more details. diff --git a/documentation/new-notes/PR-902.md b/documentation/new-notes/PR-902.md deleted file mode 100644 index 2cd0863c9..000000000 --- a/documentation/new-notes/PR-902.md +++ /dev/null @@ -1,20 +0,0 @@ -### Fix registration of DRVETs - -The C++ code generated in an IOC's `RecordDeviceDriver.cpp` file can fail -to compile if the Makefile building the IOC defines the `USE_TYPED_DRVET` -macro. Compiler errors caused by this bug will look something like this: - -``` -test_registerRecordDeviceDriver.cpp:198:15: error: -typedef 'drvet' cannot be referenced with the 'struct' specifier - 198 | static struct drvet *drvsl[] = { - | ^ -/epics/base-7.0/include/drvSup.h:38:21: note: declared here - 38 | typedef typed_drvet drvet; - | ^ -1 error generated. -``` - -[This PR](https://github.com/epics-base/epics-base/pull/902) -modifies the generated C++ code to resolve that problem, and adds a -driver to the example IOC template to catch regressions. diff --git a/documentation/new-notes/pvAccess-7.1.9.md b/documentation/new-notes/pvAccess-7.1.9.md deleted file mode 100644 index 375e3f7eb..000000000 --- a/documentation/new-notes/pvAccess-7.1.9.md +++ /dev/null @@ -1,9 +0,0 @@ -### pvAccess Module - -Changes to this module since the previous release: - -#### Release 7.1.9 - -- pvget: Add `-S` option to `pvget` and `pvmonitor` to - stringify byte arrays (Jeremy Lorelli) - diff --git a/documentation/new-notes/pvData-8.0.9.md b/documentation/new-notes/pvData-8.0.9.md deleted file mode 100644 index d885a0439..000000000 --- a/documentation/new-notes/pvData-8.0.9.md +++ /dev/null @@ -1,11 +0,0 @@ -### pvData Module - -Changes to this module since the previous release: - -#### Release 8.0.9 - -- Add a max string len param to - epics::pvData::SerializeHelper::deserializeString() (Andrew Johnson) -- Add method - epics::pvData::PVStructure::Formatter::arrayAsString() (Jeremy Lorelli) - diff --git a/documentation/new-notes/pva2pvs-1.4.2.md b/documentation/new-notes/pva2pvs-1.4.2.md deleted file mode 100644 index fe71e27f0..000000000 --- a/documentation/new-notes/pva2pvs-1.4.2.md +++ /dev/null @@ -1,7 +0,0 @@ -### pva2pva Module - -Changes to this module since the previous release: - -#### Release 1.4.2 - -- Minor bug fixes From 9d60f8d0d383dd54a3f02695bfdfcb4fad29586d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 26 Oct 2026 16:14:45 -0500 Subject: [PATCH 135/141] Update versions in Release Checklist --- documentation/ReleaseChecklist.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/documentation/ReleaseChecklist.md b/documentation/ReleaseChecklist.md index 416917d48..8e3e438bd 100644 --- a/documentation/ReleaseChecklist.md +++ b/documentation/ReleaseChecklist.md @@ -115,7 +115,7 @@ Reach a consensus that the software is ready to release. 5. Tag the submodule (replace `ANJ` with your initials): ``` - git tag -m "ANJ: Tag for EPICS 7.0.11" + git tag -m "ANJ: Tag for EPICS 7.0.12" ``` 6. Generate documentation for modules with @@ -221,7 +221,7 @@ Reach a consensus that the software is ready to release. `new-notes/*.md` files, then deletes the files and prepares a Git commit to apply those changes permanently to the repository. - Run these commands to generate the `RELEASE-7.0.11.md` + Run these commands to generate the `RELEASE-7.0.12.md` file and remove the individual release note entry files: ``` @@ -236,7 +236,7 @@ Reach a consensus that the software is ready to release. ``` git status git diff --staged - git commit -m "Generate RELEASE-7.0.11.md notes file" + git commit -m "Generate RELEASE-7.0.12.md notes file" ``` If you need to undo those Git actions before committing and confirm @@ -249,7 +249,7 @@ Tag the epics-base module in Git (replace `ANJ` with your initials): ``` cd base-7.0 -git tag -m "ANJ: Tagged for release" R7.0.11 +git tag -m "ANJ: Tagged for release" R7.0.12 ``` Don't push to GitHub yet. @@ -280,14 +280,14 @@ continuous integration: ``` cd base-7.0 -./.tools/make-tar.sh R7.0.11 ../base-7.0.11.tar.gz base-7.0.11/ +./.tools/make-tar.sh R7.0.12 ../base-7.0.12.tar.gz base-7.0.12/ ``` Create a GPG signature file of the tarfile as follows: ``` cd .. -gpg --armor --sign --detach-sig base-7.0.11.tar.gz +gpg --armor --sign --detach-sig base-7.0.12.tar.gz ``` **Release Manager:** @@ -340,7 +340,7 @@ Upload the tar file and its `.asc` signature file to the epics-controls web-server. ``` -scp base-7.0.11.tar.gz base-7.0.11.tar.gz.asc epics-controls:download/base +scp base-7.0.12.tar.gz base-7.0.12.tar.gz.asc epics-controls:download/base ``` **Website Editor:** @@ -359,7 +359,7 @@ This generates the News item. **Release Manager:** Go to the GitHub -[Create release from tag R7.0.11](https://github.com/epics-base/epics-base/releases/new?tag=R7.0.11) +[Create release from tag R7.0.12](https://github.com/epics-base/epics-base/releases/new?tag=R7.0.12) page. Upload the tar file and its `.asc` signature file to the new GitHub release page, or just drag-n-drop them into the page. Copy/paste the text from the previous release and edit. Submit. From bc9c95fde2daf80921e9f42840c3be73cbcfe51b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 26 Oct 2026 21:54:34 -0500 Subject: [PATCH 136/141] Update core version numbers after tagging --- configure/CONFIG_BASE_VERSION | 4 ++-- configure/CONFIG_CA_VERSION | 4 ++-- configure/CONFIG_DATABASE_VERSION | 4 ++-- configure/CONFIG_LIBCOM_VERSION | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index f4b710e5d..cd632dfa7 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -52,11 +52,11 @@ EPICS_MODIFICATION = 11 # EPICS_PATCH_LEVEL must be a number (win32 resource file requirement) # Not included in the official EPICS version number if zero -EPICS_PATCH_LEVEL = 0 +EPICS_PATCH_LEVEL = 1 # Immediately after an official release the EPICS_PATCH_LEVEL is incremented # and the -DEV suffix is added (similar to the Maven -SNAPSHOT versions) -EPICS_DEV_SNAPSHOT= +EPICS_DEV_SNAPSHOT=-DEV # No changes should be needed below here diff --git a/configure/CONFIG_CA_VERSION b/configure/CONFIG_CA_VERSION index e8b38f57d..712be8e56 100644 --- a/configure/CONFIG_CA_VERSION +++ b/configure/CONFIG_CA_VERSION @@ -2,11 +2,11 @@ EPICS_CA_MAJOR_VERSION = 4 EPICS_CA_MINOR_VERSION = 15 -EPICS_CA_MAINTENANCE_VERSION = 1 +EPICS_CA_MAINTENANCE_VERSION = 2 # Development flag, set to zero for release versions -EPICS_CA_DEVELOPMENT_FLAG = 0 +EPICS_CA_DEVELOPMENT_FLAG = 1 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 diff --git a/configure/CONFIG_DATABASE_VERSION b/configure/CONFIG_DATABASE_VERSION index 096c26d84..599199c2a 100644 --- a/configure/CONFIG_DATABASE_VERSION +++ b/configure/CONFIG_DATABASE_VERSION @@ -2,11 +2,11 @@ EPICS_DATABASE_MAJOR_VERSION = 3 EPICS_DATABASE_MINOR_VERSION = 26 -EPICS_DATABASE_MAINTENANCE_VERSION = 0 +EPICS_DATABASE_MAINTENANCE_VERSION = 1 # Development flag, set to zero for release versions -EPICS_DATABASE_DEVELOPMENT_FLAG = 0 +EPICS_DATABASE_DEVELOPMENT_FLAG = 1 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 diff --git a/configure/CONFIG_LIBCOM_VERSION b/configure/CONFIG_LIBCOM_VERSION index 555cbf8c9..fa4652d10 100644 --- a/configure/CONFIG_LIBCOM_VERSION +++ b/configure/CONFIG_LIBCOM_VERSION @@ -2,11 +2,11 @@ EPICS_LIBCOM_MAJOR_VERSION = 3 EPICS_LIBCOM_MINOR_VERSION = 25 -EPICS_LIBCOM_MAINTENANCE_VERSION = 1 +EPICS_LIBCOM_MAINTENANCE_VERSION = 2 # Development flag, set to zero for release versions -EPICS_LIBCOM_DEVELOPMENT_FLAG = 0 +EPICS_LIBCOM_DEVELOPMENT_FLAG = 1 # Immediately after a release the MAINTENANCE_VERSION # will be incremented and the DEVELOPMENT_FLAG set to 1 From c277e979405487c9fb5dd8f1270ca3301e856f4f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 26 Oct 2026 22:46:42 -0500 Subject: [PATCH 137/141] Update submodules --- modules/normativeTypes | 2 +- modules/pvAccess | 2 +- modules/pvData | 2 +- modules/pvDatabase | 2 +- modules/pva2pva | 2 +- modules/pvaClient | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/normativeTypes b/modules/normativeTypes index e67486c31..28fb652e8 160000 --- a/modules/normativeTypes +++ b/modules/normativeTypes @@ -1 +1 @@ -Subproject commit e67486c3195af95ea62ff2b9a149f9874e051b77 +Subproject commit 28fb652e8f61bfb1c485a68c81b7c56c577d62be diff --git a/modules/pvAccess b/modules/pvAccess index 6e41fb319..d125c58e5 160000 --- a/modules/pvAccess +++ b/modules/pvAccess @@ -1 +1 @@ -Subproject commit 6e41fb31921789b596ca2ea885040449061fbe13 +Subproject commit d125c58e5efae07652f4d2f4583b175815e47d67 diff --git a/modules/pvData b/modules/pvData index 7de3719b2..2ec45e6e8 160000 --- a/modules/pvData +++ b/modules/pvData @@ -1 +1 @@ -Subproject commit 7de3719b258ce1a9411e900077aae7c842c14084 +Subproject commit 2ec45e6e85b37b626ab13015eb6b141090c9d594 diff --git a/modules/pvDatabase b/modules/pvDatabase index 8cf550ff5..4029e6c84 160000 --- a/modules/pvDatabase +++ b/modules/pvDatabase @@ -1 +1 @@ -Subproject commit 8cf550ff57ab8b573a95af2e9602643b8af98110 +Subproject commit 4029e6c842320ded0029cf8bfc3b3226c58d28b3 diff --git a/modules/pva2pva b/modules/pva2pva index fb7fb8c14..3492a9fe1 160000 --- a/modules/pva2pva +++ b/modules/pva2pva @@ -1 +1 @@ -Subproject commit fb7fb8c1406c383c8f609bc979b1667ae4c23b97 +Subproject commit 3492a9fe1563f82198453398697729c84c8ae34c diff --git a/modules/pvaClient b/modules/pvaClient index 65d2cce75..ba0f7d5f1 160000 --- a/modules/pvaClient +++ b/modules/pvaClient @@ -1 +1 @@ -Subproject commit 65d2cce75303ffeeda2ed9514e79e91abdcac7be +Subproject commit ba0f7d5f183b572b2f5405a02c44d030ed2e7b42 From a25ba589b8d0e90fc9e7ae8fbb991c3e9c4b8f93 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 1 Nov 2026 20:52:12 -0800 Subject: [PATCH 138/141] dbYacc yyerror avoid *NULL pinputFileNow may be NULL if the syntax error occurred at or near EOF. --- modules/database/src/ioc/dbStatic/dbYacc.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/database/src/ioc/dbStatic/dbYacc.y b/modules/database/src/ioc/dbStatic/dbYacc.y index aad7ca33d..1dbbdae46 100644 --- a/modules/database/src/ioc/dbStatic/dbYacc.y +++ b/modules/database/src/ioc/dbStatic/dbYacc.y @@ -378,7 +378,7 @@ static int yyerror(char *str) dbIncludePrint(); yyFailed = TRUE; } - fprintf(stderr, "\n %d | %s\n", pinputFileNow->line_num, my_buffer); + fprintf(stderr, "\n %d | %s\n", pinputFileNow ? pinputFileNow->line_num : -1, my_buffer); return(0); } static long pvt_yy_parse(void) From 851a4df047b7c13cb060aa8f59f3213a7b1fba40 Mon Sep 17 00:00:00 2001 From: Vijay Banerjee Date: Thu, 17 Sep 2026 14:48:47 -0500 Subject: [PATCH 139/141] RTEMS/score: Allow overriding microseconds per tick --- configure/os/CONFIG_SITE.Common.RTEMS | 6 ++++++ modules/libcom/RTEMS/score/rtems_config.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/configure/os/CONFIG_SITE.Common.RTEMS b/configure/os/CONFIG_SITE.Common.RTEMS index 6857dc9a9..0c2c1480c 100644 --- a/configure/os/CONFIG_SITE.Common.RTEMS +++ b/configure/os/CONFIG_SITE.Common.RTEMS @@ -46,3 +46,9 @@ USE_GESYS = NO COMMANDLINE_LIBRARY = EPICS #COMMANDLINE_LIBRARY = LIBTECLA #COMMANDLINE_LIBRARY = READLINE + +# +# Override the microseconds per tick using +# +#OP_SYS_CFLAGS += -DCONFIGURE_MICROSECONDS_PER_TICK=1000 +# diff --git a/modules/libcom/RTEMS/score/rtems_config.c b/modules/libcom/RTEMS/score/rtems_config.c index 36b297176..c5b0c618f 100644 --- a/modules/libcom/RTEMS/score/rtems_config.c +++ b/modules/libcom/RTEMS/score/rtems_config.c @@ -37,7 +37,9 @@ #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM #define CONFIGURE_MAXIMUM_DRIVERS 8 +#ifndef CONFIGURE_MICROSECONDS_PER_TICK #define CONFIGURE_MICROSECONDS_PER_TICK 20000 +#endif #define CONFIGURE_INIT_TASK_PRIORITY 80 From 159430dbe248060e7187aadc1b2961f17617ce07 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 2 Nov 2026 16:01:33 -0600 Subject: [PATCH 140/141] Fix possible stack overflows in dbReportDeviceConfig (#930) Writes to both the dtypValue and cvtValue strings could overflow. Instead of just expanding the string buffers, I change the output. Long DTYP strings are shortened to 30 char's by replacing characters from the middle with an ellisis. Any ai & ao records with LINEAR conversions also display their cvt(,) range with limited precision on a second line. The report also gets a header line, in BOLD. --- documentation/new-notes/PR-930.md | 15 ++++++ .../database/src/ioc/dbStatic/dbStaticLib.c | 54 +++++++++++-------- 2 files changed, 46 insertions(+), 23 deletions(-) create mode 100644 documentation/new-notes/PR-930.md diff --git a/documentation/new-notes/PR-930.md b/documentation/new-notes/PR-930.md new file mode 100644 index 000000000..55cd68713 --- /dev/null +++ b/documentation/new-notes/PR-930.md @@ -0,0 +1,15 @@ +### Hardening of the iocsh command `dbReportDeviceConfig` + +This command had a tiny chance that its internal buffers could overflow and +write over parts of the stack, although that required an unusually long device +support name and huge engineering unit limits. Both these issues have been +remediated, and the output format of the report improved. + +A header line is now shown (in BOLD) at the top of the report. + +`DTYP` strings in the 3rd column are now shortened by replacing characters from +the middle of the string with an ellipsis `...`. + +Any ai and ao records with `LINEAR` conversions have their `EGUL` and `EGUF` +fields shown in a `cvt(EGUL, EGUF)` format after the record name. +These two values are now displayed with limited precision. diff --git a/modules/database/src/ioc/dbStatic/dbStaticLib.c b/modules/database/src/ioc/dbStatic/dbStaticLib.c index 73d627a78..84dca89c9 100644 --- a/modules/database/src/ioc/dbStatic/dbStaticLib.c +++ b/modules/database/src/ioc/dbStatic/dbStaticLib.c @@ -22,6 +22,7 @@ #include "dbDefs.h" #include "dbmf.h" #include "ellLib.h" +#include "epicsMath.h" #include "epicsPrint.h" #include "epicsStdio.h" #include "epicsStdlib.h" @@ -3591,11 +3592,12 @@ void dbReportDeviceConfig(dbBase *pdbbase, FILE *report) status = dbFirstRecord(pdbentry); while (!status) { int ilink; + int titlesPrinted = 0; for (ilink=0; ilink maxlen) /* elide the middle */ + epicsSnprintf(dtypValue, sizeof(dtypValue), "%.*s...%s", + (int) (maxlen - 3) / 2, dtyp, + dtyp + srclen - (maxlen - 2) / 2); + else + strcpy(dtypValue, dtyp); } - else { - if (strcmp(dbGetString(pdbentry), "LINEAR") != 0) { - cvtValue[0] = 0; - } - else { - strcpy(cvtValue,"cvt("); - status = dbFindField(pdbentry, "EGUL"); - if (!status) - strcat(cvtValue, dbGetString(pdbentry)); - status = dbFindField(pdbentry, "EGUF"); - if (!status) { - strcat(cvtValue, ","); - strcat(cvtValue, dbGetString(pdbentry)); - } - strcat(cvtValue, ")"); - } + if (!dbFindField(pdbentry, "LINR") && + strcmp(dbGetString(pdbentry), "LINEAR") == 0) { + epicsFloat64 egul = epicsNAN, eguf = epicsNAN; + + if (!dbFindField(pdbentry, "EGUL") && + pdbentry->pflddes->field_type == DBF_DOUBLE) + egul = *(epicsFloat64 *) pdbentry->pfield; + if (!dbFindField(pdbentry, "EGUF") && + pdbentry->pflddes->field_type == DBF_DOUBLE) + eguf = *(epicsFloat64 *) pdbentry->pfield; + epicsSnprintf(cvtValue, sizeof(cvtValue), + "\n cvt(%.8g, %.8g)", egul, eguf); } - fprintf(stream,"%-8s %-20s %-20s %-20s %-s\n", + if (!titlesPrinted++) + fprintf(stream, ANSI_BOLD("%-8s %-20s %-30s %-20s") "\n", + "Type", "INP/OUT", "DTYP", "Record"); + fprintf(stream,"%-8s %-20s %-30s %s %s\n", bus[linkType], linkValue, dtypValue, dbGetRecordName(pdbentry), cvtValue); break; From 92c97d0d23a214bb4144df6f61e10de895e431cd Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 4 Nov 2026 18:56:51 -0600 Subject: [PATCH 141/141] Remove duplications from RELEASE-7.0.11.md --- documentation/RELEASE-7.0.11.md | 140 ------------------------------ documentation/ReleaseChecklist.md | 26 +++++- 2 files changed, 23 insertions(+), 143 deletions(-) diff --git a/documentation/RELEASE-7.0.11.md b/documentation/RELEASE-7.0.11.md index cf4892657..32a102c42 100644 --- a/documentation/RELEASE-7.0.11.md +++ b/documentation/RELEASE-7.0.11.md @@ -221,143 +221,3 @@ Changes to this module since the previous release: - Minor bug fixes ------ - -## EPICS Release 7.0.10 - -```{include} ../../RELEASE-7.0.10.md -:start-after: EPICS Release 7.0.10 -``` - ------ - -## EPICS Release 7.0.9 - -```{include} ../../RELEASE-7.0.9.md -:start-after: EPICS Release 7.0.9 -``` - ------ - -## EPICS Release 7.0.8.1 - -```{include} ../../RELEASE-7.0.8.1.md -:start-after: EPICS Release 7.0.8.1 -``` - ------ - -## EPICS Release 7.0.8 - -```{include} ../../RELEASE-7.0.8.md -:start-after: EPICS Release 7.0.8 -``` - ------ - -## EPICS Release 7.0.7 - -```{include} ../../RELEASE-7.0.7.md -:start-after: EPICS Release 7.0.7 -``` - ------ - -## EPICS Release 7.0.6.1 - -```{include} ../../RELEASE-7.0.6.1.md -:start-after: EPICS Release 7.0.6.1 -``` - ------ - -## EPICS Release 7.0.6 - -```{include} ../../RELEASE-7.0.6.md -:start-after: EPICS Release 7.0.6 -``` - ------ - -## EPICS Release 7.0.5 - -```{include} ../../RELEASE-7.0.5.md -:start-after: EPICS Release 7.0.5 -``` - ------ - -## EPICS Release 7.0.4.1 - -```{include} ../../RELEASE-7.0.4.1.md -:start-after: EPICS Release 7.0.4.1 -``` - ------ - -## EPICS Release 7.0.4 - -```{include} ../../RELEASE-7.0.4.md -:start-after: EPICS Release 7.0.4 -``` - ------ - -## EPICS Release 7.0.3.1 - -```{include} ../../RELEASE-7.0.3.1.md -:start-after: EPICS Release 7.0.3.1 -``` - ------ - -## EPICS Release 7.0.3 - -```{include} ../../RELEASE-7.0.3.md -:start-after: EPICS Release 7.0.3 -``` - ------ - -## EPICS Release 7.0.2.2 - -```{include} ../../RELEASE-7.0.2.2.md -:start-after: EPICS Release 7.0.2.2 -``` - ------ - -## EPICS Release 7.0.2.1 - -```{include} ../../RELEASE-7.0.2.1.md -:start-after: EPICS Release 7.0.2.1 -``` - ------ - -## EPICS Release 7.0.2 - -```{include} ../../RELEASE-7.0.2.md -:start-after: EPICS Release 7.0.2 -``` - ------ - -## EPICS Release 7.0.1.1 - -```{include} ../../RELEASE-7.0.1.1.md -:start-after: EPICS Release 7.0.1.1 -``` - ------ - -```{include} ../../RELEASE-3.16.md -:heading-offset: 1 -``` - ------ - -```{include} ../../RELEASE-3.15.md -:heading-offset: 1 -``` - diff --git a/documentation/ReleaseChecklist.md b/documentation/ReleaseChecklist.md index 8e3e438bd..2a27fd739 100644 --- a/documentation/ReleaseChecklist.md +++ b/documentation/ReleaseChecklist.md @@ -302,9 +302,29 @@ git push --follow-tags upstream 7.0 ---- +### Build the tagged documentation + +The read-the-docs build process isn't automatic when the tag doesn't +point to the last commit in a push, so building the release docs +must be triggered by hand after pushing as follows: + +- Go to [read-the-docs versions page](https://app.readthedocs.org/projects/epics-base/) +- Look for a R7.0.12 version tag in the list. If present with a + green check-mark it has already been built: click on the Book icon + ("View documentation for ...") link to check the result. +- If R7.0.12 is not present, click the "+ Add version" button and + type `7.0.12` into the "Search versions" box there, then click that + entry to bring up an "Edit version" dialog. +- I like to edit the suggested "Slug" to remove the `r` from the + start. +- Click the "Active" slider to turn that on, then "Update version". +- Wait for the documentation to be built, and check the result. + +---- + ### Publish the Release -These stages don't have to happen in this particular order. +The steps below don't have to happen in this particular order. #### A. Publish to epics.anl.gov @@ -333,7 +353,7 @@ updating the front page and sidebar. Add an entry to the website News page, linking to the new version webpage. -### B. Publish to epics-controls.org +#### B. Publish to epics-controls.org **Website Editor:** Upload the tar file and its `.asc` signature file to the @@ -355,7 +375,7 @@ Not covered in the instructions on the website: Go to Posts, find a previous release and use "Duplicate Post", then edit the result and publish it. This generates the News item. -### C. Publish to GitHub +#### C. Publish to GitHub **Release Manager:** Go to the GitHub