From owner-svn-src-projects@FreeBSD.ORG Sat Dec 15 14:45:33 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E81B949B; Sat, 15 Dec 2012 14:45:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B427A8FC13; Sat, 15 Dec 2012 14:45:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBFEjX76079911; Sat, 15 Dec 2012 14:45:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBFEjXSZ079909; Sat, 15 Dec 2012 14:45:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201212151445.qBFEjXSZ079909@svn.freebsd.org> From: Alexander Motin Date: Sat, 15 Dec 2012 14:45:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r244264 - in projects/calloutng/sys: kern sys X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Dec 2012 14:45:34 -0000 Author: mav Date: Sat Dec 15 14:45:32 2012 New Revision: 244264 URL: http://svnweb.freebsd.org/changeset/base/244264 Log: Add several functions for KPI completeness. Modified: projects/calloutng/sys/kern/kern_synch.c projects/calloutng/sys/sys/systm.h Modified: projects/calloutng/sys/kern/kern_synch.c ============================================================================== --- projects/calloutng/sys/kern/kern_synch.c Sat Dec 15 14:36:41 2012 (r244263) +++ projects/calloutng/sys/kern/kern_synch.c Sat Dec 15 14:45:32 2012 (r244264) @@ -352,8 +352,11 @@ msleep_spin_flags(void *ident, struct mt * to a "timo" value of one. */ int -pause(const char *wmesg, int timo) +_pause(const char *wmesg, int timo, struct bintime *bt, struct bintime *pr, + int flags) { + struct bintime now, bt2; + KASSERT(timo >= 0, ("pause: timo must be >= 0")); /* silently convert invalid timeouts */ @@ -361,6 +364,12 @@ pause(const char *wmesg, int timo) timo = 1; if (cold) { + if (bt != NULL) { + binuptime(&now); + bt2 = *bt; + bintime_sub(&bt2, &now); + timo = bt2.sec * hz + ((bt2.frac >> 32) * hz >> 32); + } /* * We delay one HZ at a time to avoid overflowing the * system specific DELAY() function(s): @@ -373,7 +382,7 @@ pause(const char *wmesg, int timo) DELAY(timo * tick); return (0); } - return (tsleep(&pause_wchan, 0, wmesg, timo)); + return (_sleep(&pause_wchan, NULL, 0, wmesg, timo, bt, pr, flags)); } /* Modified: projects/calloutng/sys/sys/systm.h ============================================================================== --- projects/calloutng/sys/sys/systm.h Sat Dec 15 14:36:41 2012 (r244263) +++ projects/calloutng/sys/sys/systm.h Sat Dec 15 14:45:32 2012 (r244264) @@ -360,9 +360,18 @@ int msleep_spin_flags(void *chan, struct int timo, int flags) __nonnull(1); #define msleep_spin(chan, mtx, wmesg, timo) \ msleep_spin_flags((chan), (mtx), (wmesg), (timo), 0) -int pause(const char *wmesg, int timo); +int _pause(const char *wmesg, int timo, struct bintime *bt, + struct bintime *pr, int flags); +#define pause(wmesg, timo) \ + _pause((wmesg), (timo), NULL, NULL, 0) +#define pause_flags(wmesg, timo, flags) \ + _pause((wmesg), (timo), NULL, NULL, (flags)) +#define pause_bt(wmesg, bt, pr) \ + _pause((wmesg), 0, (bt), (pr), 0) #define tsleep(chan, pri, wmesg, timo) \ _sleep((chan), NULL, (pri), (wmesg), (timo), NULL, NULL, 0) +#define tsleep_flags(chan, pri, wmesg, timo, flags) \ + _sleep((chan), NULL, (pri), (wmesg), (timo), NULL, NULL, (flags)) #define tsleep_bt(chan, pri, wmesg, bt, pr) \ _sleep((chan), NULL, (pri), (wmesg), 0, (bt), (pr), 0) void wakeup(void *chan) __nonnull(1);