This version of EPICS Base has not been released yet.
The way comments are parsed by the iocsh interpreter has changed. The interpreter can be selectively disabled from echoing comments coming from a script by starting those lines with '#-' rather than just '#'.
The table of record support functions (rset methods for short) no longer has entries of type RECSUPFUN (which says: any number and type of arguments). Instead, rset methods are now typed by default. The RECSUPFUN typedef has been deprecated and casts to it as well as using the untyped struct rset will create compilation warnings.
Existing code (e.g. external record supports) will generate such warnings when compiled against this version of Base, but it will work without changes.
For a conversion period, the new typed rset definitions are activated by defining USE_TYPED_RSET, preferably by setting USR_CPPFLAGS += -DUSE_TYPED_RSET inside a Makefile. After activating the new typed rset in this way and making the following changes, the result should still compile and work properly against older versions of Base.
The first parameter of init_record and process has been changed to struct dbCommon *. Record types that use void* here should be changed to use struct dbCommon*, and cast the argument to their own xxxRecord *.
When compiled against this release, compiler warnings about incompatible types for the method pointers should be taken seriously. When compiled against older versions of base, such warnings are unavoidable.
Record types written in C++ need to take more drastic measures because of the stricter type checking in C++. To remain compatible with older versions of base you need something like:
#include "epicsVersion.h" #ifdef VERSION_INT #if EPICS_VERSION_INT < VERSION_INT(3,16,0,2) #define RECSUPFUN_CAST (RECSUPFUN) #else #define RECSUPFUN_CAST #endif #else #define RECSUPFUN_CAST (RECSUPFUN) #endif
and then replace (RECSUPFUN) with RECSUPFUN_CAST when initializing the rset. Further changes might be needed, e.g. to adapt const-ness of method parameters.
The build rules associated with the CapFast-related tools sch2edif
and e2db and the database optimization
tool dbst have
been removed, along with the DB_OPT build configuration variable.
The compressRecord has a new field BALG which can select between FIFO (append) and LIFO (prepend) ordering for insertion of new elements. FIFO ordering is the default, matching the behviour of previous versions.
Valgrind is a software debugging suite provided by many Linux distributions. The header valgrind/valgrind.h is now included in, and installed by, Base. When included by a C or C++ source file this header defines some macros which expand to provide hints to the Valgrind runtime. These have no effect on normal operation of the software, but when run using the valgrind tool they can help to find memory leaks and buffer overflows. Suitable hints have been added to several free-lists within libCom, including freeListLib, allowing valgrind to provide more accurate information about the source of potential leaks.
valgrind.h automatically disables itself when the build target is not supported by the valgrind tool. It can also explicitly be disabled by defining the macro NVALGRIND. See src/libCom/Makefile for a commented-out example.
As a matter of policy valgrind.h will never be included by any header file installed by Base, so its use will remain purely an implementation detail hidden from application software. Support modules which choose to use valgrind.h are advised to do likewise.
The IOC record locking code has been re-written with an expanded API; global locks are no longer required by the IOC database implementation.
The new API functions center around dbScanLockMany(), which behaves like dbScanLock() applied to an arbitrary group of records. dbLockerAlloc() is used to prepare a list or record pointers, then dbScanLockMany() is called. When it returns, all of the records listed may be accessed (in any order) until dbScanUnlockMany() is called.
The Application Developer's Guide has been updated to describe the API and implementation is more detail.
Previously a global mutex 'lockSetModifyLock' was locked and unlocked during dbScanLock(), acting as a sequencing point for otherwise unrelated calls. The new dbLock.c implementation does not include any global mutex in dbScanLock() or dbScanLockMany(). Locking/unlocking of unrelated lock sets is now completely concurrent.
A Perl script and Makefile rules have been added to allow modules to generate a C header file with a macro defined with an automatically updated identifier. This is a VCS revision ID (Darcs, Git, Mercurial, Subversion, and Bazaar are supported) or the date/time of the build if no VCS system is in use.
The makeBaseApp example template has been updated with a new device support which makes this identifier visible via a lsi (long string input) record.
The epicsTime routines that used to return epicsTimeERROR now return a specific S_time_ status value, allowing the caller to discover the reason for any failure. The identifier epicsTimeERROR is no longer defined, so any references to it in source code will no longer compile. The identifier epicsTimeOK still exists and has the value 0 as before, so most code that uses these APIs can be changed in a way that is backwards-compatible with the previous return status.
Time providers that have to return a status value and still need to be built with earlier versions of Base can define the necessary status symbols like this:
#include "epicsTime.h" #ifndef M_time /* S_time_... status values were not provided before Base 3.16 */ #define S_time_unsynchronized epicsTimeERROR #define S_time_...whatever... epicsTimeERROR #endif
The epicsReadline code has been reorganized to allow the commandline history editor to be disabled at runtime. The EPICS_COMMANDLINE_LIBRARY build setting still selects the preferred editor, but the new IOCSH_HISTEDIT_DISABLE environment variable can be set at runtime to disable history editing and make the IOC or other program use the basic editor instead. This is useful when starting and controlling an IOC from another program through its stdin and stdout streams since history editors often insert invisible escape codes into the stdout stream, making it hard to parse.
Added a new macro callbackGetPriority(prio, callback) to the callback.h header and removed the need for dbScan.c to reach into the internals of its CALLBACK objects.
When a National Instruments network variables CA server is already running on a Windows system and an IOC or PCAS server is started, the IOC's attempt to bind a TCP socket to the CA server port number fails, but Windows returns a different error status value than the IOC is expecting in that circumstance (because the National Instruments code requests exclusive use of that port, unlike the EPICS code) so the IOC fails to start properly. The relevent EPICS bind() checks have now been updated so the IOC will request that a dynamic port number be allocated for this TCP socket instead when this happens.
Code has been added to the IOC startup to better protect it against bad
periodic scan rates, including against locales where .
is not
accepted as a decimal separator character. If the scan period in a menuScan
choice string cannot be parsed, the associated periodic scan thread will no
longer be started by the IOC and a warning message will be displayed at iocInit
time. The scanppl command will also flag the faulty menuScan value.
Loading of database files has been optimized to avoid overproportionally long loading times for large databases. As a part of this, the alphabetical ordering of records instances (within a record type) has been dropped. In the unexpected case that applications were relying on the alphabetic order, setting dbRecordsAbcSorted = 1 before loading the databases will retain the old behavior.
The routine dbRenameRecord() has been removed, as it was intended to be used by database configuration tools linked against a host side version of the dbStatic library that is not being built anymore.
In addition to the more detailed change descriptions below, the following Launchpad bugs have also been fixed in this release:
When using the Microsoft compilers a new build system variable is provided that controls whether whole program optimization is used or not. For static builds using Visual Studio 2010 this optimization must be disabled. This is controlled in the files configure/os/CONFIG_SITE.Common.windows-x64-static and configure/os/CONFIG_SITE.Common.win32-x86-static by setting the variable OPT_WHOLE_PROGRAM = NO to override the default value YES that would otherwise be used.
Note that enabling this optimization slows down the build process. It is not possible to selectively disable this optimization, when building a particular module say; Microsoft's linker will restart itself automatically with the -LTCG flag set and display a warning if it is asked to link any object files that were compiled with the -GL flag.
Dynamic array sizing support was added to the IOC server (RSRV) in the
Base-3.14.12 release, but has not until now been supported in the Portable
Channel Access Server
(PCAS). Channel Access server applications using the
PCAS may not need to be modified at all; if they already push monitors with
different gdd array lengths, those variable sizes will be forwarded to any CA
clients who have requested variable length updates. The example CAS server
application has been modified to demonstrate this feature.
In implementing the above, the gdd method gdd::put(const gdd *) now copies the full-sized array from the source gdd if the destination gdd is of type array, has no allocated memory and a boundary size of 0.
The EPICS timestamp library (epicsTime) inside libCom's OSI layer has been extended by routines that convert from struct tm to the EPICS internal epicsTime type, assuming UTC - i.e. without going through the timezone mechanism. This solves issues with converting from the structured type to the EPICS timestamp at driver level from multiple threads at a high repetition rate, where the timezone mechanism was blocking on file access.
The build configuration files that allow cross-building of the 32-bit win32-x86-mingw cross-target have been adjusted to default to building shared libraries (DLLs) as this is now supported by recent MinGW compilers. The 64-bit windows-x64-mingw cross-target was already being built that way by default. The configuration options to tell the minGW cross-compiler to link programs with static versions of the compiler support libraries have now been moved into the CONFIG_SITE.linux-x86.target files.
The iocInit code now performs a sanity check of the current time returned by the generalTime subsystem and will print a warning if the wall-clock time returned has not been initialized yet. This is just a warning message; when a time provider does synchonize the IOC will subsequently pick up and use the correct time. This check code also primes the registered event system provider if there is one so the epicsTimeGetEventInt() routine will work on IOCs that ask for event time within an interrupt service routine.
The osiClockTime provider's synchronization thread (which is only used on some embedded targets) will now poll the other time providers at 1Hz until the first time it manages to get a successful timestamp, after which it will poll for updates every 60 seconds as before.
The routine generalTimeGetExceptPriority() was designed for use by backup (lower priority) time providers like the osiClockTime provider which do not have their own absolute time reference and rely on other providers for an absolute time source. This routine no longer implements the ratchet mechanism that prevented the time it returned from going backwards. If the backup clock's tick-timer runs fast the synchronization of the backup time provider would never allow it to be corrected backwards when the ratchet was in place. The regular epicsTimeGetCurrent() API still uses the ratchet mechanism, so this change will not cause the IOC to see time going backwards.
The build configuration files for builds using the Microsoft compilers have been updated, although there should be no noticable difference at most sites. One extra compiler warning is now being suppressed for C++ code, C4344: behavior change: use of explicit template arguments results in ... which is gratuitous and was appearing frequently in builds of the EPICS V4 modules.
Cross-builds of the windows-x64 target from a win32-x86 host have been removed as they don't actually work within the context of a single make run. Significant changes to the build configuration files would be necessary for these kinds of cross-builds to work properly, which could be done if someone needs them (email Andrew Johnson before working on this, and see this stack-overflow answer for a starting point).
In preparation for moving to git in place of the Bazaar revision control system we have removed all the keywords from the Base source code.
Building this version of Base on a Linux system creates a systemd service file suitable for starting the Channel Access Repeater under systemd. The file will be installed into the target bin directory, from where it can be copied into the appropriate systemd location and modified as necessary. Installation instructions are included as comments in the file.
A new "getenv" device support for both the stringin and lsi (long string input) record types can be used to read the value of an environment variable from the IOC at runtime. See base/db/softIocExit.db for sample usage.
A new order-only prerequisite build rule has been added to ensure that library files (and DLL stubs on Windows) get installed before linking any executables, which resolves parallel build problems on high-powered CPUs. There are some (rare) cases though where a Makefile has to build an executable and run it to be able to compile code for a library built by the same Makefile. With this new build rule GNUmake will complain about a circular dependency and the build will probably fail in those cases. To avoid this problem the failing Makefile should set DELAY_INSTALL_LIBS = YES before including the $(TOP)/configure/RULES file, disabling the new build rule.
The IOC now sets a number of environment variables at startup that provide the version of EPICS Base it was built against (EPICS_VERSION_...) and its build architecture (ARCH). In some cases this allows a single iocBoot/ioc directory to be used to run the same IOC on several different architectures without any changes.
There are also 3 new environment parameters (EPICS_BUILD_...) available that C/C++ code can use to find out the target architecture, OS class and compiler class it was built with. These may be useful when writing interfaces to other languages.
The mechanism behind the "promptgroup()" field property inside a record type definition has been changed. Instead of using a fixed set of choices, the static database access library now collects the used gui group names while parsing DBD information. Group names should start with a two-digit number plus space-dash-space to allow proper sorting of groups.
The include file guigroup.h that defined the fixed set of choices has been deprecated. Instead, use the conversion functions between index number and group string that have been added to dbStaticLib.
When a DBD file containing record-type descriptions is expanded, any old-style GUI_xxx group names will be replaced by a new-style string for use by the IOC. This permits an older record type to be used with the 3.15.4 release, although eventually record types should be converted by hand with better group names used.
RSRV now honors EPICS_CAS_INTF_ADDR_LIST and binds only to the provided list of network interfaces. Name searches (UDP and TCP) on other network interfaces are ignored. For example on a computer with interfaces 10.5.1.1/24, 10.5.2.1/24, and 10.5.3.1/24, setting "EPICS_CAS_INTF_ADDR_LIST='10.5.1.1 10.5.2.1'" will accept traffic on the .1.1 and .2.1, but ignore from .3.1
RSRV now honors EPICS_CAS_IGNORE_ADDR_LIST and ignores UDP messages received from addresses in this list.
Previously, CA servers (RSRV and PCAS) would build the beacon address list using EPICS_CA_ADDR_LIST if EPICS_CAS_BEACON_ADDR_LIST was no set. This is no longer done. Sites depending on this should set both envronment variables to the same value.
libca, RSRV, and PCAS may now use IPv4 multicasting for UDP traffic (name search and beacons). This is disabled by default. To enable multicast address(s) must be listed in EPICS_CA_ADDR_LIST for clients and EPICS_CAS_INTF_ADDR_LIST for servers (IOCs should set both). For example: "EPICS_CAS_INTF_ADDR_LIST='224.0.2.9' EPICS_CA_ADDR_LIST=224.0.2.9".
Please note that no IPv4 multicast address is officially assigned for Channel Access by IANA. The example 224.0.2.9 is taken from the AD-HOC Block I range.
Since EPICS Base 3.15.0.2 on Posix OSs the initialization of the epicsThread subsystem has called mlockall() when the OS supports it and thread priority scheduling is enabled. Doing so has caused problems in third-party applications that call the CA client library, so the functionality has been moved to a separate routine epicsThreadRealtimeLock() which will be called by the IOC at iocInit (unless disabled by setting the global variable dbThreadRealtimeLock to zero).
When loading database files, macros get expanded even on comment lines. If a comment contains an undefined macro, the load still continues but an error message gets printed. For this release the error message has been changed to a warning, but even this warning can be made less verbose by setting this new variable to a non-zero value before loading the file, like this:
var dbQuietMacroWarnings 1 iocsh dbQuietMacroWarnings=1 VxWorks
This was Launchpad bug 541119.
Dirk Zimoch provided code that allows the NTP Time provider (used on VxWorks and RTEMS only) to adapt to changes in the OS clock tick rate after the provider has been initialized. Note that changing the tick rate after iocInit() is not advisable, and that other software might still misbehave if initialized before an OS tick rate change. This change was back-ported from the 3.15 branch.
When a CA client gets data from an IOC record using a compound data type such as DBR_TIME_DOUBLE the value field is fetched from the database in a separate call than the other metadata, without keeping the record locked. This allows some other thread such as a periodic scan thread a chance to interrupt the get operation and process the record in between. CA monitors have always been atomic as long as the value data isn't a string or an array, but this race condition in the CA get path has now been fixed so the record will stay locked between the two fetch operations.
This fixes Launchpad bug #1581212, thanks to Till Strauman and Dehong Zhang.
The 'make runtests' and 'make tapfiles' build targets normally only run the self-tests for the main EPICS_HOST_ARCH architecture. If the host is able to execute self-test programs for other target architectures that are being built by the host, such as when building a -debug version of the host architecture for example, the names of those other architectures can be added to the new CROSS_COMPILER_RUNTEST_ARCHS variable in either the configure/CONFIG_SITE file or in an appropriate configure/os/CONFIG_SITE.<host>.Common file to have the test programs for those targets be run as well.
An additional check has been added at build-time for the contents of the configure/RELEASE file(s), which will mostly only affect users of the Debian EPICS packages published by NSLS-2. Support modules may share an install path, but all such modules must be listed adjacent to each other in any RELEASE files that point to them. For example the following will fail the new checks:
AUTOSAVE = /usr/lib/epics ASYN = /home/mdavidsaver/asyn EPICS_BASE = /usr/lib/epics
giving the compile-time error
This application's RELEASE file(s) define EPICS_BASE = /usr/lib/epics after but not adjacent to AUTOSAVE = /usr/lib/epics Module definitions that share paths must be grouped together. Either remove a definition, or move it to a line immediately above or below the other(s). Any non-module definitions belong in configure/CONFIG_SITE.
In many cases such as the one above the order of the AUTOSAVE and ASYN lines can be swapped to let the checks pass, but if the AUTOSAVE module depended on ASYN and hence had to appear before it in the list this error indicates that AUTOSAVE should also be built in its own private area; a shared copy would likely be incompatible with the version of ASYN built in the home directory.
Two buffer overflow bugs that can crash the IOC have been fixed, caused by initializing a string field with a value larger than the field size (Launchpad bug #1563191).
The C++ interface to the epicsThread API could corrupt the stack on thread exit in some rare circumstances, usually at program exit. This bug has been fixed (Launchpad bug #1558206).
On RTEMS the NTP Time Provider could in some circumstances get out of sync with the server because the osdNTPGet() code wasn't clearing its input socket before sending out a new request. This (Launchpad bug 1549908) has now been fixed.
The bitwise operators in the CALC engine have been modified to work properly with values that have bit 31 (0x80000000) set. This modification involved back-porting some earlier changes from the 3.15 branch, and fixes Launchpad bug #1514520.
On process exit, don't try to stop the worker thread that makes DNS lookups asynchronous. Previously this would wait for any lookups still in progress, delaying the exit unnecessarily. This was most obvious with catools (eg. cainfo). lp:1527636
Simpler versions of the epicsTime_gmtime() and epicsTime_localtime() routines have been included in the Windows implementations, and a new test program added. The original versions do not report DST status properly. Fixes Launchpad bug 1528284.