Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit baa73d9e authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Thomas Gleixner
Browse files

posix-timers: Make them configurable



Some embedded systems have no use for them.  This removes about
25KB from the kernel binary size when configured out.

Corresponding syscalls are routed to a stub logging the attempt to
use those syscalls which should be enough of a clue if they were
disabled without proper consideration. They are: timer_create,
timer_gettime: timer_getoverrun, timer_settime, timer_delete,
clock_adjtime, setitimer, getitimer, alarm.

The clock_settime, clock_gettime, clock_getres and clock_nanosleep
syscalls are replaced by simple wrappers compatible with CLOCK_REALTIME,
CLOCK_MONOTONIC and CLOCK_BOOTTIME only which should cover the vast
majority of use cases with very little code.

Signed-off-by: default avatarNicolas Pitre <nico@linaro.org>
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarJohn Stultz <john.stultz@linaro.org>
Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
Cc: Paul Bolle <pebolle@tiscali.nl>
Cc: linux-kbuild@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: Michal Marek <mmarek@suse.com>
Cc: Edward Cree <ecree@solarflare.com>
Link: http://lkml.kernel.org/r/1478841010-28605-7-git-send-email-nicolas.pitre@linaro.org


Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 53d3eaa3
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1029,11 +1029,16 @@ SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv,
	return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
}

asmlinkage long sys_ni_posix_timers(void);

SYSCALL_DEFINE2(osf_getitimer, int, which, struct itimerval32 __user *, it)
{
	struct itimerval kit;
	int error;

	if (!IS_ENABLED(CONFIG_POSIX_TIMERS))
		return sys_ni_posix_timers();

	error = do_getitimer(which, &kit);
	if (!error && put_it32(it, &kit))
		error = -EFAULT;
@@ -1047,6 +1052,9 @@ SYSCALL_DEFINE3(osf_setitimer, int, which, struct itimerval32 __user *, in,
	struct itimerval kin, kout;
	int error;

	if (!IS_ENABLED(CONFIG_POSIX_TIMERS))
		return sys_ni_posix_timers();

	if (in) {
		if (get_it32(&kin, in))
			return -EFAULT;
+1 −0
Original line number Diff line number Diff line
@@ -542,6 +542,7 @@ config HANGCHECK_TIMER
config MMTIMER
	tristate "MMTIMER Memory mapped RTC for SGI Altix"
	depends on IA64_GENERIC || IA64_SGI_SN2
	depends on POSIX_TIMERS
	default y
	help
	  The mmtimer device allows direct userspace access to the
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ menu "PTP clock support"

config PTP_1588_CLOCK
	tristate "PTP clock support"
	depends on NET
	depends on NET && POSIX_TIMERS
	select PPS
	select NET_PTP_CLASSIFY
	help
+2 −0
Original line number Diff line number Diff line
@@ -1169,8 +1169,10 @@ static int de_thread(struct task_struct *tsk)
	/* we have changed execution domain */
	tsk->exit_signal = SIGCHLD;

#ifdef CONFIG_POSIX_TIMERS
	exit_itimers(sig);
	flush_itimer_signals();
#endif

	if (atomic_read(&oldsighand->count) != 1) {
		struct sighand_struct *newsighand;
+17 −0
Original line number Diff line number Diff line
@@ -1445,6 +1445,23 @@ config SYSCTL_SYSCALL

	  If unsure say N here.

config POSIX_TIMERS
	bool "Posix Clocks & timers" if EXPERT
	default y
	help
	  This includes native support for POSIX timers to the kernel.
	  Some embedded systems have no use for them and therefore they
	  can be configured out to reduce the size of the kernel image.

	  When this option is disabled, the following syscalls won't be
	  available: timer_create, timer_gettime: timer_getoverrun,
	  timer_settime, timer_delete, clock_adjtime, getitimer,
	  setitimer, alarm. Furthermore, the clock_settime, clock_gettime,
	  clock_getres and clock_nanosleep syscalls will be limited to
	  CLOCK_REALTIME, CLOCK_MONOTONIC and CLOCK_BOOTTIME only.

	  If unsure say y.

config KALLSYMS
	 bool "Load all symbols for debugging/ksymoops" if EXPERT
	 default y
Loading