[LTP] [PATCH v2 2/4] lapi: Move SCHED_DEADLINE definition from tests

Petr Vorel pvorel@suse.cz
Tue Jan 25 15:40:41 CET 2022


DRY

SCHED_DEADLINE is currently missing on uclibc-ng (v1.0.40).

+ add indent for definitions (formatting).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
New in v2

 include/lapi/sched.h                                | 13 +++++++++----
 .../kernel/syscalls/sched_getattr/sched_getattr01.c |  1 -
 .../kernel/syscalls/sched_setattr/sched_setattr01.c |  1 -
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/lapi/sched.h b/include/lapi/sched.h
index 2fc32a38ca..226d3109a0 100644
--- a/include/lapi/sched.h
+++ b/include/lapi/sched.h
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2015 Cui Bixuan <cuibixuan@huawei.com>
+ * Copyright (c) Linux Test Project, 2016-2022
  */
 
 #ifndef LAPI_SCHED_H__
@@ -41,20 +42,24 @@ static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
 	return syscall(__NR_sched_getattr, pid, attr, size, flags);
 }
 
+#ifndef SCHED_DEADLINE
+# define SCHED_DEADLINE	6
+#endif
+
 #ifndef CLONE_VM
-#define CLONE_VM   0x00000100
+# define CLONE_VM   0x00000100
 #endif
 
 #ifndef CLONE_FS
-#define CLONE_FS   0x00000200
+# define CLONE_FS   0x00000200
 #endif
 
 #ifndef CLONE_SYSVSEM
-#define CLONE_SYSVSEM   0x00040000
+# define CLONE_SYSVSEM   0x00040000
 #endif
 
 #ifndef CLONE_IO
-#define CLONE_IO        0x80000000
+# define CLONE_IO        0x80000000
 #endif
 
 #endif /* LAPI_SCHED_H__ */
diff --git a/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c b/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c
index 0ffbce9c8d..c1715d8acf 100644
--- a/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c
+++ b/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c
@@ -30,7 +30,6 @@
 char *TCID = "sched_getattr01";
 int TST_TOTAL = 1;
 
-#define SCHED_DEADLINE	6
 #define RUNTIME_VAL 10000000
 #define PERIOD_VAL 30000000
 #define DEADLINE_VAL 30000000
diff --git a/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c b/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c
index 82156b95cb..d5178e0169 100644
--- a/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c
+++ b/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c
@@ -36,7 +36,6 @@
 
 char *TCID = "sched_setattr01";
 
-#define SCHED_DEADLINE	6
 #define RUNTIME_VAL 10000000
 #define PERIOD_VAL 30000000
 #define DEADLINE_VAL 30000000
-- 
2.34.1



More information about the ltp mailing list