On Nov 6, 1:59*am, David Schwartz <dav...@webmaster.com> wrote:
> On Nov 5, 9:24*pm, Washington Ratso <jobhunt...@aol.com> wrote:
>
> > I am running Linux 2.6.26 on an MPC8248. * In my application, mmap is
> > returning MAP_FAILED. *The arguments to mmap are start = 0, length =
> > 2680, prot = 3, flags = MAP_SHARED, fd = 5, offset = 0. *errno = 22
> > "Invalid argument"
>
> > I looked at the man page for mmap and don't see a reason why this is
> > happening. *Any ideas?
>
> It would help if you told us what you were trying to do. What is file
> descriptor 5 and how was it opened? Also, I doubt '2680' is a multiple
> of your page size, so you cannot create a 2,680-byte mapping.
>
> DS
I am trying to get oprofile to work. The file I am opening is a
sample file. Here is the code for the open:
data->fd = open(filename, flags, 0644);
where filename = "/var/lib/oprofile/samples//current/{kern}/no-vmlinux/
{dep}/{kern}/no-vmlinux/TIMER.0.0.all.all.all"
where flags = O_CREAT | O_RDWR
The file /var/lib/oprofile/samples//current/{kern}/no-vmlinux/{dep}/
{kern}/no-vmlinux/TIMER.0.0.all.all.all does exist.
I changed the length to the page size and it made no difference.
According to
http://www.ecst.csuchico.edu/~beej/guide/ipc/mmap.html,
"This can be any length you want. (Aside: if len not a multiple of the
virtual memory page size, you will get a blocksize that is rounded up
to that size. The extra bytes will be 0, and any changes you make to
them will not modify the file.) "