Debian Bug report logs - #365754
manpages-dev: Please document fopen mmap mode 'm'

version graph

Package: manpages-dev; Maintainer for manpages-dev is Martin Schulze <joey@debian.org>; Source for manpages-dev is src:manpages.

Reported by: Justin Pryzby <justinpryzby@users.sourceforge.net>

Date: Tue, 2 May 2006 17:33:09 UTC

Severity: wishlist

Tags: fixed-upstream, patch, upstream

Found in version manpages-dev/2.28-1

Fixed in version manpages/2.32-1

Done: Martin Schulze <joey@infodrom.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
New Bug report received and forwarded. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Justin Pryzby <justinpryzby@users.sourceforge.net>
To: submit@bugs.debian.org
Subject: manpages-dev: Please document fopen mmap mode 'm'
Date: Tue, 2 May 2006 13:06:38 -0400
[Message part 1 (text/plain, inline)]
Package: manpages-dev
Version: 2.28-1
Severity: wishlist
Tags: upstream patch

Included is a patch to document the fopen mode 'm'; please consider
applying it.

Note that there's also a 'c' flag for open_not_cancel, but since I
can't find much documentation and don't really understand it, I'm not
writing a patch at this time ..
[fopen-patch-mode-mmap (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to "Michael Kerrisk" <mtk-manpages@gmx.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #10 received at 365754@bugs.debian.org (full text, mbox):

From: "Michael Kerrisk" <mtk-manpages@gmx.net>
To: Justin Pryzby <justinpryzby@users.sourceforge.net>,365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Wed, 3 May 2006 23:04:23 +0200 (MEST)
Justin,

> Included is a patch to document the fopen mode 'm'; please consider
> applying it.

To repeat a past request: please, for my sake, make patches 
inline rather than attached.

> Note that there's also a 'c' flag for open_not_cancel, but since I
> can't find much documentation and don't really understand it, I'm not
> writing a patch at this time ..

I think I may add something on this.

To your patch:

>  fopen, fdopen, freopen \- stream open functions

Did you check whether you text is true of all three of these 
functions?

> +.TP
> +.B m
> +Attempts to access the file using \fBmmap()\fP rather than
> +\fBread()\fP and \fBwrite()\fP.

How did you deduce "write()"?  My reading is that mmap() is only used
if the file is opened for reading.

Cheers,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 

Want to help with man page maintenance?  
Grab the latest tarball at
ftp://ftp.win.tue.nl/pub/linux-local/manpages/, 
read the HOWTOHELP file and grep the source 
files for 'FIXME'.



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #15 received at 365754@bugs.debian.org (full text, mbox):

From: Justin Pryzby <justinpryzby@users.sourceforge.net>
To: Michael Kerrisk <mtk-manpages@gmx.net>, 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Thu, 4 May 2006 11:08:22 -0400
On Wed, May 03, 2006 at 11:04:23PM +0200, Michael Kerrisk wrote:
> Justin,
> 
> > Included is a patch to document the fopen mode 'm'; please consider
> > applying it.
> 
> To repeat a past request: please, for my sake, make patches 
> inline rather than attached.
Ups, sorry, it occurred to me after the fact.

> > Note that there's also a 'c' flag for open_not_cancel, but since I
> > can't find much documentation and don't really understand it, I'm not
> > writing a patch at this time ..
> 
> I think I may add something on this.
> 
> To your patch:
> 
> >  fopen, fdopen, freopen \- stream open functions
> 
> Did you check whether you text is true of all three of these 
> functions?
Yup, I just checked.

> > +.TP
> > +.B m
> > +Attempts to access the file using \fBmmap()\fP rather than
> > +\fBread()\fP and \fBwrite()\fP.
> 
> How did you deduce "write()"?  My reading is that mmap() is only used
> if the file is opened for reading.
This seems to be true, as indicated in the comments.  I hadn't
followed the code well enough to be sure, though, and it is slightly
strange that it defers the mmap decision until the first read..

I just wrote a test case for "r+m", which seems to indicate that you
are correct; an "r+m" file is read() not mmaped.

Justin



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to "Michael Kerrisk" <mtk-manpages@gmx.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #20 received at 365754@bugs.debian.org (full text, mbox):

From: "Michael Kerrisk" <mtk-manpages@gmx.net>
To: Justin Pryzby <justinpryzby@users.sourceforge.net>
Cc: 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Thu, 4 May 2006 20:30:53 +0200 (MEST)
Justin,

> > To your patch:
> > 
> > >  fopen, fdopen, freopen \- stream open functions
> > 
> > Did you check whether you text is true of all three of these 
> > functions?
> Yup, I just checked.
> 
> > > +.TP
> > > +.B m
> > > +Attempts to access the file using \fBmmap()\fP rather than
> > > +\fBread()\fP and \fBwrite()\fP.
> > 
> > How did you deduce "write()"?  My reading is that mmap() is only used
> > if the file is opened for reading.
> This seems to be true, as indicated in the comments.  I hadn't
> followed the code well enough to be sure, though, and it is slightly
> strange that it defers the mmap decision until the first read..
> 
> I just wrote a test case for "r+m", which seems to indicate that you
> are correct; an "r+m" file is read() not mmaped.

Have you written a test program that verifies (presumably via
monitoring via 'strace') how 'm' changes the behaviour of stdio
with respect to the use of mmap()?

Cheers,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 

Want to help with man page maintenance?  
Grab the latest tarball at
ftp://ftp.win.tue.nl/pub/linux-local/manpages/, 
read the HOWTOHELP file and grep the source 
files for 'FIXME'.



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #25 received at 365754@bugs.debian.org (full text, mbox):

From: Justin Pryzby <justinpryzby@users.sourceforge.net>
To: Michael Kerrisk <mtk-manpages@gmx.net>
Cc: 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Thu, 4 May 2006 15:03:44 -0400
On Thu, May 04, 2006 at 08:30:53PM +0200, Michael Kerrisk wrote:
> Justin,
> 
> > > To your patch:
> > > 
> > > >  fopen, fdopen, freopen \- stream open functions
> > > 
> > > Did you check whether you text is true of all three of these 
> > > functions?
> > Yup, I just checked.
> > 
> > > > +.TP
> > > > +.B m
> > > > +Attempts to access the file using \fBmmap()\fP rather than
> > > > +\fBread()\fP and \fBwrite()\fP.
> > > 
> > > How did you deduce "write()"?  My reading is that mmap() is only used
> > > if the file is opened for reading.
> > This seems to be true, as indicated in the comments.  I hadn't
> > followed the code well enough to be sure, though, and it is slightly
> > strange that it defers the mmap decision until the first read..
> > 
> > I just wrote a test case for "r+m", which seems to indicate that you
> > are correct; an "r+m" file is read() not mmaped.
> 
> Have you written a test program that verifies (presumably via
> monitoring via 'strace') how 'm' changes the behaviour of stdio
> with respect to the use of mmap()?
Erm, yes, thats what I'm talking about (and is strace exactly what I
did).  But I'm not sure if I understand you .. I verified that all 3
routines mmap() a file if "m" is given (and it is read-only), and do
not mmap() it if "m" is not given (or if it is not read-only).

I include now the test program :)

