Skip to content

Commit

Permalink
syscalls: rt_sigtimedwait: Reuse struct time64_variants
Browse files Browse the repository at this point in the history
Lets reuse the common structure here.

Signed-off-by: Viresh Kumar <[email protected]>
Reviewed-by: Cyril Hrubis <[email protected]>
  • Loading branch information
vireshk authored and metan-ucw committed Sep 17, 2020
1 parent c5cf170 commit 09cd124
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions testcases/kernel/syscalls/rt_sigtimedwait/rt_sigtimedwait01.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/* Copyright (c) Jiri Palecek<[email protected]>, 2009 */

#include "time64_variants.h"
#include "libsigwait.h"

static int my_rt_sigtimedwait(const sigset_t * set, siginfo_t * info,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 09cd124

Please sign in to comment.