diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-02-16 17:58:35 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-02-16 17:58:35 -0500 |
commit | b5bb030d74d3546f86877d674ad439947fcd7640 (patch) | |
tree | 8f1254860886d9b0507720294fde242545817f0b /ntpshm.c | |
parent | b4377c155f47514eeb045642ec22d2e42b1d85f8 (diff) | |
download | gpsd-b5bb030d74d3546f86877d674ad439947fcd7640.tar.gz |
Revert the ntpshm allocation change - go back to using an external bool array.
We're now back to no logic changes since code freeze. If SHM(1) still fails
as Gray reported on the dev list, something else is going on.
All regression tests pass.
Diffstat (limited to 'ntpshm.c')
-rw-r--r-- | ntpshm.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -91,9 +91,6 @@ struct shmTime * GPS will deliver data on segments 0 and 1, and as non-root data * will be delivered on segments 2 and 3. * - * We use dummy[0] as an in-use flag, so segments can be released and - * reallocated from holes in the sequence. - * * to debug, try looking at the live segments this way * * ipcs -m @@ -174,6 +171,7 @@ void ntpshm_context_init(struct gps_context_t *context) context->shmTime[i] = getShmTime(context, i); } } + memset(context->shmTimeInuse, 0, sizeof(context->shmTimeInuse)); } /*@-unqualifiedtrans@*/ @@ -183,8 +181,8 @@ static /*@null@*/ volatile struct shmTime *ntpshm_alloc(struct gps_context_t *co int i; for (i = 0; i < NTPSHMSEGS; i++) - if (context->shmTime[i] != NULL && context->shmTime[i]->dummy[0] == (int)false) { - context->shmTime[i]->dummy[0] = (int)true; + if (context->shmTime[i] != NULL && !context->shmTimeInuse[i]) { + context->shmTimeInuse[i] = true; /* * In case this segment gets sent to ntpd before an @@ -214,7 +212,7 @@ static bool ntpshm_free(struct gps_context_t * context, volatile struct shmTime for (i = 0; i < NTPSHMSEGS; i++) if (s == context->shmTime[i]) { - context->shmTime[i]->dummy[0] = (int)false; + context->shmTimeInuse[i] = false; return true; } |