Justin

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <error.h>

int main()
{
#define	PATHNAME	"/tmp/fp.c"

	char buf[1<<10];
	int fd;
	FILE *fp;
	// if (-1==(fd=open(PATHNAME, O_RDONLY))) {
	// 	error(EXIT_FAILURE, errno, "open");
	// } 
	
	if (NULL==(fp=fopen(PATHNAME, "r+m"))) {
		error(EXIT_FAILURE, errno, "fdopen");
	}

	fread(buf, 1, sizeof(buf), fp);

	exit(EXIT_SUCCESS);
}



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to "Michael Kerrisk" <mtk-manpages@gmx.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #30 received at 365754@bugs.debian.org (full text, mbox):

From: "Michael Kerrisk" <mtk-manpages@gmx.net>
To: Justin Pryzby <justinpryzby@users.sourceforge.net>
Cc: 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Thu, 4 May 2006 21:48:09 +0200 (MEST)
> > > I just wrote a test case for "r+m", which seems to indicate that you
> > > are correct; an "r+m" file is read() not mmaped.
> > 
> > Have you written a test program that verifies (presumably via
> > monitoring via 'strace') how 'm' changes the behaviour of stdio
> > with respect to the use of mmap()?
> Erm, yes, thats what I'm talking about (and is strace exactly what I
> did).  But I'm not sure if I understand you .. I verified that all 3
> routines mmap() a file if "m" is given (and it is read-only), and do
> not mmap() it if "m" is not given (or if it is not read-only).
> 
> I include now the test program :)

