This is Unofficial EPICS BASE Doxygen Site
osdAssert.c
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 /*
10  * Author: Jeffrey Hill
11  * Date: 02-27-95
12  */
13 
14 #include "dbDefs.h"
15 #include "epicsPrint.h"
16 #include "epicsVersion.h"
17 #include "epicsAssert.h"
18 #include "epicsThread.h"
19 #include "epicsTime.h"
20 #include "cantProceed.h"
21 #include "epicsStackTrace.h"
22 
23 
24 void epicsAssert (const char *pFile, const unsigned line,
25  const char *pExp, const char *pAuthorName)
26 {
27  epicsTimeStamp current;
28 
29  errlogPrintf("\n\n\n"
30  "A call to 'assert(%s)'\n"
31  " by thread '%s' failed in %s line %u.\n",
32  pExp, epicsThreadGetNameSelf(), pFile, line);
33 
35 
36  errlogPrintf("EPICS Release %s.\n", epicsReleaseVersion);
37 
38  if (epicsTimeGetCurrent(&current) == 0) {
39  char date[64];
40 
41  epicsTimeToStrftime(date, sizeof(date),
42  "%Y-%m-%d %H:%M:%S.%f %Z", &current);
43  errlogPrintf("Local time is %s\n", date);
44  }
45 
46  if (!pAuthorName) {
47  pAuthorName = "the author";
48  }
49  errlogPrintf("Please E-mail this message to %s or to tech-talk@aps.anl.gov\n",
50  pAuthorName);
51 
52  errlogPrintf("Calling epicsThreadSuspendSelf()\n");
54 }
An EPICS-specific replacement for ANSI C's assert.
LIBCOM_API const char *epicsStdCall epicsThreadGetNameSelf(void)
Definition: osdThread.c:846
void epicsAssert(const char *pFile, const unsigned line, const char *pExp, const char *pAuthorName)
Definition: osdAssert.c:24
Miscellaneous macro definitions.
LIBCOM_API size_t epicsStdCall epicsTimeToStrftime(char *pBuff, size_t bufLength, const char *pFormat, const epicsTimeStamp *pTS)
Convert epicsTimeStamp to string. See epicsTime::strftime()
Definition: epicsTime.cpp:1120
LIBCOM_API void epicsStdCall epicsThreadSuspendSelf(void)
Definition: osdThread.c:664
char * line
Definition: reader.c:25
int epicsStdCall epicsTimeGetCurrent(epicsTimeStamp *pDest)
Get current time into *pDest.
int errlogPrintf(const char *pFormat,...)
Definition: errlog.c:105
void epicsStackTrace(void)
void date(const char *format)
EPICS time stamp, for use from C code.
Definition: epicsTime.h:33
Routines for code that can't continue or return after an error.
EPICS time-stamps (epicsTimeStamp), epicsTime C++ class and C functions for handling wall-clock times...
C++ and C descriptions for a thread.