ca: fallback to repeater thread if unable to exec caRepeater

Silently fallback to in-process repeater thread on all targets.
Including on host targets when caRepeater executable is unavailable.
This commit is contained in:
Michael Davidsaver
2021-04-19 11:08:49 -07:00
parent a9457fc02b
commit 08b741ed05
2 changed files with 18 additions and 5 deletions

View File

@@ -17,6 +17,22 @@ should also be read to understand what has changed since earlier releases.
<!-- Insert new items immediately below here ... -->
### Automatic fallback to thread when unable to exec caRepeater
A process using libca which does not find an existing caRepeater process
will attempt to start one by running the caRepeater executable.
This is not always possible, usually when caRepeater is not in `$PATH`.
Now, instead of printing a warning, an internal caRepeater thread
will be started (as is done be RTEMS and vxWorks targets).
If this fallback occurs, the lifetime of the caRepeater thread
may be shorter than the lifetime of a separate caRepeater process
would have been.
It remains the recommended practice to explicitly start a caRepeater
instance. Examples of both systemd (`caRepeater.service`) and sysv
(`S99caRepeater`) scripts may be found under `bin/`.
### Glob pattern allowed in `var` command
When used with one argument, the `var` command can be used with a glob pattern

View File

@@ -629,8 +629,8 @@ void epicsStdCall caStartRepeaterIfNotInstalled ( unsigned repeaterPort )
* repeater's port)
*/
osiSpawnDetachedProcessReturn osptr =
osiSpawnDetachedProcess ( "CA Repeater", "caRepeater" );
if ( osptr == osiSpawnDetachedProcessNoSupport ) {
osiSpawnDetachedProcess ( "!CA Repeater", "caRepeater" );
if ( osptr != osiSpawnDetachedProcessSuccess ) {
epicsThreadId tid;
tid = epicsThreadCreate ( "CAC-repeater", epicsThreadPriorityLow,
@@ -639,9 +639,6 @@ void epicsStdCall caStartRepeaterIfNotInstalled ( unsigned repeaterPort )
fprintf ( stderr, "caStartRepeaterIfNotInstalled : unable to create CA repeater daemon thread\n" );
}
}
else if ( osptr == osiSpawnDetachedProcessFail ) {
fprintf ( stderr, "caStartRepeaterIfNotInstalled (): unable to start CA repeater daemon detached process\n" );
}
}
}