From: Ammar Faizi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected], Ammar Faizi <[email protected]>,
Louvian Lyndal <[email protected]>
Subject: [PATCH liburing 1/3] test/io_uring_setup: Don't use `__errno` as local variable name
Date: Wed, 15 Sep 2021 15:11:56 +0700 [thread overview]
Message-ID: <2d53ef3f50713749511865a7f89e27c5378e316d.1631692342.git.ammarfaizi2@gmail.com> (raw)
In-Reply-To: <[email protected]>
This commit fixes build for armv8l.
On some systems, the macro `errno` is defined as
`#define errno (*__errno())`
It is clear that `__errno` is a global function on such systems.
The problem is, `io_uring_setup.c` uses `int __errno` as a local
variable, so it shadows the `__errno` function, result in the
following error:
```
CC io_uring_setup
io_uring_setup.c:116:12: error: called object type 'int' is not a function or function pointer
__errno = errno;
^~~~~
/usr/include/errno.h:58:24: note: expanded from macro 'errno'
#define errno (*__errno())
~~~~~~~^
1 error generated.
make[1]: *** [Makefile:163: io_uring_setup] Error 1
make[1]: *** Waiting for unfinished jobs....
```
Fix this by not using `__errno` as local variable name.
Reported-by: Louvian Lyndal <[email protected]>
Tested-by: Louvian Lyndal <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
test/io_uring_setup.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/test/io_uring_setup.c b/test/io_uring_setup.c
index a0709a7..94b54fd 100644
--- a/test/io_uring_setup.c
+++ b/test/io_uring_setup.c
@@ -99,7 +99,7 @@ dump_resv(struct io_uring_params *p)
int
try_io_uring_setup(unsigned entries, struct io_uring_params *p, int expect, int error)
{
- int ret, __errno;
+ int ret, err;
printf("io_uring_setup(%u, %p), flags: %s, feat: %s, resv: %s, sq_thread_cpu: %u\n",
entries, p, flags_string(p), features_string(p), dump_resv(p),
@@ -113,13 +113,13 @@ try_io_uring_setup(unsigned entries, struct io_uring_params *p, int expect, int
close(ret);
return 1;
}
- __errno = errno;
- if (expect == -1 && error != __errno) {
- if (__errno == EPERM && geteuid() != 0) {
+ err = errno;
+ if (expect == -1 && error != err) {
+ if (err == EPERM && geteuid() != 0) {
printf("Needs root, not flagging as an error\n");
return 0;
}
- printf("expected errno %d, got %d\n", error, __errno);
+ printf("expected errno %d, got %d\n", error, err);
return 1;
}
--
2.30.2
next prev parent reply other threads:[~2021-09-15 8:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-15 8:11 [PATCH liburing 0/3] Fix build and add /test/output dir to .gitignore Ammar Faizi
2021-09-15 8:11 ` Ammar Faizi [this message]
2021-09-15 8:11 ` [PATCH liburing 2/3] test/send_recv: Use proper cast for (struct sockaddr *) argument Ammar Faizi
2021-09-15 8:11 ` [PATCH liburing 3/3] .gitignore: add `/test/output/` Ammar Faizi
2021-09-15 12:41 ` [PATCH liburing 0/3] Fix build and add /test/output dir to .gitignore Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2d53ef3f50713749511865a7f89e27c5378e316d.1631692342.git.ammarfaizi2@gmail.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox