From: LDB <thesource@ldb-jab.org>
To: leo mueller <llug.dan@googlemail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: mmap() returns with -EINVAL
Date: Sun, 16 Aug 2009 10:47:56 -0400 [thread overview]
Message-ID: <4A881C1C.9010301@master.ldb-jab.org> (raw)
In-Reply-To: <c93f91ee0907300619q2dc38f49q1092b363ed28687@mail.gmail.com>
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.
prev parent reply other threads:[~2009-08-16 14:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-30 13:19 mmap() returns with -EINVAL leo mueller
2009-08-16 14:11 ` Reto Glauser
2009-08-16 14:47 ` LDB [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A881C1C.9010301@master.ldb-jab.org \
--to=thesource@ldb-jab.org \
--cc=linux-c-programming@vger.kernel.org \
--cc=llug.dan@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.