Commit Graph

64 Commits

Author SHA1 Message Date
Andrew Johnson f4528ff5e1 libCom: Fix msgbufGetNode() in errlog.c
Systems that generate large numbers of errlog messages or have a slow
message listener could overwrite older messages in the message buffer
after the buffer wraps.  This also corrects and annotates the test
code to describe what's being checked.
2011-03-01 15:03:33 -06:00
Michael Davidsaver 6170dc9406 libCom: Fix errlogPrintf() assert fail at shutdown
If errlogPrintf() gets called during shutdown, it can cause a
recursive assert failure.

Fixes lp:693534
2011-01-07 10:24:31 -06:00
Andrew Johnson c503a03f37 libCom/errlog: Clean up possible problem at shutdown.
Don't use epicsMutexMustLock() in msgbufGetFree().
When we're shutting down, the pvtData.msgQueueLock gets destroyed.
This makes msgbufGetFree() return NULL if the lock is dead.
The epicsMutexMustLock() routine asserts(), which recurses...
2010-11-15 15:46:40 -06:00
Andrew Johnson 9678b69c1e libCom/errlog: Rewrote msgbufGetNode() to use buffer better.
Michael Davidsaver pointed out that the original algorithm used is
dumb, it can't reuse empty space at the beginning until all messages
have been drained.  This new version can, and is more efficient.
2010-09-23 15:41:55 -05:00
Michael Davidsaver aee66600ef errPrintf() newline fix.
errPrintf() was adding a newline when writing to the err log buffer,
but not when printing to the screen.  This results in the error
message running together with the next line.  Added a newline to the
stderr output.
2010-09-01 14:56:51 -05:00
Andrew Johnson 6ece3235c9 Added libCom/test code for epicsThreadOnce() implementations.
Also fixed subsystems that were not using epicsThreadOnce correctly.
2010-04-26 15:48:42 -05:00
Andrew Johnson d84d198733 Initialize the errSym table as part of errlogInit rather than doing it
later in an error path, when we might have already run out of memory!
2009-06-19 18:24:22 +00:00
Ralph Lange 7fccc59fe9 ANSIfication of stuff (mostly missing argument types in declarations) 2009-04-03 17:46:26 +00:00
Andrew Johnson ffe38fffb8 Don't forget to flush! 2009-01-28 21:16:39 +00:00
Andrew Johnson c85052de6c Fix errlogPrint and errlogVprintf so the latter outputs to the console. 2009-01-28 21:05:34 +00:00
Andrew Johnson 12e4ad3c5a Cleanup. Handle re-initialization during shutdown gracefully. 2008-12-10 21:43:36 +00:00
Andrew Johnson 9cd14f0cc4 Send errlog output to stderr rather than stdout, from J Lewis Muir. 2008-07-10 18:04:10 +00:00
Andrew Johnson d7d3bf4a13 Added an errlogInit2() routine to allow an enlarged maximum message size to be
specified at initialization time.
2006-11-08 22:14:21 +00:00
Jeff Hill 319e001d1b no longer an owner of this code 2005-03-22 21:49:34 +00:00
Marty Kraimer 3fe2c5f343 errlog crashes if called from interruot context 2005-03-17 20:41:00 +00:00
Marty Kraimer b916c750d7 do not call vfprintf twice in same routine. powerPC crashes 2005-02-15 20:02:01 +00:00
Marty Kraimer 262901c567 call epicsAtExit from errlogThread 2004-09-16 11:25:09 +00:00
Marty Kraimer 63f139adc5 epicsExit and epicsStdioRedirect 2004-08-27 16:04:26 +00:00
Marty Kraimer 83adcfbaea implement atexit to cleanup 2004-08-03 18:17:56 +00:00
Marty Kraimer 12b20f2398 More changes for OkToBlock 2004-07-16 11:33:53 +00:00
Marty Kraimer 4324145435 dont printf unless pvtData.toConsole 2004-07-15 14:04:29 +00:00
Marty Kraimer 1b20ea0e6a wrong logic on msgbufGetFree(isOkToBlock) 2004-07-14 13:22:28 +00:00
Marty Kraimer f54d1ca30a epicsThreadIsOkToBlock epicsThreadSetOkToBlock only for calling thread 2004-07-13 13:35:35 +00:00
Marty Kraimer f2fc8f8838 ShellContext=>OkToBlock 2004-07-09 17:53:54 +00:00
Marty Kraimer e9f54b70d9 if shellContext call printf from initial thread 2004-07-09 16:06:51 +00:00
W. Eric Norum dfccee739f Clean up 'truncated' message.
Ensure that truncated errrlogMessage output is reported as such.
2003-09-17 19:35:45 +00:00
W. Eric Norum d158974870 Use epicsVsnprintf to eliminate possibility of buffer overflows. 2003-09-17 18:51:44 +00:00
W. Eric Norum 2e922d7195 Move format-string checking conditional to cxxCompilerDependencies. 2003-09-17 14:43:26 +00:00
Marty Kraimer 00c9d22936 suppress extra console message from logMsg 2003-08-06 18:17:30 +00:00
Marty Kraimer 26fac718bf set BUFFER_EXTRA_BYTES = MAX_MESSAGE_SIZE 2003-04-04 16:29:29 +00:00
Jeff Hill d7c25d1554 removed epicsShareAPIV 2003-03-27 21:02:27 +00:00
Marty Kraimer 652d3a41d8 use epicsVsnprintf instead of vsprint; allow more extra bytes because vxWorks subject to buffer overflow 2003-03-25 17:09:16 +00:00
Jeff Hill 950d2c0b9d 1) depricated errSymFind function because errSymLookup below provides a
better interface
2) added errSymLookup function with these improvements
o  receive a buffer length from user and therefore never overwrite the users buffer
o return void and always copy a string into the users buffer. If the error code cant
be found then copy in a message with the error code's raw numbers in it.
3) removed prototypes for nonexistent fuinctions from header file
2002-08-29 16:45:16 +00:00
Janet B. Anderson 93b0bf478d Updated license comments. 2002-07-12 21:35:43 +00:00
Marty Kraimer d98e84cd6f errlogFlush must call errlogInit 2002-07-12 11:15:58 +00:00
Marty Kraimer 02c8f06c7f call errlogFlush before terminating 2002-07-09 18:58:54 +00:00
Marty Kraimer 4e220d8fd6 call atexit only if successful 2002-02-28 15:34:28 +00:00
Marty Kraimer 5a3e870629 add atexit to flush messages 2002-02-07 20:33:26 +00:00
Marty Kraimer f4b0c741a1 change errlogStop to errlogFlush 2001-04-05 14:42:00 +00:00
Marty Kraimer 857c4a9545 add errlogStop; remove old sytle C function prototypes 2001-04-05 14:32:50 +00:00
Marty Kraimer e347cbd2e6 osiInterrupt=>epicsInterrupt; epicsThreadInit now static 2001-01-22 20:10:19 +00:00
Marty Kraimer dbe9c8e75f changes for osiThread=>epicsThread 2001-01-18 19:08:14 +00:00
Marty Kraimer cfe2ed5f17 replace osiSem by epicsMutex/epiceEvent 2001-01-12 16:13:53 +00:00
Jeff Hill a73125ccc6 dont base priority on the server's priority 2000-06-14 21:38:45 +00:00
Marty Kraimer d6bf15feae changes in thread priorities 2000-06-14 14:35:09 +00:00
Marty Kraimer a13bf6cc0e prevent recursive calls if errlogInit fails 2000-03-08 18:49:56 +00:00
William Lupton 5324e009c6 used new threadOnce() routine 2000-02-29 20:41:49 +00:00
William Lupton 8c60195f4b various, mostly posix, thread mods 2000-02-26 03:11:42 +00:00
Jeff Hill 9f529db910 added missing argument to threadSuspend() and made errVerbose
visible outside of WIN32 DLL
2000-02-07 20:35:20 +00:00
Marty Kraimer 8d6c6f7e1d latest version of semBinary 2000-02-04 14:43:58 +00:00