Yes, but did you verify:

-- which file is being mmap()ed?  (There might be many other
   unrelated mmap() calls going on.)

-- whether the behaviour changes if 'm' is removed from the fopen()?
   (the strace output shd be different).

Cheers,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 

Want to help with man page maintenance?  
Grab the latest tarball at
ftp://ftp.win.tue.nl/pub/linux-local/manpages/, 
read the HOWTOHELP file and grep the source 
files for 'FIXME'.



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #35 received at 365754@bugs.debian.org (full text, mbox):

From: Justin Pryzby <justinpryzby@users.sourceforge.net>
To: Michael Kerrisk <mtk-manpages@gmx.net>, 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Thu, 4 May 2006 16:05:49 -0400
On Thu, May 04, 2006 at 09:48:09PM +0200, Michael Kerrisk wrote:
> > > > I just wrote a test case for "r+m", which seems to indicate that you
> > > > are correct; an "r+m" file is read() not mmaped.
> > > 
> > > Have you written a test program that verifies (presumably via
> > > monitoring via 'strace') how 'm' changes the behaviour of stdio
> > > with respect to the use of mmap()?
> > Erm, yes, thats what I'm talking about (and is strace exactly what I
> > did).  But I'm not sure if I understand you .. I verified that all 3
> > routines mmap() a file if "m" is given (and it is read-only), and do
> > not mmap() it if "m" is not given (or if it is not read-only).
> > 
> > I include now the test program :)
> 
> Yes, but did you verify:
> 
> -- which file is being mmap()ed?  (There might be many other
>    unrelated mmap() calls going on.)
Yes; note that it only happens after you fread() for the first time.

> -- whether the behaviour changes if 'm' is removed from the fopen()?
>    (the strace output shd be different).
Yes:
> > routines mmap() a file if "m" is given (and it is read-only), and do
> > not mmap() it if "m" is not given (or if it is not read-only).

Justin



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to "Michael Kerrisk" <mtk-manpages@gmx.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #40 received at 365754@bugs.debian.org (full text, mbox):

From: "Michael Kerrisk" <mtk-manpages@gmx.net>
To: Justin Pryzby <justinpryzby@users.sourceforge.net>
Cc: 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Thu, 4 May 2006 22:14:20 +0200 (MEST)
> > > > > are correct; an "r+m" file is read() not mmaped.
> > > > 
> > > > Have you written a test program that verifies (presumably via
> > > > monitoring via 'strace') how 'm' changes the behaviour of stdio
> > > > with respect to the use of mmap()?
> > > Erm, yes, thats what I'm talking about (and is strace exactly what I
> > > did).  But I'm not sure if I understand you .. I verified that all 3
> > > routines mmap() a file if "m" is given (and it is read-only), and do
> > > not mmap() it if "m" is not given (or if it is not read-only).
> > > 
> > > I include now the test program :)
> > 
> > Yes, but did you verify:
> > 
> > -- which file is being mmap()ed?  (There might be many other
> >    unrelated mmap() calls going on.)
> Yes; note that it only happens after you fread() for the first time.
> 
> > -- whether the behaviour changes if 'm' is removed from the fopen()?
> >    (the strace output shd be different).
> Yes:
> > > routines mmap() a file if "m" is given (and it is read-only), and do
> > > not mmap() it if "m" is not given (or if it is not read-only).

