From owner-p4-projects@FreeBSD.ORG Sat Jun 2 11:58:45 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8752716A46C; Sat, 2 Jun 2007 11:58:45 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4481716A400 for ; Sat, 2 Jun 2007 11:58:45 +0000 (UTC) (envelope-from fli@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 3457113C44C for ; Sat, 2 Jun 2007 11:58:45 +0000 (UTC) (envelope-from fli@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l52Bwjg0080992 for ; Sat, 2 Jun 2007 11:58:45 GMT (envelope-from fli@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l52Bwi3O080980 for perforce@freebsd.org; Sat, 2 Jun 2007 11:58:44 GMT (envelope-from fli@FreeBSD.org) Date: Sat, 2 Jun 2007 11:58:44 GMT Message-Id: <200706021158.l52Bwi3O080980@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to fli@FreeBSD.org using -f From: Fredrik Lindberg To: Perforce Change Reviews Cc: Subject: PERFORCE change 120768 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2007 11:58:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=120768 Change 120768 by fli@fli_genesis on 2007/06/02 11:58:24 Debugging and style fixes. Affected files ... .. //depot/projects/soc2007/fli-mdns_sd/mdnsd/log.c#2 edit .. //depot/projects/soc2007/fli-mdns_sd/mdnsd/wqueue.c#2 edit .. //depot/projects/soc2007/fli-mdns_sd/mdnsd/wqueue.h#2 edit Differences ... ==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/log.c#2 (text+ko) ==== @@ -24,17 +24,17 @@ * */ -#include -#include +#include + +#include #include #include #include -#include #include -#include #include #include "log.h" +#include "debug.h" static int _isdaemon = 0; static const char *_pname = NULL; ==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/wqueue.c#2 (text+ko) ==== @@ -24,19 +24,21 @@ * */ +#include +#include + +#include #include -#include +#include #include #include #ifdef HAVE_PTHREAD #include #endif -#include -#include -#include #include "wqueue.h" #include "log.h" +#include "debug.h" #ifdef HAVE_PTHREAD static void * wq_worker(void *); @@ -69,6 +71,8 @@ { struct wq_tag *wqt; + MDNS_INIT_ASSERT(wq, wq_magic); + if (TAILQ_EMPTY(&wq->wq_free)) { wqt = malloc(sizeof(struct wq_tag)); bzero(wqt, sizeof(struct wq_tag)); @@ -79,7 +83,7 @@ wqt = TAILQ_FIRST(&wq->wq_free); TAILQ_REMOVE(&wq->wq_free, wqt, wqt_list); } - + MDNS_INIT_SET(wqt, wqt_magic); wq->wq_tags_used++; dprintf(DEBUG_WQUEUE, "%d tags, used %d", wq->wq_tags, wq->wq_tags_used); return (wqt); @@ -99,7 +103,9 @@ { int i; + MDNS_INIT_ASSERT(wq, wq_magic); TAILQ_INSERT_HEAD(&wq->wq_free, wqt, wqt_list); + MDNS_INIT_UNSET(wqt, wqt_magic); /* * De-allocate job tags if we have a large share of unused tags @@ -146,6 +152,7 @@ wq->wq_workers_max = max; wq->wq_workers_min = min; + MDNS_INIT_SET(wq, wq_magic); return (wq); } @@ -161,6 +168,7 @@ { struct wq_tag *wqt; + MDNS_INIT_ASSERT(wq, wq_magic); WQ_LOCK(wq); wq->wq_flags |= WQ_FLAGS_DYING; @@ -197,6 +205,7 @@ pthread_cond_destroy(&wq->wq_cond); pthread_attr_destroy(&wq->wq_attr); #endif + MDNS_INIT_UNSET(wq, wq_magic); free(wq); } @@ -213,6 +222,7 @@ struct wq_thread *thr; struct wq_tag *wqt; + MDNS_INIT_ASSERT(wq, wq_magic); if (wq->wq_flags & WQ_FLAGS_DYING) return (-1); @@ -262,6 +272,7 @@ struct wq_thread *thr; int id; + MDNS_INIT_ASSERT(wq, wq_magic); thr = malloc(sizeof(struct wq_thread)); if (thr == NULL) return (NULL); @@ -318,7 +329,7 @@ int error; wq = wqthr->wqthr_wq; - + MDNS_INIT_ASSERT(wq, wq_magic); WQ_LOCK(wq); wq->wq_workers_idle++; for (;;) { ==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/wqueue.h#2 (text+ko) ==== @@ -33,6 +33,8 @@ #include #include +#include "debug.h" + struct wq_tag; struct wq_thread; @@ -40,6 +42,7 @@ * Thread work queue */ struct wqueue { + MAGIC(wq_magic); TAILQ_HEAD(, wq_tag) wq_queue; /* Job queue */ TAILQ_HEAD(, wq_tag) wq_free; /* Free job tags */ int wq_tags; /* Number of allocated tags */ @@ -73,6 +76,7 @@ */ typedef int (*wq_func)(const wq_arg); struct wq_tag { + MAGIC(wqt_magic); TAILQ_ENTRY(wq_tag) wqt_list; wq_func wqt_func; wq_arg wqt_func_arg;