Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 May 2022 14:04:44 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 3ed2c7a4bead - stable/13 - Have path_test ask the kernel for the page size
Message-ID:  <202205031404.243E4i2l077928@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=3ed2c7a4bead6cb8240942decce32aadc0df8ca3

commit 3ed2c7a4bead6cb8240942decce32aadc0df8ca3
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2022-04-07 14:59:38 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2022-05-03 14:04:04 +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
    
    (cherry picked from commit 8d40ee599d130a7dcf57eba448d3966a7ce30638)
---
 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 216782a5f2bc..a212325c7db6 100644
--- a/tests/sys/file/path_test.c
+++ b/tests/sys/file/path_test.c
@@ -607,6 +607,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. */
@@ -670,14 +671,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(). */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202205031404.243E4i2l077928>