From e7e4ef68e8ee9e1f33493f0f57551dfadbbcde54 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 16 Feb 2015 05:47:58 -0500 Subject: Tweak instrumentation to find out why alternate export segment isn't being set. All regression tests pass. No logic changes. --- shmexport.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'shmexport.c') diff --git a/shmexport.c b/shmexport.c index 625f570a..229ad697 100644 --- a/shmexport.c +++ b/shmexport.c @@ -41,12 +41,17 @@ bool shm_acquire(struct gps_context_t *context) int shmid = shmget((key_t)shmkey, sizeof(struct gps_data_t), (int)(IPC_CREAT|0666)); if (shmid == -1) { gpsd_report(&context->errout, LOG_ERROR, - "shmget(%ld, %zd, 0666) failed: %s\n", - (long int)shmkey, + "shmget(%x, %zd, 0666) for SHM export failed: %s\n", + shmkey, sizeof(struct gps_data_t), strerror(errno)); return false; - } + } else + gpsd_report(&context->errout, LOG_PROG, + "shmget(%x, %zd, 0666) for SHM export succeeded\n", + shmkey, + sizeof(struct gps_data_t)); + context->shmexport = (void *)shmat(shmid, 0, 0); if ((int)(long)context->shmexport == -1) { gpsd_report(&context->errout, LOG_ERROR, "shmat failed: %s\n", strerror(errno)); @@ -54,7 +59,7 @@ bool shm_acquire(struct gps_context_t *context) return false; } gpsd_report(&context->errout, LOG_PROG, - "shmat() succeeded, segment %d\n", shmid); + "shmat() for SHM export succeeded, segment %d\n", shmid); return true; } -- cgit v1.2.1