Do you have a question? Post it now! No Registration Necessary
- Washington Ratso
November 6, 2009, 5:24 am

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?
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?

Re: mmap returning MAP_FAILED

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 3D% open(filename, flags, 0644);
where filename 3D% "/var/lib/oprofile/samples//current//no-vmlinux/
//no-vmlinux/TIMER.0.0.all.all.all"
where flags 3D% O_CREAT | O_RDWR
The file /var/lib/oprofile/samples//current//no-vmlinux//
/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.) "

Re: mmap returning MAP_FAILED

That would do terrible things to the utility of shared memory -- no,
MAP_SHARED and PROT_WRITE are compatible. Maybe you're thinking of
MAP_SHARED and MAP_ANONYMOUS (which didn't used to be compatible, but is
since 2.4).
--
As we enjoy great advantages from the inventions of others, we should
be glad of an opportunity to serve others by any invention of ours;
As we enjoy great advantages from the inventions of others, we should
be glad of an opportunity to serve others by any invention of ours;
We've slightly trimmed the long signature. Click to see the full one.

Re: mmap returning MAP_FAILED

No. It is feasible.
The parameter prot determines whether read, write, execute,
or some combination of accesses are permitted to the data being
mapped.
The prot should be either PROT_NONE or the bitwise inclusive OR of
one or more of the other flags listed below -
PROT_READ Data can be read.
PROT_WRITE Data can be written.
PROT_EXEC Data can be executed.
PROT_NONE Data cannot be accessed.
Check the below links w.r.t mmap ->
http://docs.blackfin.uclinux.org/doku.php?id3D%:mmap#mmap_kernel_code_examp =
le_2
http://www.opengroup.org/onlinepubs/007908775/xsh/mmap.html
Karthik Balaguru
Karthik Balaguru
Site Timeline
- » adder875 boot fail
- — Next thread in » Embedded Linux
-
- » The Six Periods of the Creation
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » Co wetknÄ…c w dziury o rastrze 1.27?
- — The site's Newest Thread. Posted in » Electronics (Polish)
-