ATLAS Offline Software
Control
CxxUtils
Root
page_access.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CxxUtils/page_access.h
"
6
#include <unistd.h>
7
#include <limits.h>
8
namespace
athena
{
9
const
size_t
PAGESIZE
= sysconf(_SC_PAGE_SIZE);
10
11
const
void
*
page_address
(
const
void
* addr) {
12
return
(
const
void
*)((long)addr & ~(
PAGESIZE
-1));
13
}
14
void
*
page_address
(
void
* addr) {
15
return
(
void
*)((long)addr & ~(
PAGESIZE
-1));
16
}
17
void
*
next_page_address
(
void
* addr) {
18
return
(
void
*)(((long)addr & ~(
PAGESIZE
-1)) +
PAGESIZE
);
19
}
20
21
int
page_protect
(
void
* addr,
int
prot) {
22
int
rc=mprotect(
page_address
(addr),
PAGESIZE
, prot);
23
if
(rc) printf(
"page_protect WARNING: mprotect heap failed for void *address %p\n"
, addr);
24
#ifdef DEBUG
25
else
printf(
"page_protect DEBUG: set protection @%i for range @%zx - @%zx containing void* addr=%p\n"
,
26
prot,(
size_t
)
page_address
(addr),
27
(
size_t
)
page_address
(addr) +
PAGESIZE
, addr);
28
#endif
29
return
rc;
30
}
31
}
athena::page_protect
int page_protect(void *addr, int prot)
Definition:
page_access.cxx:21
athena
Definition:
athena.py:1
athena::next_page_address
void * next_page_address(void *addr)
Definition:
page_access.cxx:17
athena::page_address
const void * page_address(const void *addr)
Definition:
page_access.cxx:11
page_access.h
athena::PAGESIZE
const size_t PAGESIZE
Definition:
page_access.cxx:9
Generated on Thu Nov 7 2024 21:23:14 for ATLAS Offline Software by
1.8.18