syscalls: Fix issues around calling syscalls with old timespec
PATCH 1/1 syscalls: Fix issues around calling syscalls with old timespec
The non _time64 syscalls can only be called with the old timespec and calling them with the libc timespec or the new kernel timespec is incorrect.
Similarly, calling the libc interfaces with the old timespec is incorrect as well and they should be called only with the libc timespec.
This patch updates various testcases that have got this issue.
---
@Arnd: Hope this looks fine now.
.../syscalls/clock_adjtime/clock_adjtime.h | 65 ++++++++++++++++--- .../syscalls/clock_adjtime/clock_adjtime01.c | 11 +--- .../syscalls/clock_adjtime/clock_adjtime02.c | 11 +--- .../syscalls/clock_getres/clock_getres01.c | 17 ++--- .../syscalls/clock_gettime/clock_gettime01.c | 11 +--- .../syscalls/clock_gettime/clock_gettime02.c | 12 +--- .../syscalls/clock_gettime/clock_gettime03.c | 11 +--- .../clock_nanosleep/clock_nanosleep01.c | 11 +--- .../clock_nanosleep/clock_nanosleep03.c | 11 +--- .../clock_nanosleep/clock_nanosleep04.c | 11 +--- .../syscalls/clock_settime/clock_settime01.c | 11 +--- .../syscalls/clock_settime/clock_settime02.c | 12 +--- 12 files changed, 90 insertions(+), 104 deletions(-)
testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h +55 -10
@@ -14,9 +14,54 @@#include <pwd.h> #include <sys/timex.h> #include <sys/types.h> +#include <asm/posix_types.h> #include "lapi/timex.h" #ifndef __kernel_timex +#if defined(__x86_64__) && defined(__ILP32__) +typedef long long __kernel_long_t; +#else +typedef long __kernel_long_t; +#endif + +typedef __kernel_long_t __kernel_old_time_t; + +struct __kernel_old_timeval { + __kernel_old_time_t tv_sec; /* seconds */ + __kernel_suseconds_t tv_usec; /* microseconds */ +}; + +struct __kernel_old_timex { + unsigned int modes; /* mode selector */ + __kernel_long_t offset; /* time offset (usec) */ + __kernel_long_t freq; /* frequency offset (scaled ppm) */ + __kernel_long_t maxerror;/* maximum error (usec) */ + __kernel_long_t esterror;/* estimated error (usec) */ + int status; /* clock command/status */ + __kernel_long_t constant;/* pll time constant */ + __kernel_long_t precision;/* clock precision (usec) (read only) */ + __kernel_long_t tolerance;/* clock frequency tolerance (ppm) + * (read only) + */ + struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ + __kernel_long_t tick; /* (modified) usecs between clock ticks */ + + __kernel_long_t ppsfreq;/* pps frequency (scaled ppm) (ro) */ + __kernel_long_t jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + __kernel_long_t stabil; /* pps stability (scaled ppm) (ro) */ + __kernel_long_t jitcnt; /* jitter limit exceeded (ro) */ + __kernel_long_t calcnt; /* calibration intervals (ro) */ + __kernel_long_t errcnt; /* calibration errors (ro) */ + __kernel_long_t stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; +}; + struct __kernel_timex_timeval { __kernel_time64_t tv_sec; long long tv_usec;
@@ -58,14 +103,14 @@ struct __kernel_timex {#endif enum tst_timex_type { -TST_LIBC_TIMEX , +TST_KERN_OLD_TIMEX ,TST_KERN_TIMEX };struct tst_timex {enum tst_timex_type type;union tx { -struct timex libc_timex; +struct __kernel_old_timex kern_old_timex;struct __kernel_timex kern_timex; } tx; };
@@ -73,8 +118,8 @@ struct tst_timex {static inline void *tst_timex_get (struct tst_timex *t) {switch (t->type) { -case TST_LIBC_TIMEX : -return &t->tx.libc_timex; +case TST_KERN_OLD_TIMEX : +return &t->tx.kern_old_timex;case TST_KERN_TIMEX :return &t->tx.kern_timex;default :
@@ -124,8 +169,8 @@ static inline int sys_clock_adjtime64(clockid_t clk_id, void *timex)static inline void timex_show (const char *mode,struct tst_timex *timex) {switch (timex->type) { -case TST_LIBC_TIMEX : -TIMEX_SHOW (timex->tx.libc_timex, mode,"%ld" ); +case TST_KERN_OLD_TIMEX : +TIMEX_SHOW (timex->tx.kern_old_timex, mode,"%ld" );return ;case TST_KERN_TIMEX :TIMEX_SHOW (timex->tx.kern_timex, mode,"%lld" );
@@ -167,8 +212,8 @@ static inline void timex_show(const char *mode, struct tst_timex *timex)static inline void *timex_get_field (struct tst_timex *timex,unsigned int field) {switch (timex->type) { -case TST_LIBC_TIMEX : -SELECT_FIELD (timex->tx.libc_timex, field); +case TST_KERN_OLD_TIMEX : +SELECT_FIELD (timex->tx.kern_old_timex, field);case TST_KERN_TIMEX :SELECT_FIELD (timex->tx.kern_timex, field);default :
@@ -184,7 +229,7 @@ static inline type_kern \ timex_get_field_##type_libc(struct tst_timex *timex, unsigned int field) \ { \ switch (timex->type) { \ - case TST_LIBC_TIMEX: \ + case TST_KERN_OLD_TIMEX: \ return *((type_libc*)timex_get_field(timex, field)); \ case TST_KERN_TIMEX: \ return *((type_kern*)timex_get_field(timex, field)); \
@@ -199,7 +244,7 @@ timex_set_field_##type_libc(struct tst_timex *timex, unsigned int field, \ type_kern value) \ { \switch (timex->type) { \ -case TST_LIBC_TIMEX : \ +case TST_KERN_OLD_TIMEX : \ *((type_libc *)timex_get_field (timex, field)) = value; \return ; \case TST_KERN_TIMEX : \
testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c +3 -8
@@ -55,7 +55,6 @@*/ #include "clock_adjtime.h" -#include "lapi/abisize.h" static long hz;static struct tst_timex saved, ttxc;
@@ -110,16 +109,12 @@ static struct test_variants {enum tst_timex_type type;char *desc; } variants[] = { -#if defined(TST_ABI32) - {.clock_adjtime = sys_clock_adjtime, .type = TST_LIBC_TIMEX, .desc = "syscall with libc spec"}, -#endif - -#if defined(TST_ABI64) - {.clock_adjtime = sys_clock_adjtime, .type = TST_KERN_TIMEX, .desc = "syscall with kernel spec64"}, +#if (__NR_clock_adjtime != __LTP__NR_INVALID_SYSCALL) + {.clock_adjtime = sys_clock_adjtime, .type = TST_KERN_OLD_TIMEX, .desc = "syscall with old kernel spec"}, #endif #if (__NR_clock_adjtime64 != __LTP__NR_INVALID_SYSCALL) - {.clock_adjtime = sys_clock_adjtime64, .type = TST_KERN_TIMEX, .desc = "syscall time64 with kernel spec64"}, + {.clock_adjtime = sys_clock_adjtime64, .type = TST_KERN_TIMEX, .desc = "syscall time64 with kernel spec"}, #endif };
testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c +3 -8
@@ -56,7 +56,6 @@*/ #include "clock_adjtime.h" -#include "lapi/abisize.h" static long hz;static struct tst_timex saved, ttxc;
@@ -116,16 +115,12 @@ static struct test_variants {enum tst_timex_type type;char *desc; } variants[] = { -#if defined(TST_ABI32) - {.clock_adjtime = sys_clock_adjtime, .type = TST_LIBC_TIMEX, .desc = "syscall with libc spec"}, -#endif - -#if defined(TST_ABI64) - {.clock_adjtime = sys_clock_adjtime, .type = TST_KERN_TIMEX, .desc = "syscall with kernel spec64"}, +#if (__NR_clock_adjtime != __LTP__NR_INVALID_SYSCALL) + {.clock_adjtime = sys_clock_adjtime, .type = TST_KERN_OLD_TIMEX, .desc = "syscall with old kernel spec"}, #endif #if (__NR_clock_adjtime64 != __LTP__NR_INVALID_SYSCALL) - {.clock_adjtime = sys_clock_adjtime64, .type = TST_KERN_TIMEX, .desc = "syscall time64 with kernel spec64"}, + {.clock_adjtime = sys_clock_adjtime64, .type = TST_KERN_TIMEX, .desc = "syscall time64 with kernel spec"}, #endif };
testcases/kernel/syscalls/clock_getres/clock_getres01.c +5 -12
@@ -14,7 +14,6 @@#include "tst_timer.h" #include "lapi/posix_clocks.h" -#include "lapi/abisize.h" static struct test_case { char *name;
@@ -43,23 +42,17 @@ static struct test_variants {struct tst_ts **spec;char *desc; } variants[] = { -#if defined(TST_ABI32) { .func = libc_clock_getres, .type = TST_LIBC_TIMESPEC, .spec = &tspec, .desc = "vDSO or syscall with libc spec"}, { .func = libc_clock_getres, .type = TST_LIBC_TIMESPEC, .spec = &nspec, .desc = "vDSO or syscall with libc spec with NULL res"}, - { .func = sys_clock_getres, .type = TST_LIBC_TIMESPEC, .spec = &tspec, .desc = "syscall with libc spec"}, - { .func = sys_clock_getres, .type = TST_LIBC_TIMESPEC, .spec = &nspec, .desc = "syscall with libc spec with NULL res"}, - { .func = sys_clock_getres, .type = TST_KERN_OLD_TIMESPEC, .spec = &tspec, .desc = "syscall with kernel spec32"}, - { .func = sys_clock_getres, .type = TST_KERN_OLD_TIMESPEC, .spec = &nspec, .desc = "syscall with kernel spec32 with NULL res"}, -#endif -#if defined(TST_ABI64) - { .func = sys_clock_getres, .type = TST_KERN_TIMESPEC, .spec = &tspec, .desc = "syscall with kernel spec64"}, - { .func = sys_clock_getres, .type = TST_KERN_TIMESPEC, .spec = &nspec, .desc = "syscall with kernel spec64 with NULL res"}, +#if (__NR_clock_getres != __LTP__NR_INVALID_SYSCALL) + { .func = sys_clock_getres, .type = TST_KERN_OLD_TIMESPEC, .spec = &tspec, .desc = "syscall with old kernel spec"}, + { .func = sys_clock_getres, .type = TST_KERN_OLD_TIMESPEC, .spec = &nspec, .desc = "syscall with old kernel spec with NULL res"}, #endif #if (__NR_clock_getres_time64 != __LTP__NR_INVALID_SYSCALL) - { .func = sys_clock_getres64, .type = TST_KERN_TIMESPEC, .spec = &tspec, .desc = "syscall time64 with kernel spec64"}, - { .func = sys_clock_getres64, .type = TST_KERN_TIMESPEC, .spec = &nspec, .desc = "syscall time64 with kernel spec64 with NULL res"}, + { .func = sys_clock_getres64, .type = TST_KERN_TIMESPEC, .spec = &tspec, .desc = "syscall time64 with kernel spec"}, + { .func = sys_clock_getres64, .type = TST_KERN_TIMESPEC, .spec = &nspec, .desc = "syscall time64 with kernel spec with NULL res"}, #endif };
testcases/kernel/syscalls/clock_gettime/clock_gettime01.c +3 -8
@@ -19,7 +19,6 @@#include "config.h" #include "tst_timer.h" #include "tst_safe_clocks.h" -#include "lapi/abisize.h" struct test_case {clockid_t clktype;
@@ -64,18 +63,14 @@ static struct test_variants {enum tst_ts_type type;char *desc; } variants[] = { -#if defined(TST_ABI32) { .func = libc_clock_gettime, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"}, - { .func = sys_clock_gettime, .type = TST_LIBC_TIMESPEC, .desc = "syscall with libc spec"}, - { .func = sys_clock_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with kernel spec32"}, -#endif -#if defined(TST_ABI64) - { .func = sys_clock_gettime, .type = TST_KERN_TIMESPEC, .desc = "syscall with kernel spec64"}, +#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL) + { .func = sys_clock_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"}, #endif #if (__NR_clock_gettime64 != __LTP__NR_INVALID_SYSCALL) - { .func = sys_clock_gettime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec64"}, + { .func = sys_clock_gettime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"}, #endif };
testcases/kernel/syscalls/clock_gettime/clock_gettime02.c +3 -9
@@ -21,7 +21,6 @@#include "config.h" #include "tst_timer.h" #include "tst_safe_clocks.h" -#include "lapi/abisize.h" static void *bad_addr;
@@ -92,17 +91,12 @@ static struct test_variants {enum tst_ts_type type;char *desc; } variants[] = { -#if defined(TST_ABI32) - { .func = sys_clock_gettime, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"}, - { .func = sys_clock_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with kernel spec32"}, -#endif - -#if defined(TST_ABI64) - { .func = sys_clock_gettime, .type = TST_KERN_TIMESPEC, .desc = "syscall with kernel spec64"}, +#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL) + { .func = sys_clock_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"}, #endif #if (__NR_clock_gettime64 != __LTP__NR_INVALID_SYSCALL) - { .func = sys_clock_gettime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec64"}, + { .func = sys_clock_gettime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"}, #endif };
testcases/kernel/syscalls/clock_gettime/clock_gettime03.c +3 -8
@@ -21,7 +21,6 @@#include "tst_safe_clocks.h" #include "tst_timer.h" #include "lapi/namespaces_constants.h" -#include "lapi/abisize.h" static struct tcase { int clk_id;
@@ -46,18 +45,14 @@ static struct test_variants {enum tst_ts_type type;char *desc; } variants[] = { -#if defined(TST_ABI32) { .func = libc_clock_gettime, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"}, - { .func = sys_clock_gettime, .type = TST_LIBC_TIMESPEC, .desc = "syscall with libc spec"}, - { .func = sys_clock_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with kernel spec32"}, -#endif -#if defined(TST_ABI64) - { .func = sys_clock_gettime, .type = TST_KERN_TIMESPEC, .desc = "syscall with kernel spec64"}, +#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL) + { .func = sys_clock_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"}, #endif #if (__NR_clock_gettime64 != __LTP__NR_INVALID_SYSCALL) - { .func = sys_clock_gettime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec64"}, + { .func = sys_clock_gettime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"}, #endif };
testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c +3 -8
@@ -12,7 +12,6 @@#include "tst_safe_clocks.h" #include "tst_sig_proc.h" #include "tst_timer.h" -#include "lapi/abisize.h" static void sighandler(int sig LTP_ATTRIBUTE_UNUSED) {
@@ -89,18 +88,14 @@ static struct test_variants {enum tst_ts_type type;char *desc; } variants[] = { -#if defined(TST_ABI32) { .func = libc_clock_nanosleep, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"}, - { .func = sys_clock_nanosleep, .type = TST_LIBC_TIMESPEC, .desc = "syscall with libc spec"}, - { .func = sys_clock_nanosleep, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with kernel spec32"}, -#endif -#if defined(TST_ABI64) - { .func = sys_clock_nanosleep, .type = TST_KERN_TIMESPEC, .desc = "syscall with kernel spec64"}, +#if (__NR_clock_nanosleep != __LTP__NR_INVALID_SYSCALL) + { .func = sys_clock_nanosleep, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"}, #endif #if (__NR_clock_nanosleep_time64 != __LTP__NR_INVALID_SYSCALL) - { .func = sys_clock_nanosleep64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec64"}, + { .func = sys_clock_nanosleep64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"}, #endif };
testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c +3 -8
@@ -19,7 +19,6 @@#include "tst_safe_clocks.h" #include "tst_timer.h" #include "lapi/namespaces_constants.h" -#include "lapi/abisize.h" #define OFFSET_S 10#define SLEEP_US 100000
@@ -30,18 +29,14 @@ static struct test_variants {enum tst_ts_type type;char *desc; } variants[] = { -#if defined(TST_ABI32) { .gettime = libc_clock_gettime, .func = libc_clock_nanosleep, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"}, - { .gettime = sys_clock_gettime, .func = sys_clock_nanosleep, .type = TST_LIBC_TIMESPEC, .desc = "syscall with libc spec"}, - { .gettime = sys_clock_gettime, .func = sys_clock_nanosleep, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with kernel spec32"}, -#endif -#if defined(TST_ABI64) - { .gettime = sys_clock_gettime, .func = sys_clock_nanosleep, .type = TST_KERN_TIMESPEC, .desc = "syscall with kernel spec64"}, +#if (__NR_clock_nanosleep != __LTP__NR_INVALID_SYSCALL) + { .gettime = sys_clock_gettime, .func = sys_clock_nanosleep, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"}, #endif #if (__NR_clock_nanosleep_time64 != __LTP__NR_INVALID_SYSCALL) - { .gettime = sys_clock_gettime64, .func = sys_clock_nanosleep64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec64"}, + { .gettime = sys_clock_gettime64, .func = sys_clock_nanosleep64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"}, #endif };
testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep04.c +3 -8
@@ -9,7 +9,6 @@#include <unistd.h> #include "tst_safe_clocks.h" #include "tst_timer.h" -#include "lapi/abisize.h" static clockid_t tcase[] = {CLOCK_MONOTONIC ,
@@ -22,18 +21,14 @@ static struct test_variants {enum tst_ts_type type;char *desc; } variants[] = { -#if defined(TST_ABI32) { .gettime = libc_clock_gettime, .func = libc_clock_nanosleep, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"}, - { .gettime = sys_clock_gettime, .func = sys_clock_nanosleep, .type = TST_LIBC_TIMESPEC, .desc = "syscall with libc spec"}, - { .gettime = sys_clock_gettime, .func = sys_clock_nanosleep, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with kernel spec32"}, -#endif -#if defined(TST_ABI64) - { .gettime = sys_clock_gettime, .func = sys_clock_nanosleep, .type = TST_KERN_TIMESPEC, .desc = "syscall with kernel spec64"}, +#if (__NR_clock_nanosleep != __LTP__NR_INVALID_SYSCALL) + { .gettime = sys_clock_gettime, .func = sys_clock_nanosleep, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"}, #endif #if (__NR_clock_nanosleep_time64 != __LTP__NR_INVALID_SYSCALL) - { .gettime = sys_clock_gettime64, .func = sys_clock_nanosleep64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec64"}, + { .gettime = sys_clock_gettime64, .func = sys_clock_nanosleep64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"}, #endif };
testcases/kernel/syscalls/clock_settime/clock_settime01.c +3 -8
@@ -16,7 +16,6 @@#include "config.h" #include "tst_timer.h" #include "tst_safe_clocks.h" -#include "lapi/abisize.h" #define DELTA_SEC 10#define DELTA_US (long long) (DELTA_SEC * 1000000)
@@ -30,18 +29,14 @@ static struct test_variants {enum tst_ts_type type;char *desc; } variants[] = { -#if defined(TST_ABI32) { .gettime = libc_clock_gettime, .settime = libc_clock_settime, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"}, - { .gettime = sys_clock_gettime, .settime = sys_clock_settime, .type = TST_LIBC_TIMESPEC, .desc = "syscall with libc spec"}, - { .gettime = sys_clock_gettime, .settime = sys_clock_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with kernel spec32"}, -#endif -#if defined(TST_ABI64) - { .gettime = sys_clock_gettime, .settime = sys_clock_settime, .type = TST_KERN_TIMESPEC, .desc = "syscall with kernel spec64"}, +#if (__NR_clock_settime != __LTP__NR_INVALID_SYSCALL) + { .gettime = sys_clock_gettime, .settime = sys_clock_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"}, #endif #if (__NR_clock_settime64 != __LTP__NR_INVALID_SYSCALL) - { .gettime = sys_clock_gettime64, .settime = sys_clock_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec64"}, + { .gettime = sys_clock_gettime64, .settime = sys_clock_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"}, #endif };
testcases/kernel/syscalls/clock_settime/clock_settime02.c +3 -9
@@ -11,7 +11,6 @@#include "config.h" #include "tst_timer.h" #include "tst_safe_clocks.h" -#include "lapi/abisize.h" #define DELTA_SEC 10#define NSEC_PER_SEC (1000000000L)
@@ -98,17 +97,12 @@ static struct test_variants {enum tst_ts_type type;char *desc; } variants[] = { -#if defined(TST_ABI32) - { .gettime = sys_clock_gettime, .settime = sys_clock_settime, .type = TST_LIBC_TIMESPEC, .desc = "syscall with libc spec"}, - { .gettime = sys_clock_gettime, .settime = sys_clock_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with kernel spec32"}, -#endif - -#if defined(TST_ABI64) - { .gettime = sys_clock_gettime, .settime = sys_clock_settime, .type = TST_KERN_TIMESPEC, .desc = "syscall with kernel spec64"}, +#if (__NR_clock_settime != __LTP__NR_INVALID_SYSCALL) + { .gettime = sys_clock_gettime, .settime = sys_clock_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"}, #endif #if (__NR_clock_settime64 != __LTP__NR_INVALID_SYSCALL) - { .gettime = sys_clock_gettime64, .settime = sys_clock_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec64"}, + { .gettime = sys_clock_gettime64, .settime = sys_clock_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"}, #endif };
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
PATCH 1/1 syscalls: Fix issues around calling syscalls with old timespec
Hi Viresh,
checking for __kernel_timespec, which defined in include/tst_timer.h should fix it, but we might need some more elegant solution (have that depende
kernel/syscalls/clock_adjtime/clock_adjtime.h +1 -1
@@ -17,7 +17,7 @@#include <asm/posix_types.h> #include "lapi/timex.h" -#ifndef __kernel_timex +#ifndef __kernel_timespec#if defined(__x86_64__) && defined(__ILP32__)typedef long long __kernel_long_t ;#else
Review line 18
Quoted 7 lines
+++
b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h(quoted diff) +1
-0@@ -14,9 +14,54 @@ #include <pwd.h> #include <sys/timex.h> #include <sys/types.h> +#include <asm/posix_types.h> #include "lapi/timex.h"
Thanks! On a first look LGTM.
Unfortunately, there is failure on Centos 6 (gcc 4):
https://travis-ci.org/github/pevik/ltp/jobs/686519604
/usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h:24: error: redefinition of typedef '__kernel_long_t' /usr/src/ltp/include/tst_timer.h:99: note: previous declaration of '__kernel_long_t' was here /usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h:27: error: redefinition of typedef '__kernel_old_time_t' /usr/src/ltp/include/tst_timer.h:102: note: previous declaration of '__kernel_old_time_t' was here make[4]: *** [clock_adjtime01] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from /usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c:58:/usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h: At top level:/usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h:24: error: redefinition of typedef '__kernel_long_t' /usr/src/ltp/include/tst_timer.h:99: note: previous declaration of '__kernel_long_t' was here /usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h:27: error: redefinition of typedef '__kernel_old_time_t' /usr/src/ltp/include/tst_timer.h:102: note: previous declaration of '__kernel_old_time_t' was here make[4]: *** [clock_adjtime02] Error 1
make[4]: Leaving directory `/usr/src/ltp-build/testcases/kernel/syscalls/clock_adjtime'
Review line 26
Quoted 8 lines
(quoted diff) +7
-0#ifndef __kernel_timex +#if defined(__x86_64__) && defined(__ILP32__) +typedef long long __kernel_long_t; +#else +typedef long __kernel_long_t; +#endif + +typedef __kernel_long_t __kernel_old_time_t;
It's caused by this fallback definition ^, which is already in include/tst_timer.h. Simple deleting it should fix the problem
Kind regards,
Petr
kernel/syscalls/clock_adjtime/clock_adjtime.h +0 -7
@@ -18,13 +18,6 @@#include "lapi/timex.h" #ifndef __kernel_timex -#if defined(__x86_64__) && defined(__ILP32__) -typedef long long __kernel_long_t; -#else -typedef long __kernel_long_t; -#endif - -typedef __kernel_long_t __kernel_old_time_t; struct __kernel_old_timeval { __kernel_old_time_t tv_sec; /* seconds */
PATCH 1/1 syscalls: Fix issues around calling syscalls with old timespec
Quoted 47 lines · Petr Vorel
Hi Viresh,
checking for
__kernel_timespec, which defined ininclude/tst_timer.hshould fix it, but we might need some more elegant solution (have that dependekernel/syscalls/clock_adjtime/clock_adjtime.h +1
-1@@ -17,7 +17,7 @@#include <asm/posix_types.h> #include "lapi/timex.h" -#ifndef __kernel_timex +#ifndef __kernel_timespec#if defined(__x86_64__) && defined(__ILP32__)typedef long long __kernel_long_t ;#else Review line 18
Quoted 8 lines
+++
b/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h(quoted diff) +1
-0@@ -14,9 +14,54 @@ #include <pwd.h> #include <sys/timex.h> #include <sys/types.h> +#include <asm/posix_types.h> #include "lapi/timex.h"Thanks! On a first look LGTM.
Unfortunately, there is failure on Centos 6 (gcc 4):https://travis-ci.org/github/pevik/ltp/jobs/686519604
/usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h:24: error: redefinition of typedef '__kernel_long_t'/usr/src/ltp/include/tst_timer.h:99: note: previous declaration of '__kernel_long_t' was here/usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h:27: error: redefinition of typedef '__kernel_old_time_t'/usr/src/ltp/include/tst_timer.h:102: note: previous declaration of '__kernel_old_time_t' was here make[4]: *** [clock_adjtime01] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from/usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime02.c:58:/usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h: At top level:/usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h:24: error: redefinition of typedef '__kernel_long_t'/usr/src/ltp/include/tst_timer.h:99: note: previous declaration of '__kernel_long_t' was here/usr/src/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime.h:27: error: redefinition of typedef '__kernel_old_time_t'/usr/src/ltp/include/tst_timer.h:102: note: previous declaration of '__kernel_old_time_t' was here make[4]: *** [clock_adjtime02] Error 1
make[4]: Leaving directory `/usr/src/ltp-build/testcases/kernel/syscalls/clock_adjtime'
Quoted 11 lines
Review line 26
Quoted 8 lines
(quoted diff) +7
-0#ifndef __kernel_timex +#if defined(__x86_64__) && defined(__ILP32__) +typedef long long __kernel_long_t; +#else +typedef long __kernel_long_t; +#endif + +typedef __kernel_long_t __kernel_old_time_t;It's caused by this fallback definition ^, which is already in
include/tst_timer.h. Simple deleting it should fix the problem
But tst_timer.h isn't included here in clock_adjtime at all. What's special with Centos that failure is seen there only ?
Any idea ?
Signature · 1 line
viresh
PATCH 1/1 syscalls: Fix issues around calling syscalls with old timespec
Hi Viresh,
Quoted 12 lines
Quoted 11 lines
Review
Quoted 8 lines
#ifndef
__kernel_timex(quoted diff) +7
-0+#if defined(__x86_64__) && defined(__ILP32__) +typedef long long __kernel_long_t; +#else +typedef long __kernel_long_t; +#endif + +typedef __kernel_long_t __kernel_old_time_t;It's caused by this fallback definition ^, which is already in
include/tst_timer.h. Simple deleting it should fix the problem
Quoted 1 line
But
tst_timer.hisn't included here inclock_adjtimeat all. What's
tst_timer.h has been included in clock_adjtime.h since 5085e14c7e
Quoted 2 lines
special with Centos that failure is seen there only ? Any idea ?
Not sure why it's only for old CentOS 6. Usually there is some bug in the headers (conflicting headers which has been fixed in newer distros) or something simply missing.
And we should really drop CentOS 6 from travis CI, we agreed to discontinue gcc 4 support (10 years old). But I wanted to drop it after the release.
BTW typedef long long __kernel_long_t; is in <asm/posix_types_x32.h> which you include via <asm/posix_types.h>. But redefining typedef is not a problem.
Kind regards,
Petr
PATCH 1/1 syscalls: Fix issues around calling syscalls with old timespec
Quoted 14 lines · Petr Vorel
Hi Viresh,
Quoted 11 lines
Quoted 11 lines
Review
Quoted 8 lines
#ifndef
__kernel_timex(quoted diff) +7
-0+#if defined(__x86_64__) && defined(__ILP32__) +typedef long long __kernel_long_t; +#else +typedef long __kernel_long_t; +#endif + +typedef __kernel_long_t __kernel_old_time_t;It's caused by this fallback definition ^, which is already in
include/tst_timer.h. Simple deleting it should fix the problem
Quoted 2 lines
Quoted 1 line
But
tst_timer.hisn't included here inclock_adjtimeat all. What's
tst_timer.hhas been included inclock_adjtime.hsince5085e14c7e
And I missed that completely :(
Signature · 1 line
viresh