r1754 - trunk/varnish-cache/bin/varnishreplay

des at projects.linpro.no des at projects.linpro.no
Tue Jul 24 16:25:54 CEST 2007


Author: des
Date: 2007-07-24 16:25:54 +0200 (Tue, 24 Jul 2007)
New Revision: 1754

Modified:
   trunk/varnish-cache/bin/varnishreplay/varnishreplay.c
Log:
Instead of incorrectly assuming that a pthread_t can be meaningfully cast
to an unsigned int (which triggered warnings on some 64-bit platforms) and
printed with %08lx, incorrectly assume that it can be meaningfully cast to
a void * and printed with %p.  While still incorrect in general terms, the
latter turns out to be correct on the specific systems that we care about.


Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c
===================================================================
--- trunk/varnish-cache/bin/varnishreplay/varnishreplay.c	2007-07-24 14:10:28 UTC (rev 1753)
+++ trunk/varnish-cache/bin/varnishreplay/varnishreplay.c	2007-07-24 14:25:54 UTC (rev 1754)
@@ -145,7 +145,7 @@
 	if (lvl > debug)
 		return;
 	pthread_mutex_lock(&log_mutex);
-	fprintf(stderr, "%08x ", (unsigned int)pthread_self());
+	fprintf(stderr, "%p ", (void *)pthread_self());
 	va_start(ap, fmt);
 	vfprintf(stderr, fmt, ap);
 	va_end(ap);
@@ -183,8 +183,8 @@
 			mailbox_destroy(&threads[fd]->mbox);
 			freez(threads[fd]);
 		}
-		thread_log(1, "thread %08x started\n",
-		    (unsigned int)threads[fd]->thread_id);
+		thread_log(1, "thread %p started\n",
+		    (void *)threads[fd]->thread_id);
 	}
 	return (threads[fd]);
 }
@@ -204,8 +204,8 @@
 		return;
 	mailbox_close(&threads[fd]->mbox);
 	pthread_join(threads[fd]->thread_id, NULL);
-	thread_log(1, "thread %08x stopped\n",
-	    (unsigned int)threads[fd]->thread_id);
+	thread_log(1, "thread %p stopped\n",
+	    (void *)threads[fd]->thread_id);
 	mailbox_destroy(&threads[fd]->mbox);
 	freez(threads[fd]);
 }




More information about the varnish-commit mailing list