git: 8d40ee599d13 - main - Have path_test ask the kernel for the page size
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 07 Apr 2022 14:59:55 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=8d40ee599d130a7dcf57eba448d3966a7ce30638
commit 8d40ee599d130a7dcf57eba448d3966a7ce30638
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2022-04-07 14:59:38 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2022-04-07 14:59:38 +0000
Have path_test ask the kernel for the page size
It may be dynamic so we can't rely on PAGE_SIZE being present or
correct.
Sponsored by: The FreeBSD Foundation
---
tests/sys/file/path_test.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/sys/file/path_test.c b/tests/sys/file/path_test.c
index a39862cc78d6..39c653a07c1b 100644
--- a/tests/sys/file/path_test.c
+++ b/tests/sys/file/path_test.c
@@ -604,6 +604,7 @@ ATF_TC_BODY(path_io, tc)
char path[PATH_MAX], path2[PATH_MAX];
char buf[BUFSIZ];
struct iovec iov;
+ size_t page_size;
int error, fd, pathfd, sd[2];
/* It shouldn't be possible to create new files with O_PATH. */
@@ -667,14 +668,15 @@ ATF_TC_BODY(path_io, tc)
ATF_REQUIRE_MSG(error == ESPIPE, "posix_fadvise() returned %d", error);
/* mmap() is not allowed. */
+ page_size = getpagesize();
ATF_REQUIRE_ERRNO(ENODEV,
- mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, pathfd, 0) ==
+ mmap(NULL, page_size, PROT_READ, MAP_SHARED, pathfd, 0) ==
MAP_FAILED);
ATF_REQUIRE_ERRNO(ENODEV,
- mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_SHARED, pathfd, 0) ==
+ mmap(NULL, page_size, PROT_NONE, MAP_SHARED, pathfd, 0) ==
MAP_FAILED);
ATF_REQUIRE_ERRNO(ENODEV,
- mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, pathfd, 0) ==
+ mmap(NULL, page_size, PROT_READ, MAP_PRIVATE, pathfd, 0) ==
MAP_FAILED);
/* No fsync() or fdatasync(). */