Re: [PATCH v3 03/16] index-helper: new daemon for caching index and related stuff
- From
David Turner <dturner@twopensource.com>
- Date
- Apr 11, 2016, 23:27 UTC
- Message-ID
- <1460417232.5540.53.camel@twopensource.com>
- In-Reply-To
- <1460153784.5540.19.camel@twopensource.com>
On Fri, 2016-04-08 at 18:16 -0400, David Turner wrote:
Show 5 quoted lines
> And SHM on Macs works a bit differently than on Linux in at least two > irritating ways. > > So, uh, new version to come once I actually make it work on Mac. > Probably Monday.
I was chatting with a friend about this and he mentioned that SHM does not really fit well into the Unix "everything is a file" model. It lives in a separate namespace, and still requires most of the file-like operations just with funny names and a separate namespace: shm_open, shm_unlink. This weirdness is something I noticed in my porting work: on OS X, a shm name can only be 32 bytes long, requiring weird hacks. And on OSX, fstat on a shm fd is rounded up to the page size (!). There may also be other portability issues that I have not yet discovered.
Instead, my friend suggests that we should just use files. For instance, we could do $TMPDIR/$index_helper_pid/shm-index.$sha.
(I'm proposing $TMPDIR because it's cleaned up on reboot so we don't need any manual intervention or complicated gc schemes)
What do folks think of this?