diff options
author | Soren Sandmann <sandmann@daimi.au.dk> | 2006-10-25 02:02:44 +0000 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@src.gnome.org> | 2006-10-25 02:02:44 +0000 |
commit | a715b55029882ef32b5500de68867ad398c5b96a (patch) | |
tree | 5a966eee8cac076cbc502dd29db94ab0567813a7 /process.c | |
parent | c02712dc85d3ba4a3da7d4bcd599169a0d1b49d6 (diff) |
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.
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -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; |