[Mono-dev] Syscall.mmap problem

Jonathan Pryor jonpryor at vt.edu
Thu Oct 25 16:14:59 EDT 2007


On Thu, 2007-10-25 at 16:07 -0300, Mauricio Henriquez wrote:
> about the Syscall.mmap function call, if I ask for the 
> Mono.Unix.Native.Stdlib.GetLastError(), I get a
> EOVERFLOW error message.
> what can I do to solve this or give you a better bug report?

EOVERFLOW will be set if the `length' parameter cannot fit into a size_t
or the `offset' parameter cannot fit into an `off_t'; from sys-mman.c:

        void*
        Mono_Posix_Syscall_mmap (void *start, mph_size_t length, int
        prot, int flags,
            int fd, mph_off_t offset)
        {
          int _prot, _flags;
        
          mph_return_val_if_size_t_overflow (length, MAP_FAILED);
          mph_return_val_if_off_t_overflow (offset, MAP_FAILED);
        
          if (Mono_Posix_FromMmapProts (prot, &_prot) == -1)
            return MAP_FAILED;
          if (Mono_Posix_FromMmapFlags (flags, &_flags) == -1)
            return MAP_FAILED;
        
          return mmap (start, (size_t) length, _prot, _flags, fd, 
            (off_t) offset);
        }
        
The mph_return_val_if_*_overflow() macros are the only things that would
set errno to EOVERFLOW.

If you compiled mono yourself, you could set a breakpoint within that
function.  Otherwise, what values are you providing for `length' and
`offset'?

 - Jon





More information about the Mono-devel-list mailing list