Compare commits

...

196 Commits

Author SHA1 Message Date
Andrew Johnson
3be67aca3c Releasing R3.15.9
Some checks failed
Base / Ub-20 gcc-8 (push) Has been cancelled
Base / Ub-16 gcc-4.9 (push) Has been cancelled
Base / Win2019 MSC-19 (push) Has been cancelled
Base / Ub-20 clang-10 (push) Has been cancelled
Base / Ub-20 clang-10 C++11 (push) Has been cancelled
Base / MacOS clang-12 (push) Has been cancelled
Base / Ub-16 clang-9 (push) Has been cancelled
Base / Ub-20 gcc-9 + MinGW (push) Has been cancelled
Base / Ub-20 gcc-9 + RT-4.10 (push) Has been cancelled
Base / Ub-20 gcc-9 + RT-4.9 (push) Has been cancelled
Base / Ub-20 gcc-9 C++11, static (push) Has been cancelled
Base / Ub-20 gcc-9 + MinGW, static (push) Has been cancelled
Base / Ub-16 gcc-4.8 (push) Has been cancelled
Base / Win2019 MSC-19, static (push) Has been cancelled
2021-06-27 12:18:45 -05:00
Andrew Johnson
ebf4a155d7 Added missing entries to Release Notes 2021-06-26 18:08:52 -05:00
Andrew Johnson
28531b0dbb Reworked the README.md file
Lots of updates; removed version number
2021-06-26 17:57:33 -05:00
Andrew Johnson
5c3ecf9054 Dump the Darwin README file, very dated 2021-06-26 17:55:11 -05:00
Freddie Akeroyd
e8c5748f89 Use <osiSock.h> rather than <osdSock.h> 2021-06-25 11:37:07 +01:00
Michael Davidsaver
857527280b ci: install versioned g++ 2021-05-19 08:49:24 -07:00
Freddie Akeroyd
d1ddbad053 Fix issue with very large timeout passed to epicsEventWaitWithTimeout()
A very large timeout was getting converted to a 0 wait and causing
some unit tests to fail in strange and random ways. Not trapping
large timeouts was an oversight when converting to waitable timers
on WIN32
2021-05-19 08:46:11 -07:00
Andrew Johnson
b55c019f10 Merged Freddie's waitable_timers branch into 3.15 2021-05-05 17:55:00 -05:00
Andrew Johnson
31584e52be Merged Ralph's win-Z7 branch into 3.15 2021-05-05 17:49:11 -05:00
Andrew Johnson
2eb5af3167 Return dbPutSpecial(paddr, 1) status from dbPut()
The status from RSET::special(paddr, 1) has not been returned
to the put caller since 3.14, due to a bad up-merge.
2021-05-04 11:18:54 -05:00
Ralph Lange
fa069b0845 Revert config fixes for parallel builds with MSVC
This reverts commit 1454f42a27.
This reverts commit 4aee25e8e2.
2021-03-29 17:49:02 +02:00
Ralph Lange
c78db512f2 Windows: use -Z7 instead of -Zi to generate debug symbols
"C7 compatible" or "old-style" debug information is kept local
in the translation unit (.obj file) and does not create issues
with parallel builds
2021-03-26 17:30:36 +01:00
Freddie Akeroyd
29e9843056 Add release notes entry for waitable timers 2021-03-12 19:24:09 +00:00
Andrew Johnson
0c4ab7b24a Merge my 'make-inc-fix' branch into 3.15 2021-03-11 20:45:37 -06:00
Andrew Johnson
d831c2b384 Merge 'FreddieAkeroyd-use_epicsStrtod' into 3.15 2021-03-11 20:18:57 -06:00
Andrew Johnson
34d06b6e36 Merge branch 'gabrielfedel-fix_msi' into 3.15 2021-03-11 20:12:07 -06:00
Andrew Johnson
b2f7f4e173 Minor fixes in configure/RULES files 2021-03-11 18:13:44 -06:00
Freddie Akeroyd
3c7fb7990f Use <epicsStdlib.h> 2021-03-11 15:08:00 +00:00
Andrew Johnson
c359b49aed Fix the 3.15 'make inc' build target
Now generates and installs dbd, header and html files.
No compilation involved/required.
2021-03-10 22:05:39 -06:00
Freddie Akeroyd
c140a0a804 Add additional cleanup and error handling 2021-03-10 21:58:35 +00:00
Gabriel Fedel
0bc2a3e999 Fix variable type and cast on msi.cpp
This way the attribution of i to cmdind is a valid value.
2021-03-10 14:37:14 +01:00
Freddie Akeroyd
8e7702c8a5 Use epicsStrtod, remove some warnings 2021-03-10 11:29:45 +00:00
Freddie Akeroyd
5f94ab6d9f Tidy up 2021-03-10 10:47:24 +00:00
Gabriel Fedel
6ac10d43b1 Fix type comparision on msi.cpp
This change fix the comparision of different signedess (int and long
unsigned int).
2021-03-10 09:45:01 +01:00
Freddie Akeroyd
c6af4a245d Use waitable timers 2021-03-10 01:17:47 +00:00
Andrew Johnson
9184983cf0 Merge branch Ticket80_use_os_strtod_if_above_vs_2015 2021-03-09 18:27:18 -06:00
Jack Harper
30172226f9 whoops, MSVC 1900 not 1800 2021-03-09 13:13:16 +00:00
Jack Harper
2ea0994507 tests passing 2021-03-09 13:04:57 +00:00
Ralph Lange
dd9f38d711 Build: Fix spurious failures with SNIPPETS in Windows
Under some combinations of shell / Make version / Windows version,
Windows make was giving up searching for a target "../"
2021-01-26 17:14:00 +01:00
Andrew Johnson
d997690aa5 Build: Fix tests for the 'make -s' flag
'make -j2' or more adds an 's' to MFLAGS in "--jobserver-fds".
This is the correct way to do the check.
2020-12-30 13:08:48 -06:00
Andrew Johnson
a043599e18 GHA: Save .tap files as an artifact 2020-12-28 18:04:06 -06:00
Andrew Johnson
02be10069e Make the CI commit-ignore patterns match 2020-12-28 17:13:45 -06:00
Andrew Johnson
ff4317d05a Make .appveyor.yml into a branch-specific filename
The name should match the Appveyor account that builds the branch;
From a suggestion by Michael.
2020-12-28 15:59:12 -06:00
Andrew Johnson
63919e199c Fix menuPriority filename in RecordReference index 2020-12-28 13:40:35 -06:00
Andrew Johnson
518bab9675 Clean up .appveyor.yml
Whitelist the tagged versions too
Exclude MinGW debug builds since (unlike the VS builds) they use
the same system libraries as the non-debug builds.
We aren't building vs2008 any more anyway.
2020-12-23 11:56:32 -06:00
Andrew Johnson
a8036d7f34 posix/osdThread: Use "Once" versions properly
Functions used before epicsThreadInit() returns must call the
checkStatusOnceQuit() version to avoid recursion from errlogInit()
2020-12-23 11:53:05 -06:00
Andrew Johnson
436ce4526b Appveyor: Update CMP from mingw => gcc 2020-12-21 15:49:52 -06:00
Andrew Johnson
9ba0081a82 Change the Appveyor steps to call the new cue.py script 2020-12-18 15:35:18 -06:00
Andrew Johnson
c60056d4d6 Reconfigure and tidy up the testFailure stuff
Many variables renamed.
Generated files are now named .log for .gitignore
Actions are now defined in CONFIG_BASE variables.
2020-12-18 15:32:46 -06:00
Andrew Johnson
68c056f2f8 Fix makeTestfile.pl to report test failures properly
If a test program reports test failures, the Perl wrapper
must return the same error status. On Windows where we use
system() instead of exec() that needs some value fiddling.
2020-12-18 10:20:31 -06:00
Andrew Johnson
48a6d2f781 GH-Actions: Undo my workflow name change
Changing it also modified the names of all previous builds.
2020-12-17 20:59:56 -06:00
Andrew Johnson
79bb9e000b GH-Actions: Tweaks 2020-12-17 20:39:08 -06:00
Andrew Johnson
c404eb3f83 GH-Actions: Add short names for each job 2020-12-17 20:38:06 -06:00
Andrew Johnson
7beb32e209 Extend testFailures.pl to list the failed test programs
Creates a file .taps-failed in each O.<arch> directory,
appending the name of each tapfile that has failures to it.
The testFailures script now reads the .taps-failed files
from each directory listed in .tests-failed and nicely
displays the failing tests listed in each.
2020-12-17 18:34:24 -06:00
Andrew Johnson
a365de2419 Fix return value of epicsUnitTest::testDone()
Wasn't properly returning a non-zero exit status
when HARNESS_ACTIVE was set.
2020-12-17 18:21:07 -06:00
Ralph Lange
2035fc641a PCAS: fix scope of tsDLList when used in other classes
Use ::tsDLList to avoid resolving to privately inherited
name (which was breaking builds on newer clang compilers)
2020-12-07 10:07:23 +01:00
Ralph Lange
d25c9a74ad ci: travis-ci -> github actions 2020-12-06 15:12:28 +01:00
Andrew Johnson
7632c355ee dbpr: Catch buffer overflow from long link strings.
Fixes lp: #1776141

Currently this just truncates when we hit the end of the buffer,
a better solution is warranted.
2020-11-16 14:25:51 -05:00
Andrew Johnson
4730e14cc7 Document the PINI, POST and PRIO menus 2020-11-13 18:17:47 -06:00
Ralph Lange
c969f05f51 AppVeyor: explicitly set default runner image (VS2015) 2020-11-03 12:04:57 +01:00
Ralph Lange
3947b9a061 Appveyor: whitelist 3.15 branch
- DO NOT UPMERGE TO 7.0

The AppVeyor epics-base-3 project is supposed to pull the .appveyor.yml from this branch to only build commits from 3.15.
2020-11-03 09:41:45 +01:00
Martin Konrad
228ad79b7a Simplify addToList() function 2020-10-13 18:38:17 -04:00
Martin Konrad
bbc0a56d2b Fix wrong PHAS order
Records with lower PHAS value than any previously loaded records
were inserted at the end of the list rather than at the beginning.
This fixes lp: #1899697. Also fixes a proto-bug in that the second
argument to the previously used ellAdd() call assumed that
offsetof(scan_element, node)==0.

Thanks to Bruno Martins for providing this patch.
2020-10-13 18:34:39 -04:00
Andrew Johnson
ad3728d00d Edits to the Record Ref index page 2020-08-21 15:43:48 -05:00
Ralph Lange
bf7a1605c6 Name generated junitfiles '<testname>-results.xml'
- following an idea by Freddie Akeroyd,
  to allow better distinction from other xml files
2020-06-23 13:47:33 +02:00
Ralph Lange
0fbfc74182 Fix missing deletion in 97b29129 from 'fix/misc'
- fixes 97b29129 that was replacing two assert() statements
  without removing the original (offending) lines
