Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
mmap returning MAP_FAILED
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Washington Ratso  
View profile  
 More options Nov 6, 4:24 pm
Newsgroups: comp.os.linux.embedded, comp.os.linux.development.system, comp.os.linux.powerpc, comp.arch.embedded
From: Washington Ratso <jobhunt...@aol.com>
Date: Thu, 5 Nov 2009 21:24:15 -0800 (PST)
Local: Fri, Nov 6 2009 4:24 pm
Subject: mmap returning MAP_FAILED
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?


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Schwartz  
View profile  
 More options Nov 6, 8:59 pm
Newsgroups: comp.os.linux.embedded, comp.os.linux.development.system, comp.os.linux.powerpc, comp.arch.embedded
From: David Schwartz <dav...@webmaster.com>
Date: Fri, 6 Nov 2009 01:59:07 -0800 (PST)
Local: Fri, Nov 6 2009 8:59 pm
Subject: Re: mmap returning MAP_FAILED
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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Washington Ratso  
View profile  
 More options Nov 7, 1:10 pm
Newsgroups: comp.os.linux.embedded, comp.os.linux.development.system, comp.os.linux.powerpc, comp.arch.embedded
From: Washington Ratso <jobhunt...@aol.com>
Date: Fri, 6 Nov 2009 18:10:02 -0800 (PST)
Local: Sat, Nov 7 2009 1:10 pm
Subject: Re: mmap returning MAP_FAILED
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.) "


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Schwartz  
View profile  
 More options Nov 7, 2:52 pm
Newsgroups: comp.os.linux.embedded, comp.os.linux.development.system, comp.os.linux.powerpc, comp.arch.embedded
From: David Schwartz <dav...@webmaster.com>
Date: Fri, 6 Nov 2009 19:52:37 -0800 (PST)
Local: Sat, Nov 7 2009 2:52 pm
Subject: Re: mmap returning MAP_FAILED
On Nov 6, 6:10 pm, Washington Ratso <jobhunt...@aol.com> wrote:

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

What exactly do you think mapping a zero-length file would do?

DS


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shankar  
View profile  
 More options Nov 8, 8:03 pm
Newsgroups: comp.os.linux.embedded, comp.os.linux.development.system, comp.os.linux.powerpc, comp.arch.embedded
From: Shankar <shanka...@gmail.com>
Date: Sun, 8 Nov 2009 01:03:23 -0800 (PST)
Local: Sun, Nov 8 2009 8:03 pm
Subject: Re: mmap returning MAP_FAILED
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?

prot=3 => would mean PROT_READ|PROT_WRITE

MAP_SHARED I think is a invalid mode if you are trying to map it that
way, Probably you may want to remove PROT_WRITE and see whats
happening.

Thanks

Shankar Easwaran


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Pfeiffer  
View profile  
 More options Nov 9, 4:09 am
Newsgroups: comp.os.linux.embedded, comp.os.linux.development.system, comp.os.linux.powerpc, comp.arch.embedded
From: Joe Pfeiffer <pfeif...@cs.nmsu.edu>
Date: Sun, 08 Nov 2009 10:09:56 -0700
Local: Mon, Nov 9 2009 4:09 am
Subject: Re: mmap returning MAP_FAILED

Shankar <shanka...@gmail.com> writes:
> 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?

> prot=3 => would mean PROT_READ|PROT_WRITE

> MAP_SHARED I think is a invalid mode if you are trying to map it that
> way, Probably you may want to remove PROT_WRITE and see whats
> happening.

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;
and this we should do freely and generously. (Benjamin Franklin)

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alan Curry  
View profile  
 More options Nov 9, 9:29 am
Newsgroups: comp.os.linux.development.system
From: pac...@kosh.dhis.org (Alan Curry)
Date: Sun, 8 Nov 2009 22:29:31 +0000 (UTC)
Local: Mon, Nov 9 2009 9:29 am
Subject: Re: mmap returning MAP_FAILED
In article <1br5s9osd7....@snowball.wb.pfeifferfamily.net>,
Joe Pfeiffer  <pfeif...@cs.nmsu.edu> wrote:

Also, MAP_SHARED is the only way to get changes written back into a
memory-mapped file, so sometimes you need MAP_SHARED with PROT_WRITE
even if you don't want shared memory (simultaneously accessible by
multiple processes). It's kind of a misleading name.

--
Alan Curry


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cliff Brake  
View profile  
 More options Nov 10, 2:46 am
Newsgroups: comp.os.linux.embedded, comp.os.linux.development.system, comp.os.linux.powerpc, comp.arch.embedded
From: Cliff Brake <cliff.br...@gmail.com>
Date: Mon, 9 Nov 2009 07:46:22 -0800 (PST)
Local: Tues, Nov 10 2009 2:46 am
Subject: Re: mmap returning MAP_FAILED
On Nov 6, 9:10 pm, Washington Ratso <jobhunt...@aol.com> wrote:

> I am trying to get oprofile to work.  The file I am opening is a
> sample file.  Here is the code for the open:

Make sure you are not logging data to a JFFS2 file system.  JFFS2 does
not support MMAP.

Cliff


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google