Changes in uspace/lib/c/generic/assert.c [d8de5d3:c7bbf029] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/assert.c
rd8de5d3 rc7bbf029 33 33 #include <assert.h> 34 34 #include <stdio.h> 35 #include <io/klog.h>36 35 #include <stdlib.h> 37 #include <atomic.h>38 36 #include <stacktrace.h> 39 #include <stdint.h>40 41 static atomic_t failed_asserts = {0};42 37 43 38 void assert_abort(const char *cond, const char *file, unsigned int line) 44 39 { 45 /*46 * Send the message safely to klog. Nested asserts should not occur.47 */48 klog_printf("Assertion failed (%s) in file \"%s\", line %u.\n",49 cond, file, line);50 51 /*52 * Check if this is a nested or parallel assert.53 */54 if (atomic_postinc(&failed_asserts))55 abort();56 57 /*58 * Attempt to print the message to standard output and display59 * the stack trace. These operations can theoretically trigger nested60 * assertions.61 */62 40 printf("Assertion failed (%s) in file \"%s\", line %u.\n", 63 41 cond, file, line); 64 42 stacktrace_print(); 65 66 43 abort(); 67 44 }
Note:
See TracChangeset
for help on using the changeset viewer.