Article View: news.software.nntp
Article #15738Re: patch for nnrpd 1.5.1 to mmap .overview files
From: Andrew A. Vasilyev
Date: Tue, 11 Mar 1997 00:00
Date: Tue, 11 Mar 1997 00:00
37 lines
2305 bytes
2305 bytes
In news.software.nntp Matt Dillon <dillon@flea.best.net> wrote:
MD> Warning warning will robinson!
Unfortunately I do not know such TV person or what he is -
but I believe that was a joke :)))
MD> Many operating systems do not allow you to mmap() a file beyond it's
MD> logical end-of-file. If the file size falls on a page boundry, and you
MD> try to mmap(..., size + 1, ...), many OS's will not allow it and mmap()
MD> will return an error.
MD> I believe FreeBSD and linux allow you to map beyond the EOF. IRIX
MD> most definitely does *NOT*, however. I don't know about SunOs.
Well, is is easy to check:
Under Solaris "
mmap() allows [_p_a, _p_a + _l_e_n) to extend beyond the end of the
object, both at the time of the mmap() and while the mapping
persists, such as when the file was created just before the
mmap() and has no contents, or if the file is truncated.
Any reference to addresses beyond the end of the object,
however, will result in the delivery of a SIGBUS signal. In
other words, mmap() cannot be used to implicitly extend the
length of files.
"
So it is safe to mmap() file_size+any_more, BUT one should not
read beyond the EOF, AND do not forget to unmmap mapped region.
MD> The insidiousness of the problem is that if the file's size does not
MD> fall on a page boundry, mmap() will often be successful, so many
MD> programmers do not spot the problem immediately.
_______
ANDY
Technical Details
Message-ID:
<5g3pgg$1nc$1@news.demos.su>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<331EE55D.1493@cwix.net> <5fmjjf$qcg$1@news1.xs4all.nl> <5fn38s$3q0$1@news1.xs4all.nl> <5fv1s9$8ki$1@news.demos.su> <slrn5i7kg8.4gs.coneill@blah.erols.com> <5g0pba$dot$1@news.demos.su> <5g1u60$q41@flea.best.net>Show Full Headers
Complete Article Headers
Message-ID: <5g3pgg$1nc$1@news.demos.su> Subject: Re: patch for nnrpd 1.5.1 to mmap .overview files Date: Tue, 11 Mar 1997 00:00:00 +0000 From: Andrew A. Vasilyev <andy@snm.demos.su> References: <331EE55D.1493@cwix.net> <5fmjjf$qcg$1@news1.xs4all.nl> <5fn38s$3q0$1@news1.xs4all.nl> <5fv1s9$8ki$1@news.demos.su> <slrn5i7kg8.4gs.coneill@blah.erols.com> <5g0pba$dot$1@news.demos.su> <5g1u60$q41@flea.best.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 224667419 Distribution: world Organization: Demos Online Service Newsgroups: news.software.nntp