Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147297157
D52735.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D52735.diff
View Options
diff --git a/tests/sys/vm/mmap_test.c b/tests/sys/vm/mmap_test.c
--- a/tests/sys/vm/mmap_test.c
+++ b/tests/sys/vm/mmap_test.c
@@ -36,21 +36,6 @@
#include <stdio.h>
#include <stdlib.h>
-static const struct {
- void *addr;
- int ok[2]; /* Depending on security.bsd.map_at_zero {0, !=0}. */
-} map_at_zero_tests[] = {
- { (void *)0, { 0, 1 } }, /* Test sysctl. */
- { (void *)1, { 0, 0 } },
- { (void *)(PAGE_SIZE - 1), { 0, 0 } },
- { (void *)PAGE_SIZE, { 1, 1 } },
- { (void *)-1, { 0, 0 } },
- { (void *)(-PAGE_SIZE), { 0, 0 } },
- { (void *)(-1 - PAGE_SIZE), { 0, 0 } },
- { (void *)(-1 - PAGE_SIZE - 1), { 0, 0 } },
- { (void *)(0x1000 * PAGE_SIZE), { 1, 1 } },
-};
-
#define MAP_AT_ZERO "security.bsd.map_at_zero"
#ifdef __LP64__
@@ -68,6 +53,22 @@
int map_at_zero;
bool allow_wx;
int prot_flags;
+ size_t pgsz = getpagesize();
+
+ const struct {
+ void *addr;
+ int ok[2]; /* Depending on security.bsd.map_at_zero {0, !=0}. */
+ } map_at_zero_tests[] = {
+ { (void *)0, { 0, 1 } }, /* Test sysctl. */
+ { (void *)1, { 0, 0 } },
+ { (void *)(pgsz - 1), { 0, 0 } },
+ { (void *)pgsz, { 1, 1 } },
+ { (void *)-1, { 0, 0 } },
+ { (void *)(-pgsz), { 0, 0 } },
+ { (void *)(-1 - pgsz), { 0, 0 } },
+ { (void *)(-1 - pgsz - 1), { 0, 0 } },
+ { (void *)(0x1000 * pgsz), { 1, 1 } },
+ };
len = sizeof(map_at_zero);
if (sysctlbyname(MAP_AT_ZERO, &map_at_zero, &len, NULL, 0) == -1) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 10, 6:50 PM (16 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29506746
Default Alt Text
D52735.diff (1 KB)
Attached To
Mode
D52735: mmap_test: determine page size at run time rather than compile time
Attached
Detach File
Event Timeline
Log In to Comment