Lines Matching refs:block
244 bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const in createBlock() argument
248 block.size = (size + (pagesize - 1)) & ~(pagesize - 1); in createBlock()
249 block.start = block.exec = NULL; in createBlock()
250 block.fd = -1; in createBlock()
267 if ((block.fd = mkstemp(tmpfname)) == -1) in createBlock()
269 if (block.fd == -1) in createBlock()
276 if (ftruncate(block.fd, block.size) == -1) in createBlock()
279 close(block.fd); in createBlock()
280 block.fd = -1; in createBlock()
283 block.start = mmap(NULL, block.size, PROT_READ | PROT_WRITE, MAP_SHARED, block.fd, 0); in createBlock()
284 if (block.start== MAP_FAILED) { in createBlock()
285 block.start = 0; in createBlock()
287 block.exec = mmap(NULL, block.size, PROT_READ | PROT_EXEC, MAP_SHARED, block.fd, 0); in createBlock()
288 if (block.exec == MAP_FAILED) { in createBlock()
289 block.exec = 0; in createBlock()
293 if (block.start && block.exec && block.fd != -1) in createBlock()
296 freeBlock(block); in createBlock()
300 if (!block.start || !block.exec || block.fd == -1) in createBlock()
303 block.fd = -1; in createBlock()
304 block.start = block.exec = rtl_arena_alloc(m_arena, &block.size); in createBlock()
306 return (block.start != 0 && block.exec != 0); in createBlock()
309 void VtableFactory::freeBlock(Block const & block) const { in freeBlock()
311 if (block.fd == -1 && block.start == block.exec && block.start != NULL) in freeBlock()
312 rtl_arena_free(m_arena, block.start, block.size); in freeBlock()
315 if (block.start) munmap(block.start, block.size); in freeBlock()
316 if (block.exec) munmap(block.exec, block.size); in freeBlock()
317 if (block.fd != -1) close(block.fd); in freeBlock()
321 bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const in createBlock() argument
323 block.size = getBlockSize(slotCount); in createBlock()
324 block.start = rtl_arena_alloc(m_arena, &block.size); in createBlock()
325 return block.start != 0; in createBlock()
328 void VtableFactory::freeBlock(Block const & block) const { in freeBlock()
329 rtl_arena_free(m_arena, block.start, block.size); in freeBlock()
340 Block block; in createVtables() local
341 if (!createBlock(block, slotCount)) { in createVtables()
345 Slot * slots = initializeBlock(block.start, slotCount); in createVtables()
356 sal_IntPtr(block.exec) - sal_IntPtr(block.start), in createVtables()
367 ::std::swap(block.start, block.exec); in createVtables()
369 blocks.push_back(block); in createVtables()
371 freeBlock(block); in createVtables()