2020-06-23 11:23:57 +02:00
Ralph Lange
b248023eb2 Merge Ralph's 'fix/misc' branch into 3.15
(closes #77)
2020-06-10 18:39:22 +02:00
Ralph Lange
92374b2be2 libcom/osi: fix potential leak in vxWorks/osdThread.c
(found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
579fc9d0c7 libcom/osi: fix potential leak in default/osdThreadHooks.c
(found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
cd47bbf99b libcom/osi: fix debug printf() in default/osdNetIntf.c
(found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
d3d40689c8 libcom/osi: fix dangerous usage of strncat (WIN32)
(found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
d5eb055bb7 libcom/flex: fix sscanf() argument types
(code smell found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
97b29129af libcom/test: don't modify operand in assert() statement
(code smell found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
801710b8c7 db: fix possible null pointer dereference
(found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
30f5c3b301 db: fix incomplete initialization in dbChannelOpen()
(found by sonar/cppcheck)
2020-06-10 14:26:40 +02:00
Ralph Lange
69d4c238e7 ca/tools: free() all allocated buffers
(found by sonar/cppcheck)
2020-06-09 15:52:14 +02:00
Ralph Lange
7d1ff1411f ca/tools: fix type errors in option parsing
(found by sonar/cppcheck)
2020-06-09 15:51:35 +02:00
Ralph Lange
f0e143b907 ca/client: fix possible null pointer dereference
(found by sonar/cppcheck)
2020-06-09 15:48:33 +02:00
Andrew Johnson
e923790c41 Update versions after tagging 2020-05-15 13:55:29 -05:00
Andrew Johnson
c7e42fab3c Set version number to 3.15.8, clear snapshot 2020-05-15 12:00:23 -05:00
Andrew Johnson
2f28ce94f4 Release Notes changes for 3.15.8 2020-05-15 11:36:45 -05:00
Andrew Johnson
732f8b19be Merge branch 'defaultMessageQueue' into 3.15 2020-05-14 10:41:52 -05:00
Andrew Johnson
b03e2f376b eMQTest: Start each test with a new (empty) queue
If fastReceiver() took more than 0.01 seconds to exit,
sleepySender() might have pushed a second message onto
the queue after setting recvExit, so there would be an
extra message in the queue for the next test, which I
was seeing on Appveyor. That's my current theory...
2020-05-13 16:11:31 -05:00
Andrew Johnson
59c68807b6 Heinz Junkes' fix for lp: #1812084 Build failure on RTEMS
I reduced some of the code duplication from his original.
2020-05-13 15:26:34 -05:00
Andrew Johnson
2e7ed02a60 Allow/expect MinGW to fail epicsStackTraceTest #5 2020-05-07 13:13:26 -05:00
Andrew Johnson
089954aaab MessageQueue Tests: Extend Mark's sleep tests 2020-05-07 13:12:12 -05:00
Andrew Johnson
34e0b2f305 osdMessageQueue: Undo change to -ve timeout handling
The internal mySend() and myReceive() routines do expect a timeout
of -1 to mean wait forever, see the epicsMessageQueueSend() and
epicsMessageQueueReceive() API routines.
2020-05-04 11:56:14 -05:00
Andrew Johnson
ceb13797a6 Cosmetic 2020-05-01 00:13:02 -05:00
Andrew Johnson
084557bd3e osdMessageQueue: Don't wake our sender until we're ready for it
Move the code that wakes up the next sending task to after we've
added our threadNode to the receiveQueue. He still has to wait for
us to release the Mutex though, so this might make no difference.
This commit also changes when we decrement the number of waiting
senders so it always happens immediately after a threadNode gets
taken off the sendQueue by the code that removed it.
2020-05-01 00:12:32 -05:00
Andrew Johnson
aeed7cfbdd osdMessageQueue: This is the mirror of Heinz Junkes' earlier fix
When sending a message, if the queue is full so we have to wait, we
create a threadNode with an eventNode in it and stick it on the
sendQueue, then wait for a receiver to signal that event, waking us.
If we awoke due to a timeout but a receiver was actually waking us
up anyway (i.e. eventSent was set), we shouldn't give up.
2020-04-30 23:55:30 -05:00
Andrew Johnson
183c3b2a3e osdMessageQueue: Clear eventNode before returning it
Introduced freeEventNode() which ensures eventNodes don't have a
signalled event in them before returning the node to the freeList.
Callers pass the status from epicsEventWaitWithTimeout() to indicate
whether it was signalled or not. If it timed out we must trigger it
and Wait to clear the event state.
2020-04-30 23:38:51 -05:00
Andrew Johnson
cf2fef2405 osdMessageQueue: Return sooner on -ve timeout
It appears that previously a negative timeout actually implemented a
'wait forever', but the VxWorks and RTEMS implementations both check
for (timeout <= 0) and return immediately if nothing can be done
without waiting.
2020-04-30 23:27:43 -05:00
Andrew Johnson
298c8706ec osdMessageQueue: Rename freeEventNode() -> destroyEventNode() 2020-04-30 22:59:58 -05:00
Ralph Lange
49de2ec498 Merge ralph@gh:use-ci-scripts-3.15 into 3.15 2020-04-27 12:10:24 +02:00
Ralph Lange
0aa6e9603b Update .ci submodule to v2.3.3
- fix appveyor issue when building base
- fix RTEMS cross build for Base 3.15
- run tests using parallel make
2020-04-27 11:59:57 +02:00
Andrew Johnson
314e09d8ca Build system release notes 2020-04-24 16:44:49 -05:00
Ralph Lange
076175386f ci: remove old integration in .ci-local 2020-04-24 19:27:05 +02:00
Ralph Lange
f40d379485 appveyor: update .appveyor.yml for ci-scripts 2020-04-24 19:27:05 +02:00
Ralph Lange
445cbb8221 travis-ci: update .travis.yml for ci-scripts
- use more EXTRAs on MacOS for make args
2020-04-24 19:27:05 +02:00
Ralph Lange
a9c8d8d5d3 Add ci-scripts v2.3.2 (submodule in .ci) 2020-04-24 15:11:32 +02:00
Ralph Lange
1ff64f72a9 ci: move ci -> .ci-local
also rename appveyor.yml -> .appveyor.yml
2020-04-23 16:00:53 +02:00
Ralph Lange
f10d0d95b0 Apply perl rules for .tap and .xml only to perl tests
Don't apply the %.tap: %.t and %.xml: %.tap rules to tap and junit
result files from other test frameworks.
(They would overwrite the other frameworks' own rules.)
2020-04-21 11:45:50 +02:00
Andrew Johnson
dfbda1394d Revert the runtests:: change but in an extensible way
Use only %.t files in new TESTSCRIPTS.t var for Perl tests.
TAPFILES and JUNITFILES can be appended to by other rules.
The runtests and test-results rules have no direct recipes.
Added run-tap-tests and tap-results rules, simlified recipe.
Make %.tap:%.t and %.xml:%.tap into static pattern rules.
2020-04-21 01:39:59 -05:00
Andrew Johnson
d05d8807ec Stop generating the testspec file
It was created before modern continuous integration systems
came along; Diamond were supposed to run the tests for us,
but they didn't last for very long.
2020-04-21 01:17:48 -05:00
Andrew Johnson
582a9dbef5 Replace pre-make rule with before-actions rules
For all standard build ACTIONS, a rule before-<action> is
run just before running that action in the subdirectories
given by the DIRS variable. Only works in Makefiles that
include RULES_DIRS or RULES_TOP.
2020-04-21 01:14:03 -05:00
Andrew Johnson
b655662131 Appveyor: Move 'make test-results' to the on_finish stage 2020-04-20 11:33:37 -05:00
Andrew Johnson
be061e1084 Tidy up testFailures script slighlty 2020-04-20 11:31:45 -05:00
Andrew Johnson
91c18c32d4 Have Appveyor make 'tapfiles test-results' instead of 'runtests' 2020-04-18 00:36:35 -05:00
Andrew Johnson
3790ce4452 Have 'make test-results' fail nicely if any tests did
Lists the directories with failed tests at the end of the build.
It is no longer necessary to use 'make -k' to see the results
of all tests after one or more failures as only the top-level
test-results recipe will generate a build error.
2020-04-18 00:18:11 -05:00
Andrew Johnson
566ab038d2 Make test-results not fail so it shows all results
For some reason 'make -k test-results' isn't always doing
the -k (continue-on-error) on Windows.
2020-04-17 16:51:48 -05:00
Andrew Johnson
648589e6ab podToHtml: Add bootstrap search path for EPICS::PodHtml 2020-04-17 16:42:18 -05:00
Andrew Johnson
841effe9ee epicsMessageQueueTest: Shorten the 1R4S tests 2020-04-16 17:14:58 -05:00
Andrew Johnson
a9727fd5cb Ben Franksen's fix for lp: #1868486 2020-04-16 17:12:25 -05:00
Andrew Johnson
fde0485d6b Added Mark Rivers' tests for the message queue timeout bug 2020-04-16 17:10:53 -05:00
Ralph Lange
cbf917e833 Improve automated testing rules to allow other test frameworks
- make runtests a double-colon rule, so that other test frameworks
  can add their own recipes independently
- only define runtests:: $TESTSCRIPTS rule when there are TESTSCRIPTS
  (to avoid having it run every time when no TESTSCRIPTS are defined)
- $(strip $TAPFILES) inside ifneq to fix trouble when TAPFILES=' '
2020-04-16 12:04:16 +02:00
Andrew Johnson
45cf2ea5ce Modify the POD to HTML conversion code to work on older Perls 2020-04-14 16:41:20 -05:00
Andrew Johnson
a95635a018 Merge Freddie's bit_operations branch into 3.15 2020-04-14 15:28:22 -05:00
Andrew Johnson
9df39475cd Merge Martin Konrad's fix-log-issues branch into 3.15 2020-04-14 11:41:23 -05:00
Andrew Johnson
bdf01e7a67 Merge Martin Konrad's Appveyor-worker-image branch into 3.15 2020-04-14 11:28:53 -05:00
Andrew Johnson
0dd5f863ef Add some release notes 2020-04-13 17:57:33 -05:00
Andrew Johnson
38339b6ccf Initialize main thread as OkToBlock 2020-04-13 17:56:09 -05:00
Martin Konrad
2aecf3142a Explicitly specify worker image 2020-04-13 16:45:21 -04:00
Ralph Lange
1687757752 catools: make camonitor handle type changes
taken from a patch provided by Dirk Zimoch (in 2014)
2020-04-06 10:58:40 +02:00
Andrew Johnson
1533a4f13f Updates to record POD documentation. 2020-04-03 00:33:51 -05:00
Andrew Johnson
a1aeb23314 Modify POD to HTML tools to better support links
Introduce derived classes to process links the way we need them.
Unify the generation of an ID from a section heading.
2020-04-03 00:29:22 -05:00
Andrew Johnson
933e276e1a Rolf Keitel's POD documentation for dbCommon (from the Wiki)
I split his two "Fields Common to ..." sections back into separate docs,
added links between them all, and made the appropriate build changes.
Also added these and the aai/aao records to the documentation index.
2020-04-02 15:47:10 -05:00
Freddie Akeroyd
7f02f8a386 Exclude VS2012 from -FS option
(cherry picked from 7.0 / commit 4aee25e8 and e29a53f0)
2020-03-28 15:55:35 +01:00
Rold Keitel
cb3fb18f40 POD docs: add aai & aai, update others 2020-03-26 17:41:12 -05:00
Rold Keitel
062c75a078 Prepare for POD documentation of the aa[io]Records 2020-03-26 16:35:58 -05:00
Andrew Johnson
b2160bd618 Merge Martin Konrad's replace-usleep branch into 3.15 2020-03-20 13:40:35 -05:00
Andrew Johnson
5b7f896312 Merge Dirk's emptyArrayCrashFix branch into 3.15 2020-03-20 13:28:34 -05:00
Andrew Johnson
a9034bb586 Fix clock_gettime issue on newer MinGW builds
Fixes lp: #1853168
2020-03-07 00:40:13 -06:00
Martin Konrad
f9820577c1 Replace usleep call by nanosleep
Also improve behavior in case signals are delivered to the sleeping
thread. This fixes a potential security weakness reported by codacy
(interaction of usleep with SIGALRM and other timer functions such
as sleep(), alarm(), setitimer(), and nanosleep() is unspecified).
2020-03-04 11:19:02 -05:00
Michael Davidsaver
e6914f3b80 osdSockUnsentCount.c check for existance of SIO_TCP_INFO 2020-02-20 15:37:18 -05:00
Andrew Johnson
41f1b0ffb5 Fix histogram record allocation bug
Found by Peter Heesterman: Potential use of NULL pcallback pointer.

Nothing looks at the return value from wdogInit(), so don't bother.
2020-02-19 15:09:13 -06:00
Andrew Johnson
d82d3d3679 Combine the iocVirgin and iocStopped states into iocVoid 2020-02-18 18:05:46 -06:00
e48cdb48ac dbGet should not crash when source is an empty array 2020-02-18 17:45:12 +01:00
Freddie Akeroyd
3944b32e04 Add back in optimisation disable 2020-02-17 13:30:15 +00:00
Freddie Akeroyd
a0667a122b Excluded x64 tests now need to be excluded on x86 too 2020-02-17 13:29:38 +00:00
Freddie Akeroyd
f2b4c412d3 Fix doc typo 2020-02-17 12:49:45 +00:00
Freddie Akeroyd
8250339e0d Update record pod documentation 2020-02-17 12:46:11 +00:00
Freddie Akeroyd
803593560d Remove redundant left logical shift 2020-02-17 12:22:20 +00:00
Freddie Akeroyd
bfae080af4 Merge branch '3.15' of git+ssh://git.launchpad.net/epics-base into bit_operations 2020-02-17 11:45:25 +00:00
Michael Davidsaver
6ae3f56560 Merge remote-tracking branch 'lp-konrad/fix-crash-dbloadrecords-after-iocinit' into 3.15
* lp-konrad/fix-crash-dbloadrecords-after-iocinit:
  Fix mingw cross-build
  Use accessor in iocInit
  Fix segfault when calling dbLoadRecords after iocInit
2020-02-14 17:18:01 +00:00
Bryan Robert Tester
4844fbbd82 moved listen into rsrv_grab_tcp to allow retry if failed
Fixes race condition with multiple IOCs starting simultaneously.
2020-02-14 17:10:04 +00:00
Gabriel Fedel
983937a52f Fix event record device support with constant INP
This fix apply to event record device with constant INP.
Now when the event record is proccessed the associated records with the
same SCAN setup get triggered correctly, it is not more necessary to set
VAL on event record.

Fixes lp: #1829770
2020-02-14 17:08:36 +00:00
Freddie Akeroyd
6867f97346 Fix bit operations failures on VS2019 32bit
Working with Dirk Zimoch @dirk.zimoch, fixed various issues
with bit operations on VS2019 32bit. These seem to relate to
handling bit 31 of a 32 bit number.

As EPICS << is an arithmetic bit shift, following Java we
have added <<< and >>> operators for logical shifts

Though it is on a different architecture, this looks like
a similar issue to LP: #1838792
2020-02-14 01:16:09 +00:00
Andrew Johnson
1d9e9ff4f7 Add new POD output files to RecordReference index 2020-02-13 09:06:48 -06:00
Andrew Johnson
eb8ca22704 Add new POD documentation, from Rolf Keitel
Documents the lsi, lso and printf record types.
2020-02-13 09:06:14 -06:00
Andrew Johnson
bfd289e85f Add converted histogram POD 2020-02-13 05:11:36 -06:00
Andrew Johnson
a5bae49dab Rename lsi, lso and printf *Record.dbd to .dbd.pod 2020-02-13 04:58:06 -06:00
Andrew Johnson
7a612f9524 Update to stringout POD from Rolf Keitel
Fix spelling of OMSL.
Document the stdio device support.
2020-02-12 09:25:54 -06:00
Andrew Johnson
0db8f8ca1b Rename histogramRecord.dbd to .dbd.pod 2020-02-12 07:45:04 -06:00
Andrew Johnson
dbd6f7e807 Adding tests for epicsThreadClass API
Two tests are disabled which hang the parent in the epicsThread destuctor
2020-01-23 14:26:33 -06:00
Andrew Johnson
54cd7e7ba1 MinGW: Replace -Wno-format with -D__USE_MINGW_ANSI_STDIO 2020-01-08 17:21:04 -06:00
Andrew Johnson
cbe6173417 Updates to the subArrayRecord reference page 2020-01-08 17:19:25 -06:00
Michael Davidsaver
f64f84744e more fun with isinf() and friends.
GNU libstdc++ prior to GCC 6.1.0, the overlay math.h always
includes math.h from glibc, which defines isinf() and friends.

GCC 6.1.0 includes a change (6c8ced3f4f867b72a623fe2f23efa204c5786a28)
so that the overlay math.h never includes the glibc math.h
when compiling c++.
The overlay math.h sometimes includes "using std::isinf"
Determined by inspecting libc math.h when building gcc.
2019-12-18 20:30:23 -08:00
Michael Davidsaver
d97a12f095 travis-ci test trusty w/ c++11 2019-12-18 20:30:23 -08:00
Andrew Johnson
475963453c Merge Martin Konrad's retire-epicsexcept branch into 3.15 2019-12-17 23:48:45 -06:00
Andrew Johnson
f5a442c0de Merge Martin Konrad's fix-typos branch 2019-12-17 23:46:07 -06:00
Martin Konrad
df519ce1a2 Fix typos in calcoutRecord.dbd.pod 2019-12-17 15:53:41 -05:00
Michael Davidsaver
feb938fae2 minor epicsTimerTest
(cherry picked from commit 7acd7c6145)
2019-12-16 13:16:31 -08:00
Michael Davidsaver
e068191684 epicsTimerTest loosen test threshold
(cherry picked from commit f955199805)
2019-12-16 13:16:30 -08:00
Michael Davidsaver
33f2d8c4aa debug epicsTimerTest
(cherry picked from commit 2af0c10470)
2019-12-16 13:16:29 -08:00
Michael Davidsaver
60a092fa50 posix/epicsMath.h
Include "<cmath>" for c++11 and pull in
non-namespace versions of isnan() and friends.
2019-12-16 11:40:13 -08:00
Michael Davidsaver
24f08460bb Revert "libcom: fix colliding isnan/isinf between C99 and C++0x for gcc-4"
This reverts commit 09ec3af337.
2019-12-16 11:40:13 -08:00
Michael Davidsaver
247fea0fa9 Revert "libcom: properly declare isnan() in C++ code"
This reverts commit 2e89a60c2d.
2019-12-16 11:40:13 -08:00
Michael Davidsaver
8a9637568e travis-ci /etc/hosts workaround 2019-12-16 11:40:13 -08:00
Michael Davidsaver
87229fdef0 redo travis-ci with matrix
add mix of Ubuntu versions
2019-12-16 11:40:13 -08:00
Michael Davidsaver
b0418e5274 epicsSockResolveTest add detail 2019-12-16 11:40:13 -08:00
Ralph Lange
2e89a60c2d libcom: properly declare isnan() in C++ code 2019-12-11 14:51:16 +01:00
Ralph Lange
09ec3af337 libcom: fix colliding isnan/isinf between C99 and C++0x for gcc-4
This fix can be removed once support for gcc-4 is dropped in 2038
2019-12-06 10:52:38 +01:00
Ralph Lange
70e9d46d75 libcom: import some C99 math (isnan etc.) into global namespace 2019-12-05 16:44:59 +01:00
Andrew Johnson
1d18aa3e6c Disable printf() format warnings on MinGW, they're broken 2019-11-21 12:20:56 -06:00
Andrew Johnson
a85967caea Cross-builds of 64-bit MinGW should inherit from 32-bit
Don't duplicate, this file missed an important change as a result.
2019-11-21 12:20:13 -06:00
Martin Konrad
a50b850ebd Fix mingw cross-build 2019-11-15 09:33:15 -05:00
Martin Konrad
6767bcd31e Use accessor in iocInit
This is simpler than using init hooks.
2019-11-14 13:57:45 -05:00
Martin Konrad
81550ac4d3 Fix segfault when calling dbLoadRecords after iocInit
This fixes lp:1829919.
2019-11-14 10:11:16 -05:00
d2d8674cb9 use EPICS_PRIVATE_API macro and fix bug with darwin/ios 2019-11-13 14:02:25 -05:00
6f193242e0 renamed epicsSocketCountUnsentBytes to epicsSocketUnsentCount and moved it to osi/os/ 2019-11-13 14:02:23 -05:00
39e8ccdef4 fix bug from commit f85454. Apparently epicsExportSharedSymbols is needed even though epicsExport.h is included 2019-11-13 13:49:28 -05:00
eb8992a750 epicsSocketCountUnsentBytes returns -1 on failure 2019-11-13 13:49:27 -05:00
62fb49f93b bugfix: memmove'ed to much 2019-11-13 13:49:27 -05:00
a5c9db8c8e epicsSockCountUnsentBytes renamed to epicsSocketCountUnsentBytes 2019-11-13 13:49:26 -05:00
04e752c83a moved logClientSendMessage and made it static 2019-11-13 13:49:26 -05:00
a16ce877e7 fix wrong function name in comment 2019-11-13 13:49:26 -05:00
15f28f1183 sending 0 bytes helps to detect broken connections on some systems (but is undefined behavior on Linux, fails on vxWorks and is a documented no-op on Windows) 2019-11-13 13:49:25 -05:00
9c18ce007a cannot print sockets with %d in Windows, they are not small ints but maybe pointers. 2019-11-13 13:49:25 -05:00
765af2efea ask logClient socket how many bytes are still in the send queue and don't discard them in case the connection turns out broken. 2019-11-13 13:49:24 -05:00
059c385286 use dynamic debug flag for logClient 2019-11-13 13:49:24 -05:00
feb1f9b0df increase error message buffer size for long (Windows) error messges 2019-11-13 13:49:23 -05:00
9d9840ad1e improve logClientShow to show unsent bytes on level 2 (and fix level 1) 2019-11-13 13:49:23 -05:00
af73e4cf65 removed unneeded include 2019-11-13 13:49:23 -05:00
ad861a0617 no need to delay startup only because log server is currently not available 2019-11-13 13:49:22 -05:00
1b88e834d6 send pending log messages directly after connecting 2019-11-13 13:49:22 -05:00
e000ea4913 avoid needless memmove calls 2019-11-13 13:49:21 -05:00
06f1a8ec23 elimitate duplicate code in logClient 2019-11-13 13:49:21 -05:00
cf2658be53 do not discard unsent messages when log server has closed connection, instead try to send them after reconnect 2019-11-13 13:49:20 -05:00
74a403090b speed up logRestart thread termination at exit 2019-11-13 13:49:20 -05:00
dc123a0a37 don't send errlog on all logClients 2019-11-13 13:49:20 -05:00
Andrew Johnson
7eee262486 Shorten/simplify uninstall recipes 2019-11-12 16:16:02 -06:00
Andrew Johnson
a10379327c Replace broken cleandirs recipe 2019-11-12 16:14:39 -06:00
Martin Konrad
b37bfe3ed0 Retire unused epicsExcept.h
Due to a syntax error this header has been unusable since 2001
(since 34ea7db15b), and no one
noticed. Let's remove it.
2019-11-12 12:12:47 -05:00
Andrew Johnson
41d86ecd7a Add a document containing Record Reference links 2019-11-11 11:30:46 -06:00
Andrew Johnson
961dd2bc5d Don't check empty (overridden) RELEASE definitions
Bug reported by Dirk Zimoch
2019-11-11 11:29:03 -06:00
Andrew Johnson
db4ad455d2 Update version numbers for 3.15.8-DEV (3.15.7.1-DEV) 2019-10-31 15:23:11 -05:00
135 changed files with 5512 additions and 2533 deletions

145
.appveyor/epics-base-3.yml Normal file
View File

@@ -0,0 +1,145 @@
# Appveyor configuration file for EPICS Base 3.15 builds
# (see also https://github.com/epics-base/ci-scripts)
# branches to build
branches:
# whitelist
only:
- 3.15
- /R3\.15\.\d+.*/
# Version format
version: base-{branch}-{build}
#---------------------------------#
# build cache #
#---------------------------------#
# The AppVeyor cache allowance is way too small (1GB per account across all projects, branches and jobs)
# to be used for the dependency builds.
cache:
- C:\Users\appveyor\.tools
#---------------------------------#
# repository cloning #
#---------------------------------#
# Called at very beginning, before repo cloning
init:
# Set autocrlf to make batch files work
- git config --global core.autocrlf true
# Set clone depth (do not fetch complete history)
clone_depth: 5
# Skipping commits affecting only specific files
skip_commits:
files:
- 'documentation/*'
- 'startup/*'
- '.github/*'
- '**/*.html'
- '**/*.md'
#---------------------------------#
# build matrix configuration #
#---------------------------------#
image: Visual Studio 2015
# Build Configurations: dll/static, regular/debug
configuration:
- dynamic
- static
- dynamic-debug
- static-debug
# Environment variables: compiler toolchain, base version, setup file, ...
environment:
# common / default variables for all jobs
SETUP_PATH: .ci-local:.ci
BASE: SELF
EPICS_TEST_IMPRECISE_TIMING: YES
matrix:
- CMP: vs2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- CMP: vs2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- CMP: vs2015
- CMP: vs2013
- CMP: vs2012
- CMP: vs2010
- CMP: gcc
# Platform: processor architecture
platform:
- x86
- x64
# Matrix configuration: exclude sets of jobs
matrix:
exclude:
# VS2012 and older installs don't have the 64 bit compiler
- platform: x64
CMP: vs2012
- platform: x64
CMP: vs2010
# Exclude more jobs to reduce build time
# Skip 32-bit for "middle-aged" compilers
- platform: x86
CMP: vs2017
- platform: x86
CMP: vs2015
# MinGW debug builds use the same libraries, unlike VS
- configuration: dynamic-debug
CMP: gcc
- configuration: static-debug
CMP: gcc
#---------------------------------#
# building & testing #
#---------------------------------#
install:
- cmd: git submodule update --init --recursive
- cmd: python .ci/cue.py prepare
build_script:
- cmd: python .ci/cue.py build
test_script:
- cmd: python .ci/cue.py test
on_finish:
- ps: Get-ChildItem *.tap -Recurse -Force | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- cmd: python .ci/cue.py build test-results -s
#---------------------------------#
# debugging #
#---------------------------------#
## if you want to connect by remote desktop to a failed build, uncomment these lines
## note that you will need to connect within the usual build timeout limit (60 minutes)
## so you may want to adjust the build matrix above to just build the one of interest
# print the connection info
#init:
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# block a failed build (until the watchdog barks)
#on_failure:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
#---------------------------------#
# notifications #
#---------------------------------#
notifications:
- provider: Email
to:
- core-talk@aps.anl.gov
on_build_success: false
- provider: GitHubPullRequest

1
.ci Submodule

Submodule .ci added at ad8dd4a136

151
.github/workflows/ci-scripts-build.yml vendored Normal file
View File

@@ -0,0 +1,151 @@
# .github/workflows/ci-scripts-build.yml for use with EPICS Base ci-scripts
# (see: https://github.com/epics-base/ci-scripts)
# This is YAML - indentation levels are crucial
# Workflow name, shared by all branches
name: Base
# Trigger on pushes and PRs to any branch
on:
push:
paths-ignore:
- 'documentation/*'
- 'startup/*'
- '.appveyor/*'
- '**/*.html'
- '**/*.md'
pull_request:
env:
SETUP_PATH: .ci-local:.ci
BASE: SELF
EPICS_TEST_IMPRECISE_TIMING: YES
jobs:
build-base:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
# Set environment variables from matrix parameters
env:
CMP: ${{ matrix.cmp }}
BCFG: ${{ matrix.configuration }}
WINE: ${{ matrix.wine }}
RTEMS: ${{ matrix.rtems }}
EXTRA: ${{ matrix.extra }}
strategy:
fail-fast: false
matrix:
# Job names also name artifacts, character limitations apply
include:
- os: ubuntu-20.04
cmp: gcc
configuration: default
wine: "64"
name: "Ub-20 gcc-9 + MinGW"
- os: ubuntu-20.04
cmp: gcc
configuration: static
wine: "64"
name: "Ub-20 gcc-9 + MinGW, static"
- os: ubuntu-20.04
cmp: gcc
configuration: static
extra: "CMD_CXXFLAGS=-std=c++11"
name: "Ub-20 gcc-9 C++11, static"
- os: ubuntu-16.04
cmp: clang
configuration: default
name: "Ub-16 clang-9"
- os: ubuntu-20.04
cmp: clang
configuration: default
extra: "CMD_CXXFLAGS=-std=c++11"
name: "Ub-20 clang-10 C++11"
- os: ubuntu-20.04
cmp: gcc
configuration: default
rtems: "4.10"
name: "Ub-20 gcc-9 + RT-4.10"
- os: ubuntu-20.04
cmp: gcc
configuration: default
rtems: "4.9"
name: "Ub-20 gcc-9 + RT-4.9"
- os: ubuntu-16.04
cmp: gcc-4.8
utoolchain: true
configuration: default
name: "Ub-16 gcc-4.8"
- os: ubuntu-16.04
cmp: gcc-4.9
utoolchain: true
configuration: default
name: "Ub-16 gcc-4.9"
- os: ubuntu-20.04
cmp: gcc-8
utoolchain: true
configuration: default
name: "Ub-20 gcc-8"
- os: ubuntu-20.04
cmp: clang
configuration: default
name: "Ub-20 clang-10"
- os: macos-latest
cmp: clang
configuration: default
name: "MacOS clang-12"
- os: windows-2019
cmp: vs2019
configuration: default
name: "Win2019 MSC-19"
- os: windows-2019
cmp: vs2019
configuration: static
name: "Win2019 MSC-19, static"
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: "apt-get install"
run: |
sudo apt-get update
sudo apt-get -y install qemu-system-x86 g++-mingw-w64-x86-64 gdb
if: runner.os == 'Linux'
- name: "apt-get install ${{ matrix.cmp }}"
run: |
export GCC_NAME="${{ matrix.cmp }}"
sudo apt-get update
sudo apt-get -y install software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get -y install g++-${GCC_NAME#gcc-}
if: matrix.utoolchain
- name: Prepare and compile dependencies
run: python .ci/cue.py prepare
- name: Build main module
run: python .ci/cue.py build
- name: Run main module tests
run: python .ci/cue.py test
- name: Upload tapfiles Artifact
uses: actions/upload-artifact@v2
with:
name: tapfiles ${{ matrix.name }}
path: '**/O.*/*.tap'
- name: Collect and show test results
run: python .ci/cue.py test-results

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule ".ci"]
path = .ci
url = https://github.com/epics-base/ci-scripts
branch = master

View File

@@ -1,32 +0,0 @@
sudo: false
dist: trusty
language: c
compiler:
- gcc
env:
- CMPLR=gcc
- CMPLR=gcc EXTRA=CMD_CXXFLAGS=-std=c++11
- CMPLR=gcc STATIC=YES
- CMPLR=clang
- CMPLR=clang STATIC=YES
- WINE=32 TEST=NO STATIC=YES
- WINE=32 TEST=NO STATIC=NO
- RTEMS=4.10 TEST=NO
- RTEMS=4.9 TEST=NO
addons:
apt:
packages:
- libreadline6-dev
- libncurses5-dev
- perl
- clang
- g++-mingw-w64-i686
- bison
- flex
- texinfo
- install-info
cache:
directories:
- $HOME/.cache
install: sh ci/travis-prepare.sh </dev/null
script: sh ci/travis-build.sh </dev/null

View File

@@ -1,89 +0,0 @@
# AppVeyor configuration for EPICS Base
# Ralph Lange <ralph.lange@gmx.de>
# Copyright (c) 2016-2017 ITER Organization
# Version format
version: base-{branch}-{build}
#---------------------------------#
# repository cloning #
#---------------------------------#
# Called at very beginning, before repo cloning
init:
# Set autocrlf to make batch files work
- git config --global core.autocrlf true
# Set clone depth (do not fetch complete history)
clone_depth: 2
# Skipping commits affecting only specific files
skip_commits:
files:
- 'documentation/*'
- 'templates/*'
- '**/*.html'
- '**/*.md'
#---------------------------------#
# build matrix configuration #
#---------------------------------#
# Build Configurations: dll/static, regular/debug
configuration:
- dynamic
- static
- dynamic-debug
- static-debug
# Environment variables: compiler toolchain
environment:
matrix:
- TOOLCHAIN: 10.0
- TOOLCHAIN: 11.0
- TOOLCHAIN: 12.0
- TOOLCHAIN: 14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLCHAIN: 2017
- TOOLCHAIN: mingw
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
# Platform: architecture
platform:
- x86
- x64
# Matrix configuration: allow specific failing jobs
matrix:
exclude:
# VS Express installs don't have the 64 bit compiler
- platform: x64
TOOLCHAIN: 10.0
#---------------------------------#
# building & testing #
#---------------------------------#
install:
- cmd: ci/appveyor-prepare.bat
build_script:
- cmd: ci/appveyor-make.bat
test_script:
- cmd: ci/appveyor-make.bat runtests
#---------------------------------#
# notifications #
#---------------------------------#
notifications:
- provider: Email
to:
- core-talk@aps.anl.gov
on_build_success: false
- provider: GitHubPullRequest

View File

@@ -1,119 +0,0 @@
:: Universal build script for AppVeyor (https://ci.appveyor.com/)
:: Environment:
:: TOOLCHAIN - toolchain version [10.0/11.0/12.0/14.0/2017/mingw]
:: CONFIGURATION - determines EPICS build [dynamic/static]
:: PLATFORM - architecture [x86/x64]
::
:: All command line args are passed to make
Setlocal EnableDelayedExpansion
set "ST="
if /i "%CONFIGURATION%"=="static" set ST=-static
set OS=64BIT
if "%PLATFORM%"=="x86" set OS=32BIT
echo [INFO] Platform: %OS%
:: Use parallel make, except for 3.14
set "MAKEARGS=-j2 -Otarget"
if "%APPVEYOR_REPO_BRANCH%"=="3.14" set MAKEARGS=
if "%TOOLCHAIN%"=="mingw" (
set "MAKE=mingw32-make"
if "%OS%"=="64BIT" (
set "EPICS_HOST_ARCH=windows-x64-mingw"
set "INCLUDE=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\include;%INCLUDE%"
set "PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH%"
echo [INFO] MinGW Toolchain 64bit
) else (
set "EPICS_HOST_ARCH=win32-x86-mingw"
set "INCLUDE=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\include;%INCLUDE%"
set "PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin;%PATH%"
echo [INFO] MinGW Toolchain 32bit
)
echo [INFO] Compiler Version
gcc -v
goto Finish
)
set "VSINSTALL=C:\Program Files (x86)\Microsoft Visual Studio %TOOLCHAIN%"
if not exist "%VSINSTALL%\" set "VSINSTALL=C:\Program Files (x86)\Microsoft Visual Studio\%TOOLCHAIN%\Community"
if not exist "%VSINSTALL%\" goto MSMissing
set "MAKE=C:\tools\make"
echo [INFO] APPVEYOR_BUILD_WORKER_IMAGE=%APPVEYOR_BUILD_WORKER_IMAGE%
if "%OS%"=="64BIT" (
set EPICS_HOST_ARCH=windows-x64%ST%
:: VS 2017
if exist "%VSINSTALL%\VC\Auxiliary\Build\vcvars64.bat" (
call "%VSINSTALL%\VC\Auxiliary\Build\vcvars64.bat"
where cl
if !ERRORLEVEL! NEQ 0 goto MSMissing
goto MSFound
)
if exist "%VSINSTALL%\VC\vcvarsall.bat" (
call "%VSINSTALL%\VC\vcvarsall.bat" amd64
where cl
if !ERRORLEVEL! NEQ 0 (
call "%VSINSTALL%\VC\vcvarsall.bat" x86_amd64
where cl
if !ERRORLEVEL! NEQ 0 goto MSMissing
)
goto MSFound
)
if exist "%VSINSTALL%\VC\bin\amd64\vcvars64.bat" (
call "%VSINSTALL%\VC\bin\amd64\vcvars64.bat"
where cl
if !ERRORLEVEL! NEQ 0 goto MSMissing
goto MSFound
)
) else (
set EPICS_HOST_ARCH=win32-x86%ST%
:: VS 2017
if exist "%VSINSTALL%\VC\Auxiliary\Build\vcvars32.bat" (
call "%VSINSTALL%\VC\Auxiliary\Build\vcvars32.bat"
where cl
if !ERRORLEVEL! NEQ 0 goto MSMissing
goto MSFound
)
if exist "%VSINSTALL%\VC\vcvarsall.bat" (
call "%VSINSTALL%\VC\vcvarsall.bat" x86
where cl
if !ERRORLEVEL! NEQ 0 goto MSMissing
goto MSFound
)
if exist "%VSINSTALL%\VC\bin\vcvars32.bat" (
call "%VSINSTALL%\VC\bin\vcvars32.bat"
where cl
if !ERRORLEVEL! NEQ 0 goto MSMissing
goto MSFound
)
if exist "%VSINSTALL%\Common7\Tools\vsvars32.bat" (
call "%VSINSTALL%\Common7\Tools\vsvars32.bat"
where cl
if !ERRORLEVEL! NEQ 0 goto MSMissing
goto MSFound
)
)
:MSMissing
echo [INFO] Installation for MSVC Toolchain %TOOLCHAIN% / %OS% seems to be missing
exit 1
:MSFound
echo [INFO] Microsoft Visual Studio Toolchain %TOOLCHAIN%
echo [INFO] Compiler Version
cl
:Finish
echo [INFO] EPICS_HOST_ARCH: %EPICS_HOST_ARCH%
echo [INFO] Make version
%MAKE% --version
echo [INFO] Perl version
perl --version
%MAKE% %MAKEARGS% %*

View File

@@ -1,38 +0,0 @@
:: Build script for AppVeyor (https://ci.appveyor.com/)
:: Environment:
:: TOOLCHAIN - Toolchain Version [9.0/10.0/11.0/12.0/14.0/mingw]
:: CONFIGURATION - determines EPICS build [dynamic/static, -debug]
:: PLATFORM - "x86" -> use 32bit architecture
::
:: Prepares an Appveyor build by excuting the following steps
:: - Set up configure\CONFIG_SITE for static vs. dynamic build
:: - Install Mingw (TOOLCHAIN setting) in the in the appropriate flavor
:: - Download and install Make-4.1 from EPICS download page
Setlocal EnableDelayedExpansion
set OS=64BIT
if "%PLATFORM%"=="x86" set OS=32BIT
echo [INFO] Platform: %OS%
if "%TOOLCHAIN%"=="mingw" (
echo.%CONFIGURATION% | findstr /C:"static">nul && (
echo SHARED_LIBRARIES=NO>> configure\CONFIG_SITE
echo STATIC_BUILD=YES>> configure\CONFIG_SITE
echo [INFO] EPICS set up for static build
) || (
echo [INFO] EPICS set up for dynamic build
)
echo.%CONFIGURATION% | findstr /C:"debug">nul && (
echo HOST_OPT=NO>> configure\CONFIG_SITE
echo [INFO] EPICS set up for debug build
) || (
echo [INFO] EPICS set up for optimized build
)
)
echo [INFO] Installing Make 4.2.1 from ANL web site
curl -fsS --retry 3 -o C:\tools\make-4.2.1.zip https://epics.anl.gov/download/tools/make-4.2.1-win64.zip
cd \tools
"C:\Program Files\7-Zip\7z" e make-4.2.1.zip

View File

@@ -1,90 +0,0 @@
#!/bin/sh
set -e -x
die() {
echo "$1" >&2
exit 1
}
ticker() {
while true
do
sleep 60
date -R
[ -r "$1" ] && tail -n10 "$1"
done
}
CACHEKEY=1
EPICS_HOST_ARCH=`perl src/tools/EpicsHostArch.pl`
[ -e configure/os/CONFIG_SITE.Common.linux-x86 ] || die "Wrong location: $PWD"
case "$CMPLR" in
clang)
echo "Host compiler is clang"
cat << EOF >> configure/os/CONFIG_SITE.Common.$EPICS_HOST_ARCH
GNU = NO
CMPLR_CLASS = clang
CC = clang
CCC = clang++
EOF
;;
*) echo "Host compiler is default";;
esac
if [ "$STATIC" = "YES" ]
then
echo "Build static libraries/executables"
cat << EOF >> configure/CONFIG_SITE
SHARED_LIBRARIES=NO
STATIC_BUILD=YES
EOF
fi
# requires wine and g++-mingw-w64-i686
if [ "$WINE" = "32" ]
then
echo "Cross mingw32"
sed -i -e '/CMPLR_PREFIX/d' configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw
cat << EOF >> configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw
CMPLR_PREFIX=i686-w64-mingw32-
EOF
cat << EOF >> configure/CONFIG_SITE
CROSS_COMPILER_TARGET_ARCHS+=win32-x86-mingw
EOF
fi
# set RTEMS to eg. "4.9" or "4.10"
# requires qemu, bison, flex, texinfo, install-info
if [ -n "$RTEMS" ]
then
echo "Cross RTEMS${RTEMS} for pc386"
install -d /home/travis/.cache
curl -L "https://github.com/mdavidsaver/rsb/releases/download/travis-20160306-2/rtems${RTEMS}-i386-trusty-20190306-2.tar.gz" \
| tar -C /home/travis/.cache -xj
sed -i -e '/^RTEMS_VERSION/d' -e '/^RTEMS_BASE/d' configure/os/CONFIG_SITE.Common.RTEMS
cat << EOF >> configure/os/CONFIG_SITE.Common.RTEMS
RTEMS_VERSION=$RTEMS
RTEMS_BASE=/home/travis/.cache/rtems${RTEMS}-i386
EOF
cat << EOF >> configure/CONFIG_SITE
CROSS_COMPILER_TARGET_ARCHS+=RTEMS-pc386
EOF
# find local qemu-system-i386
export PATH="$HOME/.cache/qemu/usr/bin:$PATH"
echo -n "Using QEMU: "
type qemu-system-i386 || echo "Missing qemu"
EXTRA=RTEMS_QEMU_FIXUPS=YES
fi
make -j2 $EXTRA
if [ "$TEST" != "NO" ]
then
make tapfiles
make -s test-results
fi

View File

@@ -1,40 +0,0 @@
#!/bin/sh
set -e -x
die() {
echo "$1" >&2
exit 1
}
CURDIR="$PWD"
QDIR="$HOME/.cache/qemu"
if [ -n "$RTEMS" -a "$TEST" = "YES" ]
then
git clone --quiet --branch vme --depth 10 https://github.com/mdavidsaver/qemu.git "$HOME/.build/qemu"
cd "$HOME/.build/qemu"
HEAD=`git log -n1 --pretty=format:%H`
echo "HEAD revision $HEAD"
[ -e "$HOME/.cache/qemu/built" ] && BUILT=`cat "$HOME/.cache/qemu/built"`
echo "Cached revision $BUILT"
if [ "$HEAD" != "$BUILT" ]
then
echo "Building QEMU"
git submodule --quiet update --init
install -d "$HOME/.build/qemu/build"
cd "$HOME/.build/qemu/build"
"$HOME/.build/qemu/configure" --prefix="$HOME/.cache/qemu/usr" --target-list=i386-softmmu --disable-werror
make -j2
make install
echo "$HEAD" > "$HOME/.cache/qemu/built"
fi
fi
cd "$CURDIR"

View File

@@ -68,12 +68,10 @@ DBTOMENUH = $(PERL) $(TOOLS)/dbdToMenuH.pl
REGISTERRECORDDEVICEDRIVER = $(PERL) $(TOOLS)/registerRecordDeviceDriver.pl
CONVERTRELEASE = $(PERL) $(call FIND_TOOL,convertRelease.pl)
FULLPATHNAME = $(PERL) $(TOOLS)/fullPathName.pl
TAPTOJUNIT = $(PERL) $(TOOLS)/tap-to-junit-xml.pl
PROVE = $(PERL) $(TOOLS)/epicsProve.pl
#-------------------------------------------------------
# tools for installing libraries and products
INSTALL_QUIETLY := $(if $(findstring s,$(MFLAGS)),-q,)
INSTALL_QUIETLY := $(if $(filter -s,$(MFLAGS)),-q,)
INSTALL = $(PERL) $(TOOLS)/installEpics.pl $(INSTALL_QUIETLY)
INSTALL_PRODUCT = $(INSTALL)
INSTALL_LIBRARY = $(INSTALL)
@@ -83,6 +81,21 @@ INSTALL_LIBRARY = $(INSTALL)
MKMF = $(PERL) $(TOOLS)/mkmf.pl
REPLACEVAR = $(PERL) $(TOOLS)/replaceVAR.pl
#---------------------------------------------------------------
# Tools for testing
TAPS_FAILED_LOG = .taps-failed.log
TESTS_FAILED_LOG = .tests-failed.log
TESTS_FAILED_PATH = $(abspath $(TOP)/$(TESTS_FAILED_LOG))
TAPTOJUNIT = $(PERL) $(TOOLS)/tap-to-junit-xml.pl
PROVE = $(PERL) $(TOOLS)/epicsProve.pl --failures --color
PROVE.tap = $(PROVE) --ext .tap --exec "$(CAT)"
TESTFAILURES = $(PERL) $(TOOLS)/testFailures.pl
SHOWTESTFAILURES = $(TESTFAILURES) $(TESTS_FAILED_PATH) $(TAPS_FAILED_LOG)
PROVE_FAILURE = echo $(abspath .)>> $(TESTS_FAILED_PATH)
TAPFILE_FAILURE = echo $@>> $(TAPS_FAILED_LOG)
#---------------------------------------------------------------
# private versions of lex/yacc from EPICS
EYACC = $(TOOLS)/antelope$(HOSTEXE)

View File

@@ -4,7 +4,7 @@
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in the file LICENSE that is included with this distribution.
# in the file LICENSE that is included with this distribution.
#*************************************************************************
#
# EPICS Version information
@@ -27,7 +27,7 @@ EPICS_VERSION = 3
EPICS_REVISION = 15
# EPICS_MODIFICATION must be a number >=0 and <256
EPICS_MODIFICATION = 7
EPICS_MODIFICATION = 9
# EPICS_PATCH_LEVEL must be a number (win32 resource file requirement)
# Not included if zero
@@ -37,12 +37,8 @@ EPICS_PATCH_LEVEL = 0
#EPICS_DEV_SNAPSHOT=-DEV
#EPICS_DEV_SNAPSHOT=-pre1
#EPICS_DEV_SNAPSHOT=-pre1-DEV
#EPICS_DEV_SNAPSHOT=-pre2
#EPICS_DEV_SNAPSHOT=-pre2-DEV
#EPICS_DEV_SNAPSHOT=-rc1
#EPICS_DEV_SNAPSHOT=-rc1-DEV
#EPICS_DEV_SNAPSHOT=-rc2
#EPICS_DEV_SNAPSHOT=-rc2-DEV
EPICS_DEV_SNAPSHOT=
# No changes should be needed below here

View File

@@ -80,9 +80,9 @@ COMMON_DIR = ../O.Common
IOCS_APPL_TOP = $(shell $(FULLPATHNAME) $(INSTALL_LOCATION))
#-------------------------------------------------------
# Make echo output - suppress echoing if make's '-s' flag is set
# Make echo output - suppress echoing if '-s' flag was given
NOP = :
ECHO = @$(if $(findstring s,$(MFLAGS)),$(NOP),echo)
ECHO = @$(if $(filter -s,$(MFLAGS)),$(NOP),echo)
#-------------------------------------------------------
ifdef T_A

View File

@@ -159,7 +159,7 @@ cleanArchTargets = $(foreach arch,$(BUILD_ARCHS), clean$(DIVIDER)$(arch))
-include $(TOP)/configure/CONFIG_APP_INCLUDE
all: install
ifeq ($(EPICS_HOST_ARCH),$T_A)
ifeq ($(EPICS_HOST_ARCH),$(T_A))
host: install
else
# Do nothing
@@ -187,7 +187,8 @@ endif
##################################################### build dependancies, clean rule
inc : $(COMMON_INC) $(INSTALL_INC)
inc : $(COMMON_INC) $(INSTALL_INC) $(COMMON_DBDS) $(COMMON_DBDCATS) \
$(INSTALL_DBDS) $(INSTALL_DBD_INSTALLS)
build : $(COMMON_DBDS) $(COMMON_DBS) $(COMMON_DBDCATS) \
$(INSTALL_DBDS) $(INSTALL_DBS) \

View File

@@ -86,17 +86,20 @@ endif
#---------------------------------------------------------------
# Include defines and rules for prod, library and test* targets
#ifneq (,$(strip $(PROD) $(TESTPROD) $(LIBRARY) $(TESTLIBRARY) $(LOADABLE_LIBRARY) ))
ifneq (,$(strip $(PROD) $(TESTPROD) $(LIBRARY) $(TESTLIBRARY) \
$(LOADABLE_LIBRARY)))
include $(CONFIG)/RULES_TARGET
#endif
endif
#---------------------------------------------------------------
# Read dependency files
ifneq (inc,$(strip $(MAKECMDGOALS)))
ifneq (,$(strip $(HDEPENDS_FILES)))
$(filter-out $(wildcard *$(DEP)), $(HDEPENDS_FILES)): | $(COMMON_INC)
-include $(HDEPENDS_FILES)
endif
endif
#---------------------------------------------------------------
# Products and Object libraries
@@ -105,17 +108,17 @@ PRODTARGETS += $(PRODNAME) $(MUNCHNAME) $(CTDT_SRCS) $(CTDT_OBJS) $(NMS)
TESTPRODTARGETS += $(TESTPRODNAME) $(TESTMUNCHNAME)
#---------------------------------------------------------------
# Test specifications and test result files
# Test result files
#
ifneq (,$(strip $(TESTS)))
TARGETS += testspec
endif
# Enable testing if this host can run tests on the current target
ifneq (,$(findstring $(T_A),$(EPICS_HOST_ARCH) $(CROSS_COMPILER_RUNTEST_ARCHS)))
# Enable testing if this host can run tests for the current target
ifneq (,$(filter $(T_A), $(EPICS_HOST_ARCH) $(CROSS_COMPILER_RUNTEST_ARCHS)))
RUNTESTS_ENABLED = YES
TAPFILES += $(TESTSCRIPTS:.t=.tap)
JUNITFILES += $(TAPFILES:.tap=.xml)
TESTSCRIPTS.t = $(filter %.t, $(TESTSCRIPTS))
TAPFILES.t += $(TESTSCRIPTS.t:.t=.tap)
JUNITFILES.t += $(TESTSCRIPTS.t:.t=-results.xml)
TAPFILES += $(TAPFILES.t)
JUNITFILES += $(JUNITFILES.t)
endif
#---------------------------------------------------------------
@@ -144,14 +147,14 @@ build: inc
build: $(OBJSNAME) $(LIBTARGETS) $(PRODTARGETS) $(TESTPRODTARGETS) \
$(TARGETS) $(TESTSCRIPTS) $(INSTALL_LIB_INSTALLS)
inc : $(COMMON_INC) $(INSTALL_INC) $(INSTALL_CONFIGS)
inc : $(COMMON_INC) $(INSTALL_INC) $(INSTALL_CONFIGS) \
$(INSTALL_HTMLS)
buildInstall : \
$(INSTALL_SCRIPTS) $(INSTALL_PROD) $(INSTALL_MUNCHS) \
$(INSTALL_TCLLIBS) $(INSTALL_TCLINDEX) \
$(INSTALL_OBJS) \
$(INSTALL_DOCS) \
$(INSTALL_HTMLS) \
$(INSTALL_TEMPLATE) \
$(INSTALL_BIN_INSTALLS)
@@ -335,23 +338,24 @@ $(MODNAME): %$(MODEXT): %$(EXE)
#---------------------------------------------------------------
# Automated testing
runtests: $(TESTSCRIPTS)
runtests: run-tap-tests
run-tap-tests: $(TESTSCRIPTS.t)
ifneq ($(TESTSCRIPTS.t),)
ifdef RUNTESTS_ENABLED
-$(PERL) -MTest::Harness -e 'runtests @ARGV if @ARGV;' $^
$(ECHO) "$(PROVE) $^"
@$(PROVE) $^ || $(PROVE_FAILURE)
endif
endif
testspec: $(TESTSCRIPTS)
@$(RM) $@
@echo OS-class: $(OS_CLASS) > $@
@echo Target-arch: $(T_A) >> $@
$(if $^, @echo Tests: $^ >> $@)
$(if $(TESTFILES), @echo Files: $(TESTFILES) >> $@)
$(if $(TESTSPEC_$(OS_CLASS)), @echo "Harness: $(TESTSPEC_$(OS_CLASS))" >> $@)
tapfiles: $(TAPFILES)
junitfiles: $(JUNITFILES)
test-results: tapfiles
ifneq ($(TAPFILES),)
test-results: tap-results
tap-results: $(TAPFILES)
ifneq ($(strip $(TAPFILES)),)
ifdef RUNTESTS_ENABLED
$(PROVE) --failures --ext .tap --exec "$(CAT)" --color $(TAPFILES)
$(ECHO) "$(PROVE.tap) $^"
@$(PROVE.tap) $^ || $(PROVE_FAILURE)
endif
CURRENT_TAPFILES := $(wildcard $(TAPFILES))
@@ -359,23 +363,21 @@ CURRENT_JUNITFILES := $(wildcard $(JUNITFILES))
endif
clean-tests:
ifneq ($(CURRENT_TAPFILES),)
$(RM) $(CURRENT_TAPFILES)
ifneq ($(CURRENT_TAPFILES)$(TAPS_FAILED_LOG),)
$(RM) $(CURRENT_TAPFILES) $(TAPS_FAILED_LOG)
endif
ifneq ($(CURRENT_JUNITFILES),)
$(RM) $(CURRENT_JUNITFILES)
endif
tapfiles: $(TESTSCRIPTS) $(TAPFILES)
junitfiles: $(JUNITFILES)
# A .tap file is the output from running the associated test script
%.tap: %.t
$(TAPFILES.t): %.tap: %.t
ifdef RUNTESTS_ENABLED
-$(PERL) $< -tap > $@
$(ECHO) "$(PERL) $< -tap > $@"
@$(PERL) $< -tap > $@ || $(TAPFILE_FAILURE)
endif
%.xml: %.tap
$(JUNITFILES.t): %-results.xml: %.tap
$(TAPTOJUNIT) --puretap --output $@ --input $< $*
# If there's a perl test script (.plt) available, use it
@@ -522,8 +524,8 @@ $(INSTALL_TEMPLATES_SUBDIR)/%: %
.PRECIOUS: $(COMMON_INC)
.PHONY: all host inc build install clean rebuild buildInstall build_clean
.PHONY: runtests tapfiles clean-tests test-results junitfiles
.PHONY: checkRelease warnRelease noCheckRelease
.PHONY: runtests run-tap-tests tapfiles junitfiles test-results tap-results
.PHONY: clean-tests checkRelease warnRelease noCheckRelease
endif # BASE_RULES_BUILD
# EOF RULES_BUILD

View File

@@ -4,7 +4,7 @@
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in the file LICENSE that is included with this distribution.
# in the file LICENSE that is included with this distribution.
#*************************************************************************
ARCHS += $(BUILD_ARCHS)
@@ -54,7 +54,7 @@ $(foreach dir, $(DIRS), \
define DEP_template2
$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \
$$(addsuffix $$(DIVIDER)$(2),$$(ddir)))
$$(addsuffix $$(DIVIDER)$(2),$$(ddir))) | before-$(2)
endef
$(foreach action, $(ACTIONS), \
$(foreach dir, $(DIRS), \
@@ -79,15 +79,22 @@ $(foreach arch, $(ARCHS), \
dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@))))
actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$(notdir $@))), \
$(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@)))))
$(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets) :
$(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@)))))
$(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets):
$(MAKE) -C $(dirPart) $(actionArchPart)
# before-action rules are run once prior to recursing through the
# list of subdirectories and running the action rule in each one.
# See DEP_template2 above for how that rule ordering is achieved.
beforeActions = $(addprefix before-,$(ACTIONS))
$(beforeActions):
$(ARCHS) $(ACTIONS) $(actionArchTargets) :%: \
$(foreach dir, $(DIRS), $(dir)$(DIVIDER)%)
.PHONY : $(DIRS) all host rebuild
.PHONY : $(ARCHS) $(ACTIONS)
.PHONY : $(ARCHS) $(ACTIONS) $(beforeActions)
.PHONY : $(dirActionTargets) $(dirArchTargets)
.PHONY : $(dirActionArchTargets)
.PHONY : $(actionArchTargets)

View File

@@ -33,8 +33,10 @@ expand_clean:
ASSEMBLE_TOOL ?= $(PERL) $(TOOLS)/assembleSnippets.pl
define COMMON_ASSEMBLY_template
ifneq '$$($1_PATTERN)' ''
$1_SNIPPETS += $$(foreach dir, .. $$(SRC_DIRS), \
$$(wildcard $$(dir)/$$($1_PATTERN)))
endif
$(COMMON_DIR)/$1: $$($1_SNIPPETS)
$(ECHO) "Assembling common file $$@ from snippets"
@$(RM) $1
@@ -45,8 +47,10 @@ $(foreach asy, $(COMMON_ASSEMBLIES), \
$(eval $(call COMMON_ASSEMBLY_template,$(strip $(asy)))))
define ASSEMBLY_template
ifneq '$$($1_PATTERN)' ''
$1_SNIPPETS += $$(foreach dir, .. $$(SRC_DIRS), \
$$(wildcard $$(dir)/$$($1_PATTERN)))
endif
$1: $$($1_SNIPPETS)
$(ECHO) "Assembling file $$@ from snippets"
@$(RM) $$@

View File

@@ -26,7 +26,6 @@ $(foreach target, $(PROD) $(TESTPROD) $(LIBRARY) $(TESTLIBRARY) $(LOADABLE_LIBRA
#-----------------------------------------------------------------------
# This define block requires GNU make 3.81
define PROD_template
ifeq ($$(strip $$($(1)_OBJS) $$($(1)_SRCS) $$(PRODUCT_OBJS)),)
$(1)_OBJS = $(1)$$(OBJ)

View File

@@ -16,38 +16,36 @@ cvsclean:
$(PERL) $(CVSCLEAN)
realuninstall: uninstallDirs
$(RMDIR) $(INSTALL_LOCATION_BIN)
$(RMDIR) $(INSTALL_LOCATION_LIB)
$(RMDIR) $(INSTALL_LOCATION_BIN) $(INSTALL_LOCATION_LIB)
UNINSTALL_DIRS += $(INSTALL_DBD) $(INSTALL_INCLUDE) $(INSTALL_DOC) \
$(INSTALL_HTML) $(INSTALL_TEMPLATES) $(INSTALL_DB) $(DIRECTORY_TARGETS)
uninstallDirs:
$(RMDIR) $(UNINSTALL_DIRS)
EMPTY_INSTALL_DIRS = \
$(if $(wildcard $(INSTALL_LOCATION_BIN)/*),,$(INSTALL_LOCATION_BIN)) \
$(if $(wildcard $(INSTALL_LOCATION_LIB)/*),,$(INSTALL_LOCATION_LIB))
uninstall: archuninstall uninstallDirs
$(RMDIR) $(EMPTY_INSTALL_DIRS)
archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS)) | cleandirs
archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS))
archPart = $(word 2, $(subst $(DIVIDER), ,$@))
uninstall$(DIVIDER)%:
$(RMDIR) $(INSTALL_LOCATION_BIN)/$(archPart)
$(RMDIR) $(INSTALL_LOCATION_LIB)/$(archPart)
cleandirs:
@$(NOP)
ifeq ($(wildcard $(INSTALL_LOCATION_BIN)/*),)
$(RMDIR) $(INSTALL_LOCATION_BIN)
endif
ifeq ($(wildcard $(INSTALL_LOCATION_LIB)/*),)
$(RMDIR) $(INSTALL_LOCATION_LIB)
endif
$(RMDIR) $(addsuffix /$(subst uninstall$(DIVIDER),,$@), \
$(INSTALL_LOCATION_BIN) $(INSTALL_LOCATION_LIB))
before-runtests before-test-results: rm-failure-file
rm-failure-file:
@$(RM) $(TESTS_FAILED_PATH)
runtests test-results:
$(SHOWTESTFAILURES)
help:
@echo "Usage: gnumake [options] [target] ..."
@echo "Targets supported by all Makefiles:"
@echo " all - Same as install (default rule)"
@echo " inc - Installs header files"
@echo " inc - Installs header, dbd and html files"
@echo " build - Builds and installs all targets"
@echo " install - Builds and installs all targets"
@echo " buildInstall - Same as install (deprecated)"
@@ -75,8 +73,8 @@ help:
@echo "Indiv. object targets are supported by O.<arch> level Makefile .e.g"
@echo " xxxRecord.o"
.PHONY: cleandirs distclean cvsclean realuninstall archuninstall uninstallDirs
.PHONY: uninstall help
.PHONY: distclean cvsclean realuninstall archuninstall uninstallDirs
.PHONY: uninstall rm-failure-file help
# Include <top>/cfg/TOP_RULES* files from tops defined in RELEASE* files
#

View File

@@ -72,7 +72,7 @@ CPPFLAGS += $($(BUILD_CLASS)_CPPFLAGS) $(POSIX_CPPFLAGS) $(OPT_CPPFLAGS)\
$(USR_CPPFLAGS) $(CMD_CPPFLAGS) $(ARCH_DEP_CPPFLAGS) $(OP_SYS_CPPFLAGS)\
$(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)
ECHO = @$(if $(findstring s,$(MFLAGS)),$(NOP),echo)
ECHO = @$(if $(filter -s,$(MFLAGS)),$(NOP),echo)
#--------------------------------------------------
# Although RTEMS uses gcc, it wants to use gcc its own way

View File

@@ -30,7 +30,7 @@ ARCH_DEP_LDFLAGS += -m32
# Compiler does not define __unix __unix__ unix
# Override for -DUNIX from CONFIG.Common.UnixCommon
OP_SYS_CPPFLAGS = -D_MINGW
OP_SYS_CPPFLAGS = -D_MINGW -D__USE_MINGW_ANSI_STDIO
EXE = .exe
RES = .coff

View File

@@ -4,21 +4,5 @@
# Override these definitions in CONFIG_SITE.linux-x86.windows-x64-mingw
#-------------------------------------------------------
# Include common gnu compiler definitions
include $(CONFIG)/CONFIG.gnuCommon
# Add resource compiler
RCCMD = $(GNU_BIN)/$(CMPLR_PREFIX)windres$(CMPLR_SUFFIX) $(INCLUDES) $< $@
# Remove -fPIC flags, add out-implib
SHRLIB_CFLAGS =
SHRLIB_LDFLAGS = -shared \
-Wl,--out-implib,$(DLLSTUB_PREFIX)$*$(DLLSTUB_SUFFIX)
LOADABLE_SHRLIB_LDFLAGS = -shared \
-Wl,--out-implib,$(DLLSTUB_PREFIX)$*$(DLLSTUB_SUFFIX)
# No need to explicitly link with gcc library
GNU_LDLIBS_YES =
# Link with winsock2
OP_SYS_LDLIBS = -lws2_32
# Use the definitions from the win32-x86-mingw target
include $(CONFIG)/os/CONFIG.linux-x86.win32-x86-mingw

View File

@@ -49,9 +49,9 @@ OPT_CFLAGS_YES_NO = -Ox -Oy-
OPT_CFLAGS_YES = $(OPT_CFLAGS_YES_$(OPT_WHOLE_PROGRAM))
#
# -Zi generate program database for debugging information
# -Z7 generate C7 compatible debugging information (inside .obj)
# -RTCsu enable run-time error checks
OPT_CFLAGS_NO = -Zi -RTCsu
OPT_CFLAGS_NO = -Z7 -RTCsu
# specify object file name and location
OBJ_CFLAG = -Fo
@@ -116,9 +116,9 @@ OPT_CXXFLAGS_YES_NO = -Ox -Oy-
OPT_CXXFLAGS_YES = $(OPT_CXXFLAGS_YES_$(OPT_WHOLE_PROGRAM))
#
# -Zi generate program database for debugging information
# -Z7 generate C7 compatible debugging information (inside .obj)
# -RTCsu enable run-time error checks
OPT_CXXFLAGS_NO = -RTCsu -Zi
OPT_CXXFLAGS_NO = -RTCsu -Z7
# specify object file name and location
OBJ_CXXFLAG = -Fo
@@ -140,17 +140,6 @@ STATIC_LDLIBS_NO=
STATIC_LDFLAGS=
RANLIB=
#
# option needed for parallel builds with Visual Studio 2015 onward
#
# -FS Force Synchronous PDB Writes
ifneq ($(VisualStudioVersion),)
OPT_CXXFLAGS_NO += -FS
OPT_CFLAGS_NO += -FS
endif
#
# add -profile here to run the ms profiler
# -LTCG whole program optimization
# -incremental:no full linking

View File

@@ -4,17 +4,17 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Known Problems in R3.15.7</title>
<title>Known Problems in R3.15.9</title>
</head>
<body>
<h1 style="text-align: center">EPICS Base R3.15.7: Known Problems</h1>
<h1 style="text-align: center">EPICS Base R3.15.9: Known Problems</h1>
<p>Any patch files linked below should be applied at the root of the
base-3.15.7 tree. Download them, then use the GNU Patch program as
base-3.15.9 tree. Download them, then use the GNU Patch program as
follows:</p>
<blockquote><pre>% <b>cd <i>/path/to/</i>base-3.15.7</b>
<blockquote><pre>% <b>cd <i>/path/to/</i>base-3.15.9</b>
% <b>patch -p1 &lt; <i>/path/to/</i>file.patch</b></pre></blockquote>
<p>The following significant problems have been reported with this

View File

@@ -1,184 +0,0 @@
<html>
<head>
<title>Installation notes for EPICS on Mac OS X (Darwin)</title>
</head>
<body>
<h1>Building EPICS base</h1>
<ul>
<li>
To build base:
<ol>
<li>
Set the EPICS_HOST_ARCH environment variable to darwin-ppc, darwin-x86 or darwin-ppcx86.
The scripts in the
base/startup directory can automate this. For example, here's part
of my Bash login script (~/.bash_login):
<pre>
#
# EPICS
#
EPICS_BASE="${HOME}/src/EPICS/base"
EPICS_EXTENSIONS="${HOME}/src/EPICS/extensions"
<strong>.</strong> "${EPICS_BASE}"/startup/unix.sh
</pre>
</li>
<li>
<code>cd</code> to the EPICS base top-level source directory.
</li>
<li>
Uncomment the appropriate line in the relevent
EPICS_BASE/configure/os/CONFIG_SITE.Common.darwin-xxx file for your EPICS_HOST_ARCH value.
Newer versions of OS X (e.g. Snow Leopard) may include only 64 bit versions of some OS libraries,
so should only have the x86_64 ARCH_CLASS.
</li>
<li>
Run <code>make</code>.
</li>
</ol>
</li>
<li>
As distributed, EPICS on Mac OS X uses the readline command line input
routines. IOC applications are more pleasant to interact with if
either the readline or libtecla library is used. The easiest
way to get either or both of these libraries on to your system is to
download and install them using the either the DarwinPorts
distribution or the Fink package manager. If you don't want to install
the readline library, set the COMMANDLINE_LIBRARY variable in one of
the CONFIG_SITE files to EPICS.
<p>
Information on DarwinPorts is available from
<a href="http://www.opendarwin.org/projects/darwinports/">the DarwinPorts
project page</a>.
DarwinPorts binary packages are available from
<a href="http://packages.opendarwin.org/">here</a>.
<p>
Fink may be downloaded from
<a href="http://fink.sourceforge.net/">the Source Forge</a>.
</li>
<li>
If broadcasts are not seen locally, try adding "localhost" (127.0.0.1)
to the EPICS_CA_ADDR_LIST.
</li>
</ul>
<h1>Building EPICS extensions</h1>
<p>
Many extensions build and run properly on OS X. To build and run medm, first
obtain the X11 run-time and developer packages from Apple and the OpenMotif3
package from Fink.
<h1>Objective-C and AppleScript</h1>
<p>
Code written in Objective-C can be included in host or IOC applications.
Here are a couple of short Objective-C examples which can be used to send
AppleScript events to other applications on the OS X machine.
<pre>
/*
* exampleAppleScriptRecord.m
*
* Simple Objective-C/AppleScript subroutine record
*
* To use this record in an application:
*
* 1) Make the following changes to the application Makefile:
* - Add exampleAppleScriptRecord.m to the application SRCS.
* - Add -framework Foundation to the application LDFLAGS.
* 2) Add the following line to the application database description:
* registrar(registerExampleAppleScript)
* 3) Add a record to the application database:
* record(sub,"setVolume")
* {
* field(SNAM,"exampleAppleScriptProcess")
* }
*/
#import &lt;Foundation/Foundation.h&gt;
#include &lt;registryFunction.h&gt;
#include &lt;subRecord.h&gt;
#include &lt;alarm.h&gt;
#include &lt;errlog.h&gt;
#include &lt;recGbl.h&gt;
#include &lt;epicsExport.h&gt;
/*
* Shim between EPICS and NSAppleScript class.
*/
static long
exampleAppleScriptProcess(struct subRecord *psub)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDictionary *err;
NSAppleScript *nsa;
nsa = [[NSAppleScript alloc] initWithSource:[NSString stringWithFormat:
@"tell application \"Finder\" to set volume %g\n", psub-&gt;a]];
if ([nsa executeAndReturnError:&amp;err] == nil) {
errlogPrintf("Failed to run AppleScript: %s\n",
[[err objectForKey:NSAppleScriptErrorMessage] cString]);
recGblSetSevr(psub, SOFT_ALARM, INVALID_ALARM);
}
[nsa release];
[pool release];
return 0;
}
static registryFunctionRef subRef[] = {
{"exampleAppleScriptProcess",(REGISTRYFUNCTION)exampleAppleScriptProcess}
};
static void registerExampleAppleScript(void)
{
registryFunctionRefAdd(subRef,NELEMENTS(subRef));
}
epicsExportRegistrar(registerExampleAppleScript);
==============================================================================
/*
* runAppleScript.m
*
* Simple Objective-C/AppleScript shim to allow EPICS application to
* send arbitrary AppleScript messages to other applications.
*
* To use this subroutine in an application make the following
* changes to the application Makefile:
* - Add runAppleScript.m to the application SRCS.
* - Add -framework Foundation to the application LDFLAGS.
*/
#import &lt;Foundation/Foundation.h&gt;
#include &lt;errlog.h&gt;
int
runAppleScript(const char *format, ...)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *script;
NSMutableDictionary *err;
NSAppleScript *nsa;
va_list args;
int ret = 0;
va_start(args, format);
script = [[NSString alloc] initWithFormat:
[NSString stringWithCString:format] arguments:args];
va_end(args);
err = [NSMutableDictionary dictionaryWithCapacity:10];
nsa = [[NSAppleScript alloc] initWithSource:script];
if ([nsa executeAndReturnError:&amp;err] == nil) {
errlogPrintf("Failed to run AppleScript: %s\n",
[[err objectForKey:NSAppleScriptErrorMessage] cString]);
ret = -1;
}
[script release];
[nsa release];
[pool release];
return ret;
}
</pre>
</body>
</html>

View File

@@ -1,28 +1,28 @@
# Installation Instructions
## EPICS Base Release 3.15.7
## EPICS Base Release 3.15.x
-----
### Table of Contents
- [What is EPICS base?](#0_0_1)
- [What is new in this release?](#0_0_2)
- [Copyright](#0_0_3)
- [Supported platforms](#0_0_4)
- [Supported compilers](#0_0_5)
- [Software requirements](#0_0_6)
- [Host system storage requirements](#0_0_7)
- [Documentation](#0_0_8)
- [Directory Structure](#0_0_10)
- [Build related components](#0_0_11)
- [Building EPICS base (Unix and Win32)](#0_0_12)
- [Example application and extension](#0_0_13)
- [Multiple host platforms](#0_0_14)
- [What is EPICS base?](#what-is-epics-base?)
- [What is new in this release?](#what-is-new-in-this-release?)
- [Copyright](#copyright)
- [Supported platforms](#supported-platforms)
- [Supported compilers](#supported-compilers)
- [Software requirements](#software-requirements)
- [Host system storage requirements](#host-system-storage-requirements)
- [Documentation](#documentation)
- [Directory Structure](#directory-structure)
- [Site-specific build configuration](#site-specific-build-configuration)
- [Building EPICS base](#building-epics-base)
- [Example application and extension](#example-application-and-extension)
- [Multiple host platforms](#multiple-host-platforms)
-----
### <span id="0_0_1">What is EPICS base?</span>
### What is EPICS base?
The Experimental Physics and Industrial Control Systems (EPICS) is an
extensible set of software components and tools with which application
@@ -34,17 +34,17 @@ function. EPICS base allows an arbitrary number of target systems,
IOCs (input/output controllers), and host systems, OPIs (operator
interfaces) of various types.
### <span id="0_0_2">What is new in this release?</span>
### What is new in this release?
Please check the `RELEASE_NOTES` file in the distribution for
Please check the `documentation/RELEASE_NOTES.md` file for
description of changes and release migration details.
### <span id="0_0_3">Copyright</span>
### Copyright
Please review the LICENSE file included in the distribution for legal
terms of usage.
Please review the `LICENSE` file included in the distribution for
legal terms of usage.
### <span id="0_0_4">Supported platforms</span>
### Supported platforms
The list of platforms supported by this version of EPICS base is given
in the `configure/CONFIG_SITE` file. If you are trying to build EPICS
@@ -55,36 +55,41 @@ base/configure/os/directory. You can start by copying existing
configuration files in the configure/os directory and then make
changes for your new platforms.
### <span id="0_0_5">Supported compilers</span>
### Supported compilers
This version of EPICS base has been built and tested using the host
vendor's C and C++ compilers, as well as the GNU gcc and g++
compilers. The GNU cross-compilers work for all cross-compiled
targets. You may need the C and C++ compilers to be in your search
path to do EPICS builds; check the definitions of CC and CCC in
base/configure/os/CONFIG.&lt;host>.&lt;host> if you have problems.
`base/configure/os/CONFIG.<host>.<host>` if you have problems.
### <span id="0_0_6">Software requirements</span>
### Software requirements
**GNU make**
You must use GNU make, gnumake, for any EPICS builds. Set your path so
that a gnumake version 3.81 or later is available.
#### GNU make
You must use the GNU version of `make` for EPICS builds. Set your path
so that version 3.81 or later is available (4.0 or later on Windows).
#### Perl
**Perl**
You must have Perl version 5.8.1 or later installed. The EPICS
configuration files do not specify the perl full pathname, so the perl
executable must be found through your normal search path.
**Unzip and tar (Winzip on WIN32 systems)**
#### Unzip and tar (Winzip on WIN32 systems)
You must have tools available to unzip and untar the EPICS base
distribution file.
**Target systems**
#### Target systems
EPICS supports IOCs running on embedded platforms such as VxWorks and
RTEMS built using a cross-compiler, and also supports soft IOCs
running as processes on the host platform.
**vxWorks**
#### vxWorks
You must have vxWorks 5.5.x or 6.x installed if any of your target
systems are vxWorks systems; the C++ compiler for vxWorks 5.4 is now
too old to support. The vxWorks installation provides the
@@ -98,134 +103,148 @@ Consult the [vxWorks 5.x](https://epics.anl.gov/base/tornado.php) or
about and the vxWorks documentation for information about configuring
your vxWorks operating system for use with EPICS.
**RTEMS**
#### RTEMS
For RTEMS targets, you need RTEMS core and toolset version 4.9.2 or
later.
4.10.x. RTEMS 5 and above are only supported in EPICS 7.0.6 or later.
**GNU readline or Tecla library**
GNU readline and Tecla libraries can be used by the IOC shell to
provide command line editing and command line history recall and edit.
GNU readline (or Tecla library) must be installed on your target
system when `COMMANDLINE_LIBRARY` is set to READLINE (or TECLA) for
that target. EPICS (EPICS shell) is the default specified in
`CONFIG_COMMON`. A READLINE override is defined for linux-x86 in the
EPICS distribution. Comment out `COMMANDLINE_LIBRARY=READLINE` in
`configure/os/CONFIG_SITE.Common.linux-x86` if readline is not
installed on linux-x86. Command-line editing and history will then be
those supplied by the os. On vxWorks the ledLib command-line input
library is used instead.
#### Command Line Editing
### <span id="0_0_7">Host system storage requirements</span>
The compressed tar file is approximately 1.6 MB in size. The
GNU readline and other similar libraries can be used by the IOC shell
to provide command line editing and command line history recall. The
GNU readline development package (or Apple's emulator on macOS) must
be installed for a target when its build configuration variable
`COMMANDLINE_LIBRARY` is set to `READLINE`. The default specified in
`CONFIG_COMMON` is `EPICS`, but most linux target builds can detect if
readline is available and will then use it. RTEMS targets may be
configured to use `LIBTECLA` if available, and on vxWorks the OS's
ledLib line-editing library is normally used.
### Host system storage requirements
The compressed tar file is approximately 1.7 MB in size. The
distribution source tree takes up approximately 12 MB. Each host
target will need around 40 MB for build files, and each cross-compiled
target around 20 MB.
target will need around 50 MB for build files, and each cross-compiled
target around 30 MB.
### <span id="0_0_8">Documentation</span>
### Documentation
EPICS documentation is available through the [EPICS
website](https://epics.anl.gov/) at Argonne.
Release specific documentation can also be found in the
base/documentation directory of the distribution.
`base/documentation` directory of the distribution.
### <span id="0_0_10">Directory Structure</span>
### Directory Structure
#### Distribution directory structure:
#### Distribution directory structure
```
base Root directory of the base distribution
base/configure Operating system independent build config files
base/configure/os Operating system dependent build config files
base/documentation Distribution documentation
base/src Source code in various subdirectories
base/startup Scripts for setting up path and environment
base Root directory of the distribution
base/configure Build rules and OS-independent config files
base/configure/os OS-dependent build config files
base/documentation Distribution documentation
base/src Source code in various subdirectories
base/startup Scripts for setting up path and environment
```
#### Install directories created by the build:
#### Directories created by the build
These are created in the root directory of the installation (`base`
above) or under the directory pointed to by the `INSTALL_LOCATION`
configuration variable if that has been set.
```
bin Installed scripts and executables in subdirs
cfg Installed build configuration files
db Installed data bases
dbd Installed data base definitions
doc Installed documentation files
html Installed html documentation
include Installed header files
include/os Installed os specific header files in subdirs
include/compiler Installed compiler-specific header files
lib Installed libraries in arch subdirectories
lib/perl Installed perl modules
templates Installed templates
bin Installed scripts and executables in subdirs
cfg Installed build configuration files
db Installed database files
dbd Installed database definition files
html Installed html documentation
include Installed header files
include/os Installed OS-specific header files in subdirs
include/compiler Installed compiler-specific header files
lib Installed libraries in arch subdirectories
lib/perl Installed perl modules
templates Installed templates
```
### <span id="0_0_11">Build related components</span>
#### `base/documentation` Directory
#### base/documentation directory - contains setup, build, and install documents
This contains documents on how to setup, build, and install EPICS.
```
README.md Instructions for setup and building epics base
README.darwin.html Installation notes for Mac OS X (Darwin)
RELEASE_NOTES.html Notes on release changes
KnownProblems.html List of known problems and workarounds
README.md This file
RELEASE_NOTES.md Notes on release changes
KnownProblems.html List of known problems and workarounds
```
#### base/startup directory - contains scripts to set environment and path
#### `base/startup` Directory
This contains several example scripts that show how to set up the
build environment and PATH for using EPICS. Sites would usually copy and/or modify these files as appropriate for their environment; they are not used by the build system at all.
```
EpicsHostArch Shell script to set EPICS_HOST_ARCH env variable
unix.csh C shell script to set path and env variables
unix.sh Bourne shell script to set path and env variables
win32.bat Bat file example to configure win32-x86 target
windows.bat Bat file example to configure windows-x64 target
EpicsHostArch Shell script to set EPICS_HOST_ARCH env variable
unix.csh C shell script to set path and env variables
unix.sh Bourne shell script to set path and env variables
win32.bat Bat file example to configure win32-x86 target
windows.bat Bat file example to configure windows-x64 target
```
#### base/configure directory - contains build definitions and rules
#### `base/configure` directory
This contains build-system files providing definitions and rules
required by GNU Make to build EPICS. Users should only need to modify the `CONFIG_SITE` files to configure the EPICS build.
```
CONFIG Includes configure files and allows variable overrides
CONFIG.CrossCommon Cross build definitions
CONFIG.gnuCommon Gnu compiler build definitions for all archs
CONFIG_ADDONS Definitions for &lt;osclass> and DEFAULT options
CONFIG_APP_INCLUDE
CONFIG_BASE EPICS base tool and location definitions
CONFIG_BASE_VERSION Definitions for EPICS base version number
CONFIG_COMMON Definitions common to all builds
CONFIG_ENV Definitions of EPICS environment variables
CONFIG_FILE_TYPE
CONFIG_SITE Site specific make definitions
CONFIG_SITE_ENV Site defaults for EPICS environment variables
MAKEFILE Installs CONFIG* RULES* creates
RELEASE Location of external products
RULES Includes appropriate rules file
RULES.Db Rules for database and database definition files
RULES.ioc Rules for application iocBoot/ioc* directory
RULES_ARCHS Definitions and rules for building architectures
RULES_BUILD Build and install rules and definitions
RULES_DIRS Definitions and rules for building subdirectories
RULES_EXPAND
RULES_FILE_TYPE
RULES_TARGET
RULES_TOP Rules specific to a &lt;top> dir (uninstall and tar)
Sample.Makefile Sample makefile with comments
CONFIG Main entry point for building EPICS
CONFIG.CrossCommon Cross build definitions
CONFIG.gnuCommon Gnu compiler build definitions for all archs
CONFIG_ADDONS Definitions for <osclass> and DEFAULT options
CONFIG_APP_INCLUDE
CONFIG_BASE EPICS base tool and location definitions
CONFIG_BASE_VERSION Definitions for EPICS base version number
CONFIG_COMMON Definitions common to all builds
CONFIG_ENV Definitions of EPICS environment variables
CONFIG_FILE_TYPE
CONFIG_SITE Site specific make definitions
CONFIG_SITE_ENV Site defaults for EPICS environment variables
MAKEFILE Installs CONFIG* RULES* creates
RELEASE Location of external products
RULES Includes appropriate rules file
RULES.Db Rules for database and database definition files
RULES.ioc Rules for application iocBoot/ioc* directory
RULES_ARCHS Definitions and rules for building architectures
RULES_BUILD Build and install rules and definitions
RULES_DIRS Definitions and rules for building subdirectories
RULES_EXPAND
RULES_FILE_TYPE
RULES_TARGET
RULES_TOP Rules specific to a <top> dir only
Sample.Makefile Sample makefile with comments
```
#### base/configure/os directory - contains os-arch specific definitions
#### `base/configure/os` Directory
Files in here provide definitions that are shared by or specific to particular host and/or target architectures. Users should only need to modify the `CONFIG_SITE` files in this directory to configure the EPICS build.
```
CONFIG.&lt;host>.&lt;target> Specific host-target build definitions
CONFIG.Common.&lt;target> Specific target definitions for all hosts
CONFIG.&lt;host>.Common Specific host definitions for all targets
CONFIG.UnixCommon.Common Definitions for Unix hosts and all targets
CONFIG.Common.UnixCommon Definitions for Unix targets and all hosts
CONFIG.Common.vxWorksCommon Specific host definitions for all vx targets
CONFIG_SITE.&lt;host>.&lt;target> Site specific host-target definitions
CONFIG_SITE.Common.&lt;target> Site specific target defs for all hosts
CONFIG_SITE.&lt;host>.Common Site specific host defs for all targets
CONFIG.<host>.<target> Definitions for a specific host-target combination
CONFIG.Common.<target> Definitions for a specific target, any host
CONFIG.<host>.Common Definitions for a specific host, any target
CONFIG.UnixCommon.Common Definitions for Unix hosts, any target
CONFIG.Common.UnixCommon Definitions for Unix targets, any host
CONFIG.Common.RTEMS Definitions for all RTEMS targets, any host
CONFIG.Common.vxWorksCommon Definitions for all vxWorks targets, any host
CONFIG_SITE.<host>.<target> Local settings for a specific host-target combination
CONFIG_SITE.Common.<target> Local settings for a specific target, any host
CONFIG_SITE.<host>.Common Local settings for a specific host, any target
CONFIG_SITE.Common.RTEMS Local settings for all RTEMS targets, any host
CONFIG_SITE.Common.vxWorksCommon Local settings for all vxWorks targets, any host
```
### <span id="0_0_12">Building EPICS base (Unix and Win32)</span>
### Building EPICS base
#### Unpack file
@@ -237,7 +256,7 @@ systems.
Files in the base/startup directory have been provided to help set
required path and other environment variables.
* `EPICS_HOST_ARCH`
* **`EPICS_HOST_ARCH`**
Before you can build or use EPICS R3.15, the environment variable
`EPICS_HOST_ARCH` must be defined. A perl script EpicsHostArch.pl in
the base/startup directory has been provided to help set
@@ -250,65 +269,66 @@ compilers on a solaris host or "-mingw" for MinGW c/c++ compilers on
a WIN32 host). See `configure/CONFIG_SITE` for a list of supported
`EPICS_HOST_ARCH` values.
* `PERLLIB`
On WIN32, some versions of Perl require that the environment
variable PERLLIB be set to &lt;perl directory location>.
* **`PATH`**
As already mentioned, you must have the `perl` executable and you may
need C and C++ compilers in your search path. When building base you
must have `echo` in your search path. For Unix host builds you will
also need `cp`, `rm`, `mv`, and `mkdir` in your search path. Some Unix
systems may also need `ar` and `ranlib`, and the C/C++ compilers may
require `as` and `ld` in your path. On Solaris systems you need
`uname` in your path.
* `PATH`
As already mentioned, you must have the perl executable and you may
need C and C++ compilers in your search path. For building base you
also must have echo in your search path. For Unix host builds you
also need ln, cpp, cp, rm, mv, and mkdir in your search path and
/bin/chmod must exist. On some Unix systems you may also need ar and
ranlib in your path, and the C compiler may require as and ld in
your path. On solaris systems you need uname in your path.
* **`LD_LIBRARY_PATH`**
R3.15 shared libraries and executables normally contain the full path
to any libraries they require, so setting this variable is not usually
necessary. However, if you move the EPICS installation to a new
location after building it then in order for the shared libraries to
be found at runtime it may need to be set, or some equivalent
OS-specific mechanism such as `/etc/ld.so.conf` on Linux must be used.
Shared libraries are now built by default on all Unix type hosts.
* `LD_LIBRARY_PATH`
R3.15 shared libraries and executables normally contain the full
path to any libraries they require. However, if you move the EPICS
files or directories from their build-time location then in order
for the shared libraries to be found at runtime `LD_LIBRARY_PATH`
must include the full pathname to
`$(INSTALL_LOCATION)/lib/$(EPICS_HOST_ARCH)` when invoking
executables, or some equivalent OS-specific mechanism (such as
/etc/ld.so.conf on Linux) must be used. Shared libraries are now
built by default on all Unix type hosts.
### Site-specific build configuration
#### Do site-specific build configuration
#### Site configuration
**Site configuration**
To configure EPICS, you may want to modify the default definitions
in the following files:
To configure EPICS, you may want to modify some values set in the
following files:
```
configure/CONFIG_SITE Build choices. Specify target archs.
configure/CONFIG_SITE_ENV Environment variable defaults
configure/RELEASE TORNADO2 full path location
configure/CONFIG_SITE Build settings. Specify target archs.
configure/CONFIG_SITE_ENV Environment variable defaults
```
**Host configuration**
To configure each host system, you may override the default
definitions by adding a new file in the configure/os directory with
override definitions. The new file should have the same name as the
distribution file to be overridden except with CONFIG in the name
changed to `CONFIG_SITE`.
#### Host configuration
To configure each host system, you can override the default
definitions by adding a new settings file (or editing an existing
settings file) in the `configure/os` directory with your override
definitions. The settings file has the same name as the definitions
file to be overridden except with `CONFIG` in the name changed to
`CONFIG_SITE`.
```
configure/os/CONFIG.&lt;host>.&lt;host> Host build settings
configure/os/CONFIG.&lt;host>.Common Host common build settings
configure/os/CONFIG.<host>.<host> Host self-build definitions
configure/os/CONFIG.<host>.Common Host common build definitions
configure/os/CONFIG_SITE.<host>.<host> Host self-build overrides
configure/os/CONFIG_SITE.<host>.Common Host common build overrides
```
**Target configuration**
#### Target configuration
To configure each target system, you may override the default
definitions by adding a new file in the configure/os directory with
override definitions. The new file should have the same name as the
distribution file to be overridden except with CONFIG in the name
replaced by `CONFIG_SITE`. This step is necessary even if the host
system is the only target system.
definitions by adding a new settings file (or editing an existing
settings file) in the `configure/os` directory with your override
definitions. The settings file has the same name as the definitions
file to be overridden except with `CONFIG` in the name changed to
`CONFIG_SITE`.
```
configure/os/CONFIG.Common.&lt;target> Target common settings
configure/os/CONFIG.&lt;host>.&lt;target> Host-target settings
configure/os/CONFIG.Common.<target> Target common definitions
configure/os/CONFIG.<host>.<target> Host-target definitions
configure/os/CONFIG_SITE.Common.<target> Target common overrides
configure/os/CONFIG_SITE.<host>.<target> Host-target overrides
```
#### Build EPICS base
@@ -318,24 +338,29 @@ by issuing the following commands in the distribution's root
directory (base):
```
gnumake clean uninstall
gnumake
make distclean
make
```
The command "gnumake clean uninstall" will remove all files and
directories generated by a previous build. The command "gnumake"
The command `make distclean` will remove all files and
directories generated by a previous build. The command `make`
will build and install everything for the configured host and
targets.
It is recommended that you do a "gnumake clean uninstall" at the
It is recommended that you do a `make distclean` at the
root directory of an EPICS directory structure before each complete
rebuild to ensure that all components will be rebuilt.
### <span id="0_0_13">Example application and extension</span>
In some cases GNU Make may have been installed as `gmake` or
`gnumake`, in which case the above commands will have to be adjusted
to match.
A perl tool, makeBaseApp.pl is included in the distribution file. This
script will create a sample application that can be built and then
executed to try out this release of base.
### Example application and extension
A perl tool `makeBaseApp.pl` and several template applications are
included in the distribution. This script instantiates the selected
template into an empty directory to provide an example application
that can be built and then executed to try out this release of base.
Instructions for building and executing the 3.15 example application
can be found in the section "Example Application" of Chapter 2,
@@ -348,26 +373,30 @@ application as a host-based IOC, you will be able to quickly implement
a complete EPICS system and be able to run channel access clients on
the host system.
A perl script, makeBaseExt.pl, is included in the distribution file.
This script will create a sample extension that can be built and
executed. The makeBaseApp.pl and makeBaseExt.pl scripts are installed
into the install location bin/&lt;hostarch> directory during the base
build.
Another perl script `makeBaseExt.pl` is also included in the
distribution file for creating an extensions tree and sample
application that can also be built and executed. Both these scripts
are installed into the install location `bin/<hostarch>` directory
during the base build.
### <span id="0_0_14">Multiple host platforms</span>
### Multiple host platforms
You can build using a single EPICS directory structure on multiple
host systems and for multiple cross target systems. The intermediate
and binary files generated by the build will be created in separate
subdirectories and installed into the appropriate separate host/target
install directories. EPICS executables and perl scripts are installed
into the `$(INSTALL_LOCATION)/bin/<arch>` directories. Libraries are
installed into $`(INSTALL_LOCATION)/lib/<arch>`. The default
definition for `$(INSTALL_LOCATION)` is `$(TOP)` which is the root
directory in the distribution directory structure, base. Created
object files are stored in O.&lt;arch> source subdirectories, This
allows objects for multiple cross target architectures to be
maintained at the same time. To build EPICS base for a specific
install directories.
EPICS executables and perl scripts are installed into the
`$(INSTALL_LOCATION)/bin/<arch>` directories. Libraries are installed
into $`(INSTALL_LOCATION)/lib/<arch>`. The default definition for
`$(INSTALL_LOCATION)` is `$(TOP)` which is the root directory in the
distribution directory structure, `base`. Intermediate object files
are stored in `O.<arch>` source subdirectories during the build
process, to allow objects for multiple cross target architectures
to be maintained at the same time.
To build EPICS base for a specific
host/target combination you must have the proper host/target C/C++
cross compiler and target header files and the base/configure/os
directory must have the appropriate configure files.

View File

@@ -1,4 +1,148 @@
# EPICS Base Release 3.15.7
# EPICS Base Release 3.15.9
## Changes made between 3.15.8 and 3.15.9
### Use waitable timers on Microsoft Windows
The `epicsEventWaitWithTimeout()` and `epicsThreadSleep()` functions have
been changed to use waitable timers. On Windows 10 version 1803 or higher
they will use high resolution timers for more consistent timing.
See [this Google Groups thread](https://groups.google.com/a/chromium.org/g/scheduler-dev/c/0GlSPYreJeY)
for a comparison of the performance of different timers.
### Build target for documentation
The build target `inc` now works again after a very long hiatus. It now
generates and installs just the dbd, header and html files, without compiling
any C/C++ code. This can be used to speed up CI jobs that only generate
documentation.
### Bug fixes
- The error status returned by a record support's `special()` method is now propagated out of the `dbPut()` routine again (broken since 3.15.0).
- [gh: #80](https://github.com/epics-base/epics-base/issues/80), VS-2015 and
later have working strtod()
- [lp: #1776141](https://bugs.launchpad.net/epics-base/+bug/1776141), Catch
buffer overflow from long link strings
- [lp: #1899697](https://bugs.launchpad.net/epics-base/+bug/1899697), Records
in wrong PHAS order
### Change to the `junitfiles` self-test build target
The names of the generated junit xml test output files have been changed
from `<testname>.xml` to `<testname>-results.xml`, to allow better
distinction from other xml files. (I.e., for easy wildcard matching.)
### Fixes and code cleanups
Issues reported by various static code checkers.
## Changes made between 3.15.7 and 3.15.8
### Bug fixes
The following launchpad bugs have fixes included in this release:
- [lp: 1812084](https://bugs.launchpad.net/epics-base/+bug/1812084), Build
failure on RTEMS 4.10.2
- [lp: 1829770](https://bugs.launchpad.net/epics-base/+bug/1829770), event
record device support broken with constant INP
- [lp: 1829919](https://bugs.launchpad.net/epics-base/+bug/1829919), IOC
segfaults when calling dbLoadRecords after iocInit
- [lp: 1838792](https://bugs.launchpad.net/epics-base/+bug/1838792), epicsCalc
bit-wise operators on aarch64
- [lp: 1841608](https://bugs.launchpad.net/epics-base/+bug/1841608), logClient
falsely sends error logs on all connections
- [lp: 1853168](https://bugs.launchpad.net/epics-base/+bug/1853168), undefined
reference to `clock_gettime()`
- [lp: 1862328](https://bugs.launchpad.net/epics-base/+bug/1862328), Race
condition on IOC start leaves rsrv unresponsive
- [lp: 1868486](https://bugs.launchpad.net/epics-base/+bug/1868486),
epicsMessageQueue lost messages
### Improvements to the self-test build targets
This release contains changes that make it possible to integrate another test
running and reporting system (such as Google's gtest) into the EPICS build
system. The built-in test-runner and reporting system will continue to be used
by the test programs inside Base however.
These GNUmake `tapfiles` and `test-results` build targets now collect a list of
the directories that experienced test failures and display those at the end of
running and/or reporting all of the tests. The GNUmake process will also only
exit with an error status after running and/or reporting all of the test
results; previously the `-k` flag to make was needed and even that didn't always
work.
Continuous Integration systems are recommended to run `make tapfiles` (or if
they can read junittest output instead of TAP `make junitfiles`) followed by
`make -s test-results` to display the results of the tests. If multiple CPUs are
available the `-j` flag can be used to run tests in parallel, giving the maximum
jobs that should be allowed so `make -j4 tapfiles` for a system with 4 CPUs say.
Running many more jobs than you have CPUs is likely to be slower and is not
recommended.
### Calc Engine Fixes and Enhancements
The code that implements bit operations for Calc expressions has been reworked
to better handle some CPU architectures and compilers. As part of this work a
new operator has been added: `>>>` performs a logical right-shift, inserting
zero bits into the most significant bits (the operator `>>` is an arithmetic
right-shift which copies the sign bit as it shifts the value rightwards).
### IOC logClient Changes
The IOC's error logging system has been updated significantly to fix a number
of issues including:
- Only send errlog messages to iocLogClient listeners
- Try to minimize lost messages while the log server is down:
+ Detect disconnects sooner
+ Don't discard the buffer on disconnect
+ Flush the buffer immediately after a server reconnects
### epicsThread: Main thread defaults to allow blocking I/O
VxWorks IOCs (and potentially RTEMS IOCs running GeSys) have had problems with
garbled error messages from dbStaticLib routines for some time &mdash; messages
printed before `iocInit` were being queued through the errlog thread instead of
being output immediately. This has been fixed by initializing the main thread
with its `OkToBlock` flag set instead of cleared. IOCs running on other
operating systems that use iocsh to execute the startup script previously had
that set anyway in iocsh so were not affected, but this change might cause other
programs that don't use iocsh to change their behavior slightly if they use
`errlogPrintf()`, `epicsPrintf()` or `errPrintf()`.
### catools: Handle data type changes in camonitor
The camonitor program didn't properly cope if subscribed to a channel whose data
type changed when its IOC was rebooted without restarting the camonitor program.
This has now been fixed.
### More Record Reference Documentation
The remaining record types have had their reference pages moved from the Wiki,
and some new reference pages have been written to cover the analog array and
long string input and output record types plus the printf record type, none of
which were previously documented. The wiki reference pages covering the fields
common to all, input, and output record types have also been added, thanks to
Rolf Keitel. The POD conversion scripts have also been improved and they now
properly support linking to subsections in a different document, although the
POD changes to add the cross-links that appeared in the original wiki pages
still needs to be done in most cases.
### Fix build issues with newer MinGW versions
The `clock_gettime()` routine is no longer used under MinGW since newer versions
don't provide it any more.
### Fix race for port in RSRV when multiple IOCs start simultaneously
If multiple IOCs were started at the same time, by systemd say, they could race
to obtain the Channel Access TCP port number 5064. This issue has been fixed.
## Changes made between 3.15.6 and 3.15.7

View File

@@ -0,0 +1,71 @@
# Record Reference Documentation
The documentation below for the record types and menus included with Base was
converted from the old EPICS Wiki pages and updated. This list only includes the
record types supplied with Base. The first two links below are to an external
website where these original reference chapters are now being published.
* [Introduction to EPICS](https://docs.epics-controls.org/en/latest/guides/EPICS_Intro.html)
* [Process Database Concepts](https://docs.epics-controls.org/en/latest/guides/EPICS_Process_Database_Concepts.html)
* [Fields Common to All Record Types](dbCommonRecord.html)
* [Fields Common to Input Record Types](dbCommonInput.html)
* [Fields Common to Output Record Types](dbCommonOutput.html)
## Record Types
* [Analog Array Input Record (aai)](aaiRecord.html)
* [Analog Array Output Record (aao)](aaoRecord.html)
* [Analog Input Record (ai)](aiRecord.html)
* [Analog Output Record (ao)](aoRecord.html)
* [Array Subroutine Record (aSub)](aSubRecord.html)
* [Binary Input Record (bi)](biRecord.html)
* [Binary Output Record (bo)](boRecord.html)
* [Calculation Output Record (calcout)](calcoutRecord.html)
* [Calculation Record (calc)](calcRecord.html)
* [Compression Record (compress)](compressRecord.html)
* [Data Fanout Record (dfanout)](dfanoutRecord.html)
* [Event Record (event)](eventRecord.html)
* [Fanout Record (fanout)](fanoutRecord.html)
* [Histogram Record (histogram)](histogramRecord.html)
* [Long Input Record (longin)](longinRecord.html)
* [Long Output Record (longout)](longoutRecord.html)
* [Long String Input Record (lsi)](lsiRecord.html)
* [Long String Output Record (lso)](lsoRecord.html)
* [Multi-Bit Binary Input Direct Record (mbbiDirect)](mbbiDirectRecord.html)
* [Multi-Bit Binary Input Record (mbbi)](mbbiRecord.html)
* [Multi-Bit Binary Output Direct Record (mbboDirect)](mbboDirectRecord.html)
* [Multi-Bit Binary Output Record (mbbo)](mbboRecord.html)
* [Permissive Record (permissive)](permissiveRecord.html)
* [Printf Record (printf)](printfRecord.html)
* [Select Record (sel)](selRecord.html)
* [Sequence Record (seq)](seqRecord.html)
* [State Record (state)](stateRecord.html)
* [String Input Record (stringin)](stringinRecord.html)
* [String Output Record (stringout)](stringoutRecord.html)
* [Sub-Array Record (subArray)](subArrayRecord.html)
* [Subroutine Record (sub)](subRecord.html)
* [Waveform Record (waveform)](waveformRecord.html)
## Menu Definitions
* [Alarm Severity Menu](menuAlarmSevr.html)
* [Alarm Status Menu](menuAlarmStat.html)
* [Analog Conversions Menu](menuConvert.html)
* [Field Type Menu](menuFtype.html)
* [Invalid Value Output Action Menu](menuIvoa.html)
* [Output Mode Select Menu](menuOmsl.html)
* [Process at iocInit Menu](menuPini.html)
* [Post Monitors Menu](menuPost.html)
* [Priority Menu](menuPriority.html)
* [Scan Menu](menuScan.html)
* [Simulation Mode Menu](menuSimm.html)
* [Yes/No Menu](menuYesNo.html)
## Corrections and Updates
Corrections to these documents can be submitted as patch files to the EPICS core
developers, or as merge requests or pull requests to the 3.15 branch of Base.
The document sources can be found in the `src/std/rec` and `src/ioc/db`
directories in files with extension `.dbd.pod`. The documentation source format
is a combination of the EPICS DBD file format with an extended version of Perl's
POD (plain old documentation); run `perldoc pod` for details of POD.

View File

@@ -136,17 +136,17 @@ relevent roles unless the Release Manager designates otherwise:</p>
<td>Tag the module in Git, using these tag conventions:
<ul>
<li>
<tt>R3.15.7-pre1</tt>
<tt>R3.15.9-pre1</tt>
&mdash; pre-release tag
</li>
<li>
<tt>R3.15.7-rc1</tt>
<tt>R3.15.9-rc1</tt>
&mdash; release candidate tag
</li>
</ul>
<blockquote><tt>
cd base-3.15<br />
git tag -m 'ANJ: Tagged for 3.15.7-rc1' R3.15.7-rc1
git tag -m 'ANJ: Tagged for 3.15.9-rc1' R3.15.9-rc1
</tt></blockquote>
</td>
</tr>
@@ -158,11 +158,11 @@ relevent roles unless the Release Manager designates otherwise:</p>
files and directories that are only used for continuous integration:
<blockquote><tt>
cd base-3.15<br />
git archive --prefix=base-3.15.7-rc1/ --output=base-3.15.7-rc1.tar.gz R3.15.7-rc1 configure documentation LICENSE Makefile README src startup
git archive --prefix=base-3.15.9-rc1/ --output=base-3.15.9-rc1.tar.gz R3.15.9-rc1 configure documentation LICENSE Makefile README src startup
</tt></blockquote>
Create a GPG signature file of the tarfile as follows:
<blockquote><tt>
gpg --armor --sign --detach-sig base-3.15.7-rc1.tar.gz
gpg --armor --sign --detach-sig base-3.15.9-rc1.tar.gz
</tt></blockquote>
</td>
</tr>
@@ -274,7 +274,7 @@ relevent roles unless the Release Manager designates otherwise:</p>
<td>Tag the module in Git:
<blockquote><tt>
cd base-3.15<br />
git tag -m 'ANJ: Tagged for 3.15.7' R3.15.7
git tag -m 'ANJ: Tagged for 3.15.9' R3.15.9
</tt></blockquote>
</td>
</tr>
@@ -285,11 +285,11 @@ relevent roles unless the Release Manager designates otherwise:</p>
generates a gzipped tarfile directly from the repository:
<blockquote><tt>
cd base-3.15<br />
git archive --prefix=base-3.15.7/ --output=base-3.15.7.tar.gz R3.15.7 configure documentation LICENSE Makefile README src startup
git archive --prefix=base-3.15.9/ --output=base-3.15.9.tar.gz R3.15.9 configure documentation LICENSE Makefile README src startup
</tt></blockquote>
Create a GPG signature file of the tarfile as follows:
<blockquote><tt>
gpg --armor --sign --detach-sig base-3.15.7.tar.gz
gpg --armor --sign --detach-sig base-3.15.9.tar.gz
</tt></blockquote>
</td>
</tr>

View File

@@ -605,7 +605,7 @@ void epicsShareAPI ca_signal_formated ( long ca_status, const char *pfilenm,
}
else {
fprintf ( stderr, "CA exception in thread w/o CA ctx: status=%s file=%s line=%d: \n",
ca_message ( ca_status ), pfilenm, lineno );
ca_message ( ca_status ), pfilenm ? pfilenm : "<null>", lineno );
if ( pFormat ) {
vfprintf ( stderr, pFormat, theArgs );
}

View File

@@ -157,7 +157,7 @@ int main (int argc, char *argv[])
}
break;
case 's': /* ca_client_status interest level */
if (sscanf(optarg,"%du", &statLevel) != 1)
if (sscanf(optarg,"%u", &statLevel) != 1)
{
fprintf(stderr, "'%s' is not a valid interest level "
"- ignored. ('cainfo -h' for help.)\n", optarg);

View File

@@ -138,7 +138,14 @@ static void connection_handler ( struct connection_handler_args args )
pv *ppv = ( pv * ) ca_puser ( args.chid );
if ( args.op == CA_OP_CONN_UP ) {
nConn++;
if (!ppv->onceConnected) {
if (ppv->onceConnected && ppv->dbfType != ca_field_type(ppv->chid)) {
/* Data type has changed. Rebuild connection with new type. */
ca_clear_subscription(ppv->evid);
ppv->evid = NULL;
}
if (!ppv->evid) {
ppv->onceConnected = 1;
/* Set up pv structure */
/* ------------------- */
@@ -169,7 +176,7 @@ static void connection_handler ( struct connection_handler_args args )
eventMask,
event_handler,
(void*)ppv,
NULL);
&ppv->evid);
}
}
else if ( args.op == CA_OP_CONN_DOWN ) {
@@ -251,7 +258,7 @@ int main (int argc, char *argv[])
}
break;
case '#': /* Array count */
if (sscanf(optarg,"%ld", &reqElems) != 1)
if (sscanf(optarg,"%lu", &reqElems) != 1)
{
fprintf(stderr, "'%s' is not a valid array element count "
"- ignored. ('camonitor -h' for help.)\n", optarg);

View File

@@ -437,6 +437,7 @@ int main (int argc, char *argv[])
dbuf = calloc (count, sizeof(double));
if(!sbuf || !dbuf) {
fprintf(stderr, "Memory allocation failed\n");
free(sbuf); free(dbuf);
return 1;
}
@@ -450,6 +451,7 @@ int main (int argc, char *argv[])
result = ca_pend_io(caTimeout);
if (result == ECA_TIMEOUT) {
fprintf(stderr, "Read operation timed out: ENUM data was not read.\n");
free(sbuf); free(dbuf);
return 1;
}
@@ -460,6 +462,7 @@ int main (int argc, char *argv[])
if (*(argv+optind+i) == pend) { /* Conversion didn't work */
fprintf(stderr, "Enum index value '%s' is not a number.\n",
*(argv+optind+i));
free(sbuf); free(dbuf);
return 1;
}
if (dbuf[i] >= bufGrEnum.no_str) {
@@ -486,6 +489,7 @@ int main (int argc, char *argv[])
dbuf[i] = epicsStrtod(sbuf[i], &pend);
if (sbuf[i] == pend || enumAsString) {
fprintf(stderr, "Enum string value '%s' invalid.\n", sbuf[i]);
free(sbuf); free(dbuf);
return 1;
}
if (dbuf[i] >= bufGrEnum.no_str) {
@@ -503,6 +507,7 @@ int main (int argc, char *argv[])
ebuf = calloc(len, sizeof(char));
if(!ebuf) {
fprintf(stderr, "Memory allocation failed\n");
free(sbuf); free(dbuf); free(ebuf);
return 1;
}
count = epicsStrnRawFromEscaped(ebuf, len, cbuf, len-1) + 1;
@@ -537,12 +542,14 @@ int main (int argc, char *argv[])
}
if (result != ECA_NORMAL) {
fprintf(stderr, "Error from put operation: %s\n", ca_message(result));
free(sbuf); free(dbuf); free(ebuf);
return 1;
}
result = ca_pend_io(caTimeout);
if (result == ECA_TIMEOUT) {
fprintf(stderr, "Write operation timed out: Data was not written.\n");
free(sbuf); free(dbuf); free(ebuf);
return 1;
}
if (request == callback) { /* Also wait for callbacks */
@@ -556,6 +563,7 @@ int main (int argc, char *argv[])
if (result != ECA_NORMAL) {
fprintf(stderr, "Error occured writing data: %s\n", ca_message(result));
free(sbuf); free(dbuf); free(ebuf);
return 1;
}
@@ -567,6 +575,7 @@ int main (int argc, char *argv[])
/* Shut down Channel Access */
ca_context_destroy();
free(sbuf); free(dbuf); free(ebuf);
return result;
}

View File

@@ -78,6 +78,7 @@ typedef struct
epicsTimeStamp tsPreviousS;
char firstStampPrinted;
char onceConnected;
evid evid;
} pv;

View File

@@ -88,8 +88,8 @@ public:
private:
clientBufMemoryManager clientBufMemMgr;
tsFreeList < casMonitor, 1024 > casMonitorFreeList;
tsDLList < casStrmClient > clientList;
tsDLList < casIntfOS > intfList;
::tsDLList < casStrmClient > clientList;
::tsDLList < casIntfOS > intfList;
mutable epicsMutex mutex;
mutable epicsMutex diagnosticCountersMutex;
caServer & adapter;

View File

@@ -291,7 +291,7 @@ void casPVI::postEvent ( const casEventMask & select, const gdd & event )
}
caStatus casPVI::installMonitor (
casMonitor & mon, tsDLList < casMonitor > & monitorList )
casMonitor & mon, ::tsDLList < casMonitor > & monitorList )
{
epicsGuard < epicsMutex > guard ( this->mutex );
assert ( this->nMonAttached < UINT_MAX );
@@ -307,7 +307,7 @@ caStatus casPVI::installMonitor (
}
casMonitor * casPVI::removeMonitor (
tsDLList < casMonitor > & list, ca_uint32_t clientIdIn )
::tsDLList < casMonitor > & list, ca_uint32_t clientIdIn )
{
epicsGuard < epicsMutex > guard ( this->mutex );
casMonitor * pMon = 0;
@@ -364,8 +364,8 @@ void casPVI::installChannel ( chanIntfForPV & chan )
}
void casPVI::removeChannel (
chanIntfForPV & chan, tsDLList < casMonitor > & src,
tsDLList < casMonitor > & dest )
chanIntfForPV & chan, ::tsDLList < casMonitor > & src,
::tsDLList < casMonitor > & dest )
{
epicsGuard < epicsMutex > guard ( this->mutex );
src.removeAll ( dest );
@@ -379,7 +379,7 @@ void casPVI::removeChannel (
}
}
void casPVI::clearOutstandingReads ( tsDLList < casAsyncIOI > & ioList )
void casPVI::clearOutstandingReads ( ::tsDLList < casAsyncIOI > & ioList )
{
epicsGuard < epicsMutex > guard ( this->mutex );
@@ -399,7 +399,7 @@ void casPVI::clearOutstandingReads ( tsDLList < casAsyncIOI > & ioList )
}
}
void casPVI::destroyAllIO ( tsDLList < casAsyncIOI > & ioList )
void casPVI::destroyAllIO ( ::tsDLList < casAsyncIOI > & ioList )
{
epicsGuard < epicsMutex > guard ( this->mutex );
while ( casAsyncIOI * pIO = ioList.get() ) {
@@ -411,7 +411,7 @@ void casPVI::destroyAllIO ( tsDLList < casAsyncIOI > & ioList )
}
void casPVI::installIO (
tsDLList < casAsyncIOI > & ioList, casAsyncIOI & io )
::tsDLList < casAsyncIOI > & ioList, casAsyncIOI & io )
{
epicsGuard < epicsMutex > guard ( this->mutex );
ioList.add ( io );
@@ -420,7 +420,7 @@ void casPVI::installIO (
}
void casPVI::uninstallIO (
tsDLList < casAsyncIOI > & ioList, casAsyncIOI & io )
::tsDLList < casAsyncIOI > & ioList, casAsyncIOI & io )
{
{
epicsGuard < epicsMutex > guard ( this->mutex );

View File

@@ -49,21 +49,21 @@ public:
caStatus attachToServer ( caServerI & cas );
aitIndex nativeCount ();
bool ioIsPending () const;
void clearOutstandingReads ( tsDLList < class casAsyncIOI > &);
void clearOutstandingReads ( ::tsDLList < class casAsyncIOI > &);
void destroyAllIO (
tsDLList < casAsyncIOI > & );
::tsDLList < casAsyncIOI > & );
void installIO (
tsDLList < casAsyncIOI > &, casAsyncIOI & );
::tsDLList < casAsyncIOI > &, casAsyncIOI & );
void uninstallIO (
tsDLList < casAsyncIOI > &, casAsyncIOI & );
::tsDLList < casAsyncIOI > &, casAsyncIOI & );
void installChannel ( chanIntfForPV & chan );
void removeChannel (
chanIntfForPV & chan, tsDLList < casMonitor > & src,
tsDLList < casMonitor > & dest );
chanIntfForPV & chan, ::tsDLList < casMonitor > & src,
::tsDLList < casMonitor > & dest );
caStatus installMonitor (
casMonitor & mon, tsDLList < casMonitor > & monitorList );
casMonitor & mon, ::tsDLList < casMonitor > & monitorList );
casMonitor * removeMonitor (
tsDLList < casMonitor > & list, ca_uint32_t clientIdIn );
::tsDLList < casMonitor > & list, ca_uint32_t clientIdIn );
void deleteSignal ();
void postEvent ( const casEventMask & select, const gdd & event );
caServer * getExtServer () const;
@@ -84,7 +84,7 @@ public:
private:
mutable epicsMutex mutex;
tsDLList < chanIntfForPV > chanList;
::tsDLList < chanIntfForPV > chanList;
gddEnumStringTable enumStrTbl;
caServerI * pCAS;
casPV * pPV;

View File

@@ -19,7 +19,10 @@ BPT_DBD += bptTypeJdegC.dbd
BPT_DBD += bptTypeJdegF.dbd
BPT_DBD += bptTypeKdegC.dbd
BPT_DBD += bptTypeKdegF.dbd
ifneq (inc,$(strip $(MAKECMDGOALS)))
DBD += $(BPT_DBD)
endif
PROD_HOST += makeBpt

View File

@@ -4,7 +4,7 @@
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
# in file LICENSE that is included with this distribution.
#*************************************************************************
# This is a Makefile fragment, see src/ioc/Makefile.
@@ -59,6 +59,9 @@ DBDINC += dbCommon
dbMenusPod = $(notdir $(wildcard ../db/menu*.dbd.pod))
HTMLS += $(patsubst %.dbd.pod,%.html,$(dbMenusPod))
HTMLS += dbCommonRecord.html
HTMLS += dbCommonInput.html
HTMLS += dbCommonOutput.html
dbCore_SRCS += dbLock.c
dbCore_SRCS += dbAccess.c
@@ -91,4 +94,3 @@ dbCore_SRCS += chfPlugin.c
dbCore_SRCS += dbState.c
dbCore_SRCS += dbUnitTest.c
dbCore_SRCS += dbServer.c

View File

@@ -6,21 +6,25 @@
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
# in file LICENSE that is included with this distribution.
#*************************************************************************
# This is a Makefile fragment, see src/ioc/Makefile.
dbCommon.h$(DEP): $(IOCDIR)/db/dbCommonRecord.dbd $(IOCDIR)/db/RULES
@$(RM) $@
@$(DBTORECORDTYPEH) -D -I ../db -o $(COMMONDEP_TARGET) $< > $@
THESE_RULES := $(IOCDIR)/db/RULES
$(COMMON_DIR)/dbCommon.h: $(IOCDIR)/db/dbCommonRecord.dbd $(IOCDIR)/db/RULES
dbCommon.h$(DEP): $(COMMON_DIR)/dbCommonRecord.dbd $(THESE_RULES)
@$(RM) $@
@$(DBTORECORDTYPEH) -D -I ../db -I $(COMMON_DIR) -o $(COMMONDEP_TARGET) $< > $@
$(COMMON_DIR)/dbCommonRecord.html: ../db/dbCommon.dbd.pod
$(COMMON_DIR)/dbCommon.h: $(COMMON_DIR)/dbCommonRecord.dbd $(THESE_RULES)
@$(RM) $(notdir $@)
$(DBTORECORDTYPEH) -I ../db -o $(notdir $@) $<
$(DBTORECORDTYPEH) -I ../db -I $(COMMON_DIR) -o $(notdir $@) $<
@$(MV) $(notdir $@) $@
$(COMMON_DIR)/menuGlobal.dbd: $(IOCDIR)/db/Makefile $(IOCDIR)/db/RULES
$(COMMON_DIR)/menuGlobal.dbd: $(IOCDIR)/db/Makefile $(THESE_RULES)
# This is a target-specific variable
$(COMMON_DIR)/menuGlobal.dbd: DBDCAT_COMMAND = \

View File

@@ -730,9 +730,18 @@ int dbLoadDatabase(const char *file, const char *path, const char *subs)
int dbLoadRecords(const char* file, const char* subs)
{
int status = dbReadDatabase(&pdbbase, file, 0, subs);
if (!status && dbLoadRecordsHook)
dbLoadRecordsHook(file, subs);
switch(status)
{
case 0:
if(dbLoadRecordsHook)
dbLoadRecordsHook(file, subs);
break;
case -2:
errlogPrintf("dbLoadRecords: failed to load %s - cannot load records after running iocBuild!\n", file);
break;
default:
errlogPrintf("dbLoadRecords: failed to load %s\n", file);
}
return status;
}
@@ -898,6 +907,11 @@ long dbGet(DBADDR *paddr, short dbrType,
} else {
DBADDR localAddr = *paddr; /* Structure copy */
if (pfl->no_elements < 1) {
status = S_db_badField;
goto done;
}
localAddr.field_type = pfl->field_type;
localAddr.field_size = pfl->field_size;
localAddr.no_elements = pfl->no_elements;
@@ -1276,7 +1290,8 @@ long dbPut(DBADDR *paddr, short dbrType,
/* Always do special processing if needed */
if (special) {
long status2 = dbPutSpecial(paddr, 1);
if (status2) goto done;
if (status2)
status = status2;
}
if (status) goto done;

View File

@@ -38,6 +38,7 @@
#include "link.h"
#include "recSup.h"
#include "special.h"
#include "alarm.h"
typedef struct parseContext {
dbChannel *chan;
@@ -619,6 +620,11 @@ long dbChannelOpen(dbChannel *chan)
probe.field_type = dbChannelExportType(chan);
probe.no_elements = dbChannelElements(chan);
probe.field_size = dbChannelFieldSize(chan);
probe.sevr = NO_ALARM;
probe.stat = NO_ALARM;
probe.time.secPastEpoch = 0;
probe.time.nsec = 0;
p = probe;
/*

View File

@@ -1,261 +0,0 @@
#*************************************************************************
# Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
%#include "epicsTypes.h"
%#include "link.h"
field(NAME,DBF_STRING) {
prompt("Record Name")
special(SPC_NOMOD)
size(61)
}
field(DESC,DBF_STRING) {
prompt("Descriptor")
promptgroup("10 - Common")
size(41)
}
field(ASG,DBF_STRING) {
prompt("Access Security Group")
promptgroup("10 - Common")
special(SPC_AS)
size(29)
}
field(SCAN,DBF_MENU) {
prompt("Scan Mechanism")
promptgroup("20 - Scan")
special(SPC_SCAN)
interest(1)
menu(menuScan)
}
field(PINI,DBF_MENU) {
prompt("Process at iocInit")
promptgroup("20 - Scan")
interest(1)
menu(menuPini)
}
field(PHAS,DBF_SHORT) {
prompt("Scan Phase")
promptgroup("20 - Scan")
special(SPC_SCAN)
interest(1)
}
field(EVNT,DBF_STRING) {
prompt("Event Name")
promptgroup("20 - Scan")
special(SPC_SCAN)
size(40)
interest(1)
}
field(TSE,DBF_SHORT) {
prompt("Time Stamp Event")
promptgroup("20 - Scan")
interest(1)
}
field(TSEL,DBF_INLINK) {
prompt("Time Stamp Link")
promptgroup("20 - Scan")
interest(1)
}
field(DTYP,DBF_DEVICE) {
prompt("Device Type")
promptgroup("10 - Common")
interest(1)
}
field(DISV,DBF_SHORT) {
prompt("Disable Value")
promptgroup("20 - Scan")
initial("1")
}
field(DISA,DBF_SHORT) {
prompt("Disable")
}
field(SDIS,DBF_INLINK) {
prompt("Scanning Disable")
promptgroup("20 - Scan")
interest(1)
}
%#include "epicsMutex.h"
field(MLOK,DBF_NOACCESS) {
prompt("Monitor lock")
special(SPC_NOMOD)
interest(4)
extra("epicsMutexId mlok")
}
%#include "ellLib.h"
field(MLIS,DBF_NOACCESS) {
prompt("Monitor List")
special(SPC_NOMOD)
interest(4)
extra("ELLLIST mlis")
}
field(DISP,DBF_UCHAR) {
prompt("Disable putField")
}
field(PROC,DBF_UCHAR) {
prompt("Force Processing")
pp(TRUE)
interest(3)
}
field(STAT,DBF_MENU) {
prompt("Alarm Status")
special(SPC_NOMOD)
menu(menuAlarmStat)
initial("UDF")
}
field(SEVR,DBF_MENU) {
prompt("Alarm Severity")
special(SPC_NOMOD)
menu(menuAlarmSevr)
}
field(NSTA,DBF_MENU) {
prompt("New Alarm Status")
special(SPC_NOMOD)
interest(2)
menu(menuAlarmStat)
}
field(NSEV,DBF_MENU) {
prompt("New Alarm Severity")
special(SPC_NOMOD)
interest(2)
menu(menuAlarmSevr)
}
field(ACKS,DBF_MENU) {
prompt("Alarm Ack Severity")
special(SPC_NOMOD)
interest(2)
menu(menuAlarmSevr)
}
field(ACKT,DBF_MENU) {
prompt("Alarm Ack Transient")
promptgroup("70 - Alarm")
special(SPC_NOMOD)
interest(2)
menu(menuYesNo)
initial("YES")
}
field(DISS,DBF_MENU) {
prompt("Disable Alarm Sevrty")
promptgroup("70 - Alarm")
interest(1)
menu(menuAlarmSevr)
}
field(LCNT,DBF_UCHAR) {
prompt("Lock Count")
special(SPC_NOMOD)
interest(2)
}
field(PACT,DBF_UCHAR) {
prompt("Record active")
special(SPC_NOMOD)
interest(1)
}
field(PUTF,DBF_UCHAR) {
prompt("dbPutField process")
special(SPC_NOMOD)
interest(1)
}
field(RPRO,DBF_UCHAR) {
prompt("Reprocess ")
special(SPC_NOMOD)
interest(1)
}
field(ASP,DBF_NOACCESS) {
prompt("Access Security Pvt")
special(SPC_NOMOD)
interest(4)
extra("struct asgMember *asp")
}
field(PPN,DBF_NOACCESS) {
prompt("pprocessNotify")
special(SPC_NOMOD)
interest(4)
extra("struct processNotify *ppn")
}
field(PPNR,DBF_NOACCESS) {
prompt("pprocessNotifyRecord")
special(SPC_NOMOD)
interest(4)
extra("struct processNotifyRecord *ppnr")
}
field(SPVT,DBF_NOACCESS) {
prompt("Scan Private")
special(SPC_NOMOD)
interest(4)
extra("struct scan_element *spvt")
}
field(RSET,DBF_NOACCESS) {
prompt("Address of RSET")
special(SPC_NOMOD)
interest(4)
extra("struct rset *rset")
}
field(DSET,DBF_NOACCESS) {
prompt("DSET address")
special(SPC_NOMOD)
interest(4)
extra("struct dset *dset")
}
field(DPVT,DBF_NOACCESS) {
prompt("Device Private")
special(SPC_NOMOD)
interest(4)
extra("void *dpvt")
}
field(RDES,DBF_NOACCESS) {
prompt("Address of dbRecordType")
special(SPC_NOMOD)
interest(4)
extra("struct dbRecordType *rdes")
}
field(LSET,DBF_NOACCESS) {
prompt("Lock Set")
special(SPC_NOMOD)
interest(4)
extra("struct lockRecord *lset")
}
field(PRIO,DBF_MENU) {
prompt("Scheduling Priority")
promptgroup("20 - Scan")
special(SPC_SCAN)
interest(1)
menu(menuPriority)
}
field(TPRO,DBF_UCHAR) {
prompt("Trace Processing")
}
field(BKPT,DBF_NOACCESS) {
prompt("Break Point")
special(SPC_NOMOD)
interest(1)
extra("char bkpt")
}
field(UDF,DBF_UCHAR) {
prompt("Undefined")
promptgroup("10 - Common")
pp(TRUE)
interest(1)
initial("1")
}
field(UDFS,DBF_MENU) {
prompt("Undefined Alarm Sevrty")
promptgroup("70 - Alarm")
interest(1)
menu(menuAlarmSevr)
initial("INVALID")
}
%#include "epicsTime.h"
field(TIME,DBF_NOACCESS) {
prompt("Time")
special(SPC_NOMOD)
interest(2)
extra("epicsTimeStamp time")
}
field(FLNK,DBF_FWDLINK) {
prompt("Forward Process Link")
promptgroup("20 - Scan")
interest(1)
}

514
src/ioc/db/dbCommon.dbd.pod Normal file
View File

@@ -0,0 +1,514 @@
#*************************************************************************
# Copyright (c) 2007 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
=head3 Operator Display Parameters
The B<NAME> field contains the record name which must be unique within an
EPICS Channel Access name space. The name is supplied by the application
developer and is the means of identifying a specific record. The name has a
maximum length of 60 characters and should use only this limited set of
characters:
a-z A-Z 0-9 _ - : [ ] < > ;
The B<DESC> field may be set to provide a meaningful description of the
record's purpose. Maximum length is 40 characters.
=fields NAME, DESC
=cut
%#include "epicsTypes.h"
%#include "link.h"
field(NAME,DBF_STRING) {
prompt("Record Name")
special(SPC_NOMOD)
size(61)
}
field(DESC,DBF_STRING) {
prompt("Descriptor")
promptgroup("10 - Common")
size(41)
}
field(ASG,DBF_STRING) {
prompt("Access Security Group")
promptgroup("10 - Common")
special(SPC_AS)
size(29)
}
=head3 Scan Fields
These fields contain information related to how and when a record processes. A
few records have unique fields that also affect how they process. These
fields, if any, will be listed and explained in the section for each record.
The B<SCAN> field specifies the scanning period for periodic record scans or the
scan type for non-periodic record scans. The default set of values for SCAN can
be found in L<menuScan.dbd|menuScan>.
The choices provided by this menu are:
=over
=item *
C<Passive> for the record scan to be triggered by other records or Channel
Access
=item *
C<Event> for event-driven scan
=item *
C<I/O Intr> for interrupt-driven scan
=item *
A set of periodic scan intervals
=back
Additional periodic scan rates may be defined for individual IOCs by making a
local copy of menuScan.dbd and adding more choices as required. Scan rates
should normally be defined in order, with the fastest rates appearing first.
Scan periods may now be specified in seconds, minutes, hours or Hertz/Hz, and
plural time units will also be accepted (seconds are used if no unit is
mentioned in the choice string). For example the rates given below are all
valid:
1 hour
0.5 hours
15 minutes
3 seconds
1 second
2 Hertz
The B<PINI> field specifies record processing at initialization. If it is set
to YES during database configuration, the record is processed once at IOC
initialization (before the normal scan tasks are started).
The B<PHAS> field orders the records within a specific SCAN group. This is not
meaningful for passive records. All records of a specified phase are processed
before those with higher phase number. Whenever possible it is better to use
linked passive records to enforce the order of processing rather than a phase
number.
The B<EVNT> field specifies an event number. This event number is used if the
SCAN field is set to C<Event>. All records with scan type C<Event> and the
same EVNT value will be processed when a call to post_event for EVNT is made.
The call to post_event is: post_event(short event_number).
The B<PRIO> field specifies the scheduling priority for processing records
with SCAN=C<I/O Event> and asynchronous record completion tasks.
The B<DISV> field specifies a "disable value". Record processing is
immediately terminated if the value of this field is equal to the value of the
DISA field, i.e. the record is disabled. Note that field values of a record
can be changed by database put or Channel Access, even if a record is
disabled.
The B<DISA> field contains the value that is compared with DISV to determine
if the record is disabled. The value of the DISA field is obtained via SDIS if
SDIS is a database or channel access link. If SDIS is not a database or
channel access link, then DISA can be set via dbPutField or dbPutLink.
If the B<PROC> field of a record is written to, the record is processed.
The B<DISS> field defines the record's "disable severity". If this field is
not NO_ALARM and the record is disabled, the record will be put into alarm
with this severity and a status of DISABLE_ALARM.
The B<LSET> field contains the lock set to which this record belongs. All
records linked in any way via input, output, or forward database links belong
to the same lock set. Lock sets are determined at IOC initialization time, and
are updated whenever a database link is added, removed or altered.
The B<LCNT> field counts the number of times dbProcess finds the record active
during successive scans, i.e. PACT is TRUE. If dbProcess finds the record
active MAX_LOCK times (currently set to 10) it raises a SCAN_ALARM.
The B<PACT> field is TRUE while the record is being processed. For
asynchronous records PACT can be TRUE from the time record processing is
started until the asynchronous completion occurs. As long as PACT is TRUE,
dbProcess will not call the record processing routine. See Application
Developers Guide for details on usage of PACT.
The B<FLNK> field is a database link to another record (the "target" record).
Processing a record with a specified FLNK field will force processing of the
target record, provided the target record's SCAN field is set to C<Passive>.
The B<SPVT> field is for internal use by the scanning system.
=fields SCAN, PINI, PHAS, EVNT, PRIO, DISV, DISA, SDIS, PROC, DISS, LCNT, PACT, FLNK, SPVT
=cut
field(SCAN,DBF_MENU) {
prompt("Scan Mechanism")
promptgroup("20 - Scan")
special(SPC_SCAN)
interest(1)
menu(menuScan)
}
field(PINI,DBF_MENU) {
prompt("Process at iocInit")
promptgroup("20 - Scan")
interest(1)
menu(menuPini)
}
field(PHAS,DBF_SHORT) {
prompt("Scan Phase")
promptgroup("20 - Scan")
special(SPC_SCAN)
interest(1)
}
field(EVNT,DBF_STRING) {
prompt("Event Name")
promptgroup("20 - Scan")
special(SPC_SCAN)
size(40)
interest(1)
}
field(TSE,DBF_SHORT) {
prompt("Time Stamp Event")
promptgroup("20 - Scan")
interest(1)
}
field(TSEL,DBF_INLINK) {
prompt("Time Stamp Link")
promptgroup("20 - Scan")
interest(1)
}
field(DTYP,DBF_DEVICE) {
prompt("Device Type")
promptgroup("10 - Common")
interest(1)
}
field(DISV,DBF_SHORT) {
prompt("Disable Value")
promptgroup("20 - Scan")
initial("1")
}
field(DISA,DBF_SHORT) {
prompt("Disable")
}
field(SDIS,DBF_INLINK) {
prompt("Scanning Disable")
promptgroup("20 - Scan")
interest(1)
}
%#include "epicsMutex.h"
field(MLOK,DBF_NOACCESS) {
prompt("Monitor lock")
special(SPC_NOMOD)
interest(4)
extra("epicsMutexId mlok")
}
%#include "ellLib.h"
field(MLIS,DBF_NOACCESS) {
prompt("Monitor List")
special(SPC_NOMOD)
interest(4)
extra("ELLLIST mlis")
}
field(DISP,DBF_UCHAR) {
prompt("Disable putField")
}
field(PROC,DBF_UCHAR) {
prompt("Force Processing")
pp(TRUE)
interest(3)
}
=head3 Alarm Fields
These fields indicate the status and severity of alarms, or else determine the
how and when alarms are triggered. Of course, many records have alarm-related
fields not common to all records. These fields are listed and explained in the
appropriate section on each record.
The B<STAT> field contains the current alarm status.
The B<SEVR> field contains the current alarm severity.
These two fields are seen outside database access. The B<NSTA> and B<NSEV>
fields are used by the database access, record support, and device support
routines to set new alarm status and severity values. Whenever any software
component discovers an alarm condition, it uses the following macro function:
recGblSetSevr(precord,new_status,new_severity) This ensures that the current
alarm severity is set equal to the highest outstanding alarm. The file alarm.h
defines all allowed alarm status and severity values.
The B<ACKS> field contains the highest unacknowledged alarm severity.
The B<ACKT> field specifies if it is necessary to acknowledge transient
alarms.
The B<UDF> indicates if the record's value is B<U>nB<D>eB<F>ined. Typically
this is caused by a failure in device support, the fact that the record has
never been processed, or that the VAL field currently contains a NaN (not a
number). UDF is initialized to TRUE at IOC initialization. Record and device
support routines which write to the VAL field are responsible for setting UDF.
=fields STAT, SEVR, NSTA, NSEV, ACKS, ACKT, UDF
=cut
field(STAT,DBF_MENU) {
prompt("Alarm Status")
special(SPC_NOMOD)
menu(menuAlarmStat)
initial("UDF")
}
field(SEVR,DBF_MENU) {
prompt("Alarm Severity")
special(SPC_NOMOD)
menu(menuAlarmSevr)
}
field(NSTA,DBF_MENU) {
prompt("New Alarm Status")
special(SPC_NOMOD)
interest(2)
menu(menuAlarmStat)
}
field(NSEV,DBF_MENU) {
prompt("New Alarm Severity")
special(SPC_NOMOD)
interest(2)
menu(menuAlarmSevr)
}
field(ACKS,DBF_MENU) {
prompt("Alarm Ack Severity")
special(SPC_NOMOD)
interest(2)
menu(menuAlarmSevr)
}
field(ACKT,DBF_MENU) {
prompt("Alarm Ack Transient")
promptgroup("70 - Alarm")
special(SPC_NOMOD)
interest(2)
menu(menuYesNo)
initial("YES")
}
field(DISS,DBF_MENU) {
prompt("Disable Alarm Sevrty")
promptgroup("70 - Alarm")
interest(1)
menu(menuAlarmSevr)
}
field(LCNT,DBF_UCHAR) {
prompt("Lock Count")
special(SPC_NOMOD)
interest(2)
}
field(PACT,DBF_UCHAR) {
prompt("Record active")
special(SPC_NOMOD)
interest(1)
}
field(PUTF,DBF_UCHAR) {
prompt("dbPutField process")
special(SPC_NOMOD)
interest(1)
}
field(RPRO,DBF_UCHAR) {
prompt("Reprocess ")
special(SPC_NOMOD)
interest(1)
}
field(ASP,DBF_NOACCESS) {
prompt("Access Security Pvt")
special(SPC_NOMOD)
interest(4)
extra("struct asgMember *asp")
}
field(PPN,DBF_NOACCESS) {
prompt("pprocessNotify")
special(SPC_NOMOD)
interest(4)
extra("struct processNotify *ppn")
}
field(PPNR,DBF_NOACCESS) {
prompt("pprocessNotifyRecord")
special(SPC_NOMOD)
interest(4)
extra("struct processNotifyRecord *ppnr")
}
field(SPVT,DBF_NOACCESS) {
prompt("Scan Private")
special(SPC_NOMOD)
interest(4)
extra("struct scan_element *spvt")
}
=head3 Device Fields
The B<RSET> field contains the address of the Record Support Entry Table. See
the Application Developers Guide for details on usage.
The B<DSET> field contains the address of Device Support Entry Table. The
value of this field is determined at IOC initialization time. Record support
routines use this field to locate their device support routines.
The B<DPVT> field is is for private use of the device support modules.
=fields RSET, DSET, DPVT
=cut
field(RSET,DBF_NOACCESS) {
prompt("Address of RSET")
special(SPC_NOMOD)
interest(4)
extra("struct rset *rset")
}
field(DSET,DBF_NOACCESS) {
prompt("DSET address")
special(SPC_NOMOD)
interest(4)
extra("struct dset *dset")
}
field(DPVT,DBF_NOACCESS) {
prompt("Device Private")
special(SPC_NOMOD)
interest(4)
extra("void *dpvt")
}
field(RDES,DBF_NOACCESS) {
prompt("Address of dbRecordType")
special(SPC_NOMOD)
interest(4)
extra("struct dbRecordType *rdes")
}
field(LSET,DBF_NOACCESS) {
prompt("Lock Set")
special(SPC_NOMOD)
interest(4)
extra("struct lockRecord *lset")
}
field(PRIO,DBF_MENU) {
prompt("Scheduling Priority")
promptgroup("20 - Scan")
special(SPC_SCAN)
interest(1)
menu(menuPriority)
}
=head3 Debugging Fields
The B<TPRO> field is used for trace processing. If this field is non-zero a
message is printed whenever this record is processed, and when any other
record in the same lock-set is processed by a database link from this record.
The B<BKPT> field indicates if there is a breakpoint set at this record. This
supports setting a debug breakpoint in the record processing. STEP through
database processing can be supported using this.
=fields TPRO, BKPT
=head3 Miscellaneous Fields
The B<ASG> field contains a character string value defining the access
security group for this record. If left empty, the record is placed in group
DEFAULT.
The B<ASP> field is a field for private use of the access security system.
The B<DISP> field controls dbPutFields to this record which are normally
issued by channel access. If the field is set to TRUE all dbPutFields
directed to this record are ignored except to the field DISP itself.
The B<DTYP> field specifies the device type for the record. Each record type
has its own set of device support routines which are specified in
devSup.ASCII. If a record type does not have any associated device support,
DTYP and DSET are meaningless.
The B<MLOK> field contains the monitor lock. The lock used by the monitor
routines when the monitor list is being used. The list is locked whenever
monitors are being scheduled, invoked, or when monitors are being added to or
removed from the list. This field is accessed only by the dbEvent routines.
The B<MLIS> field is the head of the list of monitors connected to this
record. Each record support module is responsible for triggering monitors for
any fields that change as a result of record processing. Monitors are present
if mlis count is greater than zero. The call to trigger monitors is:
db_post_event(precord,&data,mask), where "mask" is some combination of
DBE_ALARM, DBE_VALUE, and DBE_LOG.
The B<PPN> field contains the address of a putNotify callback.
The B<PPNR> field contains the next record for PutNotify.
The B<PUTF> field is set to TRUE if dbPutField caused the current record
processing.
The B<RDES> field contains the address of dbRecordType
The B<RPRO> field specifies a reprocessing of the record when current
processing completes.
The B<TIME> field contains the time when this record was last processed in
standard format.
The B<TSE> field indicates the mechanism to use to get the time stamp. '0' -
call get time as before '-1' - call the time stamp driver and use the best
source available. '-2' - the device support provides the time stamp from the
hardware. Values between 1-255 request the time of the last occurance of a
generalTime event.
The B<TSEL> field contains an input link for obtaining the time stamp. If this
link references the .TIME field of a record then the time stamp of the
referenced record becomes the time stamp for this record as well. In this
case, an internal flag is set and ".TIME" is then overwritten by ".VAL". If
any other field is referenced, the field value is read and stored in the .TSE
field which is then used to acquire a timestamp.
=fields ASG, ASP, DISP, DTYP, MLOK, MLIS, PPN, PPNR, PUTF, RDES, RPRO, TIME, TSE, TSEL
=cut
field(TPRO,DBF_UCHAR) {
prompt("Trace Processing")
}
field(BKPT,DBF_NOACCESS) {
prompt("Break Point")
special(SPC_NOMOD)
interest(1)
extra("char bkpt")
}
field(UDF,DBF_UCHAR) {
prompt("Undefined")
promptgroup("10 - Common")
pp(TRUE)
interest(1)
initial("1")
}
field(UDFS,DBF_MENU) {
prompt("Undefined Alarm Sevrty")
promptgroup("70 - Alarm")
interest(1)
menu(menuAlarmSevr)
initial("INVALID")
}
%#include "epicsTime.h"
field(TIME,DBF_NOACCESS) {
prompt("Time")
special(SPC_NOMOD)
interest(2)
extra("epicsTimeStamp time")
}
field(FLNK,DBF_FWDLINK) {
prompt("Forward Process Link")
promptgroup("20 - Scan")
interest(1)
}

View File

@@ -0,0 +1,181 @@
#*************************************************************************
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
=head1 Fields Common to Input Record Types
This section describes fields that are found in many input record types.
These fields usually have the same meaning whenever they are used.
See also L<Fields Common to All Record Types|dbCommonRecord> and L<Fields Common
to Output Record Types|dbCommonOutput>.
=head3 Input and Value Fields
The B<INP> field specifies an input link. It is used by the device support
routines to obtain input. For soft analog records it can be a constant, a
database link, or a channel access link.
The B<DTYP> field specifies the name of the device support module that will
input values. Each record type has its own set of device support routines. If
a record type does not have any associated device support, DTYP is
meaningless.
The B<RVAL> field contains - whenever possible - the raw data value exactly as
it is obtained from the hardware or from the associated device driver and
before it undergoes any conversions. The Soft Channel device support module
reads values directly into VAL, bypassing this field.
The B<VAL> field contains the record's final value, after any needed
conversions have been performed.
=head3 Device Input
A device input routine normally returns one of the following values to its
associated record support routine:
=over
=item *
0: Success and convert. The input value is in RVAL. The record support module
will compute VAL from RVAL.
=item *
2: Success, but don't convert. The device support module can specify this
value if it does not want any conversions. It might do this for two reasons:
=over
=item *
A hardware error is detected (in this case, it should also raise an alarm
condition).
=item *
The device support routine reads values directly into the VAL field and then
sets UDF to FALSE. For some record types the device support routine may have to
do other record-specific processing as well such as applying a smoothing filter
to the engineering units value.
=back
=back
=head3 Device Support for Soft Records
In most cases, two soft output device support modules are provided: Soft Channel
and Raw Soft Channel. Both allow INP to be a constant, a database link, or a
channel access link. The Soft Channel device support module reads input directly
into the VAL field and specifies that no value conversion should be performed.
This allows the record to store values in the data type of its VAL field. Note
that for Soft Channel input, the RVAL field is not used. The Raw Soft Channel
support module reads input into RVAL and indicates that any specified unit
conversions be performed.
The device support read routine normally calls C<dbGetLink()> which
fetches a value from the link.
If a value was returned by the link the UDF field is set to FALSE. The device
support read routine normally returns the status from C<dbGetLink()>.
=head3 Input Simulation Fields
The B<SIMM> field controls simulation mode. It has either the value YES or NO.
By setting this field to YES, the record can be switched into simulation mode
of operation. While in simulation mode, input will be obtained from SIOL
instead of INP.
Ths B<SIML> specifies the simulation mode location. This field can be a
constant, a database link, or a channel access link. If SIML is a database or
channel access link, then SIMM is read from SIML. If SIML is a constant link
then SIMM is initialized with the constant value but can be changed via
dbPuts.
Ths B<SVAL> field contains the simulation value. This is the record's input
value, in engineering units, when the record is switched into simulation mode,
i.e. when SIMM is set to YES.
The B<SIOL> field is a link that can be used to fetch the simulation value. The
link can be a constant, a database link, or a channel access link. If SIOL is a
database or channel access link, then SVAL is read from SIOL. If SIOL is a
constant link then SVAL is initialized with the constant value but can be
changed via dbPuts.
The B<SIMS> field specifies the simulation mode alarm severity. When this
field is set to a value other than NO_ALARM and the record is in simulation
mode, it will be put into alarm with this severity and a status of SIMM.
=head3 Simulation Mode for Input Records
An input record can be switched into simulation mode of operation by setting
the value of SIMM to YES or RAW. During simulation, the record will be put
into alarm with a severity of SIMS and a status of SIMM_ALARM. While in
simulation mode, input values will be read from SIOL instead of INP:
-- (SIMM = NO?) INP (if supported and directed by device support, -> RVAL -- convert -> VAL), (else -> VAL)
/
SIML -> SIMM
\
-- (SIMM = YES?) SIOL -> SVAL -> VAL
\
-- (SIMM = RAW?) SIOL -> SVAL -> RVAL -- convert -> VAL
A record can be switched into simulation mode of operation by setting the
value of SIMM to YES. During simulation, the record will be put into alarm
with a severity of SIMS and a status of SIMM_ALARM. While in simulation mode,
input values, in engineering units, will be obtained from SIOL instead of INP.
Also, while the record is in simulation mode, there will be no raw value
conversion and no calls to device support when the record is processed.
Normally input records contain a private readValue() routine which performs
the following steps:
=over
=item *
If PACT is TRUE, the device support read routine is called, status is set to
its return code, and readValue returns.
=item *
Call C<dbGetLink()> to get a new value for SIMM from SIML.
=item *
Check value of SIMM.
=item *
If SIMM is NO, then call the device support read routine, set status to its
return code, and return.
=item *
If SIMM is YES, then call C<dbGetLink()> to read the input value from SIOL
into SVAL. If success, then set VAL to SVAL and UDF to FALSE and set status to
2 (don't convert) if input record supports conversion. If SIMS is greater than
zero, set alarm status to SIMM and severity to SIMS. Set status to the return
code from recGblGetLinkValue and return.
=item *
If SIMM is RAW, then call C<dbGetLink()> to read the input value from SIOL
into SVAL. If success, then set RVAL to SVAL and UDF to FALSE and set status
to 0 (convert) if input record supports conversion. If SIMS is greater than
zero, set alarm status to SIMM and severity to SIMS. Set status to the return
code from recGblGetLinkValue and return.
=item *
If SIMM is not YES, NO or RAW, a SOFT alarm with a severity of INVALID is
raised, and return status is set to -1.
=back

View File

@@ -0,0 +1,211 @@
#*************************************************************************
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
=head1 Fields Common to Output Record Types
This section describes fields that are found in many output record types.
These fields usually have the same meaning whenever they are used.
See also L<Fields Common to All Record Types|dbCommonRecord> and L<Fields Common to
Input Records|dbCommonInput>.
=head3 Output and Value Fields
The B<OUT> field specifies an output link. It is used by the device support
routines to decide where to send output. For soft records, it can be a
constant, a database link, or a channel access link. If the link is a
constant, the result is no output.
The B<DTYP> field specifies the name of the device support module that will
input values. Each record type has its own set of device support routines. If
a record type does not have any associated device support, DTYP is
meaningless.
The B<VAL> field contains the desired value before any conversions to raw
output have been performed.
The B<OVAL> field is used to decide when to invoke monitors. Archive and value
change monitors are invoked if OVAL is not equal to VAL. If a record type
needs to make adjustments, OVAL is used to enforce the maximum rate of change
limit before converting the desired value to a raw value.
The B<RVAL> field contains - whenever possible - the actual value sent to the
hardware itself or to the associated device driver.
The B<RBV> field contains - whenever possible - the actual read back value
obtained from the hardware itself or from the associated device driver.
=head3 Device Support for Soft Records
Normally two soft output device support modules are provided, Soft Channel and
and Raw Soft Channel. Both write a value through the output link OUT.
The Soft Channel module writes output from the value associated with OVAL or
VAL (if OVAL does not exist). The Raw Soft Channel support module writes the
value associated with the RVAL field after conversion has been performed.
The device support write routine normally calls C<dbPutLink()> which writes a
value through the OUT link, and returns the status from that call.
=head3 Input and Mode Select Fields
The B<DOL> field is a link from which the desired output value can be fetched.
DOL can be a constant, a database link, or a channel access link. If DOL is a
database or channel access link and OMSL is closed_loop, then VAL is obtained
from DOL.
The B<OMSL> field selects the output mode. This field has either the value
C<supervisory> or C<closed_loop>. DOL is used to fetch VAL only if OMSL has the
value C<closed_loop>. By setting this field a record can be switched between
supervisory and closed loop mode of operation. While in closed loop mode, the
VAL field cannot be set via dbPuts.
=head3 Output Mode Selection
The fields DOL and OMSL are used to allow the output record to be part of a
closed loop control algorithm. OMSL is meaningful only if DOL refers to a
database or channel access link. It can have the values C<supervisory> or
C<closed_loop>. If the mode is C<supervisory>, then nothing is done to VAL. If
the mode is C<closed_loop> and the record type does not contain an OIF field,
then each time the record is processed, VAL is set equal to the value obtained
from the location referenced by DOL. If the mode is C<closed_loop> in record
types with an OIF field and OIF is Full, VAL is set equal to the value obtained
from the location referenced by DOL; if OIF is Incremental VAL is incremented by
the value obtained from DOL.
=head3 Invalid Output Action Fields
The B<IVOA> field specifies the output action for the case that the record is
put into an INVALID alarm severity. IVOA can be one of the following actions:
=over
=item *
C<Continue normally>
=item *
C<Don't drive outputs>
=item *
C<Set output to IVOV>
=back
The B<IVOV> field contains the value for the IVOA action C<Set output to IVOV>
in engineering units. If a new severity has been set to INVALID and IVOA is
C<Set output to IVOV>, then VAL is set to IVOV and converted to RVAL before
device support is called.
=head3 Invalid Alarm Output Action
Whenever an output record is put into INVALID alarm severity, IVOA specifies
an action to take. The record support process routine for each output record
contains code which performs the following steps.
=over
=item *
If new severity is less than INVALID, then call C<writeValue()>:
=item *
Else do the following:
=over
=item *
If IVOA is C<Continue normally> then call C<writeValue()>.
=item *
If IVOA is C<Don't drive outputs> then do not write output.
=item *
If IVOA is C<Set output to IVOV> then set VAL to IVOV, call C<convert()> if
necessary, and then call C<writeValue()>.
=item *
If IVOA not one of the above, an error message is generated.
=back
=back
=head3 Simulation Fields
The B<SIMM> field controls simulation mode. It has either the value YES or NO.
By setting this field to YES, the record can be switched into simulation mode
of operation. While in simulation mode, output will be forwarded through SIOL
instead of OUT.
Ths B<SIML> specifies the simulation mode location. This field can be a
constant, a database link, or a channel access link. If SIML is a database or
channel access link, then SIMM is read from SIML. If SIML is a constant link
then SIMM is initialized with the constant value but can be changed via
dbPuts.
The B<SIOL> field is a link that the output value is written to when the record
is in simulation mode.
The B<SIMS> field specifies the simulation mode alarm severity. When this
field is set to a value other than NO_ALARM and the record is in simulation
mode, it will be put into alarm with this severity and a status of SIMM.
=head3 Simulation Mode
An output record can be switched into simulation mode of operation by setting
the value of SIMM to YES. During simulation, the record will be put into alarm
with a severity of SIMS and a status of SIMM_ALARM. While in simulation mode,
output values, in engineering units, will be written to SIOL instead of OUT.
However, the output values are never converted. Also, while the record is in
simulation mode, there will be no calls to device support during record
processing.
Normally output records contain a private C<writeValue()> routine which performs
the following steps:
=over
=item *
If PACT is TRUE, the device support write routine is called, status is set to
its return code, and readValue returns.
=item *
Call C<dbGetLink()> to get a new value for SIMM if SIML is a DB_LINK or a
CA_LINK.
=item *
Check value of SIMM.
=item *
If SIMM is NO, then call the device support write routine, set status to its
return code, and return.
=item *
If SIMM is YES, then call C<dbPutLink()> to write the output value from VAL or
OVAL to SIOL. Set alarm status to SIMM and severity to SIMS, if SIMS is
greater than zero. Set status to the return code from C<dbPutLink()> and
return.
=item *
If SIMM not one of the above, a SOFT alarm with a severity of INVALID is
raised, and return status is set to -1.
=back

View File

@@ -1,12 +0,0 @@
#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE Versions 3.13.7
# and higher are distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
recordtype(dbCommon) {
include "dbCommon.dbd"
}

View File

@@ -0,0 +1,20 @@
#*************************************************************************
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
=head1 Fields Common to All Record Types
This section contains a description of the fields that are common to all record
types. These fields are defined in dbCommon.dbd.
See also L<Fields Common to Input Record Types|dbCommonInput> and L<Fields
Common to Output Record Types|dbCommonOutput>.
=recordtype dbCommon
=cut
recordtype(dbCommon) {
include "dbCommon.dbd.pod"
}

View File

@@ -992,13 +992,10 @@ static void addToList(struct dbCommon *precord, scan_list *psl)
pse->pscan_list = psl;
ptemp = (scan_element *)ellLast(&psl->list);
while (ptemp) {
if (ptemp->precord->phas <= precord->phas) {
ellInsert(&psl->list, &ptemp->node, &pse->node);
break;
}
if (ptemp->precord->phas <= precord->phas) break;
ptemp = (scan_element *)ellPrevious(&ptemp->node);
}
if (ptemp == NULL) ellAdd(&psl->list, (void *)pse);
ellInsert(&psl->list, (ptemp ? &ptemp->node : NULL), &pse->node);
psl->modified = TRUE;
epicsMutexUnlock(psl->lock);
}
@@ -1024,7 +1021,7 @@ static void deleteFromList(struct dbCommon *precord, scan_list *psl)
return;
}
pse->pscan_list = NULL;
ellDelete(&psl->list, (void *)pse);
ellDelete(&psl->list, &pse->node);
psl->modified = TRUE;
epicsMutexUnlock(psl->lock);
}

View File

@@ -41,12 +41,13 @@
#include "special.h"
#define MAXLINE 80
#define MAXMESS 128
struct msgBuff { /* line output structure */
char out_buff[MAXLINE + 1];
char *pNext;
char *pLast;
char *pNexTab;
char message[128];
char message[MAXMESS];
};
typedef struct msgBuff TAB_BUFFER;
@@ -1205,7 +1206,7 @@ static int dbpr_report(
sprintf(pmsg,"%s: Illegal Link Type", pfield_name);
}
else {
sprintf(pmsg,"%s:%s %s", pfield_name,
epicsSnprintf(pmsg, MAXMESS, "%s:%s %s", pfield_name,
pamaplinkType[ind].strvalue,dbGetString(pdbentry));
}
dbpr_msgOut(pMsgBuff, tab_size);

View File

@@ -9,7 +9,7 @@
=head1 Menu menuIvoa
This menu specifies the possibile actions to take when the INVALID alarm is
This menu specifies the possible actions to take when the INVALID alarm is
triggered. See individual record types for more information.
=menu menuIvoa

View File

@@ -1,16 +0,0 @@
#*************************************************************************
# Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
menu(menuPini) {
choice(menuPiniNO,"NO")
choice(menuPiniYES,"YES")
choice(menuPiniRUN,"RUN")
choice(menuPiniRUNNING,"RUNNING")
choice(menuPiniPAUSE,"PAUSE")
choice(menuPiniPAUSED,"PAUSED")
}

View File

@@ -0,0 +1,66 @@
#*************************************************************************
# Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
=head1 Menu menuPini
This menu defines the choices for the C<PINI> field, which controls whether
and when each record should be processed during initialization or pausing
of the IOC. Choices other than C<NO> cause record processing at the
following initHook transitions:
=over 4
=item YES
C<initHookAfterScanInit> E<mdash> All records and links have been
initialized but the scan threads and CA server are not running yet, nor
have CA links been connected up. The initHook C<initHookAfterInitialProcess>
immediately follows this procssing.
=item RUN
C<initHookAtIocRun> E<mdash> The C<iocRun()> routine has just been called,
although not necessarily for the first time.
=item RUNNING
C<initHookAfterIocRunning> E<mdash> All remaining initializations have
taken place, C<interruptAccept> is enabled, the scan threads and CA server
are running and the IOC is processing records. CA links might not have
finished connecting though, and sequence programs won't usually have been
started yet.
=item PAUSE
C<initHookAtIocPause> E<mdash> The C<iocPause()> routine has just been
called and the IOC is about to suspend operations.
=item PAUSED
C<initHookAfterIocPaused> E<mdash> The CA server, CA link operations and
the scan threads have been paused and C<interruptAccept> disabled.
=back
Note that the order in which records that have the same C<PINI> value get
processed can be controlled by setting their C<PHAS> field, which is honored
for C<PINI> processing as well as for regular scanning.
=menu menuPini
=cut
menu(menuPini) {
choice(menuPiniNO,"NO")
choice(menuPiniYES,"YES")
choice(menuPiniRUN,"RUN")
choice(menuPiniRUNNING,"RUNNING")
choice(menuPiniPAUSE,"PAUSE")
choice(menuPiniPAUSED,"PAUSED")
}

View File

@@ -5,6 +5,16 @@
# in file LICENSE that is included with this distribution.
#*************************************************************************
=head1 Menu menuPost
This menu is used by the long string record types to specify whether they
should generate a monitor event only when their string value changes, or
every time it gets written to even if the value is the same.
=menu menuPost
=cut
menu(menuPost) {
choice(menuPost_OnChange, "On Change")
choice(menuPost_Always, "Always")

View File

@@ -7,6 +7,20 @@
# and higher are distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
=head1 Menu menuPriority
This menu is used for the C<PRIO> field of all record types. It controls
the relative priority of records scheduled with C<SCAN=Event> or
C<SCAN=I/O Intr>, and also of records that use asynchronous completion.
=menu menuPriority
The number of priorities is set in various other places in the code too,
so adding new entries to this menu will probably break the IOC build.
=cut
menu(menuPriority) {
choice(menuPriorityLOW,"LOW")
choice(menuPriorityMEDIUM,"MEDIUM")

View File

@@ -67,7 +67,7 @@ void recGblDbaddrError(long status, const struct dbAddr *paddr,
errPrintf(status,0,0,
"PV: %s.%s "
"error detected in routine: %s\n",
(paddr ? precord->name : "Unknown"),
(precord ? precord->name : "Unknown"),
(pdbFldDes ? pdbFldDes->name : ""),
(pmessage ? pmessage : "Unknown"));
return;
@@ -104,7 +104,7 @@ void recGblRecSupError(long status, const struct dbAddr *paddr,
" %s\n",
(psupport_name ? psupport_name : "Unknown"),
(pdbRecordType ? pdbRecordType->name : "Unknown"),
(paddr ? precord->name : "Unknown"),
(precord ? precord->name : "Unknown"),
(pdbFldDes ? pdbFldDes->name : ""),
(pmessage ? pmessage : ""));
return;

View File

@@ -35,6 +35,7 @@
#include "epicsExport.h"
#include "link.h"
#include "special.h"
#include "iocInit.h"
@@ -215,6 +216,9 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp,
char *penv;
char **macPairs;
if(getIocState() != iocVoid)
return -2;
if(*ppdbbase == 0) *ppdbbase = dbAllocBase();
pdbbase = *ppdbbase;
if(path && strlen(path)>0) {

View File

@@ -300,11 +300,11 @@ static void makeSubstitutions(inputData * const inputPvt,
char *pstart;
char *pend;
int cmdind=-1;
int i;
size_t i;
for (i = 0; i < NELEMENTS(cmdNames); i++) {
if (strstr(command, cmdNames[i])) {
cmdind = i;
cmdind = (int)i;
}
}
if (cmdind < 0) goto endcmd;

View File

@@ -25,3 +25,6 @@ variable(callbackParallelThreadsDefault,int)
# Real-time operation
variable(dbThreadRealtimeLock,int)
# show logClient network activity
variable(logClientDebug,int)

View File

@@ -70,9 +70,7 @@
#include "registryRecordType.h"
#include "rsrv.h"
static enum {
iocVirgin, iocBuilding, iocBuilt, iocRunning, iocPaused, iocStopped
} iocState = iocVirgin;
static enum iocStateEnum iocState = iocVoid;
static enum {
buildRSRV, buildIsolated
} iocBuildMode;
@@ -91,6 +89,11 @@ static void exitDatabase(void *dummy);
int dbThreadRealtimeLock = 1;
epicsExportAddress(int, dbThreadRealtimeLock);
enum iocStateEnum getIocState(void)
{
return iocState;
}
/*
* Initialize EPICS on the IOC.
*/
@@ -101,7 +104,7 @@ int iocInit(void)
static int iocBuild_1(void)
{
if (iocState != iocVirgin && iocState != iocStopped) {
if (iocState != iocVoid) {
errlogPrintf("iocBuild: IOC can only be initialized from uninitialized or stopped state\n");
return -1;
}
@@ -701,7 +704,7 @@ static void doFreeRecord(dbRecordType *pdbRecordType, dbCommon *precord,
int iocShutdown(void)
{
if (iocState == iocVirgin || iocState == iocStopped) return 0;
if (iocState == iocVoid) return 0;
iterateRecords(doCloseLinks, NULL);
if (iocBuildMode==buildIsolated) {
/* stop and "join" threads */
@@ -720,7 +723,7 @@ int iocShutdown(void)
dbProcessNotifyExit();
iocshFree();
}
iocState = iocStopped;
iocState = iocVoid;
iocBuildMode = buildRSRV;
return 0;
}

View File

@@ -13,10 +13,15 @@
#include "shareLib.h"
enum iocStateEnum {
iocVoid, iocBuilding, iocBuilt, iocRunning, iocPaused
};
#ifdef __cplusplus
extern "C" {
#endif
epicsShareFunc enum iocStateEnum getIocState(void);
epicsShareFunc int iocInit(void);
epicsShareFunc int iocBuild(void);
epicsShareFunc int iocBuildIsolated(void);

View File

@@ -66,17 +66,6 @@ static void req_server (void *pParm)
IOC_sock = conf->tcp;
/* listen and accept new connections */
if ( listen ( IOC_sock, 20 ) < 0 ) {
char sockErrBuf[64];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
errlogPrintf ( "CAS: Listen error: %s\n",
sockErrBuf );
epicsSocketDestroy (IOC_sock);
epicsThreadSuspendSelf ();
}
epicsEventSignal(castcp_startStopEvent);
while (TRUE) {
@@ -194,7 +183,7 @@ SOCKET* rsrv_grab_tcp(unsigned short *port)
epicsSocketEnableAddressReuseDuringTimeWaitState ( tcpsock );
if(bind(tcpsock, &scratch.sa, sizeof(scratch))==0) {
if(bind(tcpsock, &scratch.sa, sizeof(scratch))==0 && listen(tcpsock, 20)==0) {
if(scratch.ia.sin_port==0) {
/* use first socket to pick a random port */
osiSocklen_t alen = sizeof(ifaceAddr);

View File

@@ -25,6 +25,7 @@
#include "postfix.h"
#include "postfixPvt.h"
static double calcRandom(void);
static int cond_search(const char **ppinst, int match);
@@ -48,7 +49,6 @@ epicsShareFunc long
double *ptop; /* stack pointer */
double top; /* value from top of stack */
epicsInt32 itop; /* integer from top of stack */
epicsUInt32 utop; /* unsigned integer from top of stack */
int op;
int nargs;
@@ -287,45 +287,60 @@ epicsShareFunc long
*ptop = ! *ptop;
break;
/* For bitwise operations on values with bit 31 set, double values
* must first be cast to unsigned to correctly set that bit; the
* double value must be negative in that case. The result must be
* cast to a signed integer before converting to the double result.
/* Be VERY careful converting double to int in case bit 31 is set!
* Out-of-range errors give very different results on different sytems.
* Convert negative doubles to signed and positive doubles to unsigned
* first to avoid overflows if bit 32 is set.
* The result is always signed, values with bit 31 set are negative
* to avoid problems when writing the value to signed integer fields
* like longout.VAL or ao.RVAL. However unsigned fields may give
* problems on some architectures. (Fewer than giving problems with
* signed integer. Maybe the conversion functions should handle
* overflows better.)
*/
#define d2i(x) ((x)<0?(epicsInt32)(x):(epicsInt32)(epicsUInt32)(x))
#define d2ui(x) ((x)<0?(epicsUInt32)(epicsInt32)(x):(epicsUInt32)(x))
case BIT_OR:
utop = *ptop--;
*ptop = (epicsInt32) ((epicsUInt32) *ptop | utop);
top = *ptop--;
*ptop = (double)(d2i(*ptop) | d2i(top));
break;
case BIT_AND:
utop = *ptop--;
*ptop = (epicsInt32) ((epicsUInt32) *ptop & utop);
top = *ptop--;
*ptop = (double)(d2i(*ptop) & d2i(top));
break;
case BIT_EXCL_OR:
utop = *ptop--;
*ptop = (epicsInt32) ((epicsUInt32) *ptop ^ utop);
top = *ptop--;
*ptop = (double)(d2i(*ptop) ^ d2i(top));
break;
case BIT_NOT:
utop = *ptop;
*ptop = (epicsInt32) ~utop;
*ptop = (double)~d2i(*ptop);
break;
/* The shift operators use signed integers, so a right-shift will
* extend the sign bit into the left-hand end of the value. The
* double-casting through unsigned here is important, see above.
/* In C the shift operators decide on an arithmetic or logical shift
* based on whether the integer is signed or unsigned.
* With signed integers, a right-shift is arithmetic and will
* extend the sign bit into the left-hand end of the value. When used
* with unsigned values a logical shift is performed. The
* double-casting through signed/unsigned here is important, see above.
*/
case RIGHT_SHIFT:
utop = *ptop--;
*ptop = ((epicsInt32) (epicsUInt32) *ptop) >> (utop & 31);
case RIGHT_SHIFT_ARITH:
top = *ptop--;
*ptop = (double)(d2i(*ptop) >> (d2i(top) & 31));
break;
case LEFT_SHIFT:
utop = *ptop--;
*ptop = ((epicsInt32) (epicsUInt32) *ptop) << (utop & 31);
case LEFT_SHIFT_ARITH:
top = *ptop--;
*ptop = (double)(d2i(*ptop) << (d2i(top) & 31));
break;
case RIGHT_SHIFT_LOGIC:
top = *ptop--;
*ptop = (double)(d2ui(*ptop) >> (d2ui(top) & 31u));
break;
case NOT_EQ:
@@ -382,11 +397,11 @@ epicsShareFunc long
*presult = *ptop;
return 0;
}
#if defined(_WIN32) && defined(_M_X64) && !defined(_MINGW)
# pragma optimize("", on)
#endif
epicsShareFunc long
calcArgUsage(const char *pinst, unsigned long *pinputs, unsigned long *pstores)
{

View File

@@ -148,13 +148,14 @@ static const ELEMENT operators[] = {
{":=", 0, 0, -1, STORE_OPERATOR, STORE_A},
{";", 0, 0, 0, EXPR_TERMINATOR,NOT_GENERATED},
{"<", 3, 3, -1, BINARY_OPERATOR,LESS_THAN},
{"<<", 2, 2, -1, BINARY_OPERATOR,LEFT_SHIFT},
{"<<", 2, 2, -1, BINARY_OPERATOR,LEFT_SHIFT_ARITH},
{"<=", 3, 3, -1, BINARY_OPERATOR,LESS_OR_EQ},
{"=", 3, 3, -1, BINARY_OPERATOR,EQUAL},
{"==", 3, 3, -1, BINARY_OPERATOR,EQUAL},
{">", 3, 3, -1, BINARY_OPERATOR,GR_THAN},
{">=", 3, 3, -1, BINARY_OPERATOR,GR_OR_EQ},
{">>", 2, 2, -1, BINARY_OPERATOR,RIGHT_SHIFT},
{">>", 2, 2, -1, BINARY_OPERATOR,RIGHT_SHIFT_ARITH},
{">>>", 2, 2, -1, BINARY_OPERATOR,RIGHT_SHIFT_LOGIC},
{"?", 0, 0, -1, CONDITIONAL, COND_IF},
{"AND", 2, 2, -1, BINARY_OPERATOR,BIT_AND},
{"OR", 1, 1, -1, BINARY_OPERATOR,BIT_OR},
@@ -579,8 +580,9 @@ epicsShareFunc void
"BIT_AND",
"BIT_EXCL_OR",
"BIT_NOT",
"RIGHT_SHIFT",
"LEFT_SHIFT",
"RIGHT_SHIFT_ARITH",
"LEFT_SHIFT_ARITH",
"RIGHT_SHIFT_LOGIC",
/* Relationals */
"NOT_EQ",
"LESS_THAN",

View File

@@ -84,8 +84,9 @@ typedef enum {
BIT_AND,
BIT_EXCL_OR,
BIT_NOT,
RIGHT_SHIFT,
LEFT_SHIFT,
RIGHT_SHIFT_ARITH,
LEFT_SHIFT_ARITH,
RIGHT_SHIFT_LOGIC,
/* Relationals */
NOT_EQ,
LESS_THAN,

View File

@@ -9,6 +9,5 @@
SRC_DIRS += $(LIBCOM)/cppStd
INC += epicsAlgorithm.h
INC += epicsExcept.h
INC += epicsMemory.h

View File

@@ -1,71 +0,0 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
// Author: Andrew Johnson & Jeff Hill
// Date: December 2000
#ifndef __EPICS_EXCEPT_H__
#define __EPICS_EXCEPT_H__
#define epicsThrowHere(exc) \
throw locationException(exc, __FILE__, __LINE__)
class sourceLocation {
public: // Functions
sourceLocation(const char *fileName, int lineNumber);
// sourceLocation(const sourceLocation&); Copy constructable
// sourceLocation& operator=(const sourceLocation&); Assignable
const char *fileName() const;
int lineNumber() const;
private: // Hide compiler-generated member functions
sourceLocation(); // default constructor
private: // Data
const char *file;
int line;
};
template <class T>
class locationException : public T, public sourceLocation {
public:
locationException(const T& exc, const char *fileName, int lineNumber);
};
/* Example:
* if (status) epicsThrowHere(std::logic_error("operation failed!"));
* try { ... } catch(sourceLocation& where) { ... }
*/
// END OF DECLARATIONS
// INLINE FUNCTIONS
// sourceFileLocation
inline sourceLocation::sourceLocation (const char *fileName, int lineNumber) :
file(fileName), line(lineNumber) {}
inline const char* sourceLocation::fileName () const {
return this->file;
}
inline int sourceLocation::lineNumber () const {
return this->line;
}
// locationException<T>
template <class T>
inline locationException<T>::locationException
(const char *fileName, int lineNumber, const E& exc) :
T(exc), sourceLocation(fileName, lineNumber) {}
#endif // __EPICS_EXCEPT_H__

View File

@@ -46,8 +46,10 @@ int main ()
tsSLIter<fred> iter1 = list.firstIter ();
tsSLIter<fred> iter2 = iter1;
tsSLIter<fred> iter3 = iter1;
assert ( iter1 == iter3++ );
assert ( iter3 == ++iter2 );
tsSLIter<fred> itert = iter3++
assert ( iter1 == itert );
itert = ++iter2;
assert ( iter3 == itert );
list.remove ( *pFredII ); // removes pFred
}
list.add ( *pFred );

View File

@@ -438,7 +438,7 @@ int htoi(unsigned char *str)
{
int result;
(void) sscanf( (char *) str, "%x", &result );
(void) sscanf( (char *) str, "%x", (unsigned *) &result );
return ( result );
}
@@ -653,7 +653,7 @@ int otoi(Char *str)
{
int result;
(void) sscanf( (char *) str, "%o", &result );
(void) sscanf( (char *) str, "%o", (unsigned *) &result );
return ( result );
}

View File

@@ -18,8 +18,10 @@
#define epicsExportSharedSymbols
#include "envDefs.h"
#include "errlog.h"
#include "logClient.h"
#include "iocLog.h"
#include "epicsExit.h"
int iocLogDisable = 0;
@@ -74,6 +76,24 @@ void epicsShareAPI epicsShareAPI iocLogFlush (void)
}
}
/*
* logClientSendMessage ()
*/
static void logClientSendMessage ( logClientId id, const char * message )
{
if ( !iocLogDisable ) {
logClientSend (id, message);
}
}
/*
* iocLogClientDestroy()
*/
static void iocLogClientDestroy (logClientId id)
{
errlogRemoveListeners (logClientSendMessage, id);
}
/*
* iocLogClientInit()
*/
@@ -89,6 +109,10 @@ static logClientId iocLogClientInit (void)
return NULL;
}
id = logClientCreate (addr, port);
if (id != NULL) {
errlogAddListener (logClientSendMessage, id);
epicsAtExit (iocLogClientDestroy, id);
}
return id;
}
@@ -135,3 +159,4 @@ logClientId epicsShareAPI logClientInit (void)
{
return iocLogClientInit ();
}

View File

@@ -21,11 +21,11 @@
#include <string.h>
#include <stdio.h>
#define EPICS_PRIVATE_API
#define epicsExportSharedSymbols
#include "dbDefs.h"
#include "epicsEvent.h"
#include "iocLog.h"
#include "errlog.h"
#include "epicsMutex.h"
#include "epicsThread.h"
#include "epicsTime.h"
@@ -33,9 +33,13 @@
#include "epicsAssert.h"
#include "epicsExit.h"
#include "epicsSignal.h"
#include "epicsExport.h"
#include "logClient.h"
int logClientDebug = 0;
epicsExportAddress (int, logClientDebug);
typedef struct {
char msgBuf[0x4000];
struct sockaddr_in addr;
@@ -44,8 +48,10 @@ typedef struct {
SOCKET sock;
epicsThreadId restartThreadId;
epicsEventId stateChangeNotify;
epicsEventId shutdownNotify;
unsigned connectCount;
unsigned nextMsgIndex;
unsigned backlog;
unsigned connected;
unsigned shutdown;
unsigned shutdownConfirm;
@@ -53,7 +59,6 @@ typedef struct {
} logClient;
static const double LOG_RESTART_DELAY = 5.0; /* sec */
static const double LOG_SERVER_CREATE_CONNECT_SYNC_TIMEOUT = 5.0; /* sec */
static const double LOG_SERVER_SHUTDOWN_TIMEOUT = 30.0; /* sec */
/*
@@ -66,10 +71,10 @@ static char* logClientPrefix = NULL;
*/
static void logClientClose ( logClient *pClient )
{
# ifdef DEBUG
if (logClientDebug) {
fprintf (stderr, "log client: lingering for connection close...");
fflush (stderr);
# endif
}
/*
* mutex on
@@ -84,8 +89,6 @@ static void logClientClose ( logClient *pClient )
pClient->sock = INVALID_SOCKET;
}
pClient->nextMsgIndex = 0u;
memset ( pClient->msgBuf, '\0', sizeof ( pClient->msgBuf ) );
pClient->connected = 0u;
/*
@@ -93,9 +96,8 @@ static void logClientClose ( logClient *pClient )
*/
epicsMutexUnlock (pClient->mutex);
# ifdef DEBUG
if (logClientDebug)
fprintf (stderr, "done\n");
# endif
}
/*
@@ -113,6 +115,7 @@ static void logClientDestroy (logClientId id)
epicsMutexMustLock ( pClient->mutex );
pClient->shutdown = 1u;
epicsMutexUnlock ( pClient->mutex );
epicsEventSignal ( pClient->shutdownNotify );
/* unblock log client thread blocking in send() or connect() */
interruptInfo =
@@ -154,13 +157,11 @@ static void logClientDestroy (logClientId id)
return;
}
errlogRemoveListeners ( logClientSendMessage, (void *) pClient );
logClientClose ( pClient );
epicsMutexDestroy ( pClient->mutex );
epicsEventDestroy ( pClient->stateChangeNotify );
epicsEventDestroy ( pClient->shutdownNotify );
free ( pClient );
}
@@ -176,61 +177,26 @@ static void sendMessageChunk(logClient * pClient, const char * message) {
unsigned msgBufBytesLeft =
sizeof ( pClient->msgBuf ) - pClient->nextMsgIndex;
if ( strSize > msgBufBytesLeft ) {
int status;
if ( ! pClient->connected ) {
break;
}
if ( msgBufBytesLeft > 0u ) {
memcpy ( & pClient->msgBuf[pClient->nextMsgIndex],
message, msgBufBytesLeft );
pClient->nextMsgIndex += msgBufBytesLeft;
strSize -= msgBufBytesLeft;
message += msgBufBytesLeft;
}
status = send ( pClient->sock, pClient->msgBuf,
pClient->nextMsgIndex, 0 );
if ( status > 0 ) {
unsigned nSent = (unsigned) status;
if ( nSent < pClient->nextMsgIndex ) {
unsigned newNextMsgIndex = pClient->nextMsgIndex - nSent;
memmove ( pClient->msgBuf, & pClient->msgBuf[nSent],
newNextMsgIndex );
pClient->nextMsgIndex = newNextMsgIndex;
}
else {
pClient->nextMsgIndex = 0u;
}
}
else {
if ( ! pClient->shutdown ) {
char sockErrBuf[64];
if ( status ) {
epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) );
}
else {
strcpy ( sockErrBuf, "server initiated disconnect" );
}
fprintf ( stderr, "log client: lost contact with log server at \"%s\" because \"%s\"\n",
pClient->name, sockErrBuf );
}
logClientClose ( pClient );
break;
}
if ( msgBufBytesLeft < strSize && pClient->nextMsgIndex != 0u && pClient->connected)
{
/* buffer is full, thus flush it */
logClientFlush ( pClient );
msgBufBytesLeft = sizeof ( pClient->msgBuf ) - pClient->nextMsgIndex;
}
else {
memcpy ( & pClient->msgBuf[pClient->nextMsgIndex],
message, strSize );
pClient->nextMsgIndex += strSize;
if ( msgBufBytesLeft == 0u ) {
fprintf ( stderr, "log client: messages to \"%s\" are lost\n",
pClient->name );
break;
}
if ( msgBufBytesLeft > strSize) msgBufBytesLeft = strSize;
memcpy ( & pClient->msgBuf[pClient->nextMsgIndex],
message, msgBufBytesLeft );
pClient->nextMsgIndex += msgBufBytesLeft;
strSize -= msgBufBytesLeft;
message += msgBufBytesLeft;
}
}
/*
* logClientSend ()
*/
@@ -255,43 +221,54 @@ void epicsShareAPI logClientSend ( logClientId id, const char * message )
void epicsShareAPI logClientFlush ( logClientId id )
{
unsigned nSent;
int status = 0;
logClient * pClient = ( logClient * ) id;
if ( ! pClient ) {
if ( ! pClient || ! pClient->connected ) {
return;
}
epicsMutexMustLock ( pClient->mutex );
while ( pClient->nextMsgIndex && pClient->connected ) {
int status = send ( pClient->sock, pClient->msgBuf,
pClient->nextMsgIndex, 0 );
if ( status > 0 ) {
unsigned nSent = (unsigned) status;
if ( nSent < pClient->nextMsgIndex ) {
unsigned newNextMsgIndex = pClient->nextMsgIndex - nSent;
memmove ( pClient->msgBuf, & pClient->msgBuf[nSent],
newNextMsgIndex );
pClient->nextMsgIndex = newNextMsgIndex;
}
else {
pClient->nextMsgIndex = 0u;
}
nSent = pClient->backlog;
while ( nSent < pClient->nextMsgIndex && pClient->connected ) {
status = send ( pClient->sock, pClient->msgBuf + nSent,
pClient->nextMsgIndex - nSent, 0 );
if ( status < 0 ) break;
nSent += status;
}
if ( pClient->backlog > 0 && status >= 0 )
{
/* On Linux send 0 bytes can detect EPIPE */
/* NOOP on Windows, fails on vxWorks */
errno = 0;
status = send ( pClient->sock, NULL, 0, 0 );
if (!(errno == ECONNRESET || errno == EPIPE)) status = 0;
}
if ( status < 0 ) {
if ( ! pClient->shutdown ) {
char sockErrBuf[128];
epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) );
fprintf ( stderr, "log client: lost contact with log server at \"%s\" because \"%s\"\n",
pClient->name, sockErrBuf );
}
else {
if ( ! pClient->shutdown ) {
char sockErrBuf[64];
if ( status ) {
epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) );
}
else {
strcpy ( sockErrBuf, "server initiated disconnect" );
}
fprintf ( stderr, "log client: lost contact with log server at \"%s\" because \"%s\"\n",
pClient->name, sockErrBuf );
}
logClientClose ( pClient );
break;
pClient->backlog = 0;
logClientClose ( pClient );
}
else if ( nSent > 0 && pClient->nextMsgIndex > 0 ) {
int backlog = epicsSocketUnsentCount ( pClient->sock );
if (backlog >= 0) {
pClient->backlog = backlog;
nSent -= backlog;
}
pClient->nextMsgIndex -= nSent;
if ( nSent > 0 && pClient->nextMsgIndex > 0 ) {
memmove ( pClient->msgBuf, & pClient->msgBuf[nSent],
pClient->nextMsgIndex );
}
}
epicsMutexUnlock ( pClient->mutex );
@@ -302,10 +279,10 @@ void epicsShareAPI logClientFlush ( logClientId id )
*/
static void logClientMakeSock (logClient *pClient)
{
# ifdef DEBUG
if (logClientDebug) {
fprintf (stderr, "log client: creating socket...");
# endif
fflush (stderr);
}
epicsMutexMustLock (pClient->mutex);
@@ -314,7 +291,7 @@ static void logClientMakeSock (logClient *pClient)
*/
pClient->sock = epicsSocketCreate ( AF_INET, SOCK_STREAM, 0 );
if ( pClient->sock == INVALID_SOCKET ) {
char sockErrBuf[64];
char sockErrBuf[128];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
fprintf ( stderr, "log client: no socket error %s\n",
@@ -323,10 +300,8 @@ static void logClientMakeSock (logClient *pClient)
epicsMutexUnlock (pClient->mutex);
# ifdef DEBUG
if (logClientDebug)
fprintf (stderr, "done\n");
# endif
}
/*
@@ -366,7 +341,7 @@ static void logClientConnect (logClient *pClient)
}
else {
if ( pClient->connFailStatus != errnoCpy && ! pClient->shutdown ) {
char sockErrBuf[64];
char sockErrBuf[128];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
fprintf (stderr,
@@ -392,7 +367,7 @@ static void logClientConnect (logClient *pClient)
optval = TRUE;
status = setsockopt (pClient->sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval));
if (status<0) {
char sockErrBuf[64];
char sockErrBuf[128];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
fprintf (stderr, "log client: unable to enable keepalive option because \"%s\"\n", sockErrBuf);
@@ -404,11 +379,11 @@ static void logClientConnect (logClient *pClient)
*/
status = shutdown (pClient->sock, SHUT_RD);
if (status < 0) {
char sockErrBuf[64];
char sockErrBuf[128];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
fprintf (stderr, "%s:%d shutdown(%d,SHUT_RD) error was \"%s\"\n",
__FILE__, __LINE__, pClient->sock, sockErrBuf);
fprintf (stderr, "%s:%d shutdown(sock,SHUT_RD) error was \"%s\"\n",
__FILE__, __LINE__, sockErrBuf);
/* not fatal (although it shouldn't happen) */
}
@@ -425,7 +400,7 @@ static void logClientConnect (logClient *pClient)
lingerval.l_linger = 60*5;
status = setsockopt (pClient->sock, SOL_SOCKET, SO_LINGER, (char *) &lingerval, sizeof(lingerval));
if (status<0) {
char sockErrBuf[64];
char sockErrBuf[128];
epicsSocketConvertErrnoToString (
sockErrBuf, sizeof ( sockErrBuf ) );
fprintf (stderr, "log client: unable to set linger options because \"%s\"\n", sockErrBuf);
@@ -457,14 +432,10 @@ static void logClientRestart ( logClientId id )
epicsMutexUnlock ( pClient->mutex );
if ( isConn ) {
logClientFlush ( pClient );
}
else {
logClientConnect ( pClient );
}
epicsThreadSleep ( LOG_RESTART_DELAY );
if ( ! isConn ) logClientConnect ( pClient );
logClientFlush ( pClient );
epicsEventWaitWithTimeout ( pClient->shutdownNotify, LOG_RESTART_DELAY);
epicsMutexMustLock ( pClient->mutex );
}
@@ -480,9 +451,7 @@ static void logClientRestart ( logClientId id )
logClientId epicsShareAPI logClientCreate (
struct in_addr server_addr, unsigned short server_port)
{
epicsTimeStamp begin, current;
logClient *pClient;
double diff;
pClient = calloc (1, sizeof (*pClient));
if (pClient==NULL) {
@@ -507,14 +476,22 @@ logClientId epicsShareAPI logClientCreate (
pClient->shutdownConfirm = 0;
epicsAtExit (logClientDestroy, (void*) pClient);
pClient->stateChangeNotify = epicsEventCreate (epicsEventEmpty);
if ( ! pClient->stateChangeNotify ) {
epicsMutexDestroy ( pClient->mutex );
free ( pClient );
return NULL;
}
pClient->shutdownNotify = epicsEventCreate (epicsEventEmpty);
if ( ! pClient->shutdownNotify ) {
epicsMutexDestroy ( pClient->mutex );
epicsEventDestroy ( pClient->stateChangeNotify );
free ( pClient );
return NULL;
}
pClient->restartThreadId = epicsThreadCreate (
"logRestart", epicsThreadPriorityLow,
epicsThreadGetStackSize(epicsThreadStackSmall),
@@ -522,35 +499,12 @@ logClientId epicsShareAPI logClientCreate (
if ( pClient->restartThreadId == NULL ) {
epicsMutexDestroy ( pClient->mutex );
epicsEventDestroy ( pClient->stateChangeNotify );
epicsEventDestroy ( pClient->shutdownNotify );
free (pClient);
fprintf(stderr, "log client: unable to start log client connection watch dog thread\n");
return NULL;
}
/*
* attempt to synchronize with circuit connect
*/
epicsTimeGetCurrent ( & begin );
epicsMutexMustLock ( pClient->mutex );
do {
epicsMutexUnlock ( pClient->mutex );
epicsEventWaitWithTimeout (
pClient->stateChangeNotify,
LOG_SERVER_CREATE_CONNECT_SYNC_TIMEOUT / 10.0 );
epicsTimeGetCurrent ( & current );
diff = epicsTimeDiffInSeconds ( & current, & begin );
epicsMutexMustLock ( pClient->mutex );
}
while ( ! pClient->connected && diff < LOG_SERVER_CREATE_CONNECT_SYNC_TIMEOUT );
epicsMutexUnlock ( pClient->mutex );
if ( ! pClient->connected ) {
fprintf (stderr, "log client create: timed out synchronizing with circuit connect to \"%s\" after %.1f seconds\n",
pClient->name, LOG_SERVER_CREATE_CONNECT_SYNC_TIMEOUT );
}
errlogAddListener ( logClientSendMessage, (void *) pClient );
return (void *) pClient;
}
@@ -568,24 +522,21 @@ void epicsShareAPI logClientShow (logClientId id, unsigned level)
printf ("log client: disconnected from log server at \"%s\"\n", pClient->name);
}
if (level>1) {
printf ("log client: sock=%s, connect cycles = %u\n",
pClient->sock==INVALID_SOCKET?"INVALID":"OK",
pClient->connectCount);
}
if (logClientPrefix) {
printf ("log client: prefix is \"%s\"\n", logClientPrefix);
}
}
/*
* logClientSendMessage (); deprecated
*/
void logClientSendMessage ( logClientId id, const char * message )
{
if ( !iocLogDisable ) {
logClientSend (id, message);
if (level>0) {
printf ("log client: sock %s, connect cycles = %u\n",
pClient->sock==INVALID_SOCKET?"INVALID":"OK",
pClient->connectCount);
}
if (level>1) {
printf ("log client: %u bytes in buffer\n", pClient->nextMsgIndex);
if (pClient->nextMsgIndex)
printf("-------------------------\n"
"%.*s-------------------------\n",
(int)(pClient->nextMsgIndex), pClient->msgBuf);
}
}

View File

@@ -38,7 +38,6 @@ epicsShareFunc void epicsShareAPI iocLogPrefix(const char* prefix);
/* deprecated interface; retained for backward compatibility */
/* note: implementations are in iocLog.c, not logClient.c */
epicsShareFunc logClientId epicsShareAPI logClientInit (void);
epicsShareFunc void logClientSendMessage (logClientId id, const char *message);
#ifdef __cplusplus
}

View File

@@ -171,7 +171,12 @@ int testDone(void) {
epicsMutexMustLock(testLock);
if (perlHarness) {
if (!planned) printf("1..%d\n", tested);
if (!planned)
printf("1..%d\n", tested);
else if (tested != planned)
status = 2;
if (failed)
status |= 1;
} else {
if (planned && tested > planned) {
printf("\nRan %d tests but only planned for %d!\n", tested, planned);
@@ -186,7 +191,7 @@ int testDone(void) {
if (bonus) testResult("Todo Passes", bonus);
if (failed) {
testResult("Failed", failed);
status = 1;
status |= 1;
}
if (skipped) testResult("Skipped", skipped);
}

View File

@@ -86,6 +86,7 @@ endif
Com_SRCS += osdSock.c
Com_SRCS += osdSockAddrReuse.cpp
Com_SRCS += osdSockUnsentCount.c
Com_SRCS += osiSock.c
Com_SRCS += systemCallIntMech.cpp
Com_SRCS += epicsSocketConvertErrnoToString.cpp

View File

@@ -350,5 +350,11 @@ extern "C" {
}
} // extern "C"
// Ensure the main thread gets a unique ID
epicsThreadId epicsThreadMainId = epicsThreadGetIdSelf();
static epicsThreadId initMainThread(void) {
epicsThreadId main = epicsThreadGetIdSelf();
epicsThreadSetOkToBlock(1);
return main;
}
// Ensure the main thread gets a unique ID and allows blocking I/O
epicsThreadId epicsThreadMainId = initMainThread();

View File

@@ -0,0 +1,19 @@
/*************************************************************************\
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#define EPICS_PRIVATE_API
#include "osiSock.h"
/*
* epicsSocketUnsentCount ()
* See https://www.unix.com/man-page/osx/2/setsockopt
*/
int epicsSocketUnsentCount(SOCKET sock) {
int unsent;
socklen_t len = sizeof(unsent);
if (getsockopt(sock, SOL_SOCKET, SO_NWRITE, &unsent, &len) == 0)
return unsent;
return -1;
}

View File

@@ -0,0 +1,19 @@
/*************************************************************************\
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#include <linux/sockios.h>
#define EPICS_PRIVATE_API
#include "osiSock.h"
/*
* epicsSocketUnsentCount ()
* See https://linux.die.net/man/7/tcp
*/
int epicsSocketUnsentCount(SOCKET sock) {
int unsent;
if (ioctl(sock, SIOCOUTQ, &unsent) == 0)
return unsent;
return -1;
}

View File

@@ -25,6 +25,7 @@
#include <assert.h>
#include <syslog.h>
#include <limits.h>
#include <pthread.h>
#include <rtems.h>
#include <rtems/error.h>
@@ -615,6 +616,23 @@ showInternalTaskInfo (rtems_id tid)
}
thread = *the_thread;
_Thread_Enable_dispatch();
/* This looks a bit weird, but it has to support RTEMS versions both before
* and after 4.10.2 when threads changed how their priorities are stored.
*/
int policy;
struct sched_param sp;
rtems_task_priority real_priority, current_priority;
rtems_status_code sc = pthread_getschedparam(tid, &policy, &sp);
if (sc == RTEMS_SUCCESSFUL) {
real_priority = sp.sched_priority;
sc = rtems_task_set_priority(tid, RTEMS_CURRENT_PRIORITY, &current_priority);
}
if (sc != RTEMS_SUCCESSFUL) {
fprintf(epicsGetStdout(),"%-30s", " *** RTEMS task gone! ***");
return;
}
/*
* Show both real and current priorities if they differ.
* Note that the epicsThreadGetOsiPriorityValue routine is not used here.
@@ -622,17 +640,17 @@ showInternalTaskInfo (rtems_id tid)
* that priority should be displayed, not the value truncated to
* the EPICS range.
*/
epicsPri = 199-thread.real_priority;
epicsPri = 199-real_priority;
if (epicsPri < 0)
fprintf(epicsGetStdout()," <0");
else if (epicsPri > 99)
fprintf(epicsGetStdout()," >99");
else
fprintf(epicsGetStdout()," %4d", epicsPri);
if (thread.current_priority == thread.real_priority)
fprintf(epicsGetStdout(),"%4d ", (int)thread.current_priority);
if (current_priority == real_priority)
fprintf(epicsGetStdout(),"%4d ", (int)current_priority);
else
fprintf(epicsGetStdout(),"%4d/%-3d", (int)thread.real_priority, (int)thread.current_priority);
fprintf(epicsGetStdout(),"%4d/%-3d", (int)real_priority, (int)current_priority);
showBitmap (bitbuf, thread.current_state, taskState);
fprintf(epicsGetStdout(),"%8.8s", bitbuf);
if (thread.current_state & (STATES_WAITING_FOR_SEMAPHORE |

View File

@@ -26,6 +26,8 @@
#include "shareLib.h"
#include "epicsEvent.h"
#include "osdThreadPvt.h"
typedef struct epicsEventOSD {
HANDLE handle;
} epicsEventOSD;
@@ -90,27 +92,47 @@ epicsShareFunc epicsEventStatus epicsEventWait ( epicsEventId pSem )
epicsShareFunc epicsEventStatus epicsEventWaitWithTimeout (
epicsEventId pSem, double timeOut )
{
static const unsigned mSecPerSec = 1000;
/* waitable timers use 100 nanosecond intervals, like FILETIME */
static const unsigned ivalPerSec = 10000000u; /* number of 100ns intervals per second */
static const unsigned mSecPerSec = 1000u; /* milliseconds per second */
HANDLE handles[2];
DWORD status;
DWORD tmo;
LARGE_INTEGER tmo;
HANDLE timer;
LONGLONG nIvals; /* number of intervals */
if ( timeOut <= 0.0 ) {
tmo = 0u;
tmo.QuadPart = 0u;
}
else if ( timeOut >= INFINITE / mSecPerSec ) {
tmo = INFINITE - 1;
else if ( timeOut >= INFINITE / mSecPerSec ) {
/* we need to apply a maximum wait time to stop an overflow. We choose (INFINITE - 1) milliseconds,
to be compatible with previous WaitForSingleObject() implementation */
nIvals = (LONGLONG)(INFINITE - 1) * (ivalPerSec / mSecPerSec);
tmo.QuadPart = -nIvals; /* negative value means a relative time offset for timer */
}
else {
tmo = ( DWORD ) ( ( timeOut * mSecPerSec ) + 0.5 );
if ( tmo == 0 ) {
tmo = 1;
}
nIvals = (LONGLONG)(timeOut * ivalPerSec + 0.999999);
tmo.QuadPart = -nIvals;
}
if (tmo.QuadPart < 0) {
timer = osdThreadGetTimer();
if (!SetWaitableTimer(timer, &tmo, 0, NULL, NULL, 0)) {
return epicsEventError;
}
handles[0] = pSem->handle;
handles[1] = timer;
status = WaitForMultipleObjects (2, handles, FALSE, INFINITE);
}
else {
status = WaitForSingleObject(pSem->handle, 0);
}
status = WaitForSingleObject ( pSem->handle, tmo );
if ( status == WAIT_OBJECT_0 ) {
return epicsEventOK;
}
else if ( status == WAIT_TIMEOUT ) {
else if ( status == WAIT_OBJECT_0 + 1 || status == WAIT_TIMEOUT ) {
/* WaitForMultipleObjects will trigger WAIT_OBJECT_0 + 1,
WaitForSingleObject will trigger WAIT_TIMEOUT */
return epicsEventWaitTimeout;
}
else {

View File

@@ -64,10 +64,10 @@ epicsShareFunc int epicsShareAPI osiSockAttach()
DWORD titleLength = GetConsoleTitle(title, sizeof(title));
if (titleLength) {
titleLength = strlen (title);
strncat (title, " " EPICS_VERSION_STRING, sizeof(title));
strncat (title, " " EPICS_VERSION_STRING, sizeof(title)-1);
}
else {
strncpy(title, EPICS_VERSION_STRING, sizeof(title));
strncpy(title, EPICS_VERSION_STRING, sizeof(title)-1);
}
title[sizeof(title)-1]= '\0';
SetConsoleTitle(title);

View File

@@ -0,0 +1,26 @@
/*************************************************************************\
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#define epicsExportSharedSymbols
#define EPICS_PRIVATE_API
#include "osiSock.h"
#include <mstcpip.h>
/*
* epicsSocketUnsentCount ()
* See https://docs.microsoft.com/en-us/windows/win32/api/mstcpip/ns-mstcpip-tcp_info_v0
*/
int epicsSocketUnsentCount(SOCKET sock) {
#ifdef SIO_TCP_INFO
/* Windows 10 Version 1703 / Server 2016 */
DWORD infoVersion = 0, bytesReturned;
TCP_INFO_v0 tcpInfo;
int status;
if ((status = WSAIoctl(sock, SIO_TCP_INFO, &infoVersion, sizeof(infoVersion),
&tcpInfo, sizeof(tcpInfo), &bytesReturned, NULL, NULL)) == 0)
return tcpInfo.BytesInFlight;
#endif
return -1;
}

View File

@@ -13,10 +13,6 @@
extern "C" {
#endif
/*
* epicsStrtod() for systems with broken strtod() routine
*/
epicsShareFunc double epicsStrtod(const char *str, char **endp);
/*
* Microsoft apparently added strto[u]ll() in VS2013
@@ -28,6 +24,19 @@ epicsShareFunc double epicsStrtod(const char *str, char **endp);
# define strtoull _strtoui64
#endif
/*
* strtod works in MSVC 1900 and mingw, use
* the OS version in those and our own otherwise
*/
#if (_MSC_VER < 1900) && !defined(_MINGW)
/*
* epicsStrtod() for systems with broken strtod() routine
*/
epicsShareFunc double epicsStrtod(const char *str, char **endp);
#else
# define epicsStrtod strtod
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -18,9 +18,6 @@
#define VC_EXTRALEAN
#define STRICT
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x400 /* No support for W95 */
#endif
#include <windows.h>
#include <process.h> /* for _endthread() etc */
@@ -33,6 +30,8 @@
#include "ellLib.h"
#include "epicsExit.h"
#include "osdThreadPvt.h"
epicsShareFunc void osdThreadHooksRun(epicsThreadId id);
void setThreadName ( DWORD dwThreadID, LPCSTR szThreadName );
@@ -53,6 +52,7 @@ typedef struct epicsThreadOSD {
DWORD id;
unsigned epicsPriority;
char isSuspended;
HANDLE timer; /* waitable timer */
} win32ThreadParam;
typedef struct epicsThreadPrivateOSD {
@@ -229,6 +229,19 @@ static win32ThreadGlobal * fetchWin32ThreadGlobal ( void )
return pWin32ThreadGlobal;
}
static void epicsParmCleanupDataWIN32 ( win32ThreadParam * pParm )
{
if ( pParm ) {
if ( pParm->handle ) {
CloseHandle ( pParm->handle );
}
if ( pParm->timer ) {
CloseHandle ( pParm->timer );
}
free ( pParm );
}
}
static void epicsParmCleanupWIN32 ( win32ThreadParam * pParm )
{
win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal ();
@@ -243,8 +256,8 @@ static void epicsParmCleanupWIN32 ( win32ThreadParam * pParm )
ellDelete ( & pGbl->threadList, & pParm->node );
LeaveCriticalSection ( & pGbl->mutex );
CloseHandle ( pParm->handle );
free ( pParm );
epicsParmCleanupDataWIN32 ( pParm );
TlsSetValue ( pGbl->tlsIndexThreadLibraryEPICS, 0 );
}
}
@@ -526,6 +539,16 @@ static win32ThreadParam * epicsThreadParmCreate ( const char *pName )
pParmWIN32->pName = (char *) ( pParmWIN32 + 1 );
strcpy ( pParmWIN32->pName, pName );
pParmWIN32->isSuspended = 0;
#ifdef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION
pParmWIN32->timer = CreateWaitableTimerEx(NULL, NULL, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS);
#endif
if (pParmWIN32->timer == NULL) {
pParmWIN32->timer = CreateWaitableTimer(NULL, 0, NULL);
}
if (pParmWIN32->timer == NULL) {
free(pParmWIN32);
return NULL;
}
}
return pParmWIN32;
}
@@ -608,7 +631,7 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadCreate (const char *pName,
CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION,
& threadId );
if ( pParmWIN32->handle == 0 ) {
free ( pParmWIN32 );
epicsParmCleanupDataWIN32 ( pParmWIN32 );
return NULL;
}
/* weird win32 interface threadId parameter inconsistency */
@@ -618,8 +641,7 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadCreate (const char *pName,
osdPriority = epicsThreadGetOsdPriorityValue (priority);
bstat = SetThreadPriority ( pParmWIN32->handle, osdPriority );
if (!bstat) {
CloseHandle ( pParmWIN32->handle );
free ( pParmWIN32 );
epicsParmCleanupDataWIN32 ( pParmWIN32 );
return NULL;
}
@@ -632,8 +654,7 @@ epicsShareFunc epicsThreadId epicsShareAPI epicsThreadCreate (const char *pName,
EnterCriticalSection ( & pGbl->mutex );
ellDelete ( & pGbl->threadList, & pParmWIN32->node );
LeaveCriticalSection ( & pGbl->mutex );
CloseHandle ( pParmWIN32->handle );
free ( pParmWIN32 );
epicsParmCleanupDataWIN32 ( pParmWIN32 );
return NULL;
}
@@ -764,24 +785,62 @@ epicsShareFunc int epicsShareAPI epicsThreadIsSuspended ( epicsThreadId id )
}
}
/**
* osdThreadGetTimer ()
* return stored waitable timer object for thread
*/
HANDLE osdThreadGetTimer()
{
win32ThreadGlobal * pGbl = fetchWin32ThreadGlobal ();
win32ThreadParam * pParm;
assert ( pGbl );
pParm = ( win32ThreadParam * )
TlsGetValue ( pGbl->tlsIndexThreadLibraryEPICS );
return pParm->timer;
}
/*
* epicsThreadSleep ()
*/
epicsShareFunc void epicsShareAPI epicsThreadSleep ( double seconds )
{
static const unsigned mSecPerSec = 1000;
DWORD milliSecDelay;
/* waitable timers use 100 nanosecond intervals, like FILETIME */
static const unsigned ivalPerSec = 10000000u; /* number of 100ns intervals per second */
static const unsigned mSecPerSec = 1000u; /* milliseconds per second */
LARGE_INTEGER tmo;
HANDLE timer;
LONGLONG nIvals; /* number of intervals */
if ( seconds > 0.0 ) {
seconds *= mSecPerSec;
seconds += 0.99999999; /* 8 9s here is optimal */
milliSecDelay = ( seconds >= INFINITE ) ?
INFINITE - 1 : ( DWORD ) seconds;
if ( seconds <= 0.0 ) {
tmo.QuadPart = 0u;
}
else { /* seconds <= 0 or NAN */
milliSecDelay = 0u;
else if ( seconds >= INFINITE / mSecPerSec ) {
/* we need to apply a maximum wait time to stop an overflow. We choose (INFINITE - 1) milliseconds,
to be compatible with previous WaitForSingleObject() implementation */
nIvals = (LONGLONG)(INFINITE - 1) * (ivalPerSec / mSecPerSec);
tmo.QuadPart = -nIvals; /* negative value means a relative time offset for timer */
}
else {
nIvals = (LONGLONG)(seconds * ivalPerSec + 0.999999);
tmo.QuadPart = -nIvals;
}
if (tmo.QuadPart == 0) {
Sleep ( 0 );
}
else {
timer = osdThreadGetTimer();
if (!SetWaitableTimer(timer, &tmo, 0, NULL, NULL, 0)) {
fprintf ( stderr, "epicsThreadSleep: SetWaitableTimer failed %lu\n", GetLastError() );
return;
}
if (WaitForSingleObject(timer, INFINITE) != WAIT_OBJECT_0) {
fprintf ( stderr, "epicsThreadSleep: WaitForSingleObject failed %lu\n", GetLastError() );
}
}
Sleep ( milliSecDelay );
}
/*

View File

@@ -0,0 +1,14 @@
#ifndef osdThreadPvth
#define osdThreadPvth
#ifdef __cplusplus
extern "C" {
#endif
extern HANDLE osdThreadGetTimer(void);
#ifdef __cplusplus
}
#endif
#endif /* osdThreadPvth */

View File

@@ -123,7 +123,7 @@ bswap32(epicsUInt32 value)
#elif EPICS_BYTE_ORDER == EPICS_ENDIAN_LITTLE
/* Get hton[sl] declarations: */
#include <osdSock.h>
#include <osiSock.h>
/** @ingroup mmio
*@{

View File

@@ -5,7 +5,7 @@
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* Author W. Eric Norum
@@ -50,7 +50,7 @@ struct epicsMessageQueueOSD {
ELLLIST receiveQueue;
ELLLIST eventFreeList;
int numberOfSendersWaiting;
epicsMutexId mutex;
unsigned long capacity;
unsigned long maxMessageSize;
@@ -106,7 +106,7 @@ epicsShareFunc epicsMessageQueueId epicsShareAPI epicsMessageQueueCreate(
}
static void
freeEventNode(struct eventNode *enode)
destroyEventNode(struct eventNode *enode)
{
epicsEventDestroy(enode->event);
free(enode);
@@ -119,7 +119,7 @@ epicsMessageQueueDestroy(epicsMessageQueueId pmsg)
while ((evp = reinterpret_cast < struct eventNode * >
( ellGet(&pmsg->eventFreeList) ) ) != NULL) {
freeEventNode(evp);
destroyEventNode(evp);
}
epicsMutexDestroy(pmsg->mutex);
free(pmsg->buf);
@@ -145,6 +145,16 @@ getEventNode(epicsMessageQueueId pmsg)
return evp;
}
static void
freeEventNode(epicsMessageQueueId pmsg, eventNode *evp, epicsEventStatus status)
{
if (status == epicsEventWaitTimeout) {
epicsEventSignal(evp->event);
epicsEventWait(evp->event);
}
ellAdd(&pmsg->eventFreeList, &evp->link);
}
static int
mySend(epicsMessageQueueId pmsg, void *message, unsigned int size,
double timeout)
@@ -163,7 +173,7 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size,
if ((pmsg->numberOfSendersWaiting > 0)
|| (pmsg->full && (ellFirst(&pmsg->receiveQueue) == NULL))) {
/*
* Return if not allowed to wait
* Return if not allowed to wait. NB -1 means wait forever.
*/
if (timeout == 0) {
epicsMutexUnlock(pmsg->mutex);
@@ -171,7 +181,7 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size,
}
/*
* Wait
* Indicate that we're waiting
*/
struct threadNode threadNode;
threadNode.evp = getEventNode(pmsg);
@@ -186,22 +196,25 @@ mySend(epicsMessageQueueId pmsg, void *message, unsigned int size,
epicsMutexUnlock(pmsg->mutex);
epicsEventStatus status;
if (timeout > 0)
status = epicsEventWaitWithTimeout(threadNode.evp->event, timeout);
else
status = epicsEventWait(threadNode.evp->event);
/*
* Wait for receiver to wake us
*/
epicsEventStatus status = timeout < 0 ?
epicsEventWait(threadNode.evp->event) :
epicsEventWaitWithTimeout(threadNode.evp->event, timeout);
epicsMutexMustLock(pmsg->mutex);
if(!threadNode.eventSent)
if (!threadNode.eventSent) {
/* Receiver didn't take us off the sendQueue, do it ourselves */
ellDelete(&pmsg->sendQueue, &threadNode.link);
pmsg->numberOfSendersWaiting--;
pmsg->numberOfSendersWaiting--;
}
ellAdd(&pmsg->eventFreeList, &threadNode.evp->link);
freeEventNode(pmsg, threadNode.evp, status);
if ((pmsg->full && (ellFirst(&pmsg->receiveQueue) == NULL)) ||
status != epicsEventOK) {
if (pmsg->full && (ellFirst(&pmsg->receiveQueue) == NULL)) {
/* State of the queue didn't change, exit */
epicsMutexUnlock(pmsg->mutex);
return -1;
}
@@ -294,6 +307,7 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size,
*/
if ((pthr = reinterpret_cast < struct threadNode * >
( ellGet(&pmsg->sendQueue) ) ) != NULL) {
pmsg->numberOfSendersWaiting--;
pthr->eventSent = true;
epicsEventSignal(pthr->evp->event);
}
@@ -302,7 +316,7 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size,
}
/*
* Return if not allowed to wait
* Return if not allowed to wait. NB -1 means wait forever.
*/
if (timeout == 0) {
epicsMutexUnlock(pmsg->mutex);
@@ -310,16 +324,7 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size,
}
/*
* Wake up the oldest task waiting to send
*/
if ((pthr = reinterpret_cast < struct threadNode * >
( ellGet(&pmsg->sendQueue) ) ) != NULL) {
pthr->eventSent = true;
epicsEventSignal(pthr->evp->event);
}
/*
* Wait for message to arrive
* Indicate that we're waiting
*/
struct threadNode threadNode;
threadNode.evp = getEventNode(pmsg);
@@ -333,24 +338,36 @@ myReceive(epicsMessageQueueId pmsg, void *message, unsigned int size,
}
ellAdd(&pmsg->receiveQueue, &threadNode.link);
/*
* Wake up the oldest task waiting to send
*/
if ((pthr = reinterpret_cast < struct threadNode * >
( ellGet(&pmsg->sendQueue) ) ) != NULL) {
pmsg->numberOfSendersWaiting--;
pthr->eventSent = true;
epicsEventSignal(pthr->evp->event);
}
epicsMutexUnlock(pmsg->mutex);
epicsEventStatus status;
if (timeout > 0)
status = epicsEventWaitWithTimeout(threadNode.evp->event, timeout);
else
status = epicsEventWait(threadNode.evp->event);
/*
* Wait for a message to arrive
*/
epicsEventStatus status = timeout < 0 ?
epicsEventWait(threadNode.evp->event) :
epicsEventWaitWithTimeout(threadNode.evp->event, timeout);
epicsMutexMustLock(pmsg->mutex);
if (!threadNode.eventSent)
ellDelete(&pmsg->receiveQueue, &threadNode.link);
ellAdd(&pmsg->eventFreeList, &threadNode.evp->link);
freeEventNode(pmsg, threadNode.evp, status);
epicsMutexUnlock(pmsg->mutex);
if (threadNode.eventSent && (threadNode.size <= size) &&
status == epicsEventOK)
if (threadNode.eventSent && (threadNode.size <= size))
return threadNode.size;
return -1;
}
@@ -398,7 +415,8 @@ epicsMessageQueuePending(epicsMessageQueueId pmsg)
epicsShareFunc void epicsShareAPI
epicsMessageQueueShow(epicsMessageQueueId pmsg, int level)
{
printf("Message Queue Used:%d Slots:%lu", epicsMessageQueuePending(pmsg), pmsg->capacity);
printf("Message Queue Used:%d Slots:%lu",
epicsMessageQueuePending(pmsg), pmsg->capacity);
if (level >= 1)
printf(" Maximum size:%lu", pmsg->maxMessageSize);
printf("\n");

View File

@@ -207,7 +207,7 @@ epicsShareFunc void epicsShareAPI osiSockDiscoverBroadcastAddresses
pNewNode->addr.sa = pIfreqList->ifr_broadaddr;
ifDepenDebugPrintf ( ( "found broadcast addr = %x\n", ntohl ( baddr.ia.sin_addr.s_addr ) ) );
} else {
ifDepenDebugPrintf ( ( "Ignoring broadcast addr = \n", ntohl ( baddr.ia.sin_addr.s_addr ) ) );
ifDepenDebugPrintf ( ( "Ignoring broadcast addr = %x\n", ntohl ( baddr.ia.sin_addr.s_addr ) ) );
free ( pNewNode );
continue;
}

View File

@@ -0,0 +1,15 @@
/*************************************************************************\
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#define EPICS_PRIVATE_API
#include "osiSock.h"
/*
* epicsSocketUnsentCount ()
*/
int epicsSocketUnsentCount(SOCKET sock) {
/* not implemented */
return -1;
}

View File

@@ -72,6 +72,7 @@ epicsShareFunc int epicsThreadHookAdd(EPICS_THREAD_HOOK_ROUTINE hook)
return 0;
}
fprintf(stderr, "epicsThreadHookAdd: Locking problem\n");
free(pHook);
return -1;
}

View File

@@ -0,0 +1,19 @@
/*************************************************************************\
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#define EPICS_PRIVATE_API
#include "osiSock.h"
/*
* epicsSocketUnsentCount ()
* See https://www.unix.com/man-page/osx/2/setsockopt
*/
int epicsSocketUnsentCount(SOCKET sock) {
int unsent;
socklen_t len = sizeof(unsent);
if (getsockopt(sock, SOL_SOCKET, SO_NWRITE, &unsent, &len) == 0)
return unsent;
return -1;
}

View File

@@ -48,8 +48,10 @@ void epicsAtomicLock ( EpicsAtomicLockKey * )
status = pthread_mutex_lock ( & mutex );
if ( status == 0 ) return;
assert ( status == EINTR );
static const useconds_t retryDelayUSec = 100000;
usleep ( retryDelayUSec );
struct timespec retryDelay = { 0, 100000000 };
struct timespec remainingDelay;
while (nanosleep(&retryDelay, &remainingDelay) == -1 && errno == EINTR)
retryDelay = remainingDelay;
countDown--;
assert ( countDown );
}

View File

@@ -14,6 +14,18 @@
#include <shareLib.h>
#ifdef __cplusplus
#if __cplusplus>=201103L
#include <cmath>
#if __GLIBCXX__>20160427
using std::isfinite;
using std::isinf;
using std::isnan;
using std::isnormal;
#endif
#endif /* c++11 */
extern "C" {
#endif

View File

@@ -301,10 +301,10 @@ int status;
arg.ok = 0;
status = pthread_create(&id, 0, find_pri_range, &arg);
checkStatusQuit(status, "pthread_create","epicsThreadInit");
checkStatusOnceQuit(status, "pthread_create","epicsThreadInit");
status = pthread_join(id, &dummy);
checkStatusQuit(status, "pthread_join","epicsThreadInit");
checkStatusOnceQuit(status, "pthread_join","epicsThreadInit");
a_p->minPriority = arg.min_pri;
a_p->maxPriority = arg.max_pri;
@@ -320,9 +320,9 @@ static void once(void)
pthread_key_create(&getpthreadInfo,0);
status = pthread_mutex_init(&onceLock,0);
checkStatusQuit(status,"pthread_mutex_init","epicsThreadInit");
checkStatusOnceQuit(status,"pthread_mutex_init","epicsThreadInit");
status = pthread_mutex_init(&listLock,0);
checkStatusQuit(status,"pthread_mutex_init","epicsThreadInit");
checkStatusOnceQuit(status,"pthread_mutex_init","epicsThreadInit");
pcommonAttr = calloc(1,sizeof(commonAttr));
if(!pcommonAttr) checkStatusOnceQuit(errno,"calloc","epicsThreadInit");
status = pthread_attr_init(&pcommonAttr->attr);

View File

@@ -348,8 +348,9 @@ epicsShareFunc void epicsThreadMap ( EPICS_THREAD_HOOK_ROUTINE func )
while (noTasks == 0) {
noTasks = taskIdListGet(taskIdList, taskIdListSize);
if (noTasks == taskIdListSize) {
taskIdList = realloc(taskIdList, (taskIdListSize+ID_LIST_CHUNK)*sizeof(int));
assert(taskIdList);
int *newlist = realloc(taskIdList, (taskIdListSize+ID_LIST_CHUNK)*sizeof(int));
assert(newlist);
taskIdList = newlist;
taskIdListSize += ID_LIST_CHUNK;
noTasks = 0;
}

View File

@@ -41,7 +41,7 @@ static struct {
static epicsThreadOnceId onceId = EPICS_THREAD_ONCE_INIT;
#ifdef CLOCK_REALTIME
#if defined(CLOCK_REALTIME) && !defined(_WIN32)
/* This code is not used on systems without Posix CLOCK_REALTIME,
* but the only way to detect that is from the OS headers, so the
* Makefile can't exclude compiling this file on those systems.
@@ -229,7 +229,11 @@ static int ClockTimeGetCurrent(epicsTimeStamp *pDest)
return 0;
}
#endif /* CLOCK_REALTIME */
/* Used in Report function below: */
#define UNINIT_ERROR "initialized"
#else
#define UNINIT_ERROR "available"
#endif /* CLOCK_REALTIME && !WIN32 */
/* Allow the following report routine to be compiled anyway
* to avoid getting a build warning from ranlib.
@@ -242,13 +246,7 @@ int ClockTime_Report(int level)
char timebuf[32];
if (onceId == EPICS_THREAD_ONCE_INIT) {
printf("OS Clock driver not %s.\n",
#ifdef CLOCK_REALTIME
"initialized"
#else
"available"
#endif /* CLOCK_REALTIME */
);
puts("OS Clock driver not " UNINIT_ERROR);
}
else if (ClockTimePvt.synchronize == CLOCKTIME_SYNC) {
int synchronized, syncFromPriority;

View File

@@ -52,6 +52,14 @@ enum epicsSocketSystemCallInterruptMechanismQueryInfo {
epicsShareFunc enum epicsSocketSystemCallInterruptMechanismQueryInfo
epicsSocketSystemCallInterruptMechanismQuery ();
#ifdef EPICS_PRIVATE_API
/*
* Some systems (e.g Linux and Windows 10) allow to check the amount
* of unsent data in the output queue.
* Returns -1 if the information is not available.
*/
epicsShareFunc int epicsSocketUnsentCount(SOCKET sock);
#endif
/*
* convert socket address to ASCII in this order

View File

@@ -107,6 +107,11 @@ epicsThreadTest_SRCS += epicsThreadTest.cpp
testHarness_SRCS += epicsThreadTest.cpp
TESTS += epicsThreadTest
TESTPROD_HOST += epicsThreadClassTest
epicsThreadClassTest_SRCS += epicsThreadClassTest.cpp
testHarness_SRCS += epicsThreadClassTest.cpp
TESTS += epicsThreadClassTest
TESTPROD_HOST += epicsThreadOnceTest
epicsThreadOnceTest_SRCS += epicsThreadOnceTest.c
testHarness_SRCS += epicsThreadOnceTest.c

View File

@@ -104,7 +104,7 @@ void testUInt32Calc(const char *expr, epicsUInt32 expected) {
testDiag("calcPerform: error evaluating '%s'", expr);
}
uresult = (epicsUInt32) result;
uresult = (result < 0.0 ? (epicsUInt32)(epicsInt32)result : (epicsUInt32)result);
pass = (uresult == expected);
if (!testOk(pass, "%s", expr)) {
testDiag("Expected result is 0x%x (%u), actually got 0x%x (%u)",
@@ -297,7 +297,7 @@ MAIN(epicsCalcTest)
const double a=1.0, b=2.0, c=3.0, d=4.0, e=5.0, f=6.0,
g=7.0, h=8.0, i=9.0, j=10.0, k=11.0, l=12.0;
testPlan(613);
testPlan(630);
/* LITERAL_OPERAND elements */
testExpr(0);
@@ -612,14 +612,14 @@ MAIN(epicsCalcTest)
testExpr(0.0 + NaN);
testExpr(Inf + 0.0);
testExpr(Inf + Inf);
#if defined(_WIN64) && defined(_MSC_VER)
#if defined(_WIN32) && defined(_MSC_VER)
testCalc("Inf + -Inf", NaN);
#else
testExpr(Inf + -Inf);
#endif
testExpr(Inf + NaN);
testExpr(-Inf + 0.0);
#if defined(_WIN64) && defined(_MSC_VER)
#if defined(_WIN32) && defined(_MSC_VER)
testCalc("-Inf + Inf", NaN);
#else
testExpr(-Inf + Inf);
@@ -688,7 +688,7 @@ MAIN(epicsCalcTest)
testExpr(NaN < NaN);
testExpr(1 << 2);
testExpr(1 << 3 << 2)
testExpr(1 << 3 << 2);
testExpr(0 <= 1);
testExpr(0 <= 0);
@@ -776,7 +776,9 @@ MAIN(epicsCalcTest)
testExpr(NaN >= NaN);
testExpr(8 >> 1);
testCalc("8 >>> 1", 8u >> 1u);
testExpr(64 >> 2 >> 1);
testCalc("64 >>> 2 >>> 1", 64u >> 2u >> 1u);
testExpr(7 AND 4);
@@ -875,11 +877,14 @@ MAIN(epicsCalcTest)
testExpr(3 << 2 & 10); // 2 2
testCalc("18 & 6 << 2", (18 & 6) << 2); // 2 2
testExpr(36 >> 2 & 10); // 2 2
testCalc("36 >>> 2 & 10", 36u >> 2u & 10u); // 2 2
testCalc("18 & 20 >> 2", (18 & 20) >> 2); // 2 2
testCalc("18 & 20 >>> 2", (18u & 20u) >> 2u); // 2 2
testExpr(3 & 4 == 4); // 2 3
testExpr(3 AND 4 == 4); // 2 3
testCalc("1 << 2 != 4", 1 << (2 != 4)); // 2 3
testCalc("16 >> 2 != 4", 16 >> (2 != 4)); // 2 3
testCalc("16 >>> 2 != 4", 16u >> (2u != 4u)); // 2 3
testExpr(3 AND -2); // 2 8
testExpr(0 < 1 ? 2 : 3); // 3 0
testExpr(1 <= 0 ? 2 : 3); // 3 0
@@ -951,7 +956,11 @@ MAIN(epicsCalcTest)
testUInt32Calc("~0xaaaaaaaa", 0x55555555u);
testUInt32Calc("~~0xaaaaaaaa", 0xaaaaaaaau);
testUInt32Calc("0xaaaaaaaa >> 8", 0xffaaaaaau);
testUInt32Calc("0x55555555 >> 8", 0x00555555u);
testUInt32Calc("0xaaaaaaaa >>> 8", 0x00aaaaaau);
testUInt32Calc("0x55555555 >>> 8", 0x00555555u);
testUInt32Calc("0xaaaaaaaa << 8", 0xaaaaaa00u);
testUInt32Calc("0x55555555 << 8", 0x55555500u);
// using integer literals assigned to variables
testUInt32Calc("a:=0xaaaaaaaa; b:=0xffff0000; a AND b", 0xaaaa0000u);
testUInt32Calc("a:=0xaaaaaaaa; b:=0xffff0000; a OR b", 0xffffaaaau);
@@ -959,7 +968,11 @@ MAIN(epicsCalcTest)
testUInt32Calc("a:=0xaaaaaaaa; ~a", 0x55555555u);
testUInt32Calc("a:=0xaaaaaaaa; ~~a", 0xaaaaaaaau);
testUInt32Calc("a:=0xaaaaaaaa; a >> 8", 0xffaaaaaau);
testUInt32Calc("a:=0xaaaaaaaa; a >>> 8", 0x00aaaaaau);
testUInt32Calc("a:=0xaaaaaaaa; a << 8", 0xaaaaaa00u);
testUInt32Calc("a:=0x55555555; a >> 8", 0x00555555u);
testUInt32Calc("a:=0x55555555; a >>> 8", 0x00555555u);
testUInt32Calc("a:=0x55555555; a << 8", 0x55555500u);
// Test proper conversion of double values (+ 0.1 enforces double literal)
// when used as inputs to the bitwise operations.
@@ -979,9 +992,13 @@ MAIN(epicsCalcTest)
testUInt32Calc("~ -1431655766.1", 0x55555555u);
testUInt32Calc("~ 2863311530.1", 0x55555555u);
testUInt32Calc("-1431655766.1 >> 0", 0xaaaaaaaau);
testUInt32Calc("-1431655766.1 >>> 0", 0xaaaaaaaau);
testUInt32Calc("2863311530.1 >> 0", 0xaaaaaaaau);
testUInt32Calc("2863311530.1 >>> 0", 0xaaaaaaaau);
testUInt32Calc("-1431655766.1 >> 0.1", 0xaaaaaaaau);
testUInt32Calc("-1431655766.1 >>> 0.1", 0xaaaaaaaau);
testUInt32Calc("2863311530.1 >> 0.1", 0xaaaaaaaau);
testUInt32Calc("2863311530.1 >>> 0.1", 0xaaaaaaaau);
testUInt32Calc("-1431655766.1 << 0", 0xaaaaaaaau);
testUInt32Calc("2863311530.1 << 0", 0xaaaaaaaau);
testUInt32Calc("-1431655766.1 << 0.1", 0xaaaaaaaau);
@@ -989,4 +1006,3 @@ MAIN(epicsCalcTest)
return testDone();
}

View File

@@ -32,23 +32,23 @@ MAIN(epicsMathTest)
testOk1(epicsINF > 0.0);
testOk1(epicsINF - epicsINF != 0.0);
#if defined(_WIN64) && defined(_MSC_VER)
testTodoBegin("Known failure on windows-x64");
#if defined(_WIN32) && defined(_MSC_VER)
testTodoBegin("Known failure on windows-x64 and win32-x86");
#endif
testOk1(epicsINF + -epicsINF != 0.0);
testOk1(-epicsINF + epicsINF != 0.0);
#if defined(_WIN64) && defined(_MSC_VER)
#if defined(_WIN32) && defined(_MSC_VER)
testTodoEnd();
#endif
testOk1(isnan(epicsINF - epicsINF));
#if defined(_WIN64) && defined(_MSC_VER)
testTodoBegin("Known failure on windows-x64");
#if defined(_WIN32) && defined(_MSC_VER)
testTodoBegin("Known failure on windows-x64 and win32-x86");
#endif
testOk1(isnan(epicsINF + -epicsINF));
testOk1(isnan(-epicsINF + epicsINF));
#if defined(_WIN64) && defined(_MSC_VER)
#if defined(_WIN32) && defined(_MSC_VER)
testTodoEnd();
#endif
@@ -62,12 +62,12 @@ MAIN(epicsMathTest)
testOk1(!(epicsNAN > epicsNAN));
testOk1(isnan(epicsNAN - epicsNAN));
#if defined(_WIN64) && defined(_MSC_VER)
testTodoBegin("Known failure on windows-x64");
#if defined(_WIN32) && defined(_MSC_VER)
testTodoBegin("Known failure on windows-x64 and win32-x86");
#endif
testOk1(isnan(epicsNAN + -epicsNAN));
testOk1(isnan(-epicsNAN + epicsNAN));
#if defined(_WIN64) && defined(_MSC_VER)
#if defined(_WIN32) && defined(_MSC_VER)
testTodoEnd();
#endif

View File

@@ -28,6 +28,10 @@ static volatile int recvExit = 0;
static epicsEventId finished;
static unsigned int mediumStack;
#define SLEEPY_TESTS 500
static int numSent, numReceived;
static epicsEventId complete;
/*
* In Numerical Recipes in C: The Art of Scientific Computing (William H.
* Press, Brian P. Flannery, Saul A. Teukolsky, William T. Vetterling; New
@@ -115,6 +119,106 @@ receiver(void *arg)
epicsEventSignal(finished);
}
extern "C" void
fastReceiver(void *arg)
{
epicsMessageQueue *q = (epicsMessageQueue *)arg;
char cbuf[80];
int len;
numReceived = 0;
while (!recvExit) {
len = q->receive(cbuf, sizeof cbuf, 0.010);
if (len > 0) {
numReceived++;
}
}
recvExit = 0;
epicsEventSignal(complete);
}
void sleepySender(double delay)
{
testDiag("sleepySender: sending every %.3f seconds", delay);
epicsMessageQueue q(4, 20);
epicsThreadCreate("Fast Receiver", epicsThreadPriorityMedium,
mediumStack, fastReceiver, &q);
numSent = 0;
for (int i = 0 ; i < SLEEPY_TESTS ; i++) {
if (q.send((void *)msg1, 4) == 0) {
numSent++;
}
epicsThreadSleep(delay);
}
epicsThreadSleep(1.0);
testOk(numSent == SLEEPY_TESTS, "Sent %d (should be %d)",
numSent, SLEEPY_TESTS);
testOk(numReceived == SLEEPY_TESTS, "Received %d (should be %d)",
numReceived, SLEEPY_TESTS);
recvExit = 1;
while (q.send((void *)msg1, 4) != 0)
epicsThreadSleep(0.01);
epicsEventMustWait(complete);
}
extern "C" void
fastSender(void *arg)
{
epicsMessageQueue *q = (epicsMessageQueue *)arg;
numSent = 0;
// Send first withough timeout
q->send((void *)msg1, 4);
numSent++;
// The rest have a timeout
while (!sendExit) {
if (q->send((void *)msg1, 4, 0.010) == 0) {
numSent++;
}
}
sendExit = 0;
epicsEventSignal(complete);
}
void sleepyReceiver(double delay)
{
testDiag("sleepyReceiver: acquiring every %.3f seconds", delay);
epicsMessageQueue q(4, 20);
// Fill the queue
for (int i = q.pending(); i < 4 ;i++) {
q.send((void *)msg1, 4);
}
epicsThreadCreate("Fast Sender", epicsThreadPriorityMedium,
mediumStack, fastSender, &q);
epicsThreadSleep(0.5);
char cbuf[80];
int len;
numReceived = 0;
for (int i = 0 ; i < SLEEPY_TESTS ; i++) {
len = q.receive(cbuf, sizeof cbuf);
if (len > 0) {
numReceived++;
}
epicsThreadSleep(delay);
}
testOk(numSent == SLEEPY_TESTS, "Sent %d (should be %d)",
numSent, SLEEPY_TESTS);
testOk(numReceived == SLEEPY_TESTS, "Received %d (should be %d)",
numReceived, SLEEPY_TESTS);
sendExit = 1;
while (q.receive(cbuf, sizeof cbuf) <= 0)
epicsThreadSleep(0.01);
epicsEventMustWait(complete);
}
extern "C" void
sender(void *arg)
{
@@ -251,6 +355,18 @@ extern "C" void messageQueueTest(void *parm)
testOk(q1->send((void *)msg1, 10) == 0, "Send with no receiver");
epicsThreadSleep(2.0);
testDiag("6 Single receiver single sender 'Sleepy timeout' tests,");
testDiag(" these should take about %.2f seconds each:",
SLEEPY_TESTS * 0.010);
complete = epicsEventMustCreate(epicsEventEmpty);
sleepySender(0.009);
sleepySender(0.010);
sleepySender(0.011);
sleepyReceiver(0.009);
sleepyReceiver(0.010);
sleepyReceiver(0.011);
testDiag("Single receiver, single sender tests:");
epicsThreadSetPriority(myThreadId, epicsThreadPriorityHigh);
epicsThreadCreate("Receiver one", epicsThreadPriorityMedium,
@@ -285,7 +401,7 @@ extern "C" void messageQueueTest(void *parm)
* Single receiver, multiple sender tests
*/
testDiag("Single receiver, multiple sender tests:");
testDiag("This test lasts 60 seconds...");
testDiag("This test lasts 30 seconds...");
testOk(!!epicsThreadCreate("Sender 1", epicsThreadPriorityLow,
mediumStack, sender, q1),
"Created Sender 1");
@@ -299,9 +415,9 @@ extern "C" void messageQueueTest(void *parm)
mediumStack, sender, q1),
"Created Sender 4");
for (i = 0; i < 10; i++) {
testDiag("... %2d", 10 - i);
epicsThreadSleep(6.0);
for (i = 0; i < 6; i++) {
testDiag("... %2d", 6 - i);
epicsThreadSleep(5.0);
}
sendExit = 1;
@@ -312,7 +428,7 @@ extern "C" void messageQueueTest(void *parm)
MAIN(epicsMessageQueueTest)
{
testPlan(62);
testPlan(74);
finished = epicsEventMustCreate(epicsEventEmpty);
mediumStack = epicsThreadGetStackSize(epicsThreadStackMedium);

Some files were not shown because too many files have changed in this diff Show More