[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mmap and raw disk devices...




I didn't know about ftruncate (does it lengthen files, as well as shorten
them?). In the master. I open the file O_CREAT|O_TRUNC|O_WRONLY
and loop to write zeroes to it to the desired length. Then I close it, and
reopen it O_RDWR, do the mmap call, and immediately close the file,
before doing any IO to the memory buffer. On the slave side, I open the
file O_RDONLY, do the mmap call, and immediately close the file, before
any IO. In both cases, I do an munmap as part of the shutdown
(atexit) procedure.

Larry

At 10:59 AM 11/07/2003 +0000, you wrote:
>Hi,
>
>On Thu, 2003-11-06 at 22:17, Lawrence Dickson wrote:
>
> > If I set the buffer size over about 10 MB (that's 20 MB total for
> > the double buffer, or 40 MB if you count each process's copy
> > as separate) I soon get an incomplete write, followed (when I
> > loop back to try writing the rest) by a  perror of "Bad address".
>
>"Bad address" (EFAULT) indicates that there's something wrong with the
>write address, typically that it's outside the range of the mmap()ed
>region.
>
> > If
> > instead of doing nothing I tried "memset" in the filler process, this
> > used to be "Bus error".
>
>SIGBUS normally indicates that you're accessing an area of an mmaped
>region beyond the end of the file.  Have you used "ftruncate" to extend
>the mmaped files to be large enough for the whole mmap region?
>
>--Stephen

--
Linux-mm-www:   http://linux-mm.org/ website maintenance list
Archive:        http://mail.nl.linux.org/linux-mm-www/
Development:    linux-mm@kvack.org