mmap() w/o MAP_ANON
Ben Lindstrom
mouring at etoh.eviladmin.org
Thu Apr 11 23:38:35 EST 2002
On Thu, 11 Apr 2002, Nicolas Williams wrote:
> Er, shouldn't it be
>
> #ifdef MAP_ANON
> address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED,
> -1, 0);
> #else
> address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_PRIVATE,
> open("/dev/zero",...), 0);
> #endif
>
Yes and no.. MAP_PRIVATE must be MAP_SHARED so all children can see
the information written. But otherwises yes. Since it does not have a
MAP_ANON we need to provide a FD to something.
- Ben
> ?
>
> Nico
>
> On Wed, Apr 10, 2002 at 08:41:45PM -0700, Tim Rice wrote:
> >
> > Would this work in monitor_mm.c ?
> > #ifdef MAP_ANON
> > address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_ANON|MAP_SHARED,
> > -1, 0);
> > #else
> > address = mmap(NULL, size, PROT_WRITE|PROT_READ, MAP_SHARED,
> > -1, 0);
> > #endif
> >
> > Many systems have mmap() but no MAP_ANON/MAP_ANONYMOUS
> > Ie. SCO 5.0.x, UnixWare 2.x, Solaris < 8
> >
> > Is MAP_ANON needed or do we just #undef HAVE_MMAP on systems that
> > don't have it?
> >
> > --
> > Tim Rice Multitalents (707) 887-1469
> > tim at multitalents.net
> >
> >
> > _______________________________________________
> > openssh-unix-dev at mindrot.org mailing list
> > http://www.mindrot.org/mailman/listinfo/openssh-unix-dev
> --
> -DISCLAIMER: an automatically appended disclaimer may follow. By posting-
> -to a public e-mail mailing list I hereby grant permission to distribute-
> -and copy this message.-
>
> Visit our website at http://www.ubswarburg.com
>
> This message contains confidential information and is intended only
> for the individual named. If you are not the named addressee you
> should not disseminate, distribute or copy this e-mail. Please
> notify the sender immediately by e-mail if you have received this
> e-mail by mistake and delete this e-mail from your system.
>
> E-mail transmission cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses. The sender therefore
> does not accept liability for any errors or omissions in the contents
> of this message which arise as a result of e-mail transmission. If
> verification is required please request a hard-copy version. This
> message is provided for informational purposes and should not be
> construed as a solicitation or offer to buy or sell any securities or
> related financial instruments.
>
> _______________________________________________
> openssh-unix-dev at mindrot.org mailing list
> http://www.mindrot.org/mailman/listinfo/openssh-unix-dev
>
More information about the openssh-unix-dev
mailing list