diff options
author | Michael Tuexen <tuexen@fh-muenster.de> | 2015-11-14 11:32:00 +0100 |
---|---|---|
committer | Michael Tuexen <tuexen@fh-muenster.de> | 2015-11-14 18:53:24 +0100 |
commit | 675628ad3c46560c2434f065c717b92540103187 (patch) | |
tree | 14848a27fd6f68c842fe6314ee19f79b03f44ba6 /usrsctplib/user_environment.h | |
parent | eb07740ef6346aed041afa7014b824e9df619327 (diff) | |
download | usrsctp-675628ad3c46560c2434f065c717b92540103187.tar.gz |
panic() should write a core when using INVARIANTS
Diffstat (limited to 'usrsctplib/user_environment.h')
-rwxr-xr-x | usrsctplib/user_environment.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/usrsctplib/user_environment.h b/usrsctplib/user_environment.h index 33d4f01b..306ff6b5 100755 --- a/usrsctplib/user_environment.h +++ b/usrsctplib/user_environment.h @@ -85,20 +85,26 @@ extern u_short ip_id; #if defined(__Userspace_os_Linux) #define IPV6_VERSION 0x60 #endif + #if defined(INVARIANTS) -#define panic(...) \ - do { \ +#include <stdlib.h> + +static inline void +terminate_non_graceful(void) { + abort(); +} + +#define panic(...) \ + do { \ SCTP_PRINTF(__VA_ARGS__);\ - exit(1); \ + SCTP_PRINTF("\n"); \ + terminate_non_graceful();\ } while (0) -#endif -#if defined(INVARIANTS) #define KASSERT(cond, args) \ do { \ if (!(cond)) { \ - printf args ;\ - exit(1); \ + panic args ;\ } \ } while (0) #else |