linux/kernel/time/itimer.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 1992 Darren Senn
 */

/* These are all the functions necessary to implement itimers */

#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/syscalls.h>
#include <linux/time.h>
#include <linux/sched/signal.h>
#include <linux/sched/cputime.h>
#include <linux/posix-timers.h>
#include <linux/hrtimer.h>
#include <trace/events/timer.h>
#include <linux/compat.h>

#include <linux/uaccess.h>

/**
 * itimer_get_remtime - get remaining time for the timer
 *
 * @timer: the timer to read
 *
 * Returns the delta between the expiry time and now, which can be
 * less than zero or 1usec for an pending expired timer
 */
static struct timespec64 itimer_get_remtime(struct hrtimer *timer)
{}

static void get_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
			   struct itimerspec64 *const value)
{}

static int do_getitimer(int which, struct itimerspec64 *value)
{}

static int put_itimerval(struct __kernel_old_itimerval __user *o,
			 const struct itimerspec64 *i)
{}


SYSCALL_DEFINE2(getitimer, int, which, struct __kernel_old_itimerval __user *, value)
{}

#if defined(CONFIG_COMPAT) || defined(CONFIG_ALPHA)
struct old_itimerval32 {};

static int put_old_itimerval32(struct old_itimerval32 __user *o,
			       const struct itimerspec64 *i)
{}

COMPAT_SYSCALL_DEFINE2(getitimer, int, which,
		       struct old_itimerval32 __user *, value)
{}
#endif

/*
 * The timer is automagically restarted, when interval != 0
 */
enum hrtimer_restart it_real_fn(struct hrtimer *timer)
{}

static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
			   const struct itimerspec64 *const value,
			   struct itimerspec64 *const ovalue)
{}

/*
 * Returns true if the timeval is in canonical form
 */
#define timeval_valid(t)

static int do_setitimer(int which, struct itimerspec64 *value,
			struct itimerspec64 *ovalue)
{}

#ifdef CONFIG_SECURITY_SELINUX
void clear_itimer(void)
{}
#endif

#ifdef __ARCH_WANT_SYS_ALARM

/**
 * alarm_setitimer - set alarm in seconds
 *
 * @seconds:	number of seconds until alarm
 *		0 disables the alarm
 *
 * Returns the remaining time in seconds of a pending timer or 0 when
 * the timer is not active.
 *
 * On 32 bit machines the seconds value is limited to (INT_MAX/2) to avoid
 * negative timeval settings which would cause immediate expiry.
 */
static unsigned int alarm_setitimer(unsigned int seconds)
{}

/*
 * For backwards compatibility?  This can be done in libc so Alpha
 * and all newer ports shouldn't need it.
 */
SYSCALL_DEFINE1(alarm, unsigned int, seconds)
{}

#endif

static int get_itimerval(struct itimerspec64 *o, const struct __kernel_old_itimerval __user *i)
{}

SYSCALL_DEFINE3(setitimer, int, which, struct __kernel_old_itimerval __user *, value,
		struct __kernel_old_itimerval __user *, ovalue)
{}

#if defined(CONFIG_COMPAT) || defined(CONFIG_ALPHA)
static int get_old_itimerval32(struct itimerspec64 *o, const struct old_itimerval32 __user *i)
{}

COMPAT_SYSCALL_DEFINE3(setitimer, int, which,
		       struct old_itimerval32 __user *, value,
		       struct old_itimerval32 __user *, ovalue)
{}
#endif