summaryrefslogtreecommitdiff
path: root/gpsd.h
diff options
context:
space:
mode:
authorFred Wright <fw@fwright.net>2017-03-23 20:27:33 -0700
committerFred Wright <fw@fwright.net>2017-03-24 15:48:44 -0700
commit4ee196cd9c34f7a268118d4088392e392546fe42 (patch)
tree077adb566143d8a69436085a3f7b39f1726187f9 /gpsd.h
parent2bb3d4973597d3aa0f4376ce7191d09299f40cc0 (diff)
downloadgpsd-4ee196cd9c34f7a268118d4088392e392546fe42.tar.gz
Fixes broken 'GPSD' SHM export.
Commit 22c3faf added an IPC_RMID operation right after the shmat(), in order to keep the segment from lingering after gpsd exits. But this clears the key, making it impossible for a client to attach to the segment. This fix moves the IPC_RMID to shm_release(), so that it's not invoked until gpsd is done with the segment. This required saving the shmid in the gps_context structure. TESTED: On both OSX and Linux, used ipcs to verify that the segment is present with the correct ID while gpsd is running, and disappears after gpsd exits. Also verified that warning message for shmctl() appears when two gpsds conflict over the SHM segment.
Diffstat (limited to 'gpsd.h')
-rw-r--r--gpsd.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gpsd.h b/gpsd.h
index 50aa759a..a6e60ef5 100644
--- a/gpsd.h
+++ b/gpsd.h
@@ -281,6 +281,7 @@ struct gps_context_t {
/* we don't want the compiler to treat writes to shmexport as dead code,
* and we don't want them reordered either */
volatile void *shmexport;
+ int shmid; /* ID of SHM (for later IPC_RMID) */
#endif
ssize_t (*serial_write)(struct gps_device_t *,
const char *buf, const size_t len);