From owner-p4-projects@FreeBSD.ORG Tue Apr 25 23:21:39 2006 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 78AB916A402; Tue, 25 Apr 2006 23:21:39 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3BF5B16A400 for ; Tue, 25 Apr 2006 23:21:39 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0842F43D45 for ; Tue, 25 Apr 2006 23:21:39 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3PNLcm4050252 for ; Tue, 25 Apr 2006 23:21:38 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3PNLcin050246 for perforce@freebsd.org; Tue, 25 Apr 2006 23:21:38 GMT (envelope-from jb@freebsd.org) Date: Tue, 25 Apr 2006 23:21:38 GMT Message-Id: <200604252321.k3PNLcin050246@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 96117 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: Tue, 25 Apr 2006 23:21:39 -0000 http://perforce.freebsd.org/chv.cgi?CH=96117 Change 96117 by jb@jb_freebsd2 on 2006/04/25 23:20:46 We can just use some standards-complient code here. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_work.c#7 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_work.c#7 (text) ==== @@ -37,11 +37,9 @@ int dtslt_option; size_t dtslt_offs; } _dtrace_sleeptab[] = { -#if defined(sun) { DTRACEOPT_STATUSRATE, offsetof(dtrace_hdl_t, dt_laststatus) }, { DTRACEOPT_AGGRATE, offsetof(dtrace_hdl_t, dt_lastagg) }, { DTRACEOPT_SWITCHRATE, offsetof(dtrace_hdl_t, dt_lastswitch) }, -#endif { DTRACEOPT_MAX, 0 } }; @@ -75,9 +73,9 @@ earliest = *((hrtime_t *)a) + interval; } -printf("%s:%s(%d):\n",__FUNCTION__,__FILE__,__LINE__); (void) pthread_mutex_lock(&dph->dph_lock); +#if defined(sun) now = gethrtime(); if (earliest < now) { @@ -94,6 +92,22 @@ * awaken, iterate over any pending notifications and process them. */ (void) pthread_cond_reltimedwait_np(&dph->dph_cv, &dph->dph_lock, &tv); +#else + clock_gettime(CLOCK_REALTIME,&tv); + tv.tv_sec += earliest / NANOSEC; + tv.tv_nsec += earliest % NANOSEC; + while (tv.tv_nsec > NANOSEC) { + tv.tv_sec += 1; + tv.tv_nsec -= NANOSEC; + } + + /* + * Wait for either 'tv' nanoseconds to pass or to receive notification + * that a process is in an interesting state. Regardless of why we + * awaken, iterate over any pending notifications and process them. + */ + (void) pthread_cond_timedwait(&dph->dph_cv, &dph->dph_lock, &tv); +#endif while ((dprn = dph->dph_notify) != NULL) { if (dtp->dt_prochdlr != NULL) {