tools/testing/selftests/timers/set-2038.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/timers/set-2038.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/timers/set-2038.c- Extension
.c- Size
- 2906 bytes
- Lines
- 133
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdio.hstdlib.hunistd.htime.hsys/time.hinclude/vdso/time64.hkselftest.h
Detected Declarations
function is32bitsfunction settimefunction do_testsfunction main
Annotated Snippet
switch (opt) {
case 'd':
dangerous = 1;
}
}
start = time(0);
/* First test that crazy values don't work */
if (!settime(YEAR_1901)) {
ret = -1;
goto out;
}
if (!settime(YEAR_MAX)) {
ret = -1;
goto out;
}
if (!is32bits() && !settime(YEAR_2262)) {
ret = -1;
goto out;
}
/* Now test behavior near edges */
settime(YEAR_1970);
ret = do_tests();
if (ret)
goto out;
settime(YEAR_2038 - 600);
ret = do_tests();
if (ret)
goto out;
/* The rest of the tests can blowup on 32bit systems */
if (is32bits() && !dangerous)
goto out;
/* Test rollover behavior 32bit edge */
settime(YEAR_2038 - 10);
ret = do_tests();
if (ret)
goto out;
settime(YEAR_2262 - 600);
ret = do_tests();
out:
/* restore clock */
settime(start);
if (ret)
ksft_exit_fail();
ksft_exit_pass();
}
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `unistd.h`, `time.h`, `sys/time.h`, `include/vdso/time64.h`, `kselftest.h`.
- Detected declarations: `function is32bits`, `function settime`, `function do_tests`, `function main`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.