Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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 activityDownload SCCTChinese

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:

TypeParameterName
struct fault_attr *attr
ssize_tsize
105  If in_task() Then
106  fail_nth = READ_ONCE(fail_nth)
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
132  count++
133  If count % interval Then Return false
137  If probability <= prandom_u32() % 100 Then Return false
140  If Not fail_stacktrace(attr) Then Return false
143  fail :
144  fail_dump(attr)
146  If atomic_read( & times) != -1 Then atomic_dec_not_zero( & times)
149  Return true