mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +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
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
2006-10-24 Soren Sandmann <sandmann@daimi.au.dk>
|
||||
|
||||
* process.c (struct Process): Use an array instead of list of
|
||||
|
||||
@ -90,7 +90,6 @@ separate_debug_file_exists (const char *name, guint32 crc)
|
||||
return parser;
|
||||
}
|
||||
|
||||
/* FIXME - not10: this should probably be detected by config.h -- find out what gdb does*/
|
||||
static const char *const debug_file_directory = DEBUGDIR;
|
||||
|
||||
static ElfParser *
|
||||
|
||||
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