diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-11-05 18:47:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-11-05 18:47:50 +0000 |
commit | e1196c2c76e6a4a142a91bb9e0a0fae1a06f68fc (patch) | |
tree | a220e450deca24c69178cd0b0b8aeb0c21dd8792 /src/util | |
parent | bf886ddf525b991c6a11c9bd0be10e9aa0dd1c80 (diff) | |
download | gnunet-e1196c2c76e6a4a142a91bb9e0a0fae1a06f68fc.tar.gz gnunet-e1196c2c76e6a4a142a91bb9e0a0fae1a06f68fc.zip |
introducing GNUNET_abort
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/common_allocation.c | 6 | ||||
-rw-r--r-- | src/util/common_logging.c | 14 | ||||
-rw-r--r-- | src/util/crypto_random.c | 2 | ||||
-rw-r--r-- | src/util/scheduler.c | 4 |
4 files changed, 20 insertions, 6 deletions
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 340ad5334..fd5e993e2 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c | |||
@@ -67,7 +67,7 @@ GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber) | |||
67 | if (ret == NULL) | 67 | if (ret == NULL) |
68 | { | 68 | { |
69 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc"); | 69 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc"); |
70 | abort (); | 70 | GNUNET_abort (); |
71 | } | 71 | } |
72 | return ret; | 72 | return ret; |
73 | } | 73 | } |
@@ -103,7 +103,7 @@ GNUNET_xmemdup_ (const void *buf, size_t size, const char *filename, | |||
103 | if (ret == NULL) | 103 | if (ret == NULL) |
104 | { | 104 | { |
105 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc"); | 105 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc"); |
106 | abort (); | 106 | GNUNET_abort (); |
107 | } | 107 | } |
108 | #ifdef W32_MEM_LIMIT | 108 | #ifdef W32_MEM_LIMIT |
109 | *((size_t *) ret) = size; | 109 | *((size_t *) ret) = size; |
@@ -174,7 +174,7 @@ GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber) | |||
174 | if ((NULL == ptr) && (n > 0)) | 174 | if ((NULL == ptr) && (n > 0)) |
175 | { | 175 | { |
176 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "realloc"); | 176 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "realloc"); |
177 | abort (); | 177 | GNUNET_abort (); |
178 | } | 178 | } |
179 | #ifdef W32_MEM_LIMIT | 179 | #ifdef W32_MEM_LIMIT |
180 | ptr = &((size_t *) ptr)[1]; | 180 | ptr = &((size_t *) ptr)[1]; |
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 101f2fd9f..e96fb8e78 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -260,6 +260,20 @@ resize_logdefs () | |||
260 | logdefs = GNUNET_realloc (logdefs, logdefs_size * sizeof (struct LogDef)); | 260 | logdefs = GNUNET_realloc (logdefs, logdefs_size * sizeof (struct LogDef)); |
261 | } | 261 | } |
262 | 262 | ||
263 | |||
264 | /** | ||
265 | * Abort the process, generate a core dump if possible. | ||
266 | */ | ||
267 | void | ||
268 | GNUNET_abort () | ||
269 | { | ||
270 | #if WINDOWS | ||
271 | DebugBreak(); | ||
272 | #endif | ||
273 | abort(); | ||
274 | } | ||
275 | |||
276 | |||
263 | /** | 277 | /** |
264 | * Utility function - adds a parsed definition to logdefs array. | 278 | * Utility function - adds a parsed definition to logdefs array. |
265 | * | 279 | * |
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c index c74d60f4f..719acf07c 100644 --- a/src/util/crypto_random.c +++ b/src/util/crypto_random.c | |||
@@ -266,7 +266,7 @@ void __attribute__ ((constructor)) GNUNET_CRYPTO_random_init () | |||
266 | _ | 266 | _ |
267 | ("libgcrypt has not the expected version (version %s is required).\n"), | 267 | ("libgcrypt has not the expected version (version %s is required).\n"), |
268 | GCRYPT_VERSION); | 268 | GCRYPT_VERSION); |
269 | abort (); | 269 | GNUNET_abort (); |
270 | } | 270 | } |
271 | #ifdef gcry_fast_random_poll | 271 | #ifdef gcry_fast_random_poll |
272 | gcry_fast_random_poll (); | 272 | gcry_fast_random_poll (); |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 0c4374471..82b888fec 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -676,7 +676,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, struct GNUNET_NETWORK_FDSet *ws) | |||
676 | if (((tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY) != 0) && | 676 | if (((tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY) != 0) && |
677 | (pos->write_fd != -1) && | 677 | (pos->write_fd != -1) && |
678 | (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd))) | 678 | (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd))) |
679 | abort (); // added to ready in previous select loop! | 679 | GNUNET_abort (); // added to ready in previous select loop! |
680 | #if DEBUG_TASKS | 680 | #if DEBUG_TASKS |
681 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Running task: %llu / %p\n", pos->id, | 681 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Running task: %llu / %p\n", pos->id, |
682 | pos->callback_cls); | 682 | pos->callback_cls); |
@@ -852,7 +852,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) | |||
852 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "system"); | 852 | LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "system"); |
853 | #endif | 853 | #endif |
854 | #endif | 854 | #endif |
855 | abort (); | 855 | GNUNET_abort (); |
856 | break; | 856 | break; |
857 | } | 857 | } |
858 | if ((ret == 0) && (timeout.rel_value == 0) && (busy_wait_warning > 16)) | 858 | if ((ret == 0) && (timeout.rel_value == 0) && (busy_wait_warning > 16)) |