Re: mmap() returns with -EINVAL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



leo mueller wrote:
> hi all,
> 
> in my attached code snippet i try to mmap the incoming socket data
> accoring to the kernel documentation
> which can also be found online:
> http://lxr.linux.no/linux+v2.6.30/Documentation/networking/packet_mmap.txt
> 
> by doing a mmap() my program exits with -EINVAL and up to now i have
> no clue why... parametes should be right.
> 
> do you have any idea?
> 
> big thanks,
> daniel
> 

It has to be one of the reason below:


   EINVAL We don't like addr, length, or offset (e.g., they are too large, or
not aligned on a page boundary).

   EINVAL (since Linux 2.6.12) length was 0.

   EINVAL flags contained neither MAP_PRIVATE or MAP_SHARED, or contained both
of these values.



Also, according to the man pages under the BUGS section:


   SUSv3 specifies that mmap() should fail if length is 0.
   However, in kernels  before 2.6.12, mmap() succeeded in this case: no
   mapping was created and the call returned addr.  Since kernel 2.6.12,
   mmap() fails with the error EINVAL for this case.

Lastly, since mmap() has been superseded by mmap2(), you might want to
try the latter.



--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux