[squid-dev] ftruncate() failures on OS X (Darwin)

Markus Mayer code at mmayer.net
Sat Jan 23 19:05:18 UTC 2016


On 23 January 2016 at 09:35, Alex Rousskov <rousskov at measurement-factory.com
> wrote:

> On 01/21/2016 08:03 PM, Markus Mayer wrote:
>
> > I left out the "flags" variable from the shm_open() call that you
> > showed, since I didn't see it being used or declared anywhere.
>
> Sorry about that leftover from a previous version of my sketch. You did
> the right thing.
>
>
> > I did test it, and it works "as advertised".
>
> Your patch is solving two problems at once. You have described only one,
> but the other problem[1] is arguably more severe because (a) it leads to
> subtle bugs and crashes rather than startup failures and (b) most people
> run Squid on OSes other than OS X.
>
> [1] Item #1 at
> http://lists.squid-cache.org/pipermail/squid-dev/2015-December/004112.html


Right. I completely forgot about that. I had most of the documentation
written up before I learned about the other problem.


> IMO, we should document both problems in the code to minimize our
> chances of repeating them during future refactoring. I suggest replacing
> this comment
>

Agreed.

```
> Why a brand new segment? Our placement-new code requires an all-0
> segment. We could truncate and resize an old segment, but OS X does not
> allow using O_TRUNC with shm_open() and does not support resizing after
> ftruncate(0).```
>

Maybe say "doesn't support resizing using a second ftruncate() call" or
something along those lines, since it doesn't support resizing of any kind,
not just after ftruncate(0). But I'm not going to insist on you rewording
the comment you have.

and perhaps renaming createExclusive() to createFresh() for clarity. The
> above can be done during commit -- no need to repost IMO.
>
> Your commit message will explain the details. I (or another committer)
> will add text to state that problem [1] is also fixed by this change.
>

No objections. Looks good to me.

Regards,
-Markus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20160123/a0112ad3/attachment.html>


More information about the squid-dev mailing list