summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKurt Kanzenbach <kurt@linutronix.de>2019-06-18 12:38:36 +0200
committerJohn Kacur <jkacur@redhat.com>2019-06-19 17:32:58 +0200
commite81d2c596ccaf24c6994ffbc735e8b45710fe81d (patch)
treec2f668308ebbf3ab37929ed573cf4277980221d1
parent88efdb99bc481bbf491b9a57a729c0cd6d74a640 (diff)
downloadrt-tests-e81d2c596ccaf24c6994ffbc735e8b45710fe81d.tar.gz
rt-tests-e81d2c596ccaf24c6994ffbc735e8b45710fe81d.tar.xz
rt-tests: deadline: Remove duplicated code for sched_{set,get}_attr
The system calls for sched_get_attr() and sched_set_attr() are already implemented. Get rid of the code and use the existing libary. Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de> Signed-off-by: John Kacur <jkacur@redhat.com>
-rw-r--r--src/sched_deadline/cyclicdeadline.c36
-rw-r--r--src/sched_deadline/deadline_test.c72
2 files changed, 3 insertions, 105 deletions
diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
index 47892da..754670c 100644
--- a/src/sched_deadline/cyclicdeadline.c
+++ b/src/sched_deadline/cyclicdeadline.c
@@ -22,31 +22,17 @@
#include <linux/magic.h>
#include <rt-utils.h>
+#include <rt-sched.h>
#ifdef __i386__
-#ifndef __NR_sched_setattr
-#define __NR_sched_setattr 351
-#endif
-#ifndef __NR_sched_getattr
-#define __NR_sched_getattr 352
-#endif
#ifndef __NR_getcpu
#define __NR_getcpu 309
#endif
#else /* x86_64 */
-#ifndef __NR_sched_setattr
-#define __NR_sched_setattr 314
-#endif
-#ifndef __NR_sched_getattr
-#define __NR_sched_getattr 315
-#endif
#ifndef __NR_getcpu
#define __NR_getcpu 309
#endif
#endif /* i386 or x86_64 */
-#ifndef SCHED_DEADLINE
-#define SCHED_DEADLINE 6
-#endif
#define _STR(x) #x
#define STR(x) _STR(x)
@@ -58,8 +44,6 @@
#define CPUSET_LOCAL "my_cpuset"
#define gettid() syscall(__NR_gettid)
-#define sched_setattr(pid, attr, flags) syscall(__NR_sched_setattr, pid, attr, flags)
-#define sched_getattr(pid, attr, size, flags) syscall(__NR_sched_getattr, pid, attr, size, flags)
#define getcpu(cpup, nodep, unused) syscall(__NR_getcpu, cpup, nodep, unused)
typedef unsigned long long u64;
@@ -115,24 +99,6 @@ struct sched_data {
char buff[BUFSIZ+1];
};
-struct sched_attr {
- u32 size;
-
- u32 sched_policy;
- u64 sched_flags;
-
- /* SCHED_NORMAL, SCHED_BATCH */
- s32 sched_nice;
-
- /* SCHED_FIFO, SCHED_RR */
- u32 sched_priority;
-
- /* SCHED_DEADLINE */
- u64 sched_runtime;
- u64 sched_deadline;
- u64 sched_period;
-};
-
static int shutdown;
static pthread_barrier_t barrier;
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
index b01e3f2..c3b9dce 100644
--- a/src/sched_deadline/deadline_test.c
+++ b/src/sched_deadline/deadline_test.c
@@ -51,6 +51,8 @@
#include <linux/unistd.h>
#include <linux/magic.h>
+#include <rt-sched.h>
+
/**
* usage - show the usage of the program and exit.
* @argv: The program passed in args
@@ -82,43 +84,6 @@ static void usage(char **argv)
exit(-1);
}
-/*
- * sched_setattr() and sched_getattr() are new system calls. We need to
- * hardcode it here.
- */
-#if defined(__i386__)
-
-#ifndef __NR_sched_setattr
-#define __NR_sched_setattr 351
-#endif
-#ifndef __NR_sched_getattr
-#define __NR_sched_getattr 352
-#endif
-
-#elif defined(__x86_64__)
-
-#ifndef __NR_sched_setattr
-#define __NR_sched_setattr 314
-#endif
-#ifndef __NR_sched_getattr
-#define __NR_sched_getattr 315
-#endif
-
-#endif /* i386 or x86_64 */
-
-#if !defined(__NR_sched_setattr)
-# error "Your arch does not support sched_setattr()"
-#endif
-
-#if !defined(__NR_sched_getattr)
-# error "Your arch does not support sched_getattr()"
-#endif
-
-/* If not included in the headers, define sched deadline policy numbe */
-#ifndef SCHED_DEADLINE
-#define SCHED_DEADLINE 6
-#endif
-
#define _STR(x) #x
#define STR(x) _STR(x)
@@ -140,45 +105,12 @@ static void usage(char **argv)
/* Define the system call interfaces */
#define gettid() syscall(__NR_gettid)
-#define sched_setattr(pid, attr, flags) syscall(__NR_sched_setattr, pid, attr, flags)
-#define sched_getattr(pid, attr, size, flags) syscall(__NR_sched_getattr, pid, attr, size, flags)
typedef unsigned long long u64;
typedef unsigned int u32;
typedef int s32;
/**
- * struct sched_attr - get/set attr system call descriptor.
- *
- * This is the descriptor defined for setting SCHED_DEADLINE tasks.
- * It will someday be in a header file.
- *
- * The fields specific for deadline:
- *
- * @sched_policy: 6 is for deadline
- * @sched_runtime: The runtime in nanoseconds
- * @sched_deadline: The deadline in nanoseconds.
- * @sched_period: The period, if different than deadline (not used here)
- */
-struct sched_attr {
- u32 size;
-
- u32 sched_policy;
- u64 sched_flags;
-
- /* SCHED_NORMAL, SCHED_BATCH */
- s32 sched_nice;
-
- /* SCHED_FIFO, SCHED_RR */
- u32 sched_priority;
-
- /* SCHED_DEADLINE */
- u64 sched_runtime;
- u64 sched_deadline;
- u64 sched_period;
-};
-
-/**
* struct sched_data - the descriptor for the threads.
*
* This is the descriptor that will be passed as the thread data.