tools/testing/selftests/timers/alarmtimer-suspend.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/timers/alarmtimer-suspend.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/timers/alarmtimer-suspend.c- Extension
.c- Size
- 4021 bytes
- Lines
- 165
- 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.hunistd.htime.hstring.hsignal.hstdlib.hpthread.hinclude/vdso/time64.herrno.hkselftest.h
Detected Declarations
function timespec_subfunction sigalarmfunction main
Annotated Snippet
if (timer_create(alarm_clock_id, &se, &tm1) == -1) {
printf("timer_create failed, %s unsupported?: %s\n",
clockstring(alarm_clock_id), strerror(errno));
break;
}
clock_gettime(alarm_clock_id, &start_time);
printf("Start time (%s): %ld:%ld\n", clockstring(alarm_clock_id),
start_time.tv_sec, start_time.tv_nsec);
printf("Setting alarm for every %i seconds\n", SUSPEND_SECS);
its1.it_value = start_time;
its1.it_value.tv_sec += SUSPEND_SECS;
its1.it_interval.tv_sec = SUSPEND_SECS;
its1.it_interval.tv_nsec = 0;
timer_settime(tm1, TIMER_ABSTIME, &its1, &its2);
while (alarmcount < 5)
sleep(1); /* First 5 alarms, do nothing */
printf("Starting suspend loops\n");
while (alarmcount < 10) {
int ret;
sleep(3);
ret = system("echo mem > /sys/power/state");
if (ret)
break;
}
timer_delete(tm1);
}
if (final_ret)
ksft_exit_fail();
ksft_exit_pass();
}
Annotation
- Immediate include surface: `stdio.h`, `unistd.h`, `time.h`, `string.h`, `signal.h`, `stdlib.h`, `pthread.h`, `include/vdso/time64.h`.
- Detected declarations: `function timespec_sub`, `function sigalarm`, `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.