Hmmm -- I'm not seeing this.  Can you post for each of the two 
test cases:

-- the fopen() call that is used.

-- the command line that is used to run the program.

-- the results of grep the strace output using:

        egrep '(mmap|open|read)'

Thanks,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 

Want to help with man page maintenance?  
Grab the latest tarball at
ftp://ftp.win.tue.nl/pub/linux-local/manpages/, 
read the HOWTOHELP file and grep the source 
files for 'FIXME'.



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #45 received at 365754@bugs.debian.org (full text, mbox):

From: Justin Pryzby <justinpryzby@users.sourceforge.net>
To: Michael Kerrisk <mtk-manpages@gmx.net>, 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Fri, 5 May 2006 08:20:20 -0400
On Thu, May 04, 2006 at 10:14:20PM +0200, Michael Kerrisk wrote:
> > > > > > are correct; an "r+m" file is read() not mmaped.
> > > > > 
> > > > > Have you written a test program that verifies (presumably via
> > > > > monitoring via 'strace') how 'm' changes the behaviour of stdio
> > > > > with respect to the use of mmap()?
> > > > Erm, yes, thats what I'm talking about (and is strace exactly what I
> > > > did).  But I'm not sure if I understand you .. I verified that all 3
> > > > routines mmap() a file if "m" is given (and it is read-only), and do
> > > > not mmap() it if "m" is not given (or if it is not read-only).
> > > > 
> > > > I include now the test program :)
> > > 
> > > Yes, but did you verify:
> > > 
> > > -- which file is being mmap()ed?  (There might be many other
> > >    unrelated mmap() calls going on.)
> > Yes; note that it only happens after you fread() for the first time.
> > 
> > > -- whether the behaviour changes if 'm' is removed from the fopen()?
> > >    (the strace output shd be different).
> > Yes:
> > > > routines mmap() a file if "m" is given (and it is read-only), and do
> > > > not mmap() it if "m" is not given (or if it is not read-only).
> 
> Hmmm -- I'm not seeing this.  Can you post for each of the two 
> test cases:
> 
> -- the fopen() call that is used.
> 
> -- the command line that is used to run the program.
> 
> -- the results of grep the strace output using:
> 
>         egrep '(mmap|open|read)'
Sure, (using strace -e mmap2,open,read instead):

fopen "r":
|...
|open("/tmp/fp.c", O_RDONLY)             = 3
|mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f3a000
|read(3, "#include <sys/types.h>\n#include "..., 4096) = 460
|read(3, "", 4096)                       = 0

fopen "r+m":
|...
|open("/tmp/fp.c", O_RDWR)               = 3
|mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f8e000
|read(3, "#include <sys/types.h>\n#include "..., 4096) = 462
|read(3, "", 4096)                       = 0

fopen "rm":
|...
|open("/tmp/fp.c", O_RDONLY)             = 3
|mmap2(NULL, 461, PROT_READ, MAP_SHARED, 3, 0) = 0xb7f1c000

fdopen "rm":
|...
|open("/tmp/fp.c", O_RDONLY)             = 3
|mmap2(NULL, 447, PROT_READ, MAP_SHARED, 3, 0) = 0xb7fc3000

fdopen "r+m":
|...
|open("/tmp/fp.c", O_RDONLY)             = 3
|mmap2(NULL, 447, PROT_READ, MAP_SHARED, 3, 0) = 0xb7fc3000

