Skip to contentSkip to conversation

io_uring02.c: Check EOPNOTSUPP errno

PATCH In review Wei Gao via ltp 2 participants 3 messages Jan 20, 2023 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring02.c: Check EOPNOTSUPP errno

Add check for errno == EOPNOTSUPP and quit with TCONF instead of TBROK

---
 lib/tst_safe_io_uring.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/tst_safe_io_uring.c +4 -0
index f300fd38c..923c3e43d 100644
@@ -15,6 +15,10 @@ int safe_io_uring_init(const char *file, const int lineno,
 	uring->fd = io_uring_setup(entries, params);
 
 	if (uring->fd == -1) {
+		if (errno == EOPNOTSUPP) {
+			tst_brk(TCONF,
+				"io_uring_setup() is not supported");
+		}
 		tst_brk_(file, lineno, TBROK | TERRNO,
 			"io_uring_setup() failed");
 		return uring->fd;
Signature · 5 lines
2.35.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Wei,

Quoted 12 lines

Add check for errno == EOPNOTSUPP and quit with TCONF instead of TBROK

---
 lib/tst_safe_io_uring.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/tst_safe_io_uring.c +0 -0
index f300fd38c..923c3e43d 100644

lib/tst_safe_io_uring.c int safe_io_uring_init(const char *file, const int lineno, · line 21

Quoted 7 lines
lib/tst_safe_io_uring.c +4 -0
@@ -15,6 +15,10 @@ int safe_io_uring_init(const char *file, const int lineno,
 	uring->fd = io_uring_setup(entries, params);
 
 	if (uring->fd == -1) {
+		if (errno == EOPNOTSUPP) {
+			tst_brk(TCONF,
+				"io_uring_setup() is not supported");
+		}

I merged with these changes:

		if (errno == EOPNOTSUPP)
			tst_brk(TCONF, "CONFIG_IO_URING is not enabled");

* changed subject to: "tst_safe_io_uring.c: Check EOPNOTSUPP errno"
* Adjusted commit message (no io_uring_*() syscall will be working due CONFIG_IO_URING not enabled in the kernel).
* simplify if style

Thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Hi Petr

Thanks a lot!

Regards
Gao Wei

-----Original Message-----
From: Petr Vorel <[email protected]>
Sent: 20 January 2023 15:47
To: Wei Gao <[email protected]>
Cc: [email protected]
Subject: Re: [LTP] [PATCH v1] io_uring02.c: Check EOPNOTSUPP errno

Hi Wei,

Quoted 12 lines

Add check for errno == EOPNOTSUPP and quit with TCONF instead of TBROK

---
 lib/tst_safe_io_uring.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/tst_safe_io_uring.c index renamed from lib/tst_safe_io_uring.c +0 -0

f300fd38c..923c3e43d 100644

lib/tst_safe_io_uring.c int safe_io_uring_init(const char *file, const int lineno, · line 21

Quoted 7 lines
lib/tst_safe_io_uring.c +4 -0
@@ -15,6 +15,10 @@ int safe_io_uring_init(const char *file, const int lineno,
 	uring->fd = io_uring_setup(entries, params);
 
 	if (uring->fd == -1) {
+		if (errno == EOPNOTSUPP) {
+			tst_brk(TCONF,
+				"io_uring_setup() is not supported");
+		}

I merged with these changes:

		if (errno == EOPNOTSUPP)
			tst_brk(TCONF, "CONFIG_IO_URING is not enabled");

* changed subject to: "tst_safe_io_uring.c: Check EOPNOTSUPP errno"
* Adjusted commit message (no io_uring_*() syscall will be working due CONFIG_IO_URING not enabled in the kernel).
* simplify if style

Thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp