Merge 3.16 (after 3.16.2-rc1) into 7.0

This commit is contained in:
Andrew Johnson
2018-10-26 17:04:53 -05:00
157 changed files with 5520 additions and 1623 deletions
+1
View File
@@ -99,6 +99,7 @@ epicsShareFunc long epicsShareAPI
envGetBoolConfigParam(const ENV_PARAM *pParam, int *pBool);
epicsShareFunc long epicsShareAPI epicsPrtEnvParams(void);
epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value);
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name);
epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name);
#ifdef __cplusplus
+9 -2
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.
\*************************************************************************/
/* flex - tool to generate fast lexical analyzers */
@@ -14,7 +14,7 @@
*
* This code is derived from software contributed to Berkeley by
* Vern Paxson.
*
*
* The United States Government has rights in this work pursuant
* to contract no. DE-AC03-76SF00098 between the United States
* Department of Energy and the University of California.
@@ -495,6 +495,13 @@ void flexinit(int argc, char **argv)
/* stupid do-nothing deprecated option */
break;
case 'o':
if ( i != 1 )
flexerror( "-o flag must be given separately" );
outfile = arg + i + 1;
goto get_next_arg;
case 'p':
performance_report = true;
break;
+16
View File
@@ -110,6 +110,21 @@ static void epicsEnvSetCallFunc(const iocshArgBuf *args)
epicsEnvSet (name, value);
}
/* epicsEnvUnset */
static const iocshArg epicsEnvUnsetArg0 = { "name",iocshArgString};
static const iocshArg * const epicsEnvUnsetArgs[1] = {&epicsEnvUnsetArg0};
static const iocshFuncDef epicsEnvUnsetFuncDef = {"epicsEnvUnset",1,epicsEnvUnsetArgs};
static void epicsEnvUnsetCallFunc(const iocshArgBuf *args)
{
char *name = args[0].sval;
if (name == NULL) {
fprintf(stderr, "Missing environment variable name argument.\n");
return;
}
epicsEnvUnset (name);
}
/* epicsParamShow */
static const iocshFuncDef epicsParamShowFuncDef = {"epicsParamShow",0,NULL};
static void epicsParamShowCallFunc(const iocshArgBuf *args)
@@ -367,6 +382,7 @@ void epicsShareAPI libComRegister(void)
iocshRegister(&pwdFuncDef, pwdCallFunc);
iocshRegister(&epicsEnvSetFuncDef, epicsEnvSetCallFunc);
iocshRegister(&epicsEnvUnsetFuncDef, epicsEnvUnsetCallFunc);
iocshRegister(&epicsParamShowFuncDef, epicsParamShowCallFunc);
iocshRegister(&epicsPrtEnvParamsFuncDef, epicsPrtEnvParamsCallFunc);
iocshRegister(&epicsEnvShowFuncDef, epicsEnvShowCallFunc);
+2 -7
View File
@@ -347,11 +347,6 @@ static int openLogFile (struct ioc_log_server *pserver)
{
enum TF_RETURN ret;
if (ioc_log_file_limit==0u) {
pserver->poutfile = stderr;
return IOCLS_ERROR;
}
if (pserver->poutfile && pserver->poutfile != stderr){
fclose (pserver->poutfile);
pserver->poutfile = NULL;
@@ -627,7 +622,7 @@ static void writeMessagesToLog (struct iocLogClient *pclient)
strlen(pclient->ascii_time) + nchar + 3u;
assert (nTotChar <= INT_MAX);
ntci = (int) nTotChar;
if ( pclient->pserver->filePos+ntci >= pclient->pserver->max_file_size ) {
if ( pclient->pserver->max_file_size && pclient->pserver->filePos+ntci >= pclient->pserver->max_file_size ) {
if ( pclient->pserver->max_file_size >= pclient->pserver->filePos ) {
unsigned nPadChar;
/*
@@ -771,7 +766,7 @@ static int getConfig(void)
&EPICS_IOC_LOG_FILE_LIMIT,
&ioc_log_file_limit);
if(status>=0){
if (ioc_log_file_limit<=0) {
if (ioc_log_file_limit < 0) {
envFailureNotify (&EPICS_IOC_LOG_FILE_LIMIT);
return IOCLS_ERROR;
}
+7 -2
View File
@@ -902,11 +902,16 @@ static void refer ( MAC_HANDLE *handle, MAC_ENTRY *entry, int level,
}
}
/* Bad reference, insert $(name,errval) */
/* Bad reference, insert either $(name,<error>) or $(name) */
if ( v < valend ) *v++ = '$';
if ( v < valend ) *v++ = '(';
cpy2val( refname, &v, valend );
cpy2val( errval, &v, valend );
if (handle->flags & FLAG_SUPPRESS_WARNINGS) {
if ( v < valend ) *v++ = ')';
*v = '\0';
}
else
cpy2val( errval, &v, valend );
cleanup:
if (pop) {
+7 -1
View File
@@ -27,7 +27,13 @@
* }
*/
#if defined(vxWorks) || defined(__rtems__)
#if defined(__rtems__)
#ifdef __cplusplus
#define MAIN(prog) extern "C" int prog(void); extern "C" int main() __attribute__((weak, alias(#prog))); extern "C" int prog(void)
#else
#define MAIN(prog) int prog(); int main() __attribute__((weak, alias(#prog))); int prog()
#endif
#elif defined(vxWorks)
#ifdef __cplusplus
#define MAIN(prog) extern "C" int prog(void)
#else
+28 -13
View File
@@ -34,20 +34,22 @@ extern "C" {
/* Make printf, puts and putchar use *our* version of stdout */
#ifdef printf
# undef printf
#endif /* printf */
#define printf epicsStdoutPrintf
#ifndef epicsStdioStdPrintfEtc
# ifdef printf
# undef printf
# endif
# define printf epicsStdoutPrintf
#ifdef puts
# undef puts
#endif /* puts */
#define puts epicsStdoutPuts
# ifdef puts
# undef puts
# endif
# define puts epicsStdoutPuts
#ifdef putchar
# undef putchar
#endif /* putchar */
#define putchar epicsStdoutPutchar
# ifdef putchar
# undef putchar
# endif
# define putchar epicsStdoutPutchar
#endif
epicsShareFunc int epicsShareAPI epicsSnprintf(
char *str, size_t size, const char *format, ...) EPICS_PRINTF_STYLE(3,4);
@@ -87,6 +89,19 @@ epicsShareFunc int epicsShareAPI epicsStdoutPutchar(int c);
#ifdef __cplusplus
}
#endif
/* Also pull functions into the std namespace (see lp:1786927) */
#if !defined(__GNUC__) || (__GNUC__ > 2)
namespace std {
using ::epicsGetStdin;
using ::epicsGetStdout;
using ::epicsGetStderr;
using ::epicsStdoutPrintf;
using ::epicsStdoutPuts;
using ::epicsStdoutPutchar;
}
#endif /* __GNUC__ > 2 */
#endif /* __cplusplus */
#endif /* epicsStdioh */
+10
View File
@@ -39,6 +39,16 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val
setenv(name, value, 1);
}
/*
* Unset an environment variable
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
unsetenv(name);
}
/*
* Show the value of the specified, or all, environment variables
*/
@@ -32,6 +32,7 @@ typedef int SOCKET;
typedef int osiSockIoctl_t;
typedef socklen_t osiSocklen_t;
typedef int osiSockOptMcastLoop_t;
typedef unsigned char osiSockOptMcastTTL_t;
#define FD_IN_FDSET(FD) ((FD)<FD_SETSIZE)
@@ -36,6 +36,7 @@ typedef int SOCKET;
typedef int osiSockIoctl_t;
typedef socklen_t osiSocklen_t;
typedef int osiSockOptMcastLoop_t;
typedef int osiSockOptMcastTTL_t;
#define FD_IN_FDSET(FD) ((FD)<FD_SETSIZE)
+62
View File
@@ -0,0 +1,62 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* osdEnv.c */
/*
* Author: Eric Norum
* Date: May 7, 2001
*
* Routines to modify/display environment variables and EPICS parameters
*
*/
#include <stdlib.h>
#include <stdio.h>
#define epicsExportSharedSymbols
#include "epicsStdio.h"
#include "envDefs.h"
#include "osiUnistd.h"
#include "iocsh.h"
/*
* Set the value of an environment variable
*/
epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value)
{
iocshEnvClear(name);
setenv(name, value, 1);
}
/*
* Unset an environment variable
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
unsetenv(name);
}
/*
* Show the value of the specified, or all, environment variables
*/
epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name)
{
if (name == NULL) {
extern char **environ;
char **sp;
for (sp = environ ; (sp != NULL) && (*sp != NULL) ; sp++)
printf ("%s\n", *sp);
}
else {
const char *cp = getenv (name);
if (cp == NULL)
printf ("%s is not an environment variable.\n", name);
else
printf ("%s=%s\n", name, cp);
}
}
@@ -43,6 +43,7 @@ typedef int SOCKET;
typedef int osiSockIoctl_t;
typedef socklen_t osiSocklen_t;
typedef char osiSockOptMcastLoop_t;
typedef unsigned char osiSockOptMcastTTL_t;
#define FD_IN_FDSET(FD) ((FD)<FD_SETSIZE)
+89
View File
@@ -0,0 +1,89 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* osdEnv.c */
/*
* Author: Eric Norum
* Date: May 7, 2001
*
* Routines to modify/display environment variables and EPICS parameters
*
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#define epicsExportSharedSymbols
#include "epicsStdio.h"
#include "errlog.h"
#include "cantProceed.h"
#include "envDefs.h"
#include "osiUnistd.h"
#include "epicsFindSymbol.h"
#include "iocsh.h"
/*
* Set the value of an environment variable
* Leaks memory, but the assumption is that this routine won't be
* called often enough for the leak to be a problem.
*/
epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value)
{
char *cp;
iocshEnvClear(name);
cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet");
strcpy (cp, name);
strcat (cp, "=");
strcat (cp, value);
if (putenv (cp) < 0) {
errPrintf(
-1L,
__FILE__,
__LINE__,
"Failed to set environment parameter \"%s\" to \"%s\": %s\n",
name,
value,
strerror (errno));
free (cp);
}
}
/*
* Unset an environment variable
* Using putenv with a an existing name plus "=" (without value) deletes
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
if (getenv(name) != NULL)
epicsEnvSet((char*)name, "");
}
/*
* Show the value of the specified, or all, environment variables
*/
epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name)
{
if (name == NULL) {
extern char **environ;
char **sp;
for (sp = environ ; (sp != NULL) && (*sp != NULL) ; sp++)
printf ("%s\n", *sp);
}
else {
const char *cp = getenv (name);
if (cp == NULL)
printf ("%s is not an environment variable.\n", name);
else
printf ("%s=%s\n", name, cp);
}
}
+7 -16
View File
@@ -19,13 +19,13 @@
#endif
#include <stdlib.h>
#include <stdio.h>
#define STRICT
#include <windows.h>
#define epicsExportSharedSymbols
#include "osiProcess.h"
#include "errlog.h"
epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, unsigned bufSizeIn)
{
@@ -94,16 +94,11 @@ epicsShareFunc osiSpawnDetachedProcessReturn epicsShareAPI osiSpawnDetachedProce
pFmtArgs[1] = (char *) pBaseExecutableName;
pFmtArgs[2] = errStrMsgBuf;
pFmtArgs[3] = "Changes may be required in your \"path\" environment variable.";
pFmtArgs[4] = "PATH = ";
pFmtArgs[5] = getenv ("path");
if ( pFmtArgs[5] == NULL ) {
pFmtArgs[5] = "<empty string>";
}
W32status = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING |
FORMAT_MESSAGE_ARGUMENT_ARRAY | 80,
"%1 \"%2\". %3 %4 %5 \"%6\"",
"%1 \"%2\". %3 %4",
0,
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
(LPTSTR) &complteMsgBuf,
@@ -111,24 +106,20 @@ epicsShareFunc osiSpawnDetachedProcessReturn epicsShareAPI osiSpawnDetachedProce
pFmtArgs
);
if (W32status) {
/* Display the string. */
MessageBox (NULL, complteMsgBuf, "Configuration Problem",
MB_OK | MB_ICONINFORMATION);
fprintf (stderr, "%s\n", (char *) complteMsgBuf);
LocalFree (complteMsgBuf);
}
else {
/* Display the string. */
MessageBox (NULL, errStrMsgBuf, "Failed to start executable",
MB_OK | MB_ICONINFORMATION);
fprintf (stderr, "%s\n", (char *) errStrMsgBuf);
}
/* Free the buffer. */
LocalFree (errStrMsgBuf);
}
else {
errlogPrintf ("!!WARNING!!\n");
errlogPrintf ("Unable to locate executable \"%s\".\n", pBaseExecutableName);
errlogPrintf ("You may need to modify your \"path\" environment variable.\n");
fprintf (stderr, "!!WARNING!!\n");
fprintf (stderr, "Unable to locate executable \"%s\".\n", pBaseExecutableName);
fprintf (stderr, "You may need to modify your \"path\" environment variable.\n");
}
return osiSpawnDetachedProcessFail;
}
@@ -29,6 +29,7 @@
typedef u_long FAR osiSockIoctl_t;
typedef int osiSocklen_t;
typedef BOOL osiSockOptMcastLoop_t;
typedef DWORD osiSockOptMcastTTL_t;
#ifndef SHUT_RD
# define SHUT_RD SD_RECEIVE
@@ -35,6 +35,8 @@ typedef int SOCKET;
typedef int osiSockIoctl_t;
typedef int osiSocklen_t;
typedef int osiSockOptMcastLoop_t;
typedef int osiSockOptMcastTTL_t;
#define FD_IN_FDSET(FD) ((FD)<FD_SETSIZE&&(FD)>=0)
#ifndef SHUT_RD
#define SHUT_RD 0
@@ -55,6 +55,18 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val
}
}
/*
* Unset an environment variable
* Using putenv with a an existing name but without "=..." deletes
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
if (getenv(name) != NULL)
putenv((char*)name);
}
/*
* Show the value of the specified, or all, environment variables
*/
@@ -37,6 +37,7 @@ typedef int SOCKET;
typedef int osiSockIoctl_t;
typedef socklen_t osiSocklen_t;
typedef int osiSockOptMcastLoop_t;
typedef unsigned char osiSockOptMcastTTL_t;
#define FD_IN_FDSET(FD) ((FD)<FD_SETSIZE)
+10
View File
@@ -36,6 +36,16 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val
setenv(name, value, 1);
}
/*
* Unset an environment variable
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
unsetenv(name);
}
/*
* Show the value of the specified, or all, environment variables
*/
+1
View File
@@ -33,6 +33,7 @@ typedef int SOCKET;
typedef int osiSockIoctl_t;
typedef socklen_t osiSocklen_t;
typedef int osiSockOptMcastLoop_t;
typedef unsigned char osiSockOptMcastTTL_t;
#define FD_IN_FDSET(FD) ((FD)<FD_SETSIZE)
@@ -0,0 +1,62 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* osdEnv.c */
/*
* Author: Eric Norum
* Date: May 7, 2001
*
* Routines to modify/display environment variables and EPICS parameters
*
*/
#include <stdlib.h>
#include <stdio.h>
#define epicsExportSharedSymbols
#include "epicsStdio.h"
#include "envDefs.h"
#include "osiUnistd.h"
#include "iocsh.h"
/*
* Set the value of an environment variable
*/
epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value)
{
iocshEnvClear(name);
setenv(name, value, 1);
}
/*
* Unset an environment variable
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
iocshEnvClear(name);
unsetenv(name);
}
/*
* Show the value of the specified, or all, environment variables
*/
epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name)
{
if (name == NULL) {
extern char **environ;
char **sp;
for (sp = environ ; (sp != NULL) && (*sp != NULL) ; sp++)
printf ("%s\n", *sp);
}
else {
const char *cp = getenv (name);
if (cp == NULL)
printf ("%s is not an environment variable.\n", name);
else
printf ("%s=%s\n", name, cp);
}
}
@@ -43,6 +43,7 @@ typedef int osiSockIoctl_t;
typedef int osiSocklen_t;
#endif
typedef char osiSockOptMcastLoop_t;
typedef unsigned char osiSockOptMcastTTL_t;
#define DOES_NOT_ACCEPT_ZERO_LENGTH_UDP
@@ -51,6 +51,25 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val
}
}
/*
* Unset an environment variable
* Basically destroy the name of that variable because vxWorks does not
* support to really unset an environment variable.
*/
epicsShareFunc void epicsShareAPI epicsEnvUnset (const char *name)
{
char* var;
if (!name) return;
iocshEnvClear(name);
var = getenv(name);
if (!var) return;
var -= strlen(name);
var --;
*var = 0;
}
/*
* Show the value of the specified, or all, environment variables
*/
@@ -66,6 +66,7 @@ typedef int SOCKET;
typedef int osiSockIoctl_t;
typedef int osiSocklen_t;
typedef int osiSockOptMcastLoop_t;
typedef char osiSockOptMcastTTL_t;
#define FD_IN_FDSET(FD) ((FD)<FD_SETSIZE&&(FD)>=0)
+22 -5
View File
@@ -40,17 +40,19 @@ static struct {
static epicsThreadOnceId onceId = EPICS_THREAD_ONCE_INIT;
#if defined(CLOCK_REALTIME) && !defined(_WIN32)
/* This code is not used on systems without Posix CLOCK_REALTIME such
* as Darwin, but the only way to detect that is from the OS headers,
* so the Makefile can't exclude building this file on those systems.
#ifdef CLOCK_REALTIME
/* 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.
*/
/* Forward references */
static int ClockTimeGetCurrent(epicsTimeStamp *pDest);
static void ClockTimeSync(void *dummy);
#if defined(vxWorks) || defined(__rtems__)
static void ClockTimeSync(void *dummy);
#endif
/* ClockTime_Report iocsh command */
static const iocshArg ReportArg0 = { "interest_level", iocshArgArgv};
@@ -98,12 +100,18 @@ void ClockTime_Init(int synchronize)
if (synchronize == CLOCKTIME_SYNC) {
if (ClockTimePvt.synchronize == CLOCKTIME_NOSYNC) {
#if defined(vxWorks) || defined(__rtems__)
/* Start synchronizing */
ClockTimePvt.synchronize = synchronize;
epicsThreadCreate("ClockTimeSync", epicsThreadPriorityHigh,
epicsThreadGetStackSize(epicsThreadStackSmall),
ClockTimeSync, NULL);
#else
errlogPrintf("Clock synchronization must be performed by the OS\n");
#endif
}
else {
/* No change, sync thread should already be running */
@@ -139,6 +147,7 @@ void ClockTime_GetProgramStart(epicsTimeStamp *pDest)
/* Synchronization thread */
#if defined(vxWorks) || defined(__rtems__)
static void ClockTimeSync(void *dummy)
{
taskwdInsert(0, NULL, NULL);
@@ -177,6 +186,7 @@ static void ClockTimeSync(void *dummy)
ClockTimePvt.synchronized = 0;
taskwdRemove(0);
}
#endif
/* Time Provider Routine */
@@ -188,6 +198,7 @@ static int ClockTimeGetCurrent(epicsTimeStamp *pDest)
/* If a Hi-Res clock is available and works, use it */
#ifdef CLOCK_REALTIME_HR
clock_gettime(CLOCK_REALTIME_HR, &clockNow) &&
/* Note: Uses the lo-res clock below if the above call fails */
#endif
clock_gettime(CLOCK_REALTIME, &clockNow);
@@ -195,9 +206,15 @@ static int ClockTimeGetCurrent(epicsTimeStamp *pDest)
clockNow.tv_sec < POSIX_TIME_AT_EPICS_EPOCH) {
clockNow.tv_sec = POSIX_TIME_AT_EPICS_EPOCH + 86400;
clockNow.tv_nsec = 0;
#if defined(vxWorks) || defined(__rtems__)
clock_settime(CLOCK_REALTIME, &clockNow);
errlogPrintf("WARNING: OS Clock time was read before being set.\n"
"Using 1990-01-02 00:00:00.000000 UTC\n");
#else
errlogPrintf("WARNING: OS Clock pre-dates the EPICS epoch!\n"
"Using 1990-01-02 00:00:00.000000 UTC\n");
#endif
}
epicsTimeFromTimespec(pDest, &clockNow);