16 #if STXXL_HAVE_MMAP_FILE
30 assert(req->get_file() ==
this);
32 void* buffer = req->get_buffer();
40 int prot = (type == request::READ) ? PROT_READ : PROT_WRITE;
41 void* mem = mmap(NULL, bytes, prot, MAP_SHARED, file_des, offset);
44 if (mem == MAP_FAILED)
48 " path=" << filename <<
50 " Page size: " << sysconf(_SC_PAGESIZE) <<
51 " offset modulo page size " << (offset % sysconf(_SC_PAGESIZE)));
59 if (type == request::READ)
61 memcpy(buffer, mem, bytes);
65 memcpy(mem, buffer, bytes);
72 const char* mmap_file::io_type()
const
79 #endif // #if STXXL_HAVE_MMAP_FILE
static const int bytes
number of bytes in uint_pair
#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]".
request::offset_type offset_type
the offset of a request, also the size of the file
Request with basic properties like file and offset.
#define STXXL_END_NAMESPACE