include/linux/bug.h
Source file repositories/reference/linux-study-clean/include/linux/bug.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/bug.h- Extension
.h- Size
- 2601 bytes
- Lines
- 111
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/bug.hlinux/compiler.hlinux/build_bug.hasm-generic/bug.h
Detected Declarations
struct pt_regsstruct bug_entryenum bug_trap_typefunction is_warning_bugfunction report_bugfunction report_bug_entryfunction bug_get_file_linefunction generic_bug_clear_oncefunction mem_dump_obj
Annotated Snippet
static inline void generic_bug_clear_once(void) {}
#endif /* CONFIG_GENERIC_BUG */
#ifdef CONFIG_PRINTK
void mem_dump_obj(void *object);
#else
static inline void mem_dump_obj(void *object) {}
#endif
/*
* Since detected data corruption should stop operation on the affected
* structures. Return value must be checked and sanely acted on by caller.
*/
static inline __must_check bool check_data_corruption(bool v) { return v; }
#define CHECK_DATA_CORRUPTION(condition, addr, fmt, ...) \
check_data_corruption(({ \
bool corruption = unlikely(condition); \
if (corruption) { \
if (addr) \
mem_dump_obj(addr); \
if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) { \
pr_err(fmt, ##__VA_ARGS__); \
BUG(); \
} else \
WARN(1, fmt, ##__VA_ARGS__); \
} \
corruption; \
}))
#endif /* _LINUX_BUG_H */
Annotation
- Immediate include surface: `asm/bug.h`, `linux/compiler.h`, `linux/build_bug.h`, `asm-generic/bug.h`.
- Detected declarations: `struct pt_regs`, `struct bug_entry`, `enum bug_trap_type`, `function is_warning_bug`, `function report_bug`, `function report_bug_entry`, `function bug_get_file_line`, `function generic_bug_clear_once`, `function mem_dump_obj`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.