aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/posix-timers.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-03 16:14:51 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-03 16:14:51 -0700
commit1b044f1cfc65a7d90b209dfabd57e16d98b58c5b (patch)
treead657c911b563f9176b17578c0b88a1ea9916a02 /include/linux/posix-timers.h
parentMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux (diff)
parenttimers: Make the cpu base lock raw (diff)
downloadwireguard-linux-1b044f1cfc65a7d90b209dfabd57e16d98b58c5b.tar.xz
wireguard-linux-1b044f1cfc65a7d90b209dfabd57e16d98b58c5b.zip
Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner: "A rather large update for timers/timekeeping: - compat syscall consolidation (Al Viro) - Posix timer consolidation (Christoph Helwig / Thomas Gleixner) - Cleanup of the device tree based initialization for clockevents and clocksources (Daniel Lezcano) - Consolidation of the FTTMR010 clocksource/event driver (Linus Walleij) - The usual set of small fixes and updates all over the place" * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (93 commits) timers: Make the cpu base lock raw clocksource/drivers/mips-gic-timer: Fix an error code in 'gic_clocksource_of_init()' clocksource/drivers/fsl_ftm_timer: Unmap region obtained by of_iomap clocksource/drivers/tcb_clksrc: Make IO endian agnostic clocksource/drivers/sun4i: Switch to the timer-of common init clocksource/drivers/timer-of: Fix invalid iomap check Revert "ktime: Simplify ktime_compare implementation" clocksource/drivers: Fix uninitialized variable use in timer_of_init kselftests: timers: Add test for frequency step kselftests: timers: Fix inconsistency-check to not ignore first timestamp time: Add warning about imminent deprecation of CONFIG_GENERIC_TIME_VSYSCALL_OLD time: Clean up CLOCK_MONOTONIC_RAW time handling posix-cpu-timers: Make timespec to nsec conversion safe itimer: Make timeval to nsec conversion range limited timers: Fix parameter description of try_to_del_timer_sync() ktime: Simplify ktime_compare implementation clocksource/drivers/fttmr010: Factor out clock read code clocksource/drivers/fttmr010: Implement delay timer clocksource/drivers: Add timer-of common init routine clocksource/drivers/tcb_clksrc: Save timer context on suspend/resume ...
Diffstat (limited to 'include/linux/posix-timers.h')
-rw-r--r--include/linux/posix-timers.h105
1 files changed, 47 insertions, 58 deletions
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 8c1e43ab14a9..29f1b7f09ced 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -7,6 +7,7 @@
#include <linux/timex.h>
#include <linux/alarmtimer.h>
+struct siginfo;
struct cpu_timer_list {
struct list_head entry;
@@ -48,81 +49,69 @@ struct cpu_timer_list {
#define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD)
#define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3))
-/* POSIX.1b interval timer structure. */
-struct k_itimer {
- struct list_head list; /* free/ allocate list */
- struct hlist_node t_hash;
- spinlock_t it_lock;
- clockid_t it_clock; /* which timer type */
- timer_t it_id; /* timer id */
- int it_overrun; /* overrun on pending signal */
- int it_overrun_last; /* overrun on last delivered signal */
- int it_requeue_pending; /* waiting to requeue this timer */
#define REQUEUE_PENDING 1
- int it_sigev_notify; /* notify word of sigevent struct */
- struct signal_struct *it_signal;
+
+/**
+ * struct k_itimer - POSIX.1b interval timer structure.
+ * @list: List head for binding the timer to signals->posix_timers
+ * @t_hash: Entry in the posix timer hash table
+ * @it_lock: Lock protecting the timer
+ * @kclock: Pointer to the k_clock struct handling this timer
+ * @it_clock: The posix timer clock id
+ * @it_id: The posix timer id for identifying the timer
+ * @it_active: Marker that timer is active
+ * @it_overrun: The overrun counter for pending signals
+ * @it_overrun_last: The overrun at the time of the last delivered signal
+ * @it_requeue_pending: Indicator that timer waits for being requeued on
+ * signal delivery
+ * @it_sigev_notify: The notify word of sigevent struct for signal delivery
+ * @it_interval: The interval for periodic timers
+ * @it_signal: Pointer to the creators signal struct
+ * @it_pid: The pid of the process/task targeted by the signal
+ * @it_process: The task to wakeup on clock_nanosleep (CPU timers)
+ * @sigq: Pointer to preallocated sigqueue
+ * @it: Union representing the various posix timer type
+ * internals. Also used for rcu freeing the timer.
+ */
+struct k_itimer {
+ struct list_head list;
+ struct hlist_node t_hash;
+ spinlock_t it_lock;
+ const struct k_clock *kclock;
+ clockid_t it_clock;
+ timer_t it_id;
+ int it_active;
+ int it_overrun;
+ int it_overrun_last;
+ int it_requeue_pending;
+ int it_sigev_notify;
+ ktime_t it_interval;
+ struct signal_struct *it_signal;
union {
- struct pid *it_pid; /* pid of process to send signal to */
- struct task_struct *it_process; /* for clock_nanosleep */
+ struct pid *it_pid;
+ struct task_struct *it_process;
};
- struct sigqueue *sigq; /* signal queue entry. */
+ struct sigqueue *sigq;
union {
struct {
- struct hrtimer timer;
- ktime_t interval;
+ struct hrtimer timer;
} real;
- struct cpu_timer_list cpu;
+ struct cpu_timer_list cpu;
struct {
- unsigned int clock;
- unsigned int node;
- unsigned long incr;
- unsigned long expires;
- } mmtimer;
- struct {
- struct alarm alarmtimer;
- ktime_t interval;
+ struct alarm alarmtimer;
} alarm;
- struct rcu_head rcu;
+ struct rcu_head rcu;
} it;
};
-struct k_clock {
- int (*clock_getres) (const clockid_t which_clock, struct timespec64 *tp);
- int (*clock_set) (const clockid_t which_clock,
- const struct timespec64 *tp);
- int (*clock_get) (const clockid_t which_clock, struct timespec64 *tp);
- int (*clock_adj) (const clockid_t which_clock, struct timex *tx);
- int (*timer_create) (struct k_itimer *timer);
- int (*nsleep) (const clockid_t which_clock, int flags,
- struct timespec64 *, struct timespec __user *);
- long (*nsleep_restart) (struct restart_block *restart_block);
- int (*timer_set) (struct k_itimer *timr, int flags,
- struct itimerspec64 *new_setting,
- struct itimerspec64 *old_setting);
- int (*timer_del) (struct k_itimer *timr);
-#define TIMER_RETRY 1
- void (*timer_get) (struct k_itimer *timr,
- struct itimerspec64 *cur_setting);
-};
-
-extern struct k_clock clock_posix_cpu;
-extern struct k_clock clock_posix_dynamic;
-
-void posix_timers_register_clock(const clockid_t clock_id, struct k_clock *new_clock);
-
-/* function to call to trigger timer event */
-int posix_timer_event(struct k_itimer *timr, int si_private);
-
-void posix_cpu_timer_schedule(struct k_itimer *timer);
-
void run_posix_cpu_timers(struct task_struct *task);
void posix_cpu_timers_exit(struct task_struct *task);
void posix_cpu_timers_exit_group(struct task_struct *task);
void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
u64 *newval, u64 *oldval);
-long clock_nanosleep_restart(struct restart_block *restart_block);
-
void update_rlimit_cpu(struct task_struct *task, unsigned long rlim_new);
+void posixtimer_rearm(struct siginfo *info);
+
#endif