fdopen "r":
|...
|open("/tmp/fp.c", O_RDWR)               = 3
|mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f06000
|read(3, "#include <sys/types.h>\n#include "..., 4096) = 444
|read(3, "", 4096)                       = 0

freopen "r":
|...
|open("/tmp/fp.c", O_RDONLY)             = 2
|mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f0f000
|read(2, "#include <sys/types.h>\n#include "..., 4096) = 466
|read(2, "", 4096)                       = 0

freopen "r+":
|...
|open("/tmp/fp.c", O_RDWR)               = 2
|mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fc1000
|read(2, "#include <sys/types.h>\n#include "..., 4096) = 468
|read(2, "", 4096)                       = 0

freopen "r+":
|...
|open("/tmp/fp.c", O_RDONLY)             = 2
|mmap2(NULL, 467, PROT_READ, MAP_SHARED, 2, 0) = 0xb7f20000

If it matters:
Linux andromeda 2.6.15-1-686 #2 Mon Mar 6 15:27:08 UTC 2006 i686 GNU/Linux

GNU C Library stable release version 2.3.6, by Roland McGrath et al.
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.0.3 (Debian 4.0.3-1).
Compiled on a Linux 2.6.13 system on 2006-04-14.
Available extensions:
	GNU libio by Per Bothner
	crypt add-on version 2.1 by Michael Glad and others
	GNU Libidn by Simon Josefsson
	linuxthreads-0.10 by Xavier Leroy
	BIND-8.2.3-T5B
	libthread_db work sponsored by Alpha Processor Inc
	NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Thread-local storage support included.
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

This seems to have been newly-implemented in glibc 2.3 (from the NEWS
file).

Justin



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to "Michael Kerrisk" <mtk-manpages@gmx.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #50 received at 365754@bugs.debian.org (full text, mbox):

From: "Michael Kerrisk" <mtk-manpages@gmx.net>
To: Justin Pryzby <justinpryzby@users.sourceforge.net>
Cc: 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Fri, 5 May 2006 23:08:31 +0200 (MEST)
> > Hmmm -- I'm not seeing this.  Can you post for each of the two 
> > test cases:
> > 
> > -- the fopen() call that is used.
> > 
> > -- the command line that is used to run the program.
> > 
> > -- the results of grep the strace output using:
> > 
> >         egrep '(mmap|open|read)'
> Sure, (using strace -e mmap2,open,read instead):
> 
> fopen "r":
> |...
> |open("/tmp/fp.c", O_RDONLY)             = 3
> |mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
> = 0xb7f3a000
> |read(3, "#include <sys/types.h>\n#include "..., 4096) = 460
> |read(3, "", 4096)                       = 0
> 
> fopen "r+m":
> |...
> |open("/tmp/fp.c", O_RDWR)               = 3
> |mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
> = 0xb7f8e000
> |read(3, "#include <sys/types.h>\n#include "..., 4096) = 462
> |read(3, "", 4096)                       = 0
> 
> fopen "rm":
> |...
> |open("/tmp/fp.c", O_RDONLY)             = 3
> |mmap2(NULL, 461, PROT_READ, MAP_SHARED, 3, 0) = 0xb7f1c000

Okay -- that look good.  But it's strange, I'm not seeing the
same as you on SUSE 10.0, glibc 2.3.5.  Do you have another Linux
to hand to test?

Cheers,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 

Want to help with man page maintenance?  
Grab the latest tarball at
ftp://ftp.win.tue.nl/pub/linux-local/manpages/, 
read the HOWTOHELP file and grep the source 
files for 'FIXME'.



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #55 received at 365754@bugs.debian.org (full text, mbox):

