Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/assert.c

    rd8de5d3 rc7bbf029  
    3333#include <assert.h>
    3434#include <stdio.h>
    35 #include <io/klog.h>
    3635#include <stdlib.h>
    37 #include <atomic.h>
    3836#include <stacktrace.h>
    39 #include <stdint.h>
    40 
    41 static atomic_t failed_asserts = {0};
    4237
    4338void assert_abort(const char *cond, const char *file, unsigned int line)
    4439{
    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 display
    59          * the stack trace. These operations can theoretically trigger nested
    60          * assertions.
    61          */
    6240        printf("Assertion failed (%s) in file \"%s\", line %u.\n",
    6341            cond, file, line);
    6442        stacktrace_print();
    65        
    6643        abort();
    6744}
Note: See TracChangeset for help on using the changeset viewer.