MCPcopy Create free account
hub / github.com/GJDuck/e9patch / calculateProtections

Function calculateProtections

src/e9patch/e9mapping.cpp:204–221  ·  view source on GitHub ↗

* Calculate the protections of a mapping. */

Source from the content-addressed store, hash-verified

202 * Calculate the protections of a mapping.
203 */
204static int calculateProtections(const Mapping *mapping)
205{
206 int prot = PROT_NONE;
207 const size_t SIZE = mapping->size;
208 const intptr_t BASE = mapping->base;
209 const intptr_t END = BASE + SIZE;
210 auto iend = Allocator::end();
211 for (auto i = mapping->i; i != iend; ++i)
212 {
213 const Alloc *a = *i;
214 if (a->lb >= END)
215 break;
216 if (a->T == nullptr)
217 continue;
218 prot |= a->T->prot;
219 }
220 return prot;
221}
222
223/*
224 * Calculate the PRELOAD flag of a mapping.

Callers 1

saveMappingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected