include/linux/posix-timers.h
Source file repositories/reference/linux-study-clean/include/linux/posix-timers.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/posix-timers.h- Extension
.h- Size
- 7841 bytes
- Lines
- 266
- 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
linux/alarmtimer.hlinux/list.hlinux/mutex.hlinux/pid.hlinux/posix-timers_types.hlinux/rcuref.hlinux/spinlock.hlinux/timerqueue.hlinux/signal_types.h
Detected Declarations
struct kernel_siginfostruct task_structstruct sigqueuestruct k_itimerstruct cpu_timerstruct cpu_timerstruct k_itimerfunction make_process_cpuclockfunction make_thread_cpuclockfunction fd_to_clockidfunction clockid_to_fdfunction clockid_aux_validfunction cpu_timer_enqueuefunction cpu_timer_queuedfunction cpu_timer_dequeuefunction cpu_timer_getexpiresfunction cpu_timer_setexpiresfunction posix_cputimers_initfunction posix_cputimers_rt_watchdogfunction posix_cputimers_initfunction posixtimer_free_timerfunction clear_posix_cputimers_workfunction posixtimer_putreffunction posixtimer_sigqueue_getreffunction posixtimer_sigqueue_putreffunction posixtimer_validfunction posixtimer_sigqueue_getref
Annotated Snippet
struct cpu_timer {
struct timerqueue_node node;
struct timerqueue_head *head;
struct pid *pid;
struct list_head elist;
bool firing;
bool nanosleep;
struct task_struct __rcu *handling;
};
static inline bool cpu_timer_enqueue(struct timerqueue_head *head,
struct cpu_timer *ctmr)
{
ctmr->head = head;
return timerqueue_add(head, &ctmr->node);
}
static inline bool cpu_timer_queued(struct cpu_timer *ctmr)
{
return !!ctmr->head;
}
static inline bool cpu_timer_dequeue(struct cpu_timer *ctmr)
{
if (cpu_timer_queued(ctmr)) {
timerqueue_del(ctmr->head, &ctmr->node);
ctmr->head = NULL;
return true;
}
return false;
}
static inline u64 cpu_timer_getexpires(struct cpu_timer *ctmr)
{
return ctmr->node.expires;
}
static inline void cpu_timer_setexpires(struct cpu_timer *ctmr, u64 exp)
{
ctmr->node.expires = exp;
}
static inline void posix_cputimers_init(struct posix_cputimers *pct)
{
memset(pct, 0, sizeof(*pct));
pct->bases[0].nextevt = U64_MAX;
pct->bases[1].nextevt = U64_MAX;
pct->bases[2].nextevt = U64_MAX;
}
void posix_cputimers_group_init(struct posix_cputimers *pct, u64 cpu_limit);
static inline void posix_cputimers_rt_watchdog(struct posix_cputimers *pct,
u64 runtime)
{
pct->bases[CPUCLOCK_SCHED].nextevt = runtime;
}
void posixtimer_rearm_itimer(struct task_struct *p);
bool posixtimer_init_sigqueue(struct sigqueue *q);
void posixtimer_send_sigqueue(struct k_itimer *tmr);
bool posixtimer_deliver_signal(struct kernel_siginfo *info, struct sigqueue *timer_sigq);
void posixtimer_free_timer(struct k_itimer *timer);
long posixtimer_create_prctl(unsigned long ctrl);
/* Init task static initializer */
#define INIT_CPU_TIMERBASE(b) { \
.nextevt = U64_MAX, \
}
#define INIT_CPU_TIMERBASES(b) { \
INIT_CPU_TIMERBASE(b[0]), \
INIT_CPU_TIMERBASE(b[1]), \
INIT_CPU_TIMERBASE(b[2]), \
}
#define INIT_CPU_TIMERS(s) \
.posix_cputimers = { \
.bases = INIT_CPU_TIMERBASES(s.posix_cputimers.bases), \
},
#else
struct cpu_timer { };
#define INIT_CPU_TIMERS(s)
static inline void posix_cputimers_init(struct posix_cputimers *pct) { }
static inline void posix_cputimers_group_init(struct posix_cputimers *pct,
u64 cpu_limit) { }
static inline void posixtimer_rearm_itimer(struct task_struct *p) { }
static inline bool posixtimer_deliver_signal(struct kernel_siginfo *info,
struct sigqueue *timer_sigq) { return false; }
static inline void posixtimer_free_timer(struct k_itimer *timer) { }
Annotation
- Immediate include surface: `linux/alarmtimer.h`, `linux/list.h`, `linux/mutex.h`, `linux/pid.h`, `linux/posix-timers_types.h`, `linux/rcuref.h`, `linux/spinlock.h`, `linux/timerqueue.h`.
- Detected declarations: `struct kernel_siginfo`, `struct task_struct`, `struct sigqueue`, `struct k_itimer`, `struct cpu_timer`, `struct cpu_timer`, `struct k_itimer`, `function make_process_cpuclock`, `function make_thread_cpuclock`, `function fd_to_clockid`.
- 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.