mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 07:00:53 +00:00
replace PAGE_SIZE macro with this function.
2006-10-24 Soren Sandmann <sandmann@daimi.au.dk> * process.c (page_size): replace PAGE_SIZE macro with this function. * binfile.c: Remove obsolete comment.
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
c02712dc85
commit
a715b55029
19
process.c
19
process.c
@ -30,8 +30,6 @@
|
||||
#include "process.h"
|
||||
#include "binfile.h"
|
||||
|
||||
#define PAGE_SIZE (getpagesize())
|
||||
|
||||
static GHashTable *processes_by_cmdline;
|
||||
static GHashTable *processes_by_pid;
|
||||
|
||||
@ -281,12 +279,27 @@ process_has_page (Process *process, gulong addr)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
page_size (void)
|
||||
{
|
||||
static int page_size;
|
||||
static gboolean has_page_size;
|
||||
|
||||
if (!has_page_size)
|
||||
{
|
||||
page_size = getpagesize();
|
||||
has_page_size = TRUE;
|
||||
}
|
||||
|
||||
return page_size;
|
||||
}
|
||||
|
||||
void
|
||||
process_ensure_map (Process *process, int pid, gulong addr)
|
||||
{
|
||||
/* Round down to closest page */
|
||||
|
||||
addr = (addr - addr % PAGE_SIZE);
|
||||
addr = (addr - addr % page_size());
|
||||
|
||||
if (process_has_page (process, addr))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user