diff mbox series

[liburing,2/4] Fix the 32-bit build

Message ID 20190708195750.223103-3-bvanassche@acm.org (mailing list archive)
State New, archived
Headers show
Series Optimize i386 memory barriers | expand

Commit Message

Bart Van Assche July 8, 2019, 7:57 p.m. UTC
Fix the warnings reported when building liburing as follows:

make CFLAGS=-m32

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 test/io_uring_register.c | 11 ++++++-----
 test/send_recvmsg.c      |  4 ++--
 2 files changed, 8 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/test/io_uring_register.c b/test/io_uring_register.c
index 070d0ff3d511..32e52179af29 100644
--- a/test/io_uring_register.c
+++ b/test/io_uring_register.c
@@ -140,7 +140,7 @@  test_max_fds(int uring_fd)
 		perror("mmap fd_as");
 		exit(1);
 	}
-	printf("allocated %lu bytes of address space\n", UINT_MAX * sizeof(int));
+	printf("allocated %zu bytes of address space\n", UINT_MAX * sizeof(int));
 
 	fdtable_fd = mkstemp(template);
 	if (fdtable_fd < 0) {
@@ -178,7 +178,8 @@  test_max_fds(int uring_fd)
 		fds = mmap(fds, 128*1024*1024, PROT_READ|PROT_WRITE,
 			   MAP_SHARED|MAP_FIXED, fdtable_fd, 0);
 		if (fds == MAP_FAILED) {
-			printf("mmap failed at offset %lu\n", (char *)fd_as - (char *)fds);
+			printf("mmap failed at offset %lu\n",
+			       (unsigned long)((char *)fd_as - (char *)fds));
 			exit(1);
 		}
 	}
@@ -217,7 +218,7 @@  test_max_fds(int uring_fd)
 	close(fdtable_fd);
 	ret = munmap(fd_as, UINT_MAX * sizeof(int));
 	if (ret != 0) {
-		printf("munmap(%lu) failed\n", UINT_MAX * sizeof(int));
+		printf("munmap(%zu) failed\n", UINT_MAX * sizeof(int));
 		exit(1);
 	}
 
@@ -244,7 +245,7 @@  test_memlock_exceeded(int fd)
 		ret = io_uring_register(fd, IORING_REGISTER_BUFFERS, &iov, 1);
 		if (ret < 0) {
 			if (errno == ENOMEM) {
-				printf("io_uring_register of %lu bytes failed "
+				printf("io_uring_register of %zu bytes failed "
 				       "with ENOMEM (expected).\n", iov.iov_len);
 				iov.iov_len /= 2;
 				continue;
@@ -253,7 +254,7 @@  test_memlock_exceeded(int fd)
 			free(buf);
 			return 1;
 		}
-		printf("successfully registered %lu bytes (%d).\n",
+		printf("successfully registered %zu bytes (%d).\n",
 		       iov.iov_len, ret);
 		ret = io_uring_register(fd, IORING_UNREGISTER_BUFFERS, NULL, 0);
 		if (ret != 0) {
diff --git a/test/send_recvmsg.c b/test/send_recvmsg.c
index e6cda69664a5..9187906d3dbf 100644
--- a/test/send_recvmsg.c
+++ b/test/send_recvmsg.c
@@ -64,7 +64,7 @@  static int do_recvmsg(void)
 	memset(sqe, 0, sizeof(*sqe));
 	sqe->opcode = IORING_OP_RECVMSG;
 	sqe->fd = sockfd;
-	sqe->addr = (uint64_t) &msg;
+	sqe->addr = (uintptr_t) &msg;
 	sqe->len = 1;
 
 	ret = io_uring_submit(&ring);
@@ -136,7 +136,7 @@  static int do_sendmsg(void)
 	memset(sqe, 0, sizeof(*sqe));
 	sqe->opcode = IORING_OP_SENDMSG;
 	sqe->fd = sockfd;
-	sqe->addr = (uint64_t) &msg;
+	sqe->addr = (uintptr_t) &msg;
 	sqe->len = 1;
 
 	ret = io_uring_submit(&ring);