/usr/include/falcon/heap_linux.h is in falconpl-dev 0.9.6.9-git20120606-2.1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | /*
FALCON - The Falcon Programming Language.
FILE: flc_heap_linux.h
Base class for heap management.
-------------------------------------------------------------------
Author: Giancarlo Niccolai
Begin: mer set 29 2004
-------------------------------------------------------------------
(C) Copyright 2004: the FALCON developers (see list in AUTHORS file)
See LICENSE file for licensing details.
*/
/** \file
Heap memory for linux.
*/
#ifndef flc_HEAP_LINUX_H
#define flc_HEAP_LINUX_H
#include <unistd.h>
#include <falcon/fassert.h>
/** Page size.
\todo add a configure system to put the page size in the config.h
*/
#define PAGE_SIZE 4096
namespace Falcon {
class HeapMem_Linux
{
static long m_pageSize;
public:
/*
static void init() {
if ( m_pageSize == 0 )
{
m_pageSize = sysconf( _SC_PAGESIZE );
}
}
static void uninit() {}
*/
static void *getPage() { return getPages(1); }
static void *getPages( int pages )
{
//fassert( m_pageSize != 0 );
void *ret = mmap(((void *)0), pages * PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
fassert( ret != MAP_FAILED );
return ret;
}
static void freePage( void *memory ) { free( memory, 1 ); } // free one page
static void free( void *memory, int pages )
{
//fassert( m_pageSize != 0 );
munmap( memory, pages * PAGE_SIZE );
}
//static long pageSize() { return m_pageSize; }
static long pageSize() { return PAGE_SIZE; }
};
typedef HeapMem_Linux HeapMem;
}
#endif
/* end of flc_heap_linux.h */
|