From: Justin Pryzby <justinpryzby@users.sourceforge.net>
To: Michael Kerrisk <mtk-manpages@gmx.net>, 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Mon, 8 May 2006 08:30:52 -0400
On Fri, May 05, 2006 at 11:08:31PM +0200, Michael Kerrisk wrote:
> > > Hmmm -- I'm not seeing this.  Can you post for each of the two 
> > > test cases:
> > > 
> > > -- the fopen() call that is used.
> > > 
> > > -- the command line that is used to run the program.
> > > 
> > > -- the results of grep the strace output using:
> > > 
> > >         egrep '(mmap|open|read)'
> > Sure, (using strace -e mmap2,open,read instead):
> > 
> > fopen "r":
> > |...
> > |open("/tmp/fp.c", O_RDONLY)             = 3
> > |mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
> > = 0xb7f3a000
> > |read(3, "#include <sys/types.h>\n#include "..., 4096) = 460
> > |read(3, "", 4096)                       = 0
> > 
> > fopen "r+m":
> > |...
> > |open("/tmp/fp.c", O_RDWR)               = 3
> > |mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
> > = 0xb7f8e000
> > |read(3, "#include <sys/types.h>\n#include "..., 4096) = 462
> > |read(3, "", 4096)                       = 0
> > 
> > fopen "rm":
> > |...
> > |open("/tmp/fp.c", O_RDONLY)             = 3
> > |mmap2(NULL, 461, PROT_READ, MAP_SHARED, 3, 0) = 0xb7f1c000
> 
> Okay -- that look good.  But it's strange, I'm not seeing the
> same as you on SUSE 10.0, glibc 2.3.5.  Do you have another Linux
> to hand to test?
I just tested on another Debian machine with the same results for
fopen "rm".

But another machine did only an anonymous mmap:

  2.6.12-1-amd64-k8-smp
  glibc 2.3.6

I note the following differences:
Native POSIX Threads Library by Ulrich Drepper et al	and
libthread_db work sponsored by Alpha Processor Inc
	
	vs.

linuxthreads-0.10 by Xavier Leroy (on kobun64).

On a 32 bit radhat machine, the same thing; this time, linuxthreads
and libthread_db.  Linux 2.4.22-1.2199.nptl and glibc 2.3.3.

Alan didn't have strace installed on a different redhat machine, so I
copied mine, and again it didn't mmap the file.  Again, linuxthreads
and libthread_db.  glibc 2.3.3, and Linux 2.6.10-1.771_FC2.

I note that this functionality requires the compile-time conditional
_G_HAVE_MMAP.

Justin



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to "Michael Kerrisk" <mtk-manpages@gmx.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #60 received at 365754@bugs.debian.org (full text, mbox):

From: "Michael Kerrisk" <mtk-manpages@gmx.net>
To: Justin Pryzby <justinpryzby@users.sourceforge.net>
Cc: 365754@bugs.debian.org,control@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Mon, 8 May 2006 22:26:15 +0200 (MEST)
tags 365754 fixed-upstream
thanks

Hello Justin,

[...]

> > Okay -- that look good.  But it's strange, I'm not seeing the
> > same as you on SUSE 10.0, glibc 2.3.5.  Do you have another Linux
> > to hand to test?
> I just tested on another Debian machine with the same results for
> fopen "rm".
> 
> But another machine did only an anonymous mmap:
> 
>   2.6.12-1-amd64-k8-smp
>   glibc 2.3.6
> 
> I note the following differences:
> Native POSIX Threads Library by Ulrich Drepper et al	and
> libthread_db work sponsored by Alpha Processor Inc
> 	
> 	vs.
> 
> linuxthreads-0.10 by Xavier Leroy (on kobun64).
> 
> On a 32 bit radhat machine, the same thing; this time, linuxthreads
> and libthread_db.  Linux 2.4.22-1.2199.nptl and glibc 2.3.3.
> 
> Alan didn't have strace installed on a different redhat machine, so I
> copied mine, and again it didn't mmap the file.  Again, linuxthreads
> and libthread_db.  glibc 2.3.3, and Linux 2.6.10-1.771_FC2.
> 
> I note that this functionality requires the compile-time conditional
> _G_HAVE_MMAP.

