[LTP] [PATCH v2 1/4] lapi/sched.h: Add include <sched.h>

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


We including headers in lapi headers instead of depending headers are
included in tests which use lapi headers.

Also remove redundant include lapi/syscalls.h from tests which use
lapi/sched.h (included in lapi/sched.h).

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

 include/lapi/sched.h                                      | 3 ++-
 testcases/kernel/syscalls/kcmp/kcmp03.c                   | 1 -
 testcases/kernel/syscalls/sched_getattr/sched_getattr01.c | 2 --
 testcases/kernel/syscalls/sched_getattr/sched_getattr02.c | 2 --
 testcases/kernel/syscalls/sched_setattr/sched_setattr01.c | 1 -
 5 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/include/lapi/sched.h b/include/lapi/sched.h
index 036edd51d1..2fc32a38ca 100644
--- a/include/lapi/sched.h
+++ b/include/lapi/sched.h
@@ -6,9 +6,10 @@
 #ifndef LAPI_SCHED_H__
 #define LAPI_SCHED_H__
 
-#include "lapi/syscalls.h"
+#include <sched.h>
 #include <stdint.h>
 #include <inttypes.h>
+#include "lapi/syscalls.h"
 
 struct sched_attr {
 	uint32_t size;
diff --git a/testcases/kernel/syscalls/kcmp/kcmp03.c b/testcases/kernel/syscalls/kcmp/kcmp03.c
index 30ac3ec9db..df8633c5fc 100644
--- a/testcases/kernel/syscalls/kcmp/kcmp03.c
+++ b/testcases/kernel/syscalls/kcmp/kcmp03.c
@@ -18,7 +18,6 @@
 
 #include <errno.h>
 #include <stdlib.h>
-#include <sched.h>
 #include <sys/wait.h>
 #include "tst_test.h"
 #include "kcmp.h"
diff --git a/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c b/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c
index 2a2c13a40f..0ffbce9c8d 100644
--- a/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c
+++ b/testcases/kernel/syscalls/sched_getattr/sched_getattr01.c
@@ -22,11 +22,9 @@
 #include <linux/types.h>
 #include <sys/syscall.h>
 #include <pthread.h>
-#include <sched.h>
 #include <errno.h>
 
 #include "test.h"
-#include "lapi/syscalls.h"
 #include "lapi/sched.h"
 
 char *TCID = "sched_getattr01";
diff --git a/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c b/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c
index 2d7e15a470..9f4a09f88f 100644
--- a/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c
+++ b/testcases/kernel/syscalls/sched_getattr/sched_getattr02.c
@@ -31,11 +31,9 @@
 #include <linux/types.h>
 #include <sys/syscall.h>
 #include <pthread.h>
-#include <sched.h>
 #include <errno.h>
 
 #include "test.h"
-#include "lapi/syscalls.h"
 #include "lapi/sched.h"
 
 char *TCID = "sched_getattr02";
diff --git a/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c b/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c
index 37ca56a0aa..82156b95cb 100644
--- a/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c
+++ b/testcases/kernel/syscalls/sched_setattr/sched_setattr01.c
@@ -29,7 +29,6 @@
 #include <linux/types.h>
 #include <sys/syscall.h>
 #include <pthread.h>
-#include <sched.h>
 #include <errno.h>
 
 #include "test.h"
-- 
2.34.1



More information about the ltp mailing list