tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c- Extension
.c- Size
- 4615 bytes
- Lines
- 168
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
errno.hgetopt.hlimits.hpthread.hsignal.hstdio.hstdlib.hstring.hatomic.hfutextest.hkselftest_harness.h
Detected Declarations
function create_rt_threadfunction handle_signalfunction TEST
Annotated Snippet
if (res > 0) {
atomic_set(&requeued, 1);
break;
} else if (res < 0) {
ksft_exit_fail_msg("FUTEX_CMP_REQUEUE_PI failed\n");
}
}
ksft_print_dbg_msg("m4:f2: %x\n", f2);
/*
* Signal the waiter after requeue, waiter should return from
* futex_wait_requeue_pi() with EWOULDBLOCK. Join the thread here so the
* futex_unlock_pi() can't happen before the signal wakeup is detected
* in the kernel.
*/
ksft_print_dbg_msg("Issuing SIGUSR1 to waiter\n");
pthread_kill(waiter, SIGUSR1);
ksft_print_dbg_msg("Waiting for waiter to return\n");
pthread_join(waiter, NULL);
ksft_print_dbg_msg("Calling FUTEX_UNLOCK_PI on mutex=%x @ %p\n", f2, &f2);
futex_unlock_pi(&f2, FUTEX_PRIVATE_FLAG);
ksft_print_dbg_msg("m5:f2: %x\n", f2);
}
TEST_HARNESS_MAIN
Annotation
- Immediate include surface: `errno.h`, `getopt.h`, `limits.h`, `pthread.h`, `signal.h`, `stdio.h`, `stdlib.h`, `string.h`.
- Detected declarations: `function create_rt_thread`, `function handle_signal`, `function TEST`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.