* [PATCH liburing 0/3] Fix build and add /test/output dir to .gitignore
@ 2021-09-15 8:11 Ammar Faizi
2021-09-15 8:11 ` [PATCH liburing 1/3] test/io_uring_setup: Don't use `__errno` as local variable name Ammar Faizi
2021-09-15 12:41 ` [PATCH liburing 0/3] Fix build and add /test/output dir to .gitignore Jens Axboe
0 siblings, 2 replies; 5+ messages in thread
From: Ammar Faizi @ 2021-09-15 8:11 UTC (permalink / raw)
To: Jens Axboe; +Cc: io-uring
- Louvian reported build error (2 fixes from me).
- Add `/test/output` dir to .gitignore from me.
Ammar Faizi (3):
test/io_uring_setup: Don't use `__errno` as local variable name
test/send_recv: Use proper cast for (struct sockaddr *) argument
.gitignore: add `/test/output/`
.gitignore | 1 +
test/io_uring_setup.c | 10 +++++-----
test/send_recv.c | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH liburing 1/3] test/io_uring_setup: Don't use `__errno` as local variable name
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
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
1 sibling, 2 replies; 5+ messages in thread
From: Ammar Faizi @ 2021-09-15 8:11 UTC (permalink / raw)
To: Jens Axboe; +Cc: io-uring, Ammar Faizi, Louvian Lyndal
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH liburing 2/3] test/send_recv: Use proper cast for (struct sockaddr *) argument
2021-09-15 8:11 ` [PATCH liburing 1/3] test/io_uring_setup: Don't use `__errno` as local variable name Ammar Faizi
@ 2021-09-15 8:11 ` Ammar Faizi
2021-09-15 8:11 ` [PATCH liburing 3/3] .gitignore: add `/test/output/` Ammar Faizi
1 sibling, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2021-09-15 8:11 UTC (permalink / raw)
To: Jens Axboe; +Cc: io-uring, Ammar Faizi, Louvian Lyndal
This commit fixes build for armv8l.
Sometimes the compiler accepts (struct sockaddr_in *) to be passed to
(struct sockaddr *) without cast. But not all compilers agree with that.
Louvian found the following warning on armv8l:
```
send_recv.c:203:24: warning: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'const struct sockaddr *' [-Wincompatible-pointer-types]
ret = connect(sockfd, &saddr, sizeof(saddr));
^~~~~~
/usr/include/sys/socket.h:308:59: note: passing argument to parameter '__addr' here
__socketcall int connect(int __fd, const struct sockaddr* __addr, socklen_t __addr_length);
^
1 warning generated.
```
Fix this by casting the second argument to (struct sockaddr *).
Reported-by: Louvian Lyndal <[email protected]>
Tested-by: Louvian Lyndal <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
test/send_recv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/send_recv.c b/test/send_recv.c
index 38ae27f..1ee0234 100644
--- a/test/send_recv.c
+++ b/test/send_recv.c
@@ -200,7 +200,7 @@ static int do_send(void)
return 1;
}
- ret = connect(sockfd, &saddr, sizeof(saddr));
+ ret = connect(sockfd, (struct sockaddr *)&saddr, sizeof(saddr));
if (ret < 0) {
perror("connect");
return 1;
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH liburing 3/3] .gitignore: add `/test/output/`
2021-09-15 8:11 ` [PATCH liburing 1/3] test/io_uring_setup: Don't use `__errno` as local variable name Ammar Faizi
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 ` Ammar Faizi
1 sibling, 0 replies; 5+ messages in thread
From: Ammar Faizi @ 2021-09-15 8:11 UTC (permalink / raw)
To: Jens Axboe; +Cc: io-uring, Ammar Faizi
Signed-off-by: Ammar Faizi <[email protected]>
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 0213bfa..45f3cde 100644
--- a/.gitignore
+++ b/.gitignore
@@ -131,6 +131,7 @@
/test/submit-link-fail
/test/exec-target
/test/*.dmesg
+/test/output/
config-host.h
config-host.mak
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH liburing 0/3] Fix build and add /test/output dir to .gitignore
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 ` [PATCH liburing 1/3] test/io_uring_setup: Don't use `__errno` as local variable name Ammar Faizi
@ 2021-09-15 12:41 ` Jens Axboe
1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2021-09-15 12:41 UTC (permalink / raw)
To: Ammar Faizi; +Cc: io-uring
On 9/15/21 2:11 AM, Ammar Faizi wrote:
> - Louvian reported build error (2 fixes from me).
> - Add `/test/output` dir to .gitignore from me.
>
> Ammar Faizi (3):
> test/io_uring_setup: Don't use `__errno` as local variable name
> test/send_recv: Use proper cast for (struct sockaddr *) argument
> .gitignore: add `/test/output/`
>
> .gitignore | 1 +
> test/io_uring_setup.c | 10 +++++-----
> test/send_recv.c | 2 +-
> 3 files changed, 7 insertions(+), 6 deletions(-)
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-09-15 12:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH liburing 1/3] test/io_uring_setup: Don't use `__errno` as local variable name Ammar Faizi
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox