|
Boost Users : |
Subject: Re: [Boost-users] [interprocess] file_mapping/mapped_region on empty file throws?
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2010-11-29 13:53:39
On 29/11/2010 19:05, Jeff Flinn wrote:
> The following appears to throw an interprocess_exception with
> boost_1_44_0 compiled with MSVC8 running on windows XP.
>
> using namespace boost::interprocess;
>
> file_mapping fm("empty.txt", read_only);
> mapped_region mr( fm, read_only);
>
> Is there a reason I can't just get back a null address and zero size?
It's common practice not to support empty mappings. Windows mapped files
don't support an empty file. In Unix, mapping zero bytes is an error:
http://www.opengroup.org/onlinepubs/009695399/functions/mmap.html
"If len is zero, mmap() shall fail and no mapping shall be established"
Ion
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net