Subject: Re: [boost] [Interprocess] Possible bug in shared memory on FreeBSD 8.0
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-08-11 02:55:31
Manish Vachharajani escribió:
> I've been happily using Boost.Interprocess to create shared memory
> regions under FreeBSD 7.2, however, I am having issues on FreeBSD 8.0
> pre-release. I can reproduce the problem with Boost 1.39.0 and the
> svn trunk. The source of the problem appears to be that
> Boost.Interprocess calls lseek on a file descriptor returned by
> shm_open, but the results of such an lseek are undefined. Below, I
> explain further how I came to this conclusion.
You are right, it's undefined, but it usually works. However, I can't
find a way to obtain the size of a shared memory segment using POSIX, if
you could fin a way to do it it would be really nice.
> I've confirmed that FreeBSD 7.2 allowed such seeks but 8.0 does not by
> looking at the kernel source code. For what it's worth AIX 6.1 does
> not allow such seeks either (see
Interesting, maybe that's the reason this has not appeared sooner.
> Could someone advise me on what the correct fix for this bug is? I'd
> be glad to implement it, but I'm not sure what the right fix ought to
No idea at all, maybe the fix is particular to each system, maybe we
could open the segment as a normal file in the filesystem (if shared
memory is mounted somewhere, I don't know if that's the case) and try to
obtain its size. "ls" command displays the size, so there must be a why
to obtain the size of a segment.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk