diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-03-27 13:39:09 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-03-27 13:39:09 -0400 |
commit | 4eea65f0cd06ecd356fc371e707cda174537e616 (patch) | |
tree | a295b45bbf634a1ebe52ae6152920368fa327f4e /shmexport.c | |
parent | 8118ed642d8d2d046684d5ce596206698127dc4b (diff) | |
download | gpsd-4eea65f0cd06ecd356fc371e707cda174537e616.tar.gz |
Change return values in the shm interface to be more like socket export.
All regression tests pass. Code splints clean. shm live-testing works.
Diffstat (limited to 'shmexport.c')
-rw-r--r-- | shmexport.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/shmexport.c b/shmexport.c index 4d615abf..c79d4c08 100644 --- a/shmexport.c +++ b/shmexport.c @@ -63,6 +63,7 @@ void shm_update(struct gps_context_t *context, struct gps_data_t *gpsdata) if (context->shmexport != NULL) { static int tick; + struct shmexport_t *shared = (struct shmexport_t *)context->shmexport; ++tick; /* @@ -76,13 +77,14 @@ void shm_update(struct gps_context_t *context, struct gps_data_t *gpsdata) * start to write the segment during the read, the second bookend will * get clobbered first and the data can be detected as bad. */ - ((struct shmexport_t *)context->shmexport)->bookend2 = tick; + shared->bookend2 = tick; barrier(); memcpy((void *)(context->shmexport + offsetof(struct shmexport_t, gpsdata)), (void *)gpsdata, sizeof(struct gps_data_t)); + shared->gpsdata.gps_fd = -1; barrier(); - ((struct shmexport_t *)context->shmexport)->bookend1 = tick; + shared->bookend1 = tick; } } |