direct-code-execution / ns-3-dce

Run real programs in the discrete time simulator ns3
http://www.nsnam.org/projects/direct-code-execution/
75 stars 46 forks source link

mmap doesn't support MAP_ANONYMOUS #105

Open mpiraux opened 4 years ago

mpiraux commented 4 years ago

Currently, calling mmap with the flag MAP_ANONYMOUS returns EBADF. The mmap code looks for a file descriptor no matter what flags are passed, hence the error raised.

void * dce_mmap64 (void *start, size_t length, int prot, int flags,
                   int fd, off64_t offset)
{
  Thread *current = Current ();
  NS_LOG_FUNCTION (current << UtilsGetNodeId () << start << length << prot << flags << fd << offset);
  NS_ASSERT (current != 0);

  OPENED_FD_METHOD_ERR (MAP_FAILED, void *, Mmap (start, length, prot, flags, offset))
}