The JSON Support changes the size of the central data structure that is pushed between users of caPutLog and the caPutLog task, based on a macro value:
|
typedef union { |
|
epicsInt8 v_int8; |
|
epicsUInt8 v_uint8; |
|
epicsInt16 v_int16; |
|
epicsUInt16 v_uint16; |
|
epicsInt32 v_int32; |
|
epicsUInt32 v_uint32; |
|
#ifdef DBR_INT64 |
|
epicsInt64 v_int64; |
|
epicsUInt64 v_uint64; |
|
#endif |
|
epicsFloat32 v_float; |
|
epicsFloat64 v_double; |
|
char v_string[MAX_STRING_SIZE]; |
|
|
|
#if JSON_AND_ARRAYS_SUPPORTED |
|
epicsInt8 a_int8[MAX_ARRAY_SIZE_BYTES/sizeof(epicsInt8)]; |
|
epicsUInt8 a_uint8[MAX_ARRAY_SIZE_BYTES/sizeof(epicsUInt8)]; |
|
epicsInt16 a_int16[MAX_ARRAY_SIZE_BYTES/sizeof(epicsInt16)]; |
|
epicsUInt16 a_uint16[MAX_ARRAY_SIZE_BYTES/sizeof(epicsUInt16)]; |
|
epicsInt32 a_int32[MAX_ARRAY_SIZE_BYTES/sizeof(epicsInt32)]; |
|
epicsUInt32 a_uint32[MAX_ARRAY_SIZE_BYTES/sizeof(epicsUInt32)]; |
|
epicsInt64 a_int64[MAX_ARRAY_SIZE_BYTES/sizeof(epicsInt64)]; |
|
epicsUInt64 a_uint64[MAX_ARRAY_SIZE_BYTES/sizeof(epicsUInt64)]; |
|
epicsFloat32 a_float[MAX_ARRAY_SIZE_BYTES/sizeof(epicsFloat32)]; |
|
epicsFloat64 a_double[MAX_ARRAY_SIZE_BYTES/sizeof(epicsFloat64)]; |
|
char a_string[MAX_ARRAY_SIZE_BYTES/MAX_STRING_SIZE][MAX_STRING_SIZE]; |
|
#endif |
|
} VALUE; |
That macro is only defined in the local Makefile:
|
# Add support for json format and arrays |
|
# This requires EPICS base version 7.0.1 or higher |
|
ifdef BASE_7_0 |
|
USR_CPPFLAGS += -DJSON_AND_ARRAYS_SUPPORTED |
|
caPutLog_SRCS += caPutJsonLogTask.cpp |
|
caPutLog_SRCS += caPutJsonLogShellCommands.cpp |
|
INC += caPutJsonLogTask.h |
|
DBD += caPutJsonLog.dbd |
|
endif |
Any user application that does not define the JSON_AND_ARRAYS_SUPPORTED macro in the same way as the caPutLog module will use a different structure definition and size for sending a log message than the caPutLog module that receives it.
This is wrong. (And not documented.) It will lead to corrupted data, maybe even crashes.
Instead, caPutLog needs to generate a CONFIG snippet that gets included by applications that use the module - allowing the user application always to use the same setting as the module.
The JSON Support changes the size of the central data structure that is pushed between users of caPutLog and the caPutLog task, based on a macro value:
caPutLog/caPutLogApp/caPutLogTask.h
Lines 23 to 51 in 079dc77
That macro is only defined in the local Makefile:
caPutLog/caPutLogApp/Makefile
Lines 30 to 38 in 079dc77
Any user application that does not define the
JSON_AND_ARRAYS_SUPPORTEDmacro in the same way as the caPutLog module will use a different structure definition and size for sending a log message than the caPutLog module that receives it.This is wrong. (And not documented.) It will lead to corrupted data, maybe even crashes.
Instead, caPutLog needs to generate a CONFIG snippet that gets included by applications that use the module - allowing the user application always to use the same setting as the module.