* [LTP] [PATCH V2 00/17] syscalls: Use common variants structure
@ 2020-09-16 10:37 Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 01/17] syscalls: utils: Remove local copy of poll.h definitions Viresh Kumar
` (16 more replies)
0 siblings, 17 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Hi Cyril,
As you suggested earlier, here is an attempt to use a common structure
prototype at most of the places.
futex, clock_adjtime() and clock_getres() tests are left with their own
implementations due to compatibility issues.
V2:
- Remove local copy of poll.h as it was making the build fail with this
patchset for some of the syscalls (mq_timedsend/receive).
- Use poll.h instead of sys/poll.h
- Use libaio stuff from within macros in the 2st patch.
- Only first two patches are updated, rest are all the same.
--
viresh
Viresh Kumar (17):
syscalls: utils: Remove local copy of poll.h definitions
syscalls: Add common time64 variants structure
syscalls: clock_gettime: Reuse struct time64_variants
syscalls: clock_nanosleep: Reuse struct time64_variants
syscalls: clock_settime: Reuse struct time64_variants
syscalls: io_pgetevents: Reuse struct time64_variants
syscalls: semop: Reuse struct time64_variants
syscalls: mq_timed: Reuse struct time64_variants
syscalls: ppoll: Reuse struct time64_variants
syscalls: rt_sigtimedwait: Reuse struct time64_variants
syscalls: sched_rr_get_interval: Reuse struct time64_variants
syscalls: sendmmsg: Reuse struct time64_variants
syscalls: timer_settime: Reuse struct time64_variants
syscalls: timer_gettime: Reuse struct time64_variants
syscalls: timerfd: Reuse struct time64_variants
syscalls: utimensat: Reuse struct time64_variants
futex: Move variants struct definition to common header
include/time64_variants.h | 65 +++++++++++++++++++
.../syscalls/clock_gettime/clock_gettime01.c | 19 +++---
.../syscalls/clock_gettime/clock_gettime02.c | 17 ++---
.../syscalls/clock_gettime/clock_gettime03.c | 27 ++++----
.../syscalls/clock_gettime/clock_gettime04.c | 29 ++++-----
.../clock_nanosleep/clock_nanosleep01.c | 21 +++---
.../clock_nanosleep/clock_nanosleep03.c | 26 ++++----
.../clock_nanosleep/clock_nanosleep04.c | 22 +++----
.../syscalls/clock_settime/clock_settime01.c | 26 ++++----
.../syscalls/clock_settime/clock_settime02.c | 20 +++---
.../syscalls/clock_settime/clock_settime03.c | 22 +++----
.../syscalls/futex/futex_cmp_requeue01.c | 12 ++--
.../syscalls/futex/futex_cmp_requeue02.c | 9 +--
.../kernel/syscalls/futex/futex_wait01.c | 10 +--
.../kernel/syscalls/futex/futex_wait02.c | 11 ++--
.../kernel/syscalls/futex/futex_wait03.c | 11 ++--
.../kernel/syscalls/futex/futex_wait04.c | 10 +--
.../syscalls/futex/futex_wait_bitset01.c | 11 +---
.../kernel/syscalls/futex/futex_wake01.c | 9 +--
.../kernel/syscalls/futex/futex_wake02.c | 11 ++--
.../kernel/syscalls/futex/futex_wake03.c | 13 ++--
.../kernel/syscalls/futex/futex_wake04.c | 14 ++--
testcases/kernel/syscalls/futex/futextest.h | 7 ++
.../syscalls/io_pgetevents/io_pgetevents01.c | 16 ++---
.../syscalls/io_pgetevents/io_pgetevents02.c | 18 ++---
testcases/kernel/syscalls/ipc/semop/semop.h | 18 ++---
testcases/kernel/syscalls/ipc/semop/semop01.c | 6 +-
testcases/kernel/syscalls/ipc/semop/semop02.c | 6 +-
testcases/kernel/syscalls/ipc/semop/semop03.c | 6 +-
.../mq_timedreceive/mq_timedreceive01.c | 14 ++--
.../syscalls/mq_timedsend/mq_timedsend01.c | 16 ++---
testcases/kernel/syscalls/ppoll/ppoll01.c | 21 +++---
.../rt_sigtimedwait/rt_sigtimedwait01.c | 15 ++---
.../sched_rr_get_interval01.c | 21 +++---
.../sched_rr_get_interval02.c | 21 +++---
.../sched_rr_get_interval03.c | 21 +++---
.../kernel/syscalls/sendmmsg/sendmmsg01.c | 24 +++----
.../syscalls/timer_gettime/timer_gettime01.c | 21 +++---
.../syscalls/timer_settime/timer_settime01.c | 25 +++----
.../syscalls/timer_settime/timer_settime02.c | 18 ++---
testcases/kernel/syscalls/timerfd/timerfd01.c | 27 ++++----
testcases/kernel/syscalls/timerfd/timerfd04.c | 20 +++---
.../syscalls/timerfd/timerfd_gettime01.c | 8 +--
.../syscalls/timerfd/timerfd_settime01.c | 17 ++---
.../syscalls/timerfd/timerfd_settime02.c | 15 ++---
testcases/kernel/syscalls/utils/mq_timed.h | 18 ++---
testcases/kernel/syscalls/utils/poll.h | 27 --------
.../kernel/syscalls/utimensat/utimensat01.c | 18 ++---
48 files changed, 376 insertions(+), 483 deletions(-)
create mode 100644 include/time64_variants.h
delete mode 100644 testcases/kernel/syscalls/utils/poll.h
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 01/17] syscalls: utils: Remove local copy of poll.h definitions
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 12:33 ` Cyril Hrubis
2020-09-16 10:37 ` [LTP] [PATCH V2 02/17] syscalls: Add common time64 variants structure Viresh Kumar
` (15 subsequent siblings)
16 siblings, 1 reply; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
The local copy of these definitions and this file conflicts with the
system wide ones and make the builds fail sometimes, for example when
this copy gets included instead of the system wide one.
Remove it.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
testcases/kernel/syscalls/utils/poll.h | 27 --------------------------
1 file changed, 27 deletions(-)
delete mode 100644 testcases/kernel/syscalls/utils/poll.h
diff --git a/testcases/kernel/syscalls/utils/poll.h b/testcases/kernel/syscalls/utils/poll.h
deleted file mode 100644
index 2cd4929abd40..000000000000
--- a/testcases/kernel/syscalls/utils/poll.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __i386_POLL_H
-#define __i386_POLL_H
-
-/* These are specified by iBCS2 */
-#define POLLIN 0x0001
-#define POLLPRI 0x0002
-#define POLLOUT 0x0004
-#define POLLERR 0x0008
-#define POLLHUP 0x0010
-#define POLLNVAL 0x0020
-
-/* The rest seem to be more-or-less nonstandard. Check them! */
-#define POLLRDNORM 0x0040
-#define POLLRDBAND 0x0080
-#define POLLWRNORM 0x0100
-#define POLLWRBAND 0x0200
-#define POLLMSG 0x0400
-#define POLLREMOVE 0x1000
-#define POLLRDHUP 0x2000
-
-struct pollfd {
- int fd;
- short events;
- short revents;
-};
-
-#endif
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 02/17] syscalls: Add common time64 variants structure
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 01/17] syscalls: utils: Remove local copy of poll.h definitions Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 03/17] syscalls: clock_gettime: Reuse struct time64_variants Viresh Kumar
` (14 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
This adds a common variants structure which all other syscall tests can
use.
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
include/time64_variants.h | 65 +++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 include/time64_variants.h
diff --git a/include/time64_variants.h b/include/time64_variants.h
new file mode 100644
index 000000000000..fc52623c868a
--- /dev/null
+++ b/include/time64_variants.h
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 Linaro Limited. All rights reserved.
+ * Author: Viresh Kumar <viresh.kumar@linaro.org>
+ */
+
+#ifndef TIME64_VARIANTS_H
+#define TIME64_VARIANTS_H
+
+#include "config.h"
+
+#ifdef HAVE_LIBAIO
+#include <libaio.h>
+#endif
+
+#include <signal.h>
+#include <stdio.h>
+#include <poll.h>
+#include <time.h>
+#include "tst_timer.h"
+
+struct tst_ts;
+struct pollfd;
+struct io_event;
+struct sembuf;
+struct mmsghdr;
+
+struct time64_variants {
+ char *desc;
+
+ enum tst_ts_type ts_type;
+ int (*clock_gettime)(clockid_t clk_id, void *ts);
+ int (*clock_settime)(clockid_t clk_id, void *ts);
+ int (*clock_nanosleep)(clockid_t clock_id, int flags, void *request, void *remain);
+
+ int (*timer_gettime)(kernel_timer_t timer, void *its);
+ int (*timer_settime)(kernel_timer_t timerid, int flags, void *its, void *old_its);
+ int (*tfd_gettime)(int fd, void *its);
+ int (*tfd_settime)(int fd, int flags, void *new_value, void *old_value);
+
+#ifdef HAVE_LIBAIO
+ int (*io_pgetevents)(io_context_t ctx, long min_nr, long max_nr,
+ struct io_event *events, void *timeout, sigset_t *sigmask);
+#endif
+
+ int (*mqt_send)(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
+ unsigned int msg_prio, void *abs_timeout);
+ ssize_t (*mqt_receive)(mqd_t mqdes, char *msg_ptr, size_t msg_len,
+ unsigned int *msg_prio, void *abs_timeout);
+ int (*ppoll)(struct pollfd *fds, nfds_t nfds, void *tmo_p,
+ const sigset_t *sigmask, size_t sigsetsize);
+ int (*sched_rr_get_interval)(pid_t pid, void *ts);
+ int (*semop)(int semid, struct sembuf *sops, size_t nsops);
+ int (*semtimedop)(int semid, struct sembuf *sops, size_t nsops, void *timeout);
+ int (*sigwait) (const sigset_t * set, siginfo_t * info,
+ void * timeout);
+ int (*recvmmsg)(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,
+ unsigned int flags, void *timeout);
+ int (*sendmmsg)(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,
+ unsigned int flags);
+ int (*utimensat)(int dirfd, const char *pathname, void *times,
+ int flags);
+};
+
+#endif /* TIME64_VARIANTS_H */
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 03/17] syscalls: clock_gettime: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 01/17] syscalls: utils: Remove local copy of poll.h definitions Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 02/17] syscalls: Add common time64 variants structure Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 04/17] syscalls: clock_nanosleep: " Viresh Kumar
` (13 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../syscalls/clock_gettime/clock_gettime01.c | 19 +++++-------
.../syscalls/clock_gettime/clock_gettime02.c | 17 +++++------
.../syscalls/clock_gettime/clock_gettime03.c | 27 ++++++++---------
.../syscalls/clock_gettime/clock_gettime04.c | 29 +++++++++----------
4 files changed, 40 insertions(+), 52 deletions(-)
diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime01.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime01.c
index 769ac32cd038..be9573afcc8e 100644
--- a/testcases/kernel/syscalls/clock_gettime/clock_gettime01.c
+++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime01.c
@@ -17,6 +17,7 @@
*/
#include "config.h"
+#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_clocks.h"
@@ -58,19 +59,15 @@ static struct test_case tc[] = {
static struct tst_ts spec;
-static struct test_variants {
- int (*func)(clockid_t clk_id, void *ts);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .func = libc_clock_gettime, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .clock_gettime = libc_clock_gettime, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_clock_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .clock_gettime = sys_clock_gettime, .ts_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 spec"},
+ { .clock_gettime = sys_clock_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -81,13 +78,13 @@ static void setup(void)
static void verify_clock_gettime(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
int ret;
memset(&spec, 0, sizeof(spec));
- spec.type = tv->type;
+ spec.type = tv->ts_type;
- TEST(tv->func(tc[i].clktype, tst_ts_get(&spec)));
+ TEST(tv->clock_gettime(tc[i].clktype, tst_ts_get(&spec)));
if (TST_RET == -1) {
/* errors: allow unsupported clock types */
diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime02.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime02.c
index f26db7c577e3..b0a9e9067142 100644
--- a/testcases/kernel/syscalls/clock_gettime/clock_gettime02.c
+++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime02.c
@@ -19,6 +19,7 @@
*/
#include "config.h"
+#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_clocks.h"
@@ -86,17 +87,13 @@ static struct tst_ts spec;
/*
* bad pointer w/ libc causes SIGSEGV signal, call syscall directly
*/
-static struct test_variants {
- int (*func)(clockid_t clk_id, void *ts);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_clock_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .clock_gettime = sys_clock_gettime, .ts_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 spec"},
+ { .clock_gettime = sys_clock_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -109,18 +106,18 @@ static void setup(void)
static void verify_clock_gettime(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
void *ts;
/* bad pointer cases */
if (tc[i].exp_err == EFAULT) {
ts = bad_addr;
} else {
- spec.type = tv->type;
+ spec.type = tv->ts_type;
ts = tst_ts_get(&spec);
}
- TEST(tv->func(tc[i].clktype, ts));
+ TEST(tv->clock_gettime(tc[i].clktype, ts));
if (TST_RET != -1) {
tst_res(TFAIL, "clock_gettime(2): clock %s passed unexcpectedly",
diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
index 8341051088d7..dc570a06c55c 100644
--- a/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
+++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime03.c
@@ -18,6 +18,7 @@
*/
#define _GNU_SOURCE
+#include "time64_variants.h"
#include "tst_safe_clocks.h"
#include "tst_timer.h"
#include "lapi/namespaces_constants.h"
@@ -40,27 +41,23 @@ static struct tcase {
static struct tst_ts now, then, parent_then;
static int parent_ns;
-static struct test_variants {
- int (*func)(clockid_t clk_id, void *ts);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .func = libc_clock_gettime, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .clock_gettime = libc_clock_gettime, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_clock_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .clock_gettime = sys_clock_gettime, .ts_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 spec"},
+ { .clock_gettime = sys_clock_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
-static void child(struct test_variants *tv, struct tcase *tc)
+static void child(struct time64_variants *tv, struct tcase *tc)
{
long long diff;
- if (tv->func(tc->clk_id, tst_ts_get(&then))) {
+ if (tv->clock_gettime(tc->clk_id, tst_ts_get(&then))) {
tst_res(TFAIL | TERRNO, "clock_gettime(%s) failed",
tst_clock_name(tc->clk_id));
return;
@@ -68,7 +65,7 @@ static void child(struct test_variants *tv, struct tcase *tc)
SAFE_SETNS(parent_ns, CLONE_NEWTIME);
- if (tv->func(tc->clk_id, tst_ts_get(&parent_then))) {
+ if (tv->clock_gettime(tc->clk_id, tst_ts_get(&parent_then))) {
tst_res(TFAIL | TERRNO, "clock_gettime(%s) failed",
tst_clock_name(tc->clk_id));
return;
@@ -97,7 +94,7 @@ static void child(struct test_variants *tv, struct tcase *tc)
static void verify_ns_clock(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct tcase *tc = &tcases[n];
SAFE_UNSHARE(CLONE_NEWTIME);
@@ -105,7 +102,7 @@ static void verify_ns_clock(unsigned int n)
SAFE_FILE_PRINTF("/proc/self/timens_offsets", "%d %d 0",
tc->clk_off, tc->off);
- if (tv->func(tc->clk_id, tst_ts_get(&now))) {
+ if (tv->clock_gettime(tc->clk_id, tst_ts_get(&now))) {
tst_res(TFAIL | TERRNO, "%d clock_gettime(%s) failed",
__LINE__, tst_clock_name(tc->clk_id));
return;
@@ -117,9 +114,9 @@ static void verify_ns_clock(unsigned int n)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
- now.type = then.type = parent_then.type = tv->type;
+ now.type = then.type = parent_then.type = tv->ts_type;
tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
parent_ns = SAFE_OPEN("/proc/self/ns/time_for_children", O_RDONLY);
}
diff --git a/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c b/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c
index c54faa3058c3..5f8264cc65ef 100644
--- a/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c
+++ b/testcases/kernel/syscalls/clock_gettime/clock_gettime04.c
@@ -9,6 +9,7 @@
#include "config.h"
#include "parse_vdso.h"
+#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_clocks.h"
@@ -62,23 +63,19 @@ static inline int my_gettimeofday(clockid_t clk_id, void *ts)
return 0;
}
-static struct test_variants {
- int (*gettime)(clockid_t clk_id, void *ts);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .gettime = libc_clock_gettime, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .clock_gettime = libc_clock_gettime, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#if (__NR_clock_gettime != __LTP__NR_INVALID_SYSCALL)
- { .gettime = sys_clock_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
- { .gettime = vdso_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "vDSO with old kernel spec"},
+ { .clock_gettime = sys_clock_gettime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .clock_gettime = vdso_gettime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "vDSO with old kernel spec"},
#endif
#if (__NR_clock_gettime64 != __LTP__NR_INVALID_SYSCALL)
- { .gettime = sys_clock_gettime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
- { .gettime = vdso_gettime64, .type = TST_KERN_TIMESPEC, .desc = "vDSO time64 with kernel spec"},
+ { .clock_gettime = sys_clock_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .clock_gettime = vdso_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "vDSO time64 with kernel spec"},
#endif
- { .gettime = my_gettimeofday, .type = TST_LIBC_TIMESPEC, .desc = "gettimeofday"},
+ { .clock_gettime = my_gettimeofday, .ts_type = TST_LIBC_TIMESPEC, .desc = "gettimeofday"},
};
static void setup(void)
@@ -95,7 +92,7 @@ static void run(unsigned int i)
{
struct tst_ts ts;
long long start, end = 0, diff, slack;
- struct test_variants *tv;
+ struct time64_variants *tv;
int count = 10000, ret;
unsigned int j;
@@ -105,13 +102,13 @@ static void run(unsigned int i)
start = end;
tv = &variants[j];
- ts.type = tv->type;
+ ts.type = tv->ts_type;
/* Do gettimeofday() test only for CLOCK_REALTIME */
- if (tv->gettime == my_gettimeofday && clks[i] != CLOCK_REALTIME)
+ if (tv->clock_gettime == my_gettimeofday && clks[i] != CLOCK_REALTIME)
continue;
- ret = tv->gettime(clks[i], tst_ts_get(&ts));
+ ret = tv->clock_gettime(clks[i], tst_ts_get(&ts));
if (ret) {
/*
* _vdso_gettime() sets error to ENOSYS if vdso
@@ -135,7 +132,7 @@ static void run(unsigned int i)
* gettimeofday() doesn't capture time less than 1 us,
* add 999 to it.
*/
- if (tv->gettime == my_gettimeofday)
+ if (tv->clock_gettime == my_gettimeofday)
slack = 999;
else
slack = 0;
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 04/17] syscalls: clock_nanosleep: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (2 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 03/17] syscalls: clock_gettime: Reuse struct time64_variants Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 05/17] syscalls: clock_settime: " Viresh Kumar
` (12 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../clock_nanosleep/clock_nanosleep01.c | 21 +++++++--------
.../clock_nanosleep/clock_nanosleep03.c | 26 ++++++++-----------
.../clock_nanosleep/clock_nanosleep04.c | 22 +++++++---------
3 files changed, 29 insertions(+), 40 deletions(-)
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
index 716f383bbeca..516ab50f16d6 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
+++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
@@ -17,6 +17,7 @@
#include <limits.h>
+#include "time64_variants.h"
#include "tst_safe_clocks.h"
#include "tst_sig_proc.h"
#include "tst_timer.h"
@@ -105,25 +106,21 @@ static struct test_case tcase[] = {
static struct tst_ts *rq;
static struct tst_ts *rm;
-static struct test_variants {
- int (*func)(clockid_t clock_id, int flags, void *request, void *remain);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .func = libc_clock_nanosleep, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .clock_nanosleep = libc_clock_nanosleep, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#if (__NR_clock_nanosleep != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_clock_nanosleep, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .clock_nanosleep = sys_clock_nanosleep, .ts_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 spec"},
+ { .clock_nanosleep = sys_clock_nanosleep64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
void setup(void)
{
- rq->type = variants[tst_variant].type;
+ rq->type = variants[tst_variant].ts_type;
tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
SAFE_SIGNAL(SIGINT, sighandler);
bad_addr = tst_get_bad_addr(NULL);
@@ -131,7 +128,7 @@ void setup(void)
static void do_test(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct test_case *tc = &tcase[i];
pid_t pid = 0;
void *request, *remain;
@@ -157,9 +154,9 @@ static void do_test(unsigned int i)
else
remain = tst_ts_get(rm);
- TEST(tv->func(tc->clk_id, tc->flags, request, remain));
+ TEST(tv->clock_nanosleep(tc->clk_id, tc->flags, request, remain));
- if (tv->func == libc_clock_nanosleep) {
+ if (tv->clock_nanosleep == libc_clock_nanosleep) {
/*
* The return value and error number are differently set for
* libc syscall as compared to kernel syscall.
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
index 0a7ea5586327..bd2c38ee3401 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
+++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep03.c
@@ -16,6 +16,7 @@
*/
#include <stdlib.h>
+#include "time64_variants.h"
#include "tst_safe_clocks.h"
#include "tst_timer.h"
#include "lapi/namespaces_constants.h"
@@ -23,40 +24,35 @@
#define OFFSET_S 10
#define SLEEP_US 100000
-static struct test_variants {
- int (*gettime)(clockid_t clk_id, void *ts);
- int (*func)(clockid_t clock_id, int flags, void *request, void *remain);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .gettime = libc_clock_gettime, .func = libc_clock_nanosleep, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .clock_gettime = libc_clock_gettime, .clock_nanosleep = libc_clock_nanosleep, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#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"},
+ { .clock_gettime = sys_clock_gettime, .clock_nanosleep = sys_clock_nanosleep, .ts_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 spec"},
+ { .clock_gettime = sys_clock_gettime64, .clock_nanosleep = sys_clock_nanosleep64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
-static void do_clock_gettime(struct test_variants *tv, struct tst_ts *ts)
+static void do_clock_gettime(struct time64_variants *tv, struct tst_ts *ts)
{
int ret;
- ret = tv->gettime(CLOCK_MONOTONIC, tst_ts_get(ts));
+ ret = tv->clock_gettime(CLOCK_MONOTONIC, tst_ts_get(ts));
if (ret == -1)
tst_brk(TBROK | TERRNO, "clock_settime(CLOCK_MONOTONIC) failed");
}
static void verify_clock_nanosleep(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct tst_ts start, end, sleep_abs;
tst_res(TINFO, "Testing variant: %s", tv->desc);
- start.type = end.type = sleep_abs.type = tv->type;
+ start.type = end.type = sleep_abs.type = tv->ts_type;
SAFE_UNSHARE(CLONE_NEWTIME);
@@ -67,12 +63,12 @@ static void verify_clock_nanosleep(void)
sleep_abs = tst_ts_add_us(start, 1000000 * OFFSET_S + SLEEP_US);
if (!SAFE_FORK()) {
- TEST(tv->func(CLOCK_MONOTONIC, TIMER_ABSTIME, tst_ts_get(&sleep_abs), NULL));
+ TEST(tv->clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, tst_ts_get(&sleep_abs), NULL));
/*
* The return value and error number are differently set for
* libc syscall as compared to kernel syscall.
*/
- if ((tv->func == libc_clock_nanosleep) && TST_RET) {
+ if ((tv->clock_nanosleep == libc_clock_nanosleep) && TST_RET) {
TST_ERR = TST_RET;
TST_RET = -1;
}
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep04.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep04.c
index 1f2d3c4f83ec..c5aeed505685 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep04.c
+++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep04.c
@@ -7,6 +7,7 @@
#include <stdio.h>
#include <time.h>
#include <unistd.h>
+#include "time64_variants.h"
#include "tst_safe_clocks.h"
#include "tst_timer.h"
@@ -15,20 +16,15 @@ static clockid_t tcase[] = {
CLOCK_REALTIME,
};
-static struct test_variants {
- int (*gettime)(clockid_t clk_id, void *ts);
- int (*func)(clockid_t clock_id, int flags, void *request, void *remain);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .gettime = libc_clock_gettime, .func = libc_clock_nanosleep, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .clock_gettime = libc_clock_gettime, .clock_nanosleep = libc_clock_nanosleep, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#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"},
+ { .clock_gettime = sys_clock_gettime, .clock_nanosleep = sys_clock_nanosleep, .ts_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 spec"},
+ { .clock_gettime = sys_clock_gettime64, .clock_nanosleep = sys_clock_nanosleep64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -39,10 +35,10 @@ void setup(void)
static void do_test(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
- struct tst_ts ts = {.type = tv->type};
+ struct time64_variants *tv = &variants[tst_variant];
+ struct tst_ts ts = {.type = tv->ts_type};
- TEST(tv->gettime(tcase[i], tst_ts_get(&ts)));
+ TEST(tv->clock_gettime(tcase[i], tst_ts_get(&ts)));
if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "clock_gettime(2) failed for clock %s",
tst_clock_name(tcase[i]));
@@ -51,7 +47,7 @@ static void do_test(unsigned int i)
ts = tst_ts_add_us(ts, 10000);
- TEST(tv->func(tcase[i], TIMER_ABSTIME, tst_ts_get(&ts), NULL));
+ TEST(tv->clock_nanosleep(tcase[i], TIMER_ABSTIME, tst_ts_get(&ts), NULL));
if (TST_RET) {
tst_res(TFAIL | TTERRNO, "clock_nanosleep(2) failed for clock %s",
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 05/17] syscalls: clock_settime: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (3 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 04/17] syscalls: clock_nanosleep: " Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 06/17] syscalls: io_pgetevents: " Viresh Kumar
` (11 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../syscalls/clock_settime/clock_settime01.c | 26 ++++++++-----------
.../syscalls/clock_settime/clock_settime02.c | 20 ++++++--------
.../syscalls/clock_settime/clock_settime03.c | 22 ++++++----------
3 files changed, 27 insertions(+), 41 deletions(-)
diff --git a/testcases/kernel/syscalls/clock_settime/clock_settime01.c b/testcases/kernel/syscalls/clock_settime/clock_settime01.c
index ba6045fc5c8f..19bddbcd30ef 100644
--- a/testcases/kernel/syscalls/clock_settime/clock_settime01.c
+++ b/testcases/kernel/syscalls/clock_settime/clock_settime01.c
@@ -14,6 +14,7 @@
*/
#include "config.h"
+#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_clocks.h"
@@ -23,41 +24,36 @@
static struct tst_ts *begin, *change, *end;
-static struct test_variants {
- int (*gettime)(clockid_t clk_id, void *ts);
- int (*settime)(clockid_t clk_id, void *ts);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .gettime = libc_clock_gettime, .settime = libc_clock_settime, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .clock_gettime = libc_clock_gettime, .clock_settime = libc_clock_settime, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#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"},
+ { .clock_gettime = sys_clock_gettime, .clock_settime = sys_clock_settime, .ts_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 spec"},
+ { .clock_gettime = sys_clock_gettime64, .clock_settime = sys_clock_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static void setup(void)
{
- begin->type = change->type = end->type = variants[tst_variant].type;
+ begin->type = change->type = end->type = variants[tst_variant].ts_type;
tst_res(TINFO, "Testing variant: %s", variants[tst_variant].desc);
}
-static void do_clock_gettime(struct test_variants *tv, struct tst_ts *ts)
+static void do_clock_gettime(struct time64_variants *tv, struct tst_ts *ts)
{
int ret;
- ret = tv->gettime(CLOCK_REALTIME, tst_ts_get(ts));
+ ret = tv->clock_gettime(CLOCK_REALTIME, tst_ts_get(ts));
if (ret == -1)
tst_brk(TBROK | TERRNO, "clock_settime(CLOCK_REALTIME) failed");
}
static void verify_clock_settime(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
long long elapsed;
/* test 01: move forward */
@@ -65,7 +61,7 @@ static void verify_clock_settime(void)
*change = tst_ts_add_us(*begin, DELTA_US);
- TEST(tv->settime(CLOCK_REALTIME, tst_ts_get(change)));
+ TEST(tv->clock_settime(CLOCK_REALTIME, tst_ts_get(change)));
if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "clock_settime(2) failed for clock %s",
tst_clock_name(CLOCK_REALTIME));
@@ -86,7 +82,7 @@ static void verify_clock_settime(void)
*change = tst_ts_sub_us(*begin, DELTA_US);
- TEST(tv->settime(CLOCK_REALTIME, tst_ts_get(change)));
+ TEST(tv->clock_settime(CLOCK_REALTIME, tst_ts_get(change)));
if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "clock_settime(2) failed for clock %s",
tst_clock_name(CLOCK_REALTIME));
diff --git a/testcases/kernel/syscalls/clock_settime/clock_settime02.c b/testcases/kernel/syscalls/clock_settime/clock_settime02.c
index 0a8245dd4889..88d4492456f8 100644
--- a/testcases/kernel/syscalls/clock_settime/clock_settime02.c
+++ b/testcases/kernel/syscalls/clock_settime/clock_settime02.c
@@ -9,6 +9,7 @@
*/
#include "config.h"
+#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_clocks.h"
@@ -91,18 +92,13 @@ struct test_case tc[] = {
static struct tst_ts spec;
-static struct test_variants {
- int (*gettime)(clockid_t clk_id, void *ts);
- int (*settime)(clockid_t clk_id, void *ts);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#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"},
+ { .clock_gettime = sys_clock_gettime, .clock_settime = sys_clock_settime, .ts_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 spec"},
+ { .clock_gettime = sys_clock_gettime64, .clock_settime = sys_clock_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -115,13 +111,13 @@ static void setup(void)
static void verify_clock_settime(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
void *ts;
- spec.type = tv->type;
+ spec.type = tv->ts_type;
if (tc[i].replace == 0) {
- TEST(tv->gettime(CLOCK_REALTIME, tst_ts_get(&spec)));
+ TEST(tv->clock_gettime(CLOCK_REALTIME, tst_ts_get(&spec)));
if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "clock_gettime(2) failed for clock %s",
tst_clock_name(CLOCK_REALTIME));
@@ -142,7 +138,7 @@ static void verify_clock_settime(unsigned int i)
else
ts = tst_ts_get(&spec);
- TEST(tv->settime(tc[i].type, ts));
+ TEST(tv->clock_settime(tc[i].type, ts));
if (TST_RET != -1) {
tst_res(TFAIL | TTERRNO, "clock_settime(2): clock %s passed unexpectedly, expected %s",
diff --git a/testcases/kernel/syscalls/clock_settime/clock_settime03.c b/testcases/kernel/syscalls/clock_settime/clock_settime03.c
index ad6183e4ce3e..fef3c10e98b1 100644
--- a/testcases/kernel/syscalls/clock_settime/clock_settime03.c
+++ b/testcases/kernel/syscalls/clock_settime/clock_settime03.c
@@ -8,6 +8,7 @@
#include <signal.h>
#include "config.h"
+#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_clocks.h"
@@ -17,32 +18,25 @@
static struct tst_ts start, end;
static struct tst_its its;
-static struct test_variants {
- int (*clock_gettime)(clockid_t clk_id, void *ts);
- int (*clock_settime)(clockid_t clk_id, void *ts);
- int (*timer_settime)(kernel_timer_t timerid, int flags, void *its,
- void *old_its);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_clock_settime != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime, .clock_settime = sys_clock_settime, .timer_settime = sys_timer_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .clock_gettime = sys_clock_gettime, .clock_settime = sys_clock_settime, .timer_settime = sys_timer_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_clock_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .clock_gettime = sys_clock_gettime64, .clock_settime = sys_clock_settime64, .timer_settime = sys_timer_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .clock_gettime = sys_clock_gettime64, .clock_settime = sys_clock_settime64, .timer_settime = sys_timer_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
- start.type = end.type = its.type = tv->type;
+ start.type = end.type = its.type = tv->ts_type;
/* Check if the kernel is y2038 safe */
- if (tv->type == TST_KERN_OLD_TIMESPEC &&
+ if (tv->ts_type == TST_KERN_OLD_TIMESPEC &&
sizeof(start.ts.kern_old_ts.tv_sec) == 4) {
tst_brk(TCONF, "Not Y2038 safe to run test");
}
@@ -50,7 +44,7 @@ static void setup(void)
static void run(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
unsigned long long time = 0x7FFFFFFE; /* Time just before y2038 */
struct sigevent ev = {
.sigev_notify = SIGEV_SIGNAL,
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 06/17] syscalls: io_pgetevents: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (4 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 05/17] syscalls: clock_settime: " Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 07/17] syscalls: semop: " Viresh Kumar
` (10 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../syscalls/io_pgetevents/io_pgetevents01.c | 16 ++++++----------
.../syscalls/io_pgetevents/io_pgetevents02.c | 18 +++++++-----------
2 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c b/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c
index adeca3f3cf79..2a1aad8d9f96 100644
--- a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c
+++ b/testcases/kernel/syscalls/io_pgetevents/io_pgetevents01.c
@@ -5,6 +5,7 @@
* Description:
* Basic io_pgetevents() test to receive 1 event successfully.
*/
+#include "time64_variants.h"
#include "tst_test.h"
#include "tst_timer.h"
#include "lapi/io_pgetevents.h"
@@ -12,18 +13,13 @@
#ifdef HAVE_LIBAIO
static int fd;
-static struct test_variants {
- int (*io_pgetevents)(io_context_t ctx, long min_nr, long max_nr,
- struct io_event *events, void *timeout, sigset_t *sigmask);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_io_pgetevents != __LTP__NR_INVALID_SYSCALL)
- { .io_pgetevents = sys_io_pgetevents, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .io_pgetevents = sys_io_pgetevents, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_io_pgetevents_time64 != __LTP__NR_INVALID_SYSCALL)
- { .io_pgetevents = sys_io_pgetevents_time64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .io_pgetevents = sys_io_pgetevents_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -40,11 +36,11 @@ static void cleanup(void)
static void run(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct io_event events[1];
struct iocb cb, *cbs[1];
io_context_t ctx = 0;
- struct tst_ts to = tst_ts_from_ns(tv->type, 10000);
+ struct tst_ts to = tst_ts_from_ns(tv->ts_type, 10000);
sigset_t sigmask;
char data[4096];
int ret;
diff --git a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c b/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c
index 885722fcad09..28afdb4a02d7 100644
--- a/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c
+++ b/testcases/kernel/syscalls/io_pgetevents/io_pgetevents02.c
@@ -5,6 +5,7 @@
* Description:
* Basic io_pgetevents() test to check various failures.
*/
+#include "time64_variants.h"
#include "tst_test.h"
#include "tst_timer.h"
#include "lapi/io_pgetevents.h"
@@ -36,31 +37,26 @@ static struct tcase {
{"invalid sigmask", &ctx, 1, 1, events, &to, NULL, EFAULT},
};
-static struct test_variants {
- int (*io_pgetevents)(io_context_t ctx, long min_nr, long max_nr,
- struct io_event *events, void *timeout, sigset_t *sigmask);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_io_pgetevents != __LTP__NR_INVALID_SYSCALL)
- { .io_pgetevents = sys_io_pgetevents, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .io_pgetevents = sys_io_pgetevents, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_io_pgetevents_time64 != __LTP__NR_INVALID_SYSCALL)
- { .io_pgetevents = sys_io_pgetevents_time64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .io_pgetevents = sys_io_pgetevents_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct iocb cb, *cbs[1];
char data[4096];
int ret;
tst_res(TINFO, "Testing variant: %s", tv->desc);
bad_addr = tst_get_bad_addr(NULL);
- to = tst_ts_from_ns(tv->type, 10000);
+ to = tst_ts_from_ns(tv->ts_type, 10000);
cbs[0] = &cb;
@@ -93,7 +89,7 @@ static void cleanup(void)
static void run(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct tcase *tc = &tcases[n];
struct timespec *to;
sigset_t *sigmask;
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 07/17] syscalls: semop: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (5 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 06/17] syscalls: io_pgetevents: " Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 08/17] syscalls: mq_timed: " Viresh Kumar
` (9 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
testcases/kernel/syscalls/ipc/semop/semop.h | 18 +++++++-----------
testcases/kernel/syscalls/ipc/semop/semop01.c | 6 +++---
testcases/kernel/syscalls/ipc/semop/semop02.c | 6 +++---
testcases/kernel/syscalls/ipc/semop/semop03.c | 6 +++---
4 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/testcases/kernel/syscalls/ipc/semop/semop.h b/testcases/kernel/syscalls/ipc/semop/semop.h
index 1fac31818108..73ab9fbbc15c 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop.h
+++ b/testcases/kernel/syscalls/ipc/semop/semop.h
@@ -4,6 +4,7 @@
#define SEMOP_VAR__
#include <sys/sem.h>
+#include "time64_variants.h"
#include "tst_timer.h"
static inline int sys_semtimedop(int semid, struct sembuf *sops, size_t nsops,
@@ -18,24 +19,19 @@ static inline int sys_semtimedop_time64(int semid, struct sembuf *sops,
return tst_syscall(__NR_semtimedop_time64, semid, sops, nsops, timeout);
}
-struct test_variants {
- int (*semop)(int semid, struct sembuf *sops, size_t nsops);
- int (*semtimedop)(int semid, struct sembuf *sops, size_t nsops, void *timeout);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .semop = semop, .type = TST_LIBC_TIMESPEC, .desc = "semop: syscall"},
+static struct time64_variants variants[] = {
+ { .semop = semop, .ts_type = TST_LIBC_TIMESPEC, .desc = "semop: syscall"},
#if (__NR_semtimedop != __LTP__NR_INVALID_SYSCALL)
- { .semtimedop = sys_semtimedop, .type = TST_KERN_OLD_TIMESPEC, .desc = "semtimedop: syscall with old kernel spec"},
+ { .semtimedop = sys_semtimedop, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "semtimedop: syscall with old kernel spec"},
#endif
#if (__NR_semtimedop_time64 != __LTP__NR_INVALID_SYSCALL)
- { .semtimedop = sys_semtimedop_time64, .type = TST_KERN_TIMESPEC, .desc = "semtimedop: syscall time64 with kernel spec"},
+ { .semtimedop = sys_semtimedop_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "semtimedop: syscall time64 with kernel spec"},
#endif
};
-static inline int call_semop(struct test_variants *tv, int semid,
+static inline int call_semop(struct time64_variants *tv, int semid,
struct sembuf *sops, size_t nsops, void *timeout)
{
if (tv->semop)
@@ -44,7 +40,7 @@ static inline int call_semop(struct test_variants *tv, int semid,
return tv->semtimedop(semid, sops, nsops, timeout);
}
-static inline void semop_supported_by_kernel(struct test_variants *tv)
+static inline void semop_supported_by_kernel(struct time64_variants *tv)
{
/* Check if the syscall is implemented on the platform */
TEST(call_semop(tv, 0, NULL, 0, NULL));
diff --git a/testcases/kernel/syscalls/ipc/semop/semop01.c b/testcases/kernel/syscalls/ipc/semop/semop01.c
index add9d07f3ad4..b20eef45cf59 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop01.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop01.c
@@ -33,7 +33,7 @@ static struct test_case_t {
static void run(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
union semun arr = { .val = 0 };
int fail = 0;
int i;
@@ -66,13 +66,13 @@ static void run(unsigned int n)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
int i;
tst_res(TINFO, "Testing variant: %s", tv->desc);
semop_supported_by_kernel(tv);
- timeout.type = tv->type;
+ timeout.type = tv->ts_type;
tst_ts_set_sec(&timeout, 0);
tst_ts_set_nsec(&timeout, 10000);
diff --git a/testcases/kernel/syscalls/ipc/semop/semop02.c b/testcases/kernel/syscalls/ipc/semop/semop02.c
index 9d799e6437cd..2c3ec2c66686 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop02.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop02.c
@@ -69,7 +69,7 @@ static struct test_case_t {
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct passwd *ltpuser;
key_t semkey;
union semun arr;
@@ -79,7 +79,7 @@ static void setup(void)
tst_res(TINFO, "Testing variant: %s", tv->desc);
semop_supported_by_kernel(tv);
- timeout.type = tv->type;
+ timeout.type = tv->ts_type;
tst_ts_set_sec(&timeout, 0);
tst_ts_set_nsec(&timeout, 10000);
@@ -110,7 +110,7 @@ static void setup(void)
static void run(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
union semun arr = {.val = tc[i].arr_val};
struct sembuf buf = {
.sem_op = *tc[i].sem_op,
diff --git a/testcases/kernel/syscalls/ipc/semop/semop03.c b/testcases/kernel/syscalls/ipc/semop/semop03.c
index 43d22a8ee1a7..89603f19d651 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop03.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop03.c
@@ -36,7 +36,7 @@ struct test_case_t {
static void do_child(int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct sembuf s_buf = {
.sem_op = tc[i].op,
.sem_flg = tc[i].flg,
@@ -65,12 +65,12 @@ static void sighandler(int sig)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
semop_supported_by_kernel(tv);
- timeout.type = tv->type;
+ timeout.type = tv->ts_type;
tst_ts_set_sec(&timeout, 0);
tst_ts_set_nsec(&timeout, 10000000);
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 08/17] syscalls: mq_timed: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (6 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 07/17] syscalls: semop: " Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 09/17] syscalls: ppoll: " Viresh Kumar
` (8 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../mq_timedreceive/mq_timedreceive01.c | 14 +++++++-------
.../syscalls/mq_timedsend/mq_timedsend01.c | 16 ++++++++--------
testcases/kernel/syscalls/utils/mq_timed.h | 18 +++++-------------
3 files changed, 20 insertions(+), 28 deletions(-)
diff --git a/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c b/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
index de0505106d04..be437e19a47f 100644
--- a/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
+++ b/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
@@ -135,10 +135,10 @@ static struct test_case tcase[] = {
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
- ts.type = tv->type;
+ ts.type = tv->ts_type;
bad_addr = tst_get_bad_addr(NULL);
@@ -147,7 +147,7 @@ static void setup(void)
static void do_test(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
const struct test_case *tc = &tcase[i];
unsigned int j;
unsigned int prio;
@@ -160,13 +160,13 @@ static void do_test(unsigned int i)
tst_ts_set_nsec(&ts, tc->tv_nsec);
if (tc->signal)
- pid = set_sig(tc->rq, tv->gettime);
+ pid = set_sig(tc->rq, tv->clock_gettime);
if (tc->timeout)
- set_timeout(tc->rq, tv->gettime);
+ set_timeout(tc->rq, tv->clock_gettime);
if (tc->send) {
- if (tv->send(*tc->fd, smsg, tc->len, tc->prio, NULL) < 0) {
+ if (tv->mqt_send(*tc->fd, smsg, tc->len, tc->prio, NULL) < 0) {
tst_res(TFAIL | TTERRNO, "mq_timedsend() failed");
return;
}
@@ -180,7 +180,7 @@ static void do_test(unsigned int i)
else
abs_timeout = tst_ts_get(tc->rq);
- TEST(tv->receive(*tc->fd, rmsg, len, &prio, abs_timeout));
+ TEST(tv->mqt_receive(*tc->fd, rmsg, len, &prio, abs_timeout));
if (pid > 0)
kill_pid(pid);
diff --git a/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c b/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c
index d72f5d41ad61..334131402c9d 100644
--- a/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c
+++ b/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c
@@ -148,10 +148,10 @@ static struct test_case tcase[] = {
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
- ts.type = tv->type;
+ ts.type = tv->ts_type;
bad_addr = tst_get_bad_addr(cleanup_common);
@@ -160,7 +160,7 @@ static void setup(void)
static void do_test(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
const struct test_case *tc = &tcase[i];
unsigned int j;
unsigned int prio;
@@ -173,14 +173,14 @@ static void do_test(unsigned int i)
tst_ts_set_nsec(&ts, tc->tv_nsec);
if (tc->signal)
- pid = set_sig(tc->rq, tv->gettime);
+ pid = set_sig(tc->rq, tv->clock_gettime);
if (tc->timeout)
- set_timeout(tc->rq, tv->gettime);
+ set_timeout(tc->rq, tv->clock_gettime);
if (tc->send) {
for (j = 0; j < MSG_LENGTH; j++)
- if (tv->send(*tc->fd, smsg, tc->len, tc->prio, NULL) < 0) {
+ if (tv->mqt_send(*tc->fd, smsg, tc->len, tc->prio, NULL) < 0) {
tst_res(TFAIL | TTERRNO, "mq_timedsend() failed");
return;
}
@@ -196,7 +196,7 @@ static void do_test(unsigned int i)
else
abs_timeout = tst_ts_get(tc->rq);
- TEST(tv->send(*tc->fd, msg_ptr, tc->len, tc->prio, abs_timeout));
+ TEST(tv->mqt_send(*tc->fd, msg_ptr, tc->len, tc->prio, abs_timeout));
if (pid > 0)
kill_pid(pid);
@@ -215,7 +215,7 @@ static void do_test(unsigned int i)
return;
}
- TEST(tv->receive(*tc->fd, rmsg, len, &prio, tst_ts_get(tc->rq)));
+ TEST(tv->mqt_receive(*tc->fd, rmsg, len, &prio, tst_ts_get(tc->rq)));
if (*tc->fd == fd)
cleanup_queue(fd);
diff --git a/testcases/kernel/syscalls/utils/mq_timed.h b/testcases/kernel/syscalls/utils/mq_timed.h
index a217e864e1e4..adf46034bdc6 100644
--- a/testcases/kernel/syscalls/utils/mq_timed.h
+++ b/testcases/kernel/syscalls/utils/mq_timed.h
@@ -7,26 +7,18 @@
#define MQ_TIMED_H
#include "mq.h"
+#include "time64_variants.h"
#include "tst_timer.h"
-static struct test_variants {
- int (*send)(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
- unsigned int msg_prio, void *abs_timeout);
- ssize_t (*receive)(mqd_t mqdes, char *msg_ptr, size_t msg_len,
- unsigned int *msg_prio, void *abs_timeout);
-
- int (*gettime)(clockid_t clk_id, void *ts);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .gettime = libc_clock_gettime, .send = libc_mq_timedsend, .receive = libc_mq_timedreceive, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .clock_gettime = libc_clock_gettime, .mqt_send = libc_mq_timedsend, .mqt_receive = libc_mq_timedreceive, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#if (__NR_mq_timedsend != __LTP__NR_INVALID_SYSCALL)
- { .gettime = sys_clock_gettime, .send = sys_mq_timedsend, .receive = sys_mq_timedreceive, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .clock_gettime = sys_clock_gettime, .mqt_send = sys_mq_timedsend, .mqt_receive = sys_mq_timedreceive, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_mq_timedsend_time64 != __LTP__NR_INVALID_SYSCALL)
- { .gettime = sys_clock_gettime64, .send = sys_mq_timedsend64, .receive = sys_mq_timedreceive64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .clock_gettime = sys_clock_gettime64, .mqt_send = sys_mq_timedsend64, .mqt_receive = sys_mq_timedreceive64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 09/17] syscalls: ppoll: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (7 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 08/17] syscalls: mq_timed: " Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 10/17] syscalls: rt_sigtimedwait: " Viresh Kumar
` (7 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
testcases/kernel/syscalls/ppoll/ppoll01.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/testcases/kernel/syscalls/ppoll/ppoll01.c b/testcases/kernel/syscalls/ppoll/ppoll01.c
index e9e57e5858e6..3d2f92f2ac1d 100644
--- a/testcases/kernel/syscalls/ppoll/ppoll01.c
+++ b/testcases/kernel/syscalls/ppoll/ppoll01.c
@@ -19,6 +19,7 @@
#include <sys/wait.h>
#include "lapi/syscalls.h"
#include "ltp_signal.h"
+#include "time64_variants.h"
#include "tst_sig_proc.h"
#include "tst_test.h"
#include "tst_timer.h"
@@ -174,21 +175,15 @@ static inline int sys_ppoll_time64(struct pollfd *fds, nfds_t nfds, void *tmo_p,
sigsetsize);
}
-static struct test_variants {
- int (*ppoll)(struct pollfd *fds, nfds_t nfds, void *tmo_p,
- const sigset_t *sigmask, size_t sigsetsize);
-
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .ppoll = libc_ppoll, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .ppoll = libc_ppoll, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#if (__NR_ppoll != __LTP__NR_INVALID_SYSCALL)
- { .ppoll = sys_ppoll, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .ppoll = sys_ppoll, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_ppoll_time64 != __LTP__NR_INVALID_SYSCALL)
- { .ppoll = sys_ppoll_time64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .ppoll = sys_ppoll_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -198,7 +193,7 @@ static void sighandler(int sig LTP_ATTRIBUTE_UNUSED)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
int fd2;
tst_res(TINFO, "Testing variant: %s", tv->desc);
@@ -222,7 +217,7 @@ static void setup(void)
fds_already_closed[0].revents = 0;
SAFE_CLOSE(fd2);
- ts_short.type = ts_long.type = tv->type;
+ ts_short.type = ts_long.type = tv->ts_type;
tst_ts_set_sec(&ts_short, 0);
tst_ts_set_nsec(&ts_short, 20000000);
tst_ts_set_sec(&ts_long, 2);
@@ -237,7 +232,7 @@ static void cleanup(void)
static void do_test(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
pid_t pid = 0;
int sys_ret, sys_errno = 0, dummy;
struct test_case *tc = &tcase[i];
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 10/17] syscalls: rt_sigtimedwait: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (8 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 09/17] syscalls: ppoll: " Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 11/17] syscalls: sched_rr_get_interval: " Viresh Kumar
` (6 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../syscalls/rt_sigtimedwait/rt_sigtimedwait01.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/testcases/kernel/syscalls/rt_sigtimedwait/rt_sigtimedwait01.c b/testcases/kernel/syscalls/rt_sigtimedwait/rt_sigtimedwait01.c
index db4901a40ea1..813f75b9ed82 100644
--- a/testcases/kernel/syscalls/rt_sigtimedwait/rt_sigtimedwait01.c
+++ b/testcases/kernel/syscalls/rt_sigtimedwait/rt_sigtimedwait01.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* Copyright (c) Jiri Palecek<jpalecek@web.de>, 2009 */
+#include "time64_variants.h"
#include "libsigwait.h"
static int my_rt_sigtimedwait(const sigset_t * set, siginfo_t * info,
@@ -40,26 +41,22 @@ struct sigwait_test_desc tests[] = {
{ test_masked_matching_rt, -1},
};
-static struct test_variants {
- swi_func swi;
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_rt_sigtimedwait != __LTP__NR_INVALID_SYSCALL)
- { .swi = my_rt_sigtimedwait, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .sigwait = my_rt_sigtimedwait, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_rt_sigtimedwait_time64 != __LTP__NR_INVALID_SYSCALL)
- { .swi = my_rt_sigtimedwait_time64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .sigwait = my_rt_sigtimedwait_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static void run(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct sigwait_test_desc *tc = &tests[i];
- tc->tf(tv->swi, tc->signo, tv->type);
+ tc->tf(tv->sigwait, tc->signo, tv->ts_type);
}
static void setup(void)
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 11/17] syscalls: sched_rr_get_interval: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (9 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 10/17] syscalls: rt_sigtimedwait: " Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 12/17] syscalls: sendmmsg: " Viresh Kumar
` (5 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../sched_rr_get_interval01.c | 21 ++++++++-----------
.../sched_rr_get_interval02.c | 21 ++++++++-----------
.../sched_rr_get_interval03.c | 21 ++++++++-----------
3 files changed, 27 insertions(+), 36 deletions(-)
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
index 0466be36bec0..9d9ddf32eec1 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
@@ -12,6 +12,7 @@
*/
#include <sched.h>
+#include "time64_variants.h"
#include "tst_timer.h"
#define PROC_SCHED_RR_TIMESLICE_MS "/proc/sys/kernel/sched_rr_timeslice_ms"
@@ -19,30 +20,26 @@ static int proc_flag;
struct tst_ts tp;
-static struct test_variants {
- int (*func)(pid_t pid, void *ts);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .func = libc_sched_rr_get_interval, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .sched_rr_get_interval = libc_sched_rr_get_interval, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#if (__NR_sched_rr_get_interval != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_sched_rr_get_interval, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .sched_rr_get_interval = sys_sched_rr_get_interval, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_sched_rr_get_interval_time64 != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_sched_rr_get_interval64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .sched_rr_get_interval = sys_sched_rr_get_interval64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct sched_param p = { 1 };
tst_res(TINFO, "Testing variant: %s", tv->desc);
- tp.type = tv->type;
+ tp.type = tv->ts_type;
if ((sched_setscheduler(0, SCHED_RR, &p)) == -1)
tst_res(TFAIL | TTERRNO, "sched_setscheduler() failed");
@@ -52,9 +49,9 @@ static void setup(void)
static void run(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
- TEST(tv->func(0, tst_ts_get(&tp)));
+ TEST(tv->sched_rr_get_interval(0, tst_ts_get(&tp)));
if (!TST_RET) {
tst_res(TPASS, "sched_rr_get_interval() passed");
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
index 5b38e5bff0d3..0e98fec5608f 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
@@ -9,34 +9,31 @@
*/
#include <sched.h>
+#include "time64_variants.h"
#include "tst_timer.h"
static struct tst_ts tp;
-static struct test_variants {
- int (*func)(pid_t pid, void *ts);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .func = libc_sched_rr_get_interval, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .sched_rr_get_interval = libc_sched_rr_get_interval, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#if (__NR_sched_rr_get_interval != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_sched_rr_get_interval, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .sched_rr_get_interval = sys_sched_rr_get_interval, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_sched_rr_get_interval_time64 != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_sched_rr_get_interval64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .sched_rr_get_interval = sys_sched_rr_get_interval64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct sched_param p = { 1 };
tst_res(TINFO, "Testing variant: %s", tv->desc);
- tp.type = tv->type;
+ tp.type = tv->ts_type;
if ((sched_setscheduler(0, SCHED_FIFO, &p)) == -1)
tst_res(TFAIL | TTERRNO, "sched_setscheduler() failed");
@@ -44,12 +41,12 @@ static void setup(void)
static void run(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
tst_ts_set_sec(&tp, 99);
tst_ts_set_nsec(&tp, 99);
- TEST(tv->func(0, tst_ts_get(&tp)));
+ TEST(tv->sched_rr_get_interval(0, tst_ts_get(&tp)));
if (!TST_RET && tst_ts_valid(&tp) == -1) {
tst_res(TPASS, "sched_rr_get_interval() passed");
diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
index d7bbe268689c..6a64ca2c6b94 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
@@ -13,6 +13,7 @@
*/
#include <sched.h>
+#include "time64_variants.h"
#include "tst_timer.h"
static pid_t unused_pid;
@@ -32,31 +33,27 @@ struct test_cases_t {
{ &zero_pid, NULL, EFAULT}
};
-static struct test_variants {
- int (*func)(pid_t pid, void *ts);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .func = libc_sched_rr_get_interval, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .sched_rr_get_interval = libc_sched_rr_get_interval, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#if (__NR_sched_rr_get_interval != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_sched_rr_get_interval, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .sched_rr_get_interval = sys_sched_rr_get_interval, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_sched_rr_get_interval_time64 != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_sched_rr_get_interval64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .sched_rr_get_interval = sys_sched_rr_get_interval64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct sched_param p = { 1 };
tst_res(TINFO, "Testing variant: %s", tv->desc);
bad_addr = tst_get_bad_addr(NULL);
- tp.type = tv->type;
+ tp.type = tv->ts_type;
if ((sched_setscheduler(0, SCHED_RR, &p)) == -1)
tst_res(TFAIL | TTERRNO, "sched_setscheduler() failed");
@@ -66,7 +63,7 @@ static void setup(void)
static void run(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct test_cases_t *tc = &test_cases[i];
struct timerspec *ts;
@@ -75,7 +72,7 @@ static void run(unsigned int i)
else
ts = tst_ts_get(tc->tp);
- TEST(tv->func(*tc->pid, ts));
+ TEST(tv->sched_rr_get_interval(*tc->pid, ts));
if (TST_RET != -1) {
tst_res(TFAIL, "sched_rr_get_interval() passed unexcpectedly");
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 12/17] syscalls: sendmmsg: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (10 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 11/17] syscalls: sched_rr_get_interval: " Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 13/17] syscalls: timer_settime: " Viresh Kumar
` (4 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../kernel/syscalls/sendmmsg/sendmmsg01.c | 24 +++++++------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c b/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c
index 54febf661530..d6a717687ee7 100644
--- a/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c
+++ b/testcases/kernel/syscalls/sendmmsg/sendmmsg01.c
@@ -11,6 +11,7 @@
#include <string.h>
#include <sys/types.h>
+#include "time64_variants.h"
#include "tst_test.h"
#include "lapi/socket.h"
#include "tst_safe_macros.h"
@@ -24,32 +25,25 @@ static int receive_sockfd;
static struct mmsghdr *snd_msg, *rcv_msg;
static struct iovec *snd1, *snd2, *rcv1, *rcv2;
-static struct test_variants {
- int (*receive)(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,
- unsigned int flags, void *timeout);
- int (*send)(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,
- unsigned int flags);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
- { .receive = libc_recvmmsg, .send = libc_sendmmsg, .type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
+static struct time64_variants variants[] = {
+ { .recvmmsg = libc_recvmmsg, .sendmmsg = libc_sendmmsg, .ts_type = TST_LIBC_TIMESPEC, .desc = "vDSO or syscall with libc spec"},
#if (__NR_recvmmsg != __LTP__NR_INVALID_SYSCALL)
- { .receive = sys_recvmmsg, .send = sys_sendmmsg, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .recvmmsg = sys_recvmmsg, .sendmmsg = sys_sendmmsg, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_recvmmsg_time64 != __LTP__NR_INVALID_SYSCALL)
- { .receive = sys_recvmmsg64, .send = sys_sendmmsg, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .recvmmsg = sys_recvmmsg64, .sendmmsg = sys_sendmmsg, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static void run(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct tst_ts timeout;
int retval;
- retval = tv->send(send_sockfd, snd_msg, VLEN, 0);
+ retval = tv->sendmmsg(send_sockfd, snd_msg, VLEN, 0);
if (retval < 0 || snd_msg[0].msg_len != 6 || snd_msg[1].msg_len != 6) {
tst_res(TFAIL | TERRNO, "sendmmsg() failed");
return;
@@ -58,11 +52,11 @@ static void run(void)
memset(rcv1->iov_base, 0, rcv1->iov_len);
memset(rcv2->iov_base, 0, rcv2->iov_len);
- timeout.type = tv->type;
+ timeout.type = tv->ts_type;
tst_ts_set_sec(&timeout, 1);
tst_ts_set_nsec(&timeout, 0);
- retval = tv->receive(receive_sockfd, rcv_msg, VLEN, 0, tst_ts_get(&timeout));
+ retval = tv->recvmmsg(receive_sockfd, rcv_msg, VLEN, 0, tst_ts_get(&timeout));
if (retval == -1) {
tst_res(TFAIL | TERRNO, "recvmmsg() failed");
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 13/17] syscalls: timer_settime: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (11 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 12/17] syscalls: sendmmsg: " Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 14/17] syscalls: timer_gettime: " Viresh Kumar
` (3 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../syscalls/timer_settime/timer_settime01.c | 25 ++++++++-----------
.../syscalls/timer_settime/timer_settime02.c | 18 ++++++-------
2 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime01.c b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
index 415c6290fe2f..67143e8f88b2 100644
--- a/testcases/kernel/syscalls/timer_settime/timer_settime01.c
+++ b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <time.h>
#include <signal.h>
+#include "time64_variants.h"
#include "tst_timer.h"
static struct tst_ts timenow;
@@ -45,19 +46,13 @@ static struct testcase {
{&old_set, 50000, 0, TIMER_ABSTIME, "using absolute time"},
};
-static struct test_variants {
- int (*cgettime)(clockid_t clk_id, void *ts);
- int (*tgettime)(kernel_timer_t timer, void *its);
- int (*func)(kernel_timer_t timerid, int flags, void *its, void *old_its);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_timer_settime != __LTP__NR_INVALID_SYSCALL)
- { .cgettime = sys_clock_gettime, .tgettime = sys_timer_gettime, .func = sys_timer_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .clock_gettime = sys_clock_gettime, .timer_gettime = sys_timer_gettime, .timer_settime = sys_timer_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_timer_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .cgettime = sys_clock_gettime64, .tgettime = sys_timer_gettime64, .func = sys_timer_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .clock_gettime = sys_clock_gettime64, .timer_gettime = sys_timer_gettime64, .timer_settime = sys_timer_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -93,7 +88,7 @@ static void setup(void)
static void run(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct testcase *tc = &tcases[n];
long long val;
unsigned int i;
@@ -126,12 +121,12 @@ static void run(unsigned int n)
memset(&new_set, 0, sizeof(new_set));
memset(&old_set, 0, sizeof(old_set));
- new_set.type = old_set.type = tv->type;
+ new_set.type = old_set.type = tv->ts_type;
val = tc->it_value_tv_usec;
if (tc->flag & TIMER_ABSTIME) {
- timenow.type = tv->type;
- if (tv->cgettime(clock, tst_ts_get(&timenow)) < 0) {
+ timenow.type = tv->ts_type;
+ if (tv->clock_gettime(clock, tst_ts_get(&timenow)) < 0) {
tst_res(TFAIL,
"clock_gettime(%s) failed - skipping the test",
get_clock_str(clock));
@@ -143,14 +138,14 @@ static void run(unsigned int n)
tst_its_set_interval_from_us(&new_set, tc->it_interval_tv_usec);
tst_its_set_value_from_us(&new_set, val);
- TEST(tv->func(timer, tc->flag, tst_its_get(&new_set), tst_its_get(tc->old_ptr)));
+ TEST(tv->timer_settime(timer, tc->flag, tst_its_get(&new_set), tst_its_get(tc->old_ptr)));
if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO, "timer_settime(%s) failed",
get_clock_str(clock));
}
- TEST(tv->tgettime(timer, tst_its_get(&new_set)));
+ TEST(tv->timer_gettime(timer, tst_its_get(&new_set)));
if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO, "timer_gettime(%s) failed",
get_clock_str(clock));
diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime02.c b/testcases/kernel/syscalls/timer_settime/timer_settime02.c
index f1225c1ccfad..564f1c2ce323 100644
--- a/testcases/kernel/syscalls/timer_settime/timer_settime02.c
+++ b/testcases/kernel/syscalls/timer_settime/timer_settime02.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include <time.h>
+#include "time64_variants.h"
#include "tst_timer.h"
static struct tst_its new_set, old_set;
@@ -58,18 +59,13 @@ static struct testcase {
{&timer, &pnew_set, (struct tst_its **)&faulty_set, 0, EFAULT},
};
-static struct test_variants {
- int (*func)(kernel_timer_t timerid, int flags, void *its,
- void *old_its);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_timer_settime != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_timer_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .timer_settime = sys_timer_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_timer_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_timer_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .timer_settime = sys_timer_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -81,7 +77,7 @@ static void setup(void)
static void run(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct testcase *tc = &tcases[n];
void *new, *old;
unsigned int i;
@@ -115,7 +111,7 @@ static void run(unsigned int n)
memset(&new_set, 0, sizeof(new_set));
memset(&old_set, 0, sizeof(old_set));
- new_set.type = old_set.type = tv->type;
+ new_set.type = old_set.type = tv->ts_type;
tst_its_set_interval_sec(&new_set, 0);
tst_its_set_interval_nsec(&new_set, 0);
tst_its_set_value_sec(&new_set, 5);
@@ -124,7 +120,7 @@ static void run(unsigned int n)
new = (tc->new_ptr == (struct tst_its **)&faulty_set) ? faulty_set : tst_its_get(*tc->new_ptr);
old = (tc->old_ptr == (struct tst_its **)&faulty_set) ? faulty_set : tst_its_get(*tc->old_ptr);
- TEST(tv->func(*tc->timer_id, 0, new, old));
+ TEST(tv->timer_settime(*tc->timer_id, 0, new, old));
if (tc->error != TST_ERR) {
tst_res(TFAIL | TTERRNO,
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 14/17] syscalls: timer_gettime: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (12 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 13/17] syscalls: timer_settime: " Viresh Kumar
@ 2020-09-16 10:37 ` Viresh Kumar
2020-09-16 10:38 ` [LTP] [PATCH V2 15/17] syscalls: timerfd: " Viresh Kumar
` (2 subsequent siblings)
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:37 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../syscalls/timer_gettime/timer_gettime01.c | 21 ++++++++-----------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c b/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c
index 02d5b416d1a2..7ac83546224c 100644
--- a/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c
+++ b/testcases/kernel/syscalls/timer_gettime/timer_gettime01.c
@@ -12,19 +12,16 @@
#include <stdio.h>
#include <errno.h>
+#include "time64_variants.h"
#include "tst_timer.h"
-static struct test_variants {
- int (*func)(kernel_timer_t timer, void *its);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_timer_gettime != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_timer_gettime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .timer_gettime = sys_timer_gettime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_timer_gettime64 != __LTP__NR_INVALID_SYSCALL)
- { .func = sys_timer_gettime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .timer_gettime = sys_timer_gettime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -50,10 +47,10 @@ static void setup(void)
static void verify(void)
{
- struct test_variants *tv = &variants[tst_variant];
- struct tst_its spec = {.type = tv->type, };
+ struct time64_variants *tv = &variants[tst_variant];
+ struct tst_its spec = {.type = tv->ts_type, };
- TEST(tv->func(timer, tst_its_get(&spec)));
+ TEST(tv->timer_gettime(timer, tst_its_get(&spec)));
if (TST_RET == 0) {
if (tst_its_get_interval_sec(spec) ||
tst_its_get_interval_nsec(spec) ||
@@ -66,13 +63,13 @@ static void verify(void)
tst_res(TFAIL | TTERRNO, "timer_gettime() Failed");
}
- TEST(tv->func((kernel_timer_t)-1, tst_its_get(&spec)));
+ TEST(tv->timer_gettime((kernel_timer_t)-1, tst_its_get(&spec)));
if (TST_RET == -1 && TST_ERR == EINVAL)
tst_res(TPASS, "timer_gettime(-1) Failed: EINVAL");
else
tst_res(TFAIL | TTERRNO, "timer_gettime(-1) = %li", TST_RET);
- TEST(tv->func(timer, NULL));
+ TEST(tv->timer_gettime(timer, NULL));
if (TST_RET == -1 && TST_ERR == EFAULT)
tst_res(TPASS, "timer_gettime(NULL) Failed: EFAULT");
else
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 15/17] syscalls: timerfd: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (13 preceding siblings ...)
2020-09-16 10:37 ` [LTP] [PATCH V2 14/17] syscalls: timer_gettime: " Viresh Kumar
@ 2020-09-16 10:38 ` Viresh Kumar
2020-09-16 10:38 ` [LTP] [PATCH V2 16/17] syscalls: utimensat: " Viresh Kumar
2020-09-16 10:38 ` [LTP] [PATCH V2 17/17] futex: Move variants struct definition to common header Viresh Kumar
16 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:38 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
testcases/kernel/syscalls/timerfd/timerfd01.c | 27 ++++++++-----------
testcases/kernel/syscalls/timerfd/timerfd04.c | 20 ++++++--------
.../syscalls/timerfd/timerfd_gettime01.c | 8 +++---
.../syscalls/timerfd/timerfd_settime01.c | 17 +++++-------
.../syscalls/timerfd/timerfd_settime02.c | 15 +++++------
5 files changed, 35 insertions(+), 52 deletions(-)
diff --git a/testcases/kernel/syscalls/timerfd/timerfd01.c b/testcases/kernel/syscalls/timerfd/timerfd01.c
index 039d962ca228..cede40dafb2b 100644
--- a/testcases/kernel/syscalls/timerfd/timerfd01.c
+++ b/testcases/kernel/syscalls/timerfd/timerfd01.c
@@ -17,6 +17,7 @@
#define _GNU_SOURCE
#include <poll.h>
+#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_timerfd.h"
@@ -28,28 +29,22 @@ static struct tcase {
{CLOCK_REALTIME, "CLOCK REALTIME"},
};
-static struct test_variants {
- int (*cgettime)(clockid_t clk_id, void *ts);
- int (*tfd_gettime)(int fd, void *its);
- int (*tfd_settime)(int fd, int flags, void *new_value, void *old_value);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_timerfd_gettime != __LTP__NR_INVALID_SYSCALL)
- { .cgettime = sys_clock_gettime, .tfd_gettime = sys_timerfd_gettime, .tfd_settime = sys_timerfd_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .clock_gettime = sys_clock_gettime, .tfd_gettime = sys_timerfd_gettime, .tfd_settime = sys_timerfd_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_timerfd_gettime64 != __LTP__NR_INVALID_SYSCALL)
- { .cgettime = sys_clock_gettime64, .tfd_gettime = sys_timerfd_gettime64, .tfd_settime = sys_timerfd_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .clock_gettime = sys_clock_gettime64, .tfd_gettime = sys_timerfd_gettime64, .tfd_settime = sys_timerfd_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static unsigned long long getustime(int clockid)
{
- struct test_variants *tv = &variants[tst_variant];
- struct tst_ts tp = {.type = tv->type, };
+ struct time64_variants *tv = &variants[tst_variant];
+ struct tst_ts tp = {.type = tv->ts_type, };
- if (tv->cgettime((clockid_t) clockid, tst_ts_get(&tp))) {
+ if (tv->clock_gettime((clockid_t) clockid, tst_ts_get(&tp))) {
tst_res(TFAIL | TERRNO, "clock_gettime() failed");
return 0;
}
@@ -60,7 +55,7 @@ static unsigned long long getustime(int clockid)
static void settime(int tfd, struct tst_its *tmr, int tflags,
unsigned long long tvalue, int tinterval)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
tst_its_set_value_from_us(tmr, tvalue);
tst_its_set_interval_from_us(tmr, tinterval);
@@ -97,11 +92,11 @@ static void waittmr(int tfd, unsigned int exp_ticks)
static void run(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
int tfd;
unsigned long long tnow;
uint64_t uticks;
- struct tst_its tmr = {.type = tv->type, };
+ struct tst_its tmr = {.type = tv->ts_type, };
struct tcase *clks = &tcases[n];
tst_res(TINFO, "testing %s", clks->name);
@@ -122,7 +117,7 @@ static void run(unsigned int n)
settime(tfd, &tmr, TFD_TIMER_ABSTIME, tnow + 50 * 1000, 50 * 1000);
memset(&tmr, 0, sizeof(tmr));
- tmr.type = tv->type;
+ tmr.type = tv->ts_type;
if (tv->tfd_gettime(tfd, tst_its_get(&tmr)))
tst_res(TFAIL | TERRNO, "timerfd_gettime() failed");
diff --git a/testcases/kernel/syscalls/timerfd/timerfd04.c b/testcases/kernel/syscalls/timerfd/timerfd04.c
index b6409574a219..798d95e607ed 100644
--- a/testcases/kernel/syscalls/timerfd/timerfd04.c
+++ b/testcases/kernel/syscalls/timerfd/timerfd04.c
@@ -15,6 +15,7 @@
*/
#include <stdlib.h>
+#include "time64_variants.h"
#include "tst_safe_clocks.h"
#include "tst_safe_timerfd.h"
#include "tst_timer.h"
@@ -34,18 +35,13 @@ static struct tcase {
{CLOCK_BOOTTIME, CLOCK_BOOTTIME, -10},
};
-static struct test_variants {
- int (*cgettime)(clockid_t clk_id, void *ts);
- int (*tfd_settime)(int fd, int flags, void *new_value, void *old_value);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_timerfd_settime != __LTP__NR_INVALID_SYSCALL)
- { .cgettime = sys_clock_gettime, .tfd_settime = sys_timerfd_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .clock_gettime = sys_clock_gettime, .tfd_settime = sys_timerfd_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_timerfd_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .cgettime = sys_clock_gettime64, .tfd_settime = sys_timerfd_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .clock_gettime = sys_clock_gettime64, .tfd_settime = sys_timerfd_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -56,18 +52,18 @@ static void setup(void)
static void verify_timerfd(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct tst_ts start, end;
struct tst_its it;
struct tcase *tc = &tcases[n];
- start.type = end.type = it.type = tv->type;
+ start.type = end.type = it.type = tv->ts_type;
SAFE_UNSHARE(CLONE_NEWTIME);
SAFE_FILE_PRINTF("/proc/self/timens_offsets", "%d %d 0",
tc->clk_off, tc->off);
- if (tv->cgettime(tc->clk_id, tst_ts_get(&start))) {
+ if (tv->clock_gettime(tc->clk_id, tst_ts_get(&start))) {
tst_res(TFAIL | TTERRNO, "clock_gettime(2) failed for clock %s",
tst_clock_name(tc->clk_id));
return;
@@ -98,7 +94,7 @@ static void verify_timerfd(unsigned int n)
SAFE_WAIT(NULL);
- if (tv->cgettime(CLOCK_MONOTONIC, tst_ts_get(&end))) {
+ if (tv->clock_gettime(CLOCK_MONOTONIC, tst_ts_get(&end))) {
tst_res(TFAIL | TTERRNO, "clock_gettime(2) failed for clock %s",
tst_clock_name(CLOCK_MONOTONIC));
return;
diff --git a/testcases/kernel/syscalls/timerfd/timerfd_gettime01.c b/testcases/kernel/syscalls/timerfd/timerfd_gettime01.c
index 49f5aa59a96b..aba77c05d796 100644
--- a/testcases/kernel/syscalls/timerfd/timerfd_gettime01.c
+++ b/testcases/kernel/syscalls/timerfd/timerfd_gettime01.c
@@ -12,6 +12,7 @@
#define _GNU_SOURCE
+#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_timerfd.h"
@@ -32,10 +33,7 @@ static struct test_case_t {
{&fd, NULL, EINVAL},
};
-static struct test_variants {
- int (*tfd_gettime)(int fd, void *its);
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_timerfd_gettime != __LTP__NR_INVALID_SYSCALL)
{ .tfd_gettime = sys_timerfd_gettime, .desc = "syscall with old kernel spec"},
#endif
@@ -70,7 +68,7 @@ static void cleanup(void)
static void run(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct test_case_t *test = &test_cases[n];
void *its;
diff --git a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
index 781c0fdb1cb7..36577e2c4c0b 100644
--- a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
+++ b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
@@ -13,6 +13,7 @@
#define _GNU_SOURCE
+#include "time64_variants.h"
#include "tst_timer.h"
#include "lapi/timerfd.h"
@@ -35,27 +36,23 @@ static struct test_case_t {
static struct tst_its new_value;
-static struct test_variants {
- int (*tfd_settime)(int fd, int flags, void *new_value, void *old_value);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_timerfd_settime != __LTP__NR_INVALID_SYSCALL)
- { .tfd_settime = sys_timerfd_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .tfd_settime = sys_timerfd_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_timerfd_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .tfd_settime = sys_timerfd_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .tfd_settime = sys_timerfd_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
bad_addr = tst_get_bad_addr(NULL);
- new_value.type = tv->type;
+ new_value.type = tv->ts_type;
clockfd = timerfd_create(CLOCK_REALTIME, 0);
if (clockfd == -1) {
@@ -77,7 +74,7 @@ static void cleanup(void)
static void run(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct test_case_t *test = &test_cases[n];
void *its;
diff --git a/testcases/kernel/syscalls/timerfd/timerfd_settime02.c b/testcases/kernel/syscalls/timerfd/timerfd_settime02.c
index ab978bde5820..bd92ee964644 100644
--- a/testcases/kernel/syscalls/timerfd/timerfd_settime02.c
+++ b/testcases/kernel/syscalls/timerfd/timerfd_settime02.c
@@ -15,6 +15,7 @@
* timerfd: Protect the might cancel mechanism proper
*/
#include <unistd.h>
+#include "time64_variants.h"
#include "tst_timer.h"
#include "tst_safe_timerfd.h"
#include "tst_fuzzy_sync.h"
@@ -29,26 +30,22 @@ static int fd = -1;
static struct tst_its its;
static struct tst_fzsync_pair fzsync_pair;
-static struct test_variants {
- int (*tfd_settime)(int fd, int flags, void *new_value, void *old_value);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_timerfd_settime != __LTP__NR_INVALID_SYSCALL)
- { .tfd_settime = sys_timerfd_settime, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .tfd_settime = sys_timerfd_settime, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_timerfd_settime64 != __LTP__NR_INVALID_SYSCALL)
- { .tfd_settime = sys_timerfd_settime64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .tfd_settime = sys_timerfd_settime64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
- its.type = tv->type;
+ its.type = tv->ts_type;
fd = SAFE_TIMERFD_CREATE(CLOCK_REALTIME, 0);
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 16/17] syscalls: utimensat: Reuse struct time64_variants
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (14 preceding siblings ...)
2020-09-16 10:38 ` [LTP] [PATCH V2 15/17] syscalls: timerfd: " Viresh Kumar
@ 2020-09-16 10:38 ` Viresh Kumar
2020-09-17 12:46 ` Cyril Hrubis
2020-09-16 10:38 ` [LTP] [PATCH V2 17/17] futex: Move variants struct definition to common header Viresh Kumar
16 siblings, 1 reply; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:38 UTC (permalink / raw)
To: ltp
Lets reuse the common structure here.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../kernel/syscalls/utimensat/utimensat01.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/testcases/kernel/syscalls/utimensat/utimensat01.c b/testcases/kernel/syscalls/utimensat/utimensat01.c
index e2d4fee3e433..fe490f4415e6 100644
--- a/testcases/kernel/syscalls/utimensat/utimensat01.c
+++ b/testcases/kernel/syscalls/utimensat/utimensat01.c
@@ -18,6 +18,7 @@
#include <sys/stat.h>
#include "lapi/fs.h"
#include "lapi/utime.h"
+#include "time64_variants.h"
#include "tst_timer.h"
#define TEST_FILE "test_file"
@@ -109,18 +110,13 @@ static inline int sys_utimensat_time64(int dirfd, const char *pathname,
return tst_syscall(__NR_utimensat_time64, dirfd, pathname, times, flags);
}
-static struct test_variants {
- int (*utimensat)(int dirfd, const char *pathname, void *times,
- int flags);
- enum tst_ts_type type;
- char *desc;
-} variants[] = {
+static struct time64_variants variants[] = {
#if (__NR_utimensat != __LTP__NR_INVALID_SYSCALL)
- { .utimensat = sys_utimensat, .type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
+ { .utimensat = sys_utimensat, .ts_type = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_utimensat_time64 != __LTP__NR_INVALID_SYSCALL)
- { .utimensat = sys_utimensat_time64, .type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
+ { .utimensat = sys_utimensat_time64, .ts_type = TST_KERN_TIMESPEC, .desc = "syscall time64 with kernel spec"},
#endif
};
@@ -198,7 +194,7 @@ static void change_attr(struct test_case *tc, int fd, int set)
static void reset_time(char *pathname, int dfd, int flags, int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct stat sb;
memset(&ts, 0, sizeof(ts));
@@ -215,7 +211,7 @@ static void reset_time(char *pathname, int dfd, int flags, int i)
static void run(unsigned int i)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct time64_variants *tv = &variants[tst_variant];
struct test_case *tc = &tcase[i];
int dfd = AT_FDCWD, fd = 0, atime_change, mtime_change;
struct mytime *mytime = tc->mytime;
@@ -237,7 +233,7 @@ static void run(unsigned int i)
}
if (mytime) {
- tst_multi_set_time(tv->type, mytime);
+ tst_multi_set_time(tv->ts_type, mytime);
tsp = &ts;
} else if (tc->exp_err == EFAULT) {
tsp = bad_addr;
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 17/17] futex: Move variants struct definition to common header
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
` (15 preceding siblings ...)
2020-09-16 10:38 ` [LTP] [PATCH V2 16/17] syscalls: utimensat: " Viresh Kumar
@ 2020-09-16 10:38 ` Viresh Kumar
2020-10-21 7:22 ` Viresh Kumar
16 siblings, 1 reply; 22+ messages in thread
From: Viresh Kumar @ 2020-09-16 10:38 UTC (permalink / raw)
To: ltp
Use a single definition of the structure and move it to a common place.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../kernel/syscalls/futex/futex_cmp_requeue01.c | 12 ++++--------
.../kernel/syscalls/futex/futex_cmp_requeue02.c | 9 +++------
testcases/kernel/syscalls/futex/futex_wait01.c | 10 +++-------
testcases/kernel/syscalls/futex/futex_wait02.c | 11 ++++-------
testcases/kernel/syscalls/futex/futex_wait03.c | 11 ++++-------
testcases/kernel/syscalls/futex/futex_wait04.c | 10 +++-------
.../kernel/syscalls/futex/futex_wait_bitset01.c | 11 +++--------
testcases/kernel/syscalls/futex/futex_wake01.c | 9 +++------
testcases/kernel/syscalls/futex/futex_wake02.c | 11 ++++-------
testcases/kernel/syscalls/futex/futex_wake03.c | 13 +++++--------
testcases/kernel/syscalls/futex/futex_wake04.c | 14 +++++---------
testcases/kernel/syscalls/futex/futextest.h | 7 +++++++
12 files changed, 48 insertions(+), 80 deletions(-)
diff --git a/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c b/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c
index 537641766357..13e67c758bed 100644
--- a/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c
+++ b/testcases/kernel/syscalls/futex/futex_cmp_requeue01.c
@@ -42,11 +42,7 @@ static struct tcase {
{1000, 300, 500},
};
-static struct test_variants {
- enum futex_fn_type fntype;
- enum tst_ts_type tstype;
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
@@ -58,7 +54,7 @@ static struct test_variants {
static void do_child(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
struct tst_ts usec = tst_ts_from_ms(tv->tstype, max_sleep_ms);
int slept_for_ms = 0;
int pid = getpid();
@@ -87,7 +83,7 @@ static void do_child(void)
static void verify_futex_cmp_requeue(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
int num_requeues = 0, num_waits = 0, num_total = 0;
int i, status, spurious, woken_up;
struct tcase *tc = &tcases[n];
@@ -194,7 +190,7 @@ static void verify_futex_cmp_requeue(unsigned int n)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
diff --git a/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c b/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c
index dd8fafb3ee38..0514b0ba4e69 100644
--- a/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c
+++ b/testcases/kernel/syscalls/futex/futex_cmp_requeue02.c
@@ -32,10 +32,7 @@ static struct tcase {
{1, 1, FUTEX_INITIALIZER + 1, EAGAIN},
};
-static struct test_variants {
- enum futex_fn_type fntype;
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
#endif
@@ -47,7 +44,7 @@ static struct test_variants {
static void verify_futex_cmp_requeue(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
struct tcase *tc = &tcases[n];
TEST(futex_cmp_requeue(tv->fntype, &futexes[0], tc->exp_val,
@@ -69,7 +66,7 @@ static void verify_futex_cmp_requeue(unsigned int n)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
diff --git a/testcases/kernel/syscalls/futex/futex_wait01.c b/testcases/kernel/syscalls/futex/futex_wait01.c
index 09a95aa2ca0d..02a3fca3501f 100644
--- a/testcases/kernel/syscalls/futex/futex_wait01.c
+++ b/testcases/kernel/syscalls/futex/futex_wait01.c
@@ -29,11 +29,7 @@ static struct testcase testcases[] = {
{&futex, FUTEX_INITIALIZER+1, FUTEX_PRIVATE_FLAG, EWOULDBLOCK},
};
-static struct test_variants {
- enum futex_fn_type fntype;
- enum tst_ts_type tstype;
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
@@ -45,7 +41,7 @@ static struct test_variants {
static void run(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
struct testcase *tc = &testcases[n];
struct tst_ts to = tst_ts_from_ns(tv->tstype, 10000);
int res;
@@ -68,7 +64,7 @@ static void run(unsigned int n)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
diff --git a/testcases/kernel/syscalls/futex/futex_wait02.c b/testcases/kernel/syscalls/futex/futex_wait02.c
index 32bcfd1e744a..c83e6cce44b5 100644
--- a/testcases/kernel/syscalls/futex/futex_wait02.c
+++ b/testcases/kernel/syscalls/futex/futex_wait02.c
@@ -15,10 +15,7 @@
static futex_t *futex;
-static struct test_variants {
- enum futex_fn_type fntype;
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
#endif
@@ -30,7 +27,7 @@ static struct test_variants {
static void do_child(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
int ret;
TST_PROCESS_STATE_WAIT(getppid(), 'S', 1000);
@@ -45,7 +42,7 @@ static void do_child(void)
static void run(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
int res, pid;
pid = SAFE_FORK();
@@ -64,7 +61,7 @@ static void run(void)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
diff --git a/testcases/kernel/syscalls/futex/futex_wait03.c b/testcases/kernel/syscalls/futex/futex_wait03.c
index 3e3a7ce2373e..50eb61f7e49d 100644
--- a/testcases/kernel/syscalls/futex/futex_wait03.c
+++ b/testcases/kernel/syscalls/futex/futex_wait03.c
@@ -13,10 +13,7 @@
static futex_t futex = FUTEX_INITIALIZER;
-static struct test_variants {
- enum futex_fn_type fntype;
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
#endif
@@ -28,7 +25,7 @@ static struct test_variants {
static void *threaded(void *arg)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
long ret, pid = (long)arg;
TST_PROCESS_STATE_WAIT(pid, 'S', 0);
@@ -42,7 +39,7 @@ static void *threaded(void *arg)
static void run(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
long res, pid = getpid();
pthread_t t;
@@ -61,7 +58,7 @@ static void run(void)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
diff --git a/testcases/kernel/syscalls/futex/futex_wait04.c b/testcases/kernel/syscalls/futex/futex_wait04.c
index f2885c8b27d5..500b74ae1ef9 100644
--- a/testcases/kernel/syscalls/futex/futex_wait04.c
+++ b/testcases/kernel/syscalls/futex/futex_wait04.c
@@ -13,11 +13,7 @@
#include "futextest.h"
-static struct test_variants {
- enum futex_fn_type fntype;
- enum tst_ts_type tstype;
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
@@ -29,7 +25,7 @@ static struct test_variants {
static void run(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
struct tst_ts to = tst_ts_from_ns(tv->tstype, 10000);
size_t pagesize = getpagesize();
void *buf;
@@ -49,7 +45,7 @@ static void run(void)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
diff --git a/testcases/kernel/syscalls/futex/futex_wait_bitset01.c b/testcases/kernel/syscalls/futex/futex_wait_bitset01.c
index 358a5cd4542c..6880df6a554e 100644
--- a/testcases/kernel/syscalls/futex/futex_wait_bitset01.c
+++ b/testcases/kernel/syscalls/futex/futex_wait_bitset01.c
@@ -21,12 +21,7 @@ static struct test_case_t {
{ CLOCK_REALTIME }
};
-static struct test_variants {
- enum futex_fn_type fntype;
- enum tst_ts_type tstype;
- int (*gettime)(clockid_t clk_id, void *ts);
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .gettime = sys_clock_gettime, .desc = "syscall with old kernel spec"},
#endif
@@ -38,7 +33,7 @@ static struct test_variants {
static void verify_futex_wait_bitset(long long wait_us, clock_t clk_id)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
struct tst_ts start, to, end;
futex_t futex = FUTEX_INITIALIZER;
u_int32_t bitset = 0xffffffff;
@@ -99,7 +94,7 @@ static void run(unsigned int n)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
diff --git a/testcases/kernel/syscalls/futex/futex_wake01.c b/testcases/kernel/syscalls/futex/futex_wake01.c
index a2f225a9cd1a..1dcf2f094e0c 100644
--- a/testcases/kernel/syscalls/futex/futex_wake01.c
+++ b/testcases/kernel/syscalls/futex/futex_wake01.c
@@ -27,10 +27,7 @@ static struct testcase testcases[] = {
{&futex, INT_MAX, FUTEX_PRIVATE_FLAG},
};
-static struct test_variants {
- enum futex_fn_type fntype;
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
#endif
@@ -42,7 +39,7 @@ static struct test_variants {
static void run(unsigned int n)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
struct testcase *tc = &testcases[n];
int res;
@@ -57,7 +54,7 @@ static void run(unsigned int n)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
diff --git a/testcases/kernel/syscalls/futex/futex_wake02.c b/testcases/kernel/syscalls/futex/futex_wake02.c
index de80738bd73f..2eeec959d480 100644
--- a/testcases/kernel/syscalls/futex/futex_wake02.c
+++ b/testcases/kernel/syscalls/futex/futex_wake02.c
@@ -15,10 +15,7 @@ static futex_t futex = FUTEX_INITIALIZER;
static volatile int threads_flags[55];
-static struct test_variants {
- enum futex_fn_type fntype;
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
#endif
@@ -51,7 +48,7 @@ static void clear_threads_awake(void)
static void *threaded(void *arg)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
long i = (long)arg;
futex_wait(tv->fntype, &futex, futex, NULL, FUTEX_PRIVATE_FLAG);
@@ -63,7 +60,7 @@ static void *threaded(void *arg)
static void do_child(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
int i, j, awake;
pthread_t t[55];
@@ -132,7 +129,7 @@ static void run(void)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
diff --git a/testcases/kernel/syscalls/futex/futex_wake03.c b/testcases/kernel/syscalls/futex/futex_wake03.c
index 02b291e1a29e..a56ae92221f6 100644
--- a/testcases/kernel/syscalls/futex/futex_wake03.c
+++ b/testcases/kernel/syscalls/futex/futex_wake03.c
@@ -13,10 +13,7 @@
static futex_t *futex;
-static struct test_variants {
- enum futex_fn_type fntype;
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .desc = "syscall with old kernel spec"},
#endif
@@ -28,7 +25,7 @@ static struct test_variants {
static void do_child(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
futex_wait(tv->fntype, futex, *futex, NULL, 0);
exit(0);
@@ -36,7 +33,7 @@ static void do_child(void)
static void do_wake(int nr_children)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
int res, i, cnt;
TEST(futex_wake(tv->fntype, futex, nr_children, 0));
@@ -67,7 +64,7 @@ static void do_wake(int nr_children)
static void run(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
pid_t pids[55];
unsigned int i;
@@ -95,7 +92,7 @@ static void run(void)
static void setup(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
diff --git a/testcases/kernel/syscalls/futex/futex_wake04.c b/testcases/kernel/syscalls/futex/futex_wake04.c
index f6f571ac4bff..2260a3936d6e 100644
--- a/testcases/kernel/syscalls/futex/futex_wake04.c
+++ b/testcases/kernel/syscalls/futex/futex_wake04.c
@@ -36,11 +36,7 @@ static futex_t *futex1, *futex2;
static struct tst_ts to;
-static struct test_variants {
- enum futex_fn_type fntype;
- enum tst_ts_type tstype;
- char *desc;
-} variants[] = {
+static struct futex_test_variants variants[] = {
#if (__NR_futex != __LTP__NR_INVALID_SYSCALL)
{ .fntype = FUTEX_FN_FUTEX, .tstype = TST_KERN_OLD_TIMESPEC, .desc = "syscall with old kernel spec"},
#endif
@@ -55,7 +51,7 @@ static void setup(void)
if (tst_hugepages == 0)
tst_brk(TCONF, "No enough hugepages for testing.");
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
tst_res(TINFO, "Testing variant: %s", tv->desc);
futex_supported_by_kernel(tv->fntype);
@@ -65,7 +61,7 @@ static void setup(void)
static void *wait_thread1(void *arg LTP_ATTRIBUTE_UNUSED)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
futex_wait(tv->fntype, futex1, *futex1, &to, 0);
@@ -74,7 +70,7 @@ static void *wait_thread1(void *arg LTP_ATTRIBUTE_UNUSED)
static void *wait_thread2(void *arg LTP_ATTRIBUTE_UNUSED)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
int res;
errno = 0;
@@ -89,7 +85,7 @@ static void *wait_thread2(void *arg LTP_ATTRIBUTE_UNUSED)
static void wakeup_thread2(void)
{
- struct test_variants *tv = &variants[tst_variant];
+ struct futex_test_variants *tv = &variants[tst_variant];
void *addr;
int hpsz, pgsz;
pthread_t th1, th2;
diff --git a/testcases/kernel/syscalls/futex/futextest.h b/testcases/kernel/syscalls/futex/futextest.h
index c50876fa67d4..3f2f36fef4ea 100644
--- a/testcases/kernel/syscalls/futex/futextest.h
+++ b/testcases/kernel/syscalls/futex/futextest.h
@@ -67,6 +67,13 @@ enum futex_fn_type {
FUTEX_FN_FUTEX64,
};
+struct futex_test_variants {
+ enum futex_fn_type fntype;
+ enum tst_ts_type tstype;
+ int (*gettime)(clockid_t clk_id, void *ts);
+ char *desc;
+};
+
static inline void futex_supported_by_kernel(enum futex_fn_type fntype)
{
if (fntype != FUTEX_FN_FUTEX64)
--
2.25.0.rc1.19.g042ed3e048af
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 01/17] syscalls: utils: Remove local copy of poll.h definitions
2020-09-16 10:37 ` [LTP] [PATCH V2 01/17] syscalls: utils: Remove local copy of poll.h definitions Viresh Kumar
@ 2020-09-16 12:33 ` Cyril Hrubis
0 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-09-16 12:33 UTC (permalink / raw)
To: ltp
Hi!
Good catch, applied.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 16/17] syscalls: utimensat: Reuse struct time64_variants
2020-09-16 10:38 ` [LTP] [PATCH V2 16/17] syscalls: utimensat: " Viresh Kumar
@ 2020-09-17 12:46 ` Cyril Hrubis
0 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-09-17 12:46 UTC (permalink / raw)
To: ltp
Hi!
I've pushed the changes up to this point as this is a nice cleanup and
the changes are mostly mechanical so it's safe to apply before the
release, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 17/17] futex: Move variants struct definition to common header
2020-09-16 10:38 ` [LTP] [PATCH V2 17/17] futex: Move variants struct definition to common header Viresh Kumar
@ 2020-10-21 7:22 ` Viresh Kumar
2020-10-21 15:38 ` Cyril Hrubis
0 siblings, 1 reply; 22+ messages in thread
From: Viresh Kumar @ 2020-10-21 7:22 UTC (permalink / raw)
To: ltp
On 16-09-20, 16:08, Viresh Kumar wrote:
> Use a single definition of the structure and move it to a common place.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> .../kernel/syscalls/futex/futex_cmp_requeue01.c | 12 ++++--------
> .../kernel/syscalls/futex/futex_cmp_requeue02.c | 9 +++------
> testcases/kernel/syscalls/futex/futex_wait01.c | 10 +++-------
> testcases/kernel/syscalls/futex/futex_wait02.c | 11 ++++-------
> testcases/kernel/syscalls/futex/futex_wait03.c | 11 ++++-------
> testcases/kernel/syscalls/futex/futex_wait04.c | 10 +++-------
> .../kernel/syscalls/futex/futex_wait_bitset01.c | 11 +++--------
> testcases/kernel/syscalls/futex/futex_wake01.c | 9 +++------
> testcases/kernel/syscalls/futex/futex_wake02.c | 11 ++++-------
> testcases/kernel/syscalls/futex/futex_wake03.c | 13 +++++--------
> testcases/kernel/syscalls/futex/futex_wake04.c | 14 +++++---------
> testcases/kernel/syscalls/futex/futextest.h | 7 +++++++
> 12 files changed, 48 insertions(+), 80 deletions(-)
Cyril, this one is pending too I believe.
--
viresh
^ permalink raw reply [flat|nested] 22+ messages in thread
* [LTP] [PATCH V2 17/17] futex: Move variants struct definition to common header
2020-10-21 7:22 ` Viresh Kumar
@ 2020-10-21 15:38 ` Cyril Hrubis
0 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-10-21 15:38 UTC (permalink / raw)
To: ltp
Hi!
> Cyril, this one is pending too I believe.
Indeed, pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2020-10-21 15:38 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-16 10:37 [LTP] [PATCH V2 00/17] syscalls: Use common variants structure Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 01/17] syscalls: utils: Remove local copy of poll.h definitions Viresh Kumar
2020-09-16 12:33 ` Cyril Hrubis
2020-09-16 10:37 ` [LTP] [PATCH V2 02/17] syscalls: Add common time64 variants structure Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 03/17] syscalls: clock_gettime: Reuse struct time64_variants Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 04/17] syscalls: clock_nanosleep: " Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 05/17] syscalls: clock_settime: " Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 06/17] syscalls: io_pgetevents: " Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 07/17] syscalls: semop: " Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 08/17] syscalls: mq_timed: " Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 09/17] syscalls: ppoll: " Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 10/17] syscalls: rt_sigtimedwait: " Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 11/17] syscalls: sched_rr_get_interval: " Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 12/17] syscalls: sendmmsg: " Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 13/17] syscalls: timer_settime: " Viresh Kumar
2020-09-16 10:37 ` [LTP] [PATCH V2 14/17] syscalls: timer_gettime: " Viresh Kumar
2020-09-16 10:38 ` [LTP] [PATCH V2 15/17] syscalls: timerfd: " Viresh Kumar
2020-09-16 10:38 ` [LTP] [PATCH V2 16/17] syscalls: utimensat: " Viresh Kumar
2020-09-17 12:46 ` Cyril Hrubis
2020-09-16 10:38 ` [LTP] [PATCH V2 17/17] futex: Move variants struct definition to common header Viresh Kumar
2020-10-21 7:22 ` Viresh Kumar
2020-10-21 15:38 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).