Have the coredump_phnum test ask for the page size
The page size may be dynamically selected on boot. Have the coredump_phnum test helper ask the kernel for the correct value. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
be461cdfb3
commit
df696a2fb6
@ -33,6 +33,7 @@
|
||||
#include <err.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/*
|
||||
* This program is intended to create a bunch of segment mappings, then dump
|
||||
@ -42,10 +43,11 @@ int
|
||||
main(int argc __unused, char **argv __unused)
|
||||
{
|
||||
void *v;
|
||||
size_t i, pages;
|
||||
size_t i, pages, page_size;
|
||||
|
||||
page_size = getpagesize();
|
||||
pages = UINT16_MAX + 1000;
|
||||
v = mmap(NULL, pages * PAGE_SIZE, PROT_READ | PROT_WRITE,
|
||||
v = mmap(NULL, pages * page_size, PROT_READ | PROT_WRITE,
|
||||
MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
if (v == NULL)
|
||||
err(1, "mmap");
|
||||
@ -54,7 +56,7 @@ main(int argc __unused, char **argv __unused)
|
||||
* Alternate protections to interleave RW and R PT_LOAD
|
||||
* segments.
|
||||
*/
|
||||
if (mprotect((char *)v + i * PAGE_SIZE, PAGE_SIZE,
|
||||
if (mprotect((char *)v + i * page_size, page_size,
|
||||
PROT_READ) != 0)
|
||||
err(1, "mprotect");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user