Hmmm -- it is all a bit strange.  There are some other factors
going on that aren't obvious.  Anyway, I've added the following
text for man-pages-2.32:

       m (since glibc 2.3)
              Attempt  to  access  the  file  using  mmap(2),
              rather   than   I/O   system   calls  (read(2),
              write(2)).  Currently, use of mmap(2)  is  only
              attempted for a file opened for reading.

Thanks for you report and all the testing.

Cheers,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 

Want to help with man page maintenance?  
Grab the latest tarball at
ftp://ftp.win.tue.nl/pub/linux-local/manpages/, 
read the HOWTOHELP file and grep the source 
files for 'FIXME'.



Tags added: fixed-upstream Request was from "Michael Kerrisk" <mtk-manpages@gmx.net> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #67 received at 365754@bugs.debian.org (full text, mbox):

From: Justin Pryzby <justinpryzby@users.sourceforge.net>
To: Michael Kerrisk <mtk-manpages@gmx.net>, 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Tue, 9 May 2006 08:31:43 -0400
On Mon, May 08, 2006 at 10:26:15PM +0200, Michael Kerrisk wrote:
> tags 365754 fixed-upstream
> thanks
> 
> Hello Justin,
> 
> [...]
> 
> > > Okay -- that look good.  But it's strange, I'm not seeing the
> > > same as you on SUSE 10.0, glibc 2.3.5.  Do you have another Linux
> > > to hand to test?
> > I just tested on another Debian machine with the same results for
> > fopen "rm".
> > 
> > But another machine did only an anonymous mmap:
> > 
> >   2.6.12-1-amd64-k8-smp
> >   glibc 2.3.6
> > 
> > I note the following differences:
> > Native POSIX Threads Library by Ulrich Drepper et al	and
> > libthread_db work sponsored by Alpha Processor Inc
> > 	
> > 	vs.
> > 
> > linuxthreads-0.10 by Xavier Leroy (on kobun64).
> > 
> > On a 32 bit radhat machine, the same thing; this time, linuxthreads
> > and libthread_db.  Linux 2.4.22-1.2199.nptl and glibc 2.3.3.
> > 
> > Alan didn't have strace installed on a different redhat machine, so I
> > copied mine, and again it didn't mmap the file.  Again, linuxthreads
> > and libthread_db.  glibc 2.3.3, and Linux 2.6.10-1.771_FC2.
> > 
> > I note that this functionality requires the compile-time conditional
> > _G_HAVE_MMAP.
> 
> Hmmm -- it is all a bit strange.  There are some other factors
> going on that aren't obvious.  Anyway, I've added the following
> text for man-pages-2.32:
> 
>        m (since glibc 2.3)
>               Attempt  to  access  the  file  using  mmap(2),
>               rather   than   I/O   system   calls  (read(2),
>               write(2)).  Currently, use of mmap(2)  is  only
>               attempted for a file opened for reading.
> 
> Thanks for you report and all the testing.
It occurs to me that this could be a part of the Debian patch; either
something not yet included upstream, or included in a release later
than glibc 2.3, but with the patch included by Debian anyway.

Google didn't reveal too much, and there's nothing in the .diff.gz
indicating that this is true .. I donno.

Justin



Information forwarded to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#365754; Package manpages-dev. Full text and rfc822 format available.

Acknowledgement sent to "Michael Kerrisk" <mtk-manpages@gmx.net>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>. Full text and rfc822 format available.

Message #72 received at 365754@bugs.debian.org (full text, mbox):

From: "Michael Kerrisk" <mtk-manpages@gmx.net>
To: Justin Pryzby <justinpryzby@users.sourceforge.net>
Cc: 365754@bugs.debian.org
Subject: Re: Bug#365754: manpages-dev: Please document fopen mmap mode 'm'
Date: Tue, 9 May 2006 22:12:31 +0200 (MEST)
Hello Justin,

