Function report |
Source Code:lib\fault-inject.c |
Create Date:2022-07-28 07:11:34 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:This code is stolen from failmalloc-1.0* http://www.nongnu.org/failmalloc/
Proto:bool should_fail(struct fault_attr *attr, ssize_t size)
Type:bool
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct fault_attr * | attr | |
| ssize_t | size |
| 105 | If in_task() Then |
| 108 | If fail_nth Then |
| 109 | If Not WRITE_ONCE(fail_nth, fail_nth - 1) Then Go to fail |
| 112 | Return false |
| 117 | If probability == 0 Then Return false |
| 120 | If task_filter && Not fail_task(attr, current process) Then Return false |
| 123 | If atomic_read( & times) == 0 Then Return false |
| 126 | If atomic_read( & space) > size Then |
| 127 | atomic_sub(size, & space) |
| 128 | Return false |
| 131 | If interval > 1 Then |
| 137 | If probability <= prandom_u32() % 100 Then Return false |
| 140 | If Not fail_stacktrace(attr) Then Return false |
| 143 | fail : |
| 146 | If atomic_read( & times) != -1 Then atomic_dec_not_zero( & times) |
| 149 | Return true |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |