Skip to contentSkip to conversation

Logdirty debug cleanup

PATCH New Ben Guthro 1 participant 1 message Oct 24, 2007

lore
Share & tools
lore

Ben Guthro

author
#0 lore raw

PATCH 1/1 Logdirty debug cleanup

Restructure and add some debug messages around mapping the logdirty bitmap to make it clearer which operation is failing.

tools/ioemu/xenstore.c +14 -7
diff -r 34e634f6743d tools/ioemu/xenstore.c
@@ -296,14 +296,21 @@ void xenstore_process_logdirty_event(voi
         logdirty_bitmap_size *= sizeof (unsigned long); /* bytes */
 
         /* Map the shared-memory segment */
-        if ((shmid = shmget(key, 
-                            2 * logdirty_bitmap_size, 
-                            S_IRUSR|S_IWUSR)) == -1 
-            || (seg = shmat(shmid, NULL, 0)) == (void *)-1) {
-            fprintf(logfile, "Log-dirty: can't map segment %16.16llx (%s)\n",
+	fprintf(logfile, "%s: key=%16.16llx size=%d\n", __FUNCTION__,
+		(unsigned long long)key, logdirty_bitmap_size);
+        shmid = shmget(key, 2 * logdirty_bitmap_size, S_IRUSR|S_IWUSR);
+	if (shmid == -1) {
+            fprintf(logfile, "Log-dirty: shmget failed: segment %16.16llx (%s)\n",
                     (unsigned long long) key, strerror(errno));
-            exit(1);
-        }
+	    exit(1);
+	}
+
+	seg = shmat(shmid, NULL, 0);
+	if (seg == (void *)-1) {
+            fprintf(logfile, "Log-dirty: shmat failed: segment %16.16llx (%s)\n",
+                    (unsigned long long) key, strerror(errno));
+	    exit(1);
+	}
 
         fprintf(logfile, "Log-dirty: mapped segment at %p\n", seg);
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel