tools/testing/selftests/futex/include/futex2test.h
Source file repositories/reference/linux-study-clean/tools/testing/selftests/futex/include/futex2test.h
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/futex/include/futex2test.h- Extension
.h- Size
- 2095 bytes
- Lines
- 99
- 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
linux/time_types.hstdint.h
Detected Declarations
struct futex_waitvstruct futex32_numafunction futex_waitvfunction futex_waitfunction futex2_wake
Annotated Snippet
struct futex_waitv {
__u64 val;
__u64 uaddr;
__u32 flags;
__u32 __reserved;
};
#endif
#ifndef __NR_futex_wake
#define __NR_futex_wake 454
#endif
#ifndef __NR_futex_wait
#define __NR_futex_wait 455
#endif
#ifndef FUTEX2_SIZE_U32
#define FUTEX2_SIZE_U32 0x02
#endif
#ifndef FUTEX2_NUMA
#define FUTEX2_NUMA 0x04
#endif
#ifndef FUTEX2_MPOL
#define FUTEX2_MPOL 0x08
#endif
#ifndef FUTEX2_PRIVATE
#define FUTEX2_PRIVATE FUTEX_PRIVATE_FLAG
#endif
#ifndef FUTEX2_NO_NODE
#define FUTEX_NO_NODE (-1)
#endif
#ifndef FUTEX_32
#define FUTEX_32 FUTEX2_SIZE_U32
#endif
struct futex32_numa {
futex_t futex;
futex_t numa;
};
/**
* futex_waitv - Wait at multiple futexes, wake on any
* @waiters: Array of waiters
* @nr_waiters: Length of waiters array
* @flags: Operation flags
* @timo: Optional timeout for operation
*/
static inline int futex_waitv(volatile struct futex_waitv *waiters, unsigned long nr_waiters,
unsigned long flags, struct timespec *timo, clockid_t clockid)
{
struct __kernel_timespec ts = {
.tv_sec = timo->tv_sec,
.tv_nsec = timo->tv_nsec,
};
return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, &ts, clockid);
}
/*
* futex_wait() - block on uaddr with optional timeout
* @val: Expected value
* @flags: FUTEX2 flags
* @timeout: Relative timeout
* @clockid: Clock id for the timeout
*/
static inline int futex2_wait(void *uaddr, long val, unsigned int flags,
struct timespec *timeout, clockid_t clockid)
{
return syscall(__NR_futex_wait, uaddr, val, ~0U, flags, timeout, clockid);
}
/*
* futex2_wake() - Wake a number of futexes
* @nr: Number of threads to wake at most
* @flags: FUTEX2 flags
*/
static inline int futex2_wake(void *uaddr, int nr, unsigned int flags)
{
return syscall(__NR_futex_wake, uaddr, ~0U, nr, flags);
}
Annotation
- Immediate include surface: `linux/time_types.h`, `stdint.h`.
- Detected declarations: `struct futex_waitv`, `struct futex32_numa`, `function futex_waitv`, `function futex_wait`, `function futex2_wake`.
- 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.