Date: Sat, 15 Dec 2012 14:45:33 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r244264 - in projects/calloutng/sys: kern sys Message-ID: <201212151445.qBFEjXSZ079909@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212151445.qBFEjXSZ079909>