16 #if STXXL_HAVE_MMAP_FILE
34 int prot = (type == request::READ) ? PROT_READ : PROT_WRITE;
35 void* mem = mmap(NULL, bytes, prot, MAP_SHARED, file_des, offset);
38 if (mem == MAP_FAILED)
42 " path=" << filename <<
44 " Page size: " << sysconf(_SC_PAGESIZE) <<
45 " offset modulo page size " << (offset % sysconf(_SC_PAGESIZE)));
53 if (type == request::READ)
55 memcpy(buffer, mem, bytes);
59 memcpy(mem, buffer, bytes);
66 const char* mmap_file::io_type()
const
73 #endif // #if STXXL_HAVE_MMAP_FILE
#define STXXL_THROW_ERRNO_NE_0(expr, exception_type, error_message)
Throws exception_type if (expr != 0) with "Error in [function] : [error_message] : [errno message]"...
request::size_type size_type
the size of a request
Aquire a lock that's valid until the end of scope.
#define STXXL_BEGIN_NAMESPACE
#define STXXL_THROW_ERRNO(exception_type, error_message)
Throws exception_type with "Error in [function] : [error_message] : [errno message]".
static const size_t bytes
number of bytes in uint_pair
request::offset_type offset_type
the offset of a request, also the size of the file
#define STXXL_END_NAMESPACE