[LTP] [PATCH v2 1/1] lapi/io_uring: <sys/types.h> => <linux/types.h>

Petr Vorel pvorel@suse.cz
Fri Jan 26 12:15:06 CET 2024


This fixes compilation on old toolchains:

Some old toolchains require to add <linux/types.h> to missing kernel
types:

tst_safe_io_uring.c: In function ‘safe_io_uring_init’:
tst_safe_io_uring.c:34:45: error: ‘__u32’ undeclared (first use in this function)
   34 |                 params->sq_entries * sizeof(__u32);
      |                                             ^~~~~

io_uring02.c: In function ‘drain_fallback’:
io_uring02.c:106:34: error: ‘__u64’ undeclared (first use in this function)
  106 |                 sqe_ptr->addr = (__u64)&spam_header;
      |                                  ^~~~~
io_uring02.c:106:34: note: each undeclared identifier is reported only once for each function it appears in
io_uring02.c: In function ‘run’:
io_uring02.c:221:26: error: ‘__u64’ undeclared (first use in this function)
  221 |         sqe_ptr->addr = (__u64)&beef_header;
      |                          ^~~~~

Newer kernel headers includes <linux/types.h> in <linux/io_uring.h>, but
we still support compilers without this header. Therefore replace
<sys/types.h> in lapi header with <linux/types.h>.

Fixes: 3f2ff5431 ("Add safe functions for io_uring to LTP library")
Fixes: c4f669f13 ("Add test for CVE 2020-29373")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v1->v2:
* Fix also io_uring02.c

 include/lapi/io_uring.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
index 03c45190e..c05517595 100644
--- a/include/lapi/io_uring.h
+++ b/include/lapi/io_uring.h
@@ -11,9 +11,9 @@
 
 #include <unistd.h>
 #include <fcntl.h>
-#include <sys/types.h>
 #include <sys/uio.h>
 #include <stdlib.h>
+#include <linux/types.h>
 
 #include "lapi/syscalls.h"
 
-- 
2.43.0



More information about the ltp mailing list