[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] SHM code
From: |
Eric S. Raymond |
Subject: |
Re: [gpsd-dev] SHM code |
Date: |
Sun, 15 Feb 2015 14:41:29 -0500 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hal Murray <address@hidden>:
> I don't see the use case for a segment-in-use flag. What do you have in mind?
>
> In use by gpsd? In use by ntpd?
In use by gpsd. If you look in the gps_device_t structure you'll see this:
volatile struct shmTime *shmTime[NTPSHMSEGS];
bool shmTimeInuse[NTPSHMSEGS];
Which is OK for our normal use case, but consider the case where the host
has multiple refclocks. They would all be trying to get segments, and it
would be handy if the "in_use" flag for each segment were in shared memory.
>Is the use-count from the SHM API good enough?
Probably not, the way we're presently doing allocation. Every instance of gpsd
grabs at least two segmants at startup that it thinks it might use, before
knowing whether there will be PPS devices attached. This is because segs 0 and
1
will not be attachable after prvilege dropping.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>