svn commit: r330349 - in head/sys: kern sys
Hans Petter Selasky
hselasky at FreeBSD.org
Sat Mar 3 18:36:39 UTC 2018
Author: hselasky
Date: Sat Mar 3 18:36:38 2018
New Revision: 330349
URL: https://svnweb.freebsd.org/changeset/base/330349
Log:
Allow pause_sbt() to catch signals during sleep by passing C_CATCH flag.
Define pause_sig() function macro helper similarly to other kernel functions
which catch signals. Update outdated function description.
Discussed with: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies
Modified:
head/sys/kern/kern_synch.c
head/sys/sys/callout.h
head/sys/sys/systm.h
Modified: head/sys/kern/kern_synch.c
==============================================================================
--- head/sys/kern/kern_synch.c Sat Mar 3 18:30:31 2018 (r330348)
+++ head/sys/kern/kern_synch.c Sat Mar 3 18:36:38 2018 (r330349)
@@ -297,16 +297,16 @@ msleep_spin_sbt(void *ident, struct mtx *mtx, const ch
}
/*
- * pause() delays the calling thread by the given number of system ticks.
- * During cold bootup, pause() uses the DELAY() function instead of
- * the tsleep() function to do the waiting. The "timo" argument must be
- * greater than or equal to zero. A "timo" value of zero is equivalent
- * to a "timo" value of one.
+ * pause_sbt() delays the calling thread by the given signed binary
+ * time. During cold bootup, pause_sbt() uses the DELAY() function
+ * instead of the _sleep() function to do the waiting. The "sbt"
+ * argument must be greater than or equal to zero. A "sbt" value of
+ * zero is equivalent to a "sbt" value of one tick.
*/
int
pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags)
{
- KASSERT(sbt >= 0, ("pause: timeout must be >= 0"));
+ KASSERT(sbt >= 0, ("pause_sbt: timeout must be >= 0"));
/* silently convert invalid timeouts */
if (sbt == 0)
@@ -328,7 +328,8 @@ pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_
DELAY(sbt);
return (EWOULDBLOCK);
}
- return (_sleep(&pause_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags));
+ return (_sleep(&pause_wchan[curcpu], NULL,
+ (flags & C_CATCH) ? PCATCH : 0, wmesg, sbt, pr, flags));
}
/*
Modified: head/sys/sys/callout.h
==============================================================================
--- head/sys/sys/callout.h Sat Mar 3 18:30:31 2018 (r330348)
+++ head/sys/sys/callout.h Sat Mar 3 18:36:38 2018 (r330349)
@@ -60,6 +60,7 @@
#define C_HARDCLOCK 0x0100 /* align to hardclock() calls */
#define C_ABSOLUTE 0x0200 /* event time is absolute. */
#define C_PRECALC 0x0400 /* event time is pre-calculated. */
+#define C_CATCH 0x0800 /* catch signals, used by pause_sbt(9) */
struct callout_handle {
struct callout *callout;
Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h Sat Mar 3 18:30:31 2018 (r330348)
+++ head/sys/sys/systm.h Sat Mar 3 18:36:38 2018 (r330349)
@@ -411,6 +411,8 @@ int pause_sbt(const char *wmesg, sbintime_t sbt, sbint
int flags);
#define pause(wmesg, timo) \
pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK)
+#define pause_sig(wmesg, timo) \
+ pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK | C_CATCH)
#define tsleep(chan, pri, wmesg, timo) \
_sleep((chan), NULL, (pri), (wmesg), tick_sbt * (timo), \
0, C_HARDCLOCK)
More information about the svn-src-all
mailing list