> > Hmmm -- it is all a bit strange.  There are some other factors
> > going on that aren't obvious.  Anyway, I've added the following
> > text for man-pages-2.32:
> > 
> >        m (since glibc 2.3)
> >               Attempt  to  access  the  file  using  mmap(2),
> >               rather   than   I/O   system   calls  (read(2),
> >               write(2)).  Currently, use of mmap(2)  is  only
> >               attempted for a file opened for reading.
> > 
> > Thanks for you report and all the testing.
> It occurs to me that this could be a part of the Debian patch; either
> something not yet included upstream, or included in a release later
> than glibc 2.3, but with the patch included by Debian anyway.
> 
> Google didn't reveal too much, and there's nothing in the .diff.gz
> indicating that this is true .. I donno.

It doesn't seem Debian specific -- I mean that I can see the 
relevant code for 'm' in a vanilla glibc tree.  Oh well.

Cheers,

Michael

-- 
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 

Want to help with man page maintenance?  
Grab the latest tarball at
ftp://ftp.win.tue.nl/pub/linux-local/manpages/, 
read the HOWTOHELP file and grep the source 
files for 'FIXME'.



Reply sent to Martin Schulze <joey@infodrom.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Justin Pryzby <justinpryzby@users.sourceforge.net>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #77 received at 365754-close@bugs.debian.org (full text, mbox):

From: Martin Schulze <joey@infodrom.org>
To: 365754-close@bugs.debian.org
Subject: Bug#365754: fixed in manpages 2.32-1
Date: Sat, 03 Jun 2006 01:47:07 -0700
Source: manpages
Source-Version: 2.32-1

We believe that the bug you reported is fixed in the latest version of
manpages, which is due to be installed in the Debian FTP archive:

manpages-dev_2.32-1_all.deb
  to pool/main/m/manpages/manpages-dev_2.32-1_all.deb
manpages_2.32-1.diff.gz
  to pool/main/m/manpages/manpages_2.32-1.diff.gz
manpages_2.32-1.dsc
  to pool/main/m/manpages/manpages_2.32-1.dsc
manpages_2.32-1_all.deb
  to pool/main/m/manpages/manpages_2.32-1_all.deb
manpages_2.32.orig.tar.gz
  to pool/main/m/manpages/manpages_2.32.orig.tar.gz



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 365754@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Martin Schulze <joey@infodrom.org> (supplier of updated manpages package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Sat,  3 Jun 2006 10:27:59 +0200
Source: manpages
Binary: manpages manpages-dev
Architecture: source all
Version: 2.32-1
Distribution: unstable
Urgency: low
Maintainer: Martin Schulze <joey@debian.org>
Changed-By: Martin Schulze <joey@infodrom.org>
Description: 
 manpages   - Manual pages about using a GNU/Linux system
 manpages-dev - Manual pages about using GNU/Linux for development
Closes: 365754
Changes: 
 manpages (2.32-1) unstable; urgency=low
 .
   * New upstream release
     . Document 'm' (mmap) flag in fopen(3) (closes: Bug#365754)
Files: 
 dc158eee49b21cad7233d6a89cb2e6b2 584 doc - manpages_2.32-1.dsc
 7f28a493fe17931f3734e436a7a4faab 1167595 doc - manpages_2.32.orig.tar.gz
 1e29efbc8b833296140b0d8fb938ad41 51060 doc - manpages_2.32-1.diff.gz
 c6afbfd5c66eaa7356f023302e4efeb5 471116 doc important manpages_2.32-1_all.deb
 d9d43681f5310bdfb5028fc8ef8951fd 1200918 doc standard manpages-dev_2.32-1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEgUqmW5ql+IAeqTIRAoefAJwMbEl2BWrlT3IXTKqEiHcFFIXh4QCeOh8R
H6OlihuDHu5+fQMyd3yTQX8=
=1KKT
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 25 Jun 2007 22:16:34 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Apr 20 00:42:43 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.