src/os.cc
// Prepare the target memory. It may requre mapping in, or this may be a noop.
Prepare the target memory. It may requre mapping in, or this may be a noop.
Prepare the target memory . It may requre mapping in or this may be a noop .
void *OsLayer::PrepareTestMem(uint64 offset, uint64 length) {
  sat_assert((offset + length) <= testmemsize_);
  if (dynamic_mapped_shmem_) {
#ifdef HAVE_MMAP64
    void * mapping = mmap64(NULL, length, PROT_READ | PROT_WRITE,
                     MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE,
                     shmid_, offset);
#else
    void * mapping = mmap(NULL, length, PROT_READ | PROT_WRITE,
                     MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE,
                     shmid_, offset);
#endif
    if (mapping == MAP_FAILED) {
      string errtxt = ErrorString(errno);
      logprintf(0, "Process Error: PrepareTestMem mmap64(%llx, %llx) failed. "
                   "error: %s.\n",
                offset, length, errtxt.c_str());
      sat_assert(0);
    }
    return mapping;
  }
  return reinterpret_cast<void*>(reinterpret_cast<char*>(testmem_) + offset);
}
void * OsLayer :: PrepareTestMem ( uint64 offset , uint64 length ) { sat_assert ( ( offset + length ) <= testmemsize_ ) ; if ( dynamic_mapped_shmem_ ) { #ifdef HAVE_MMAP64 void * mapping = mmap64 ( NULL , length , PROT_READ | PROT_WRITE , MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE , shmid_ , offset ) ; #else void * mapping = mmap ( NULL , length , PROT_READ | PROT_WRITE , MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE , shmid_ , offset ) ; #endif if ( mapping == MAP_FAILED ) { string errtxt = ErrorString ( errno ) ; logprintf ( 0 , " " " \n " , offset , length , errtxt . c_str ( ) ) ; sat_assert ( 0 ) ; } return mapping ; } return reinterpret_cast < void * > ( reinterpret_cast < char * > ( testmem_ ) + offset ) ; }
Prepare the target memory.
Prepare the target memory .
// TODO(nsanders): Check if we can support MAP_NONBLOCK, // and evaluate performance hit from not using it.