From e5812beaf9c95cbae4a024503feb977e6aca7b77 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 14 Nov 2019 15:10:04 -0600 Subject: [PATCH] syscall/ and include/sys/syscall.h: Fix an inconsistency. In someplaces, getitimer() and setitimer() depend on CONFIG_DISABLE_POSIX_TIMERS=n and in other places they depend on nothing. As a result, there are link failures when CONFIG_DISABLE_POSIX_TIMERS=y. Which is correct? On one hand, these interfaces are not POSIX timers, so conditioning them on on CONFIG_DISABLE_POSIX_TIMERS. I opted to keep the dependence and just apply it consistently. I did this because setitimer() and getitimer() are seldom used so it is really best if a system call is no generated for them in all cases. --- include/sys/syscall.h | 12 ++++++------ syscall/syscall.csv | 4 ++-- syscall/syscall_lookup.h | 4 ++-- syscall/syscall_stublookup.c | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/sys/syscall.h b/include/sys/syscall.h index c5860198b4..7e941a8461 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -255,13 +255,11 @@ #define SYS_clock_getres (__SYS_clock + 1) #define SYS_clock_gettime (__SYS_clock + 2) #define SYS_clock_settime (__SYS_clock + 3) -#define SYS_getitimer (__SYS_clock + 4) -#define SYS_setitimer (__SYS_clock + 5) #ifdef CONFIG_CLOCK_TIMEKEEPING -# define SYS_adjtime (__SYS_clock + 6) -# define __SYS_timers (__SYS_clock + 7) +# define SYS_adjtime (__SYS_clock + 4) +# define __SYS_timers (__SYS_clock + 5) #else -# define __SYS_timers (__SYS_clock + 6) +# define __SYS_timers (__SYS_clock + 4) #endif /* The following are defined only if POSIX timers are supported */ @@ -272,7 +270,9 @@ # define SYS_timer_getoverrun (__SYS_timers + 2) # define SYS_timer_gettime (__SYS_timers + 3) # define SYS_timer_settime (__SYS_timers + 4) -# define __SYS_syslog (__SYS_timers + 5) +# define SYS_getitimer (__SYS_timers + 5) +# define SYS_setitimer (__SYS_timers + 6) +# define __SYS_syslog (__SYS_timers + 7) #else # define __SYS_syslog __SYS_timers #endif diff --git a/syscall/syscall.csv b/syscall/syscall.csv index e681769a4d..80bde70e11 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -33,7 +33,7 @@ "get_errno_ptr","errno.h","defined(__DIRECT_ERRNO_ACCESS)","FAR int*" "getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char*","FAR const char*" "getgid","unistd.h","defined(CONFIG_SCHED_USER_IDENTITY)","gid_t" -"getitimer","sys/time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","int","FAR struct itimerval*" +"getitimer","sys/time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","int","FAR struct itimerval *" "getpeername","sys/socket.h","defined(CONFIG_NET)","int","int","FAR struct sockaddr *","FAR socklen_t *" "getpid","unistd.h","","pid_t" "getrandom","sys/random.h","defined(CONFIG_CRYPTO_RANDOM_POOL)","void","FAR void*","size_t" @@ -175,7 +175,7 @@ "timer_create","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","clockid_t","FAR struct sigevent*","FAR timer_t*" "timer_delete","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t" "timer_getoverrun","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t" -"timer_gettime","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t","FAR struct itimerspec*" +"timer_gettime","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t","FAR struct itimerspec *" "timer_settime","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t","int","FAR const struct itimerspec*","FAR struct itimerspec*" "umount2","sys/mount.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*","unsigned int" "uname","sys/utsname.h","","int","FAR struct utsname*" diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index 4acd6287de..df2f6dfd46 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -178,8 +178,6 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) SYSCALL_LOOKUP(clock_getres, 2, STUB_clock_getres) SYSCALL_LOOKUP(clock_gettime, 2, STUB_clock_gettime) SYSCALL_LOOKUP(clock_settime, 2, STUB_clock_settime) - SYSCALL_LOOKUP(getitimer, 2, STUB_getitimer) - SYSCALL_LOOKUP(setitimer, 3, STUB_setitimer) #ifdef CONFIG_CLOCK_TIMEKEEPING SYSCALL_LOOKUP(adjtime, 2, STUB_adjtime) #endif @@ -192,6 +190,8 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) SYSCALL_LOOKUP(timer_getoverrun, 1, STUB_timer_getoverrun) SYSCALL_LOOKUP(timer_gettime, 2, STUB_timer_gettime) SYSCALL_LOOKUP(timer_settime, 4, STUB_timer_settime) + SYSCALL_LOOKUP(getitimer, 2, STUB_getitimer) + SYSCALL_LOOKUP(setitimer, 3, STUB_setitimer) #endif /* System logging */ diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index 474b50dea0..f9b2fb1afc 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -173,9 +173,6 @@ uintptr_t STUB_clock(int nbr); uintptr_t STUB_clock_getres(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_clock_gettime(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_clock_settime(int nbr, uintptr_t parm1, uintptr_t parm2); -uintptr_t STUB_getitimer(int nbr, uintptr_t parm1, uintptr_t parm2); -uintptr_t STUB_setitimer(int nbr, uintptr_t parm1, uintptr_t parm2, - uintptr_t parm3); uintptr_t STUB_adjtime(int nbr, uintptr_t parm1, uintptr_t parm2); /* The following are defined only if POSIX timers are supported */ @@ -187,6 +184,9 @@ uintptr_t STUB_timer_getoverrun(int nbr, uintptr_t parm1); uintptr_t STUB_timer_gettime(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_timer_settime(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4); +uintptr_t STUB_getitimer(int nbr, uintptr_t parm1, uintptr_t parm2); +uintptr_t STUB_setitimer(int nbr, uintptr_t parm1, uintptr_t parm2, + uintptr_t parm3); /* System logging */