Skip to contentSkip to conversation

Makefile and t/no-mmap-inval updates

PATCH Applied Ammar Faizi 3 participants 5 messages Dec 19, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Makefile and t/no-mmap-inval updates

Hi Jens,

There are two patches in this series:

1. Makefile: Remove the partcheck target.

Remove the partcheck target because it has remained unused for nearly four years, and the associated TODO comment has not been actioned since its introduction in commit:

  b57dbc2d308a849 ("configure/Makefile: introduce libdevdir defaults to $(libdir)")

2. t/no-mmap-inval: Replace valloc() with t_posix_memalign().

Address the limitations of valloc(). This function, which is primarily used for allocating page-aligned memory, is not only absent in some systems but is also marked as obsolete according to the man 3 valloc.

Replace valloc() with t_posix_memalign() to fix the following build error:

  no-mmap-inval.c:28:56: warning: call to undeclared function 'valloc'; ISO C99 and \
  later do not support implicit function declarations [-Wimplicit-function-declaration]
          p.cq_off.user_addr = (unsigned long long) (uintptr_t) valloc(8192);
                                                                ^
  1 warning generated.

ld.lld: error: undefined symbol: valloc

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

referenced by no-mmap-inval.c:28

              /tmp/no-mmap-inval-ea16a2.o:(main)

did you mean: calloc
defined in: /system/lib64/libc.so

clang-15: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [Makefile:239: no-mmap-inval.t] Error 1

---
Ammar Faizi (2):
Makefile: Remove the partcheck target t/no-mmap-inval: Replace valloc() with t_posix_memalign()

 Makefile             | 3 ---
 test/no-mmap-inval.c | 4 +++-
 2 files changed, 3 insertions(+), 4 deletions(-)

base-commit: bbd27495d302856b1f28d64b346d3ad80be3a86f

Signature · 1 line
Ammar Faizi
#1 lore raw

PATCH 1/2 Makefile: Remove the `partcheck` target

Remove the partcheck target because it has remained unused for nearly four years, and the associated TODO comment has not been actioned since its introduction in commit:

  b57dbc2d308a849 ("configure/Makefile: introduce libdevdir defaults to $(libdir)")
Cc Stefan Metzmacher <[email protected]>
---
 Makefile | 3 ---
 1 file changed, 3 deletions(-)
Makefile +0 -3
index 73d021c2e46255bf..7326e644e3a18bdb 100644
@@ -14,9 +14,6 @@ all:
 .PHONY: all install default clean test
 .PHONY: FORCE cscope
 
-partcheck: all
-	@echo "make partcheck => TODO add tests with out kernel support"
-
 runtests: all
 	@$(MAKE) -C test runtests
 runtests-loop: all
Signature · 1 line
Ammar Faizi
#2 lore raw

PATCH 2/2 t/no-mmap-inval: Replace `valloc()` with `t_posix_memalign()`

In reply to Ammar Faizi

Address the limitations of valloc(). This function, which is primarily used for allocating page-aligned memory, is not only absent in some systems but is also marked as obsolete according to the man 3 valloc.

Replace valloc() with t_posix_memalign() to fix the following build error:

  no-mmap-inval.c:28:56: warning: call to undeclared function 'valloc'; ISO C99 and \
  later do not support implicit function declarations [-Wimplicit-function-declaration]
          p.cq_off.user_addr = (unsigned long long) (uintptr_t) valloc(8192);
                                                                ^
  1 warning generated.

ld.lld: error: undefined symbol: valloc

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

referenced by no-mmap-inval.c:28

              /tmp/no-mmap-inval-ea16a2.o:(main)

did you mean: calloc
defined in: /system/lib64/libc.so

clang-15: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [Makefile:239: no-mmap-inval.t] Error 1

---
 test/no-mmap-inval.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
test/no-mmap-inval.c +3 -1
index 9571fee0035ac5ce..244d4eb645115a44 100644
@@ -20,12 +20,14 @@ int main(int argc, char *argv[])
 		.flags		= IORING_SETUP_NO_MMAP,
 	};
 	struct io_uring ring;
+	void *addr;
 	int ret;
 
 	if (argc > 1)
 		return T_EXIT_SKIP;
 
-	p.cq_off.user_addr = (unsigned long long) (uintptr_t) valloc(8192);
+	t_posix_memalign(&addr, sysconf(_SC_PAGESIZE), 8192);
+	p.cq_off.user_addr = (unsigned long long) (uintptr_t) addr;
 
 	ret = io_uring_queue_init_params(2, &ring, &p);
 	if (ret == -EINVAL) {
Signature · 1 line
Ammar Faizi
Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH liburing v1 2/2] t/no-mmap-inval: Replace `valloc()` with `t_posix_memalign()`

Quoted 14 lines · Ammar Faizi

Address the limitations of valloc(). This function, which is primarily used for allocating page-aligned memory, is not only absent in some systems but is also marked as obsolete according to the man 3 valloc.

Replace valloc() with t_posix_memalign() to fix the following build error:

  no-mmap-inval.c:28:56: warning: call to undeclared function 'valloc'; ISO C99 and \
  later do not support implicit function declarations [-Wimplicit-function-declaration]
          p.cq_off.user_addr = (unsigned long long) (uintptr_t) valloc(8192);
                                                                ^
  1 warning generated.

ld.lld: error: undefined symbol: valloc

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

referenced by no-mmap-inval.c:28

              /tmp/no-mmap-inval-ea16a2.o:(main)

did you mean: calloc
defined in: /system/lib64/libc.so

clang-15: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [Makefile:239: no-mmap-inval.t] Error 1

-- Viro

maintainer Applied
#4 lore raw
In reply to Ammar Faizi
Quoted 9 lines · Ammar Faizi

There are two patches in this series:

1. Makefile: Remove the partcheck target.

Remove the partcheck target because it has remained unused for nearly four years, and the associated TODO comment has not been actioned since its introduction in commit:

[...]

Applied, thanks!

[1/2] Makefile: Remove the partcheck target

      commit: 4ea77f3a1561bbd3140cc0de03698a67d08f4f27
[2/2] t/no-mmap-inval: Replace `valloc()` with `t_posix_memalign()`
      commit: 7524a6adf4d6720a47bfa617b5cb2fd8d57f16d2

Best regards,

Signature · 1 line
Jens Axboe