Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
74aa649b
Commit
74aa649b
authored
Feb 23, 2017
by
Alessandro Rubini
Committed by
Adam Wujek
Feb 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/assert: report to syslog if syslog is there
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
9336a054
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
13 deletions
+31
-13
assert.c
lib/assert.c
+31
-13
No files found.
lib/assert.c
View file @
74aa649b
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include <wrc.h>
#include "ipv4.h"
#ifdef CONFIG_SYSLOG
# define HAS_SYSLOG 1
#else
# define HAS_SYSLOG 0
#endif
void
panic
(
const
char
*
fmt
,
...)
{
va_list
args
;
char
message
[
128
];
while
(
1
)
{
pp_printf
(
"Panic: "
);
strcpy
(
message
,
"Panic: "
);
va_start
(
args
,
fmt
);
vprintf
(
fmt
,
args
);
pp_vsprintf
(
message
+
7
,
fmt
,
args
);
va_end
(
args
);
if
(
HAS_SYSLOG
)
syslog_report
(
message
);
while
(
1
)
{
pp_printf
(
message
);
usleep
(
1000
*
1000
);
}
}
...
...
@@ -19,17 +33,21 @@ void __assert(const char *func, int line, int forever,
const
char
*
fmt
,
...)
{
va_list
args
;
char
message
[
200
];
int
more
=
fmt
&&
fmt
[
0
];
while
(
1
)
{
pp_printf
(
"Assertion failed (%s:%i)"
,
func
,
line
);
if
(
fmt
&&
fmt
[
0
])
{
pp_printf
(
": "
);
pp_sprintf
(
message
,
"Assertion failed (%s:%i)%s"
,
func
,
line
,
more
?
": "
:
"
\n
"
);
if
(
more
)
{
va_start
(
args
,
fmt
);
vprintf
(
fmt
,
args
);
pp_vsprintf
(
message
+
strlen
(
message
),
fmt
,
args
);
va_end
(
args
);
}
else
{
pp_printf
(
".
\n
"
);
}
if
(
HAS_SYSLOG
)
syslog_report
(
message
);
while
(
1
)
{
pp_printf
(
message
);
if
(
!
forever
)
break
;
usleep
(
1000
*
1000
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment