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
This commit is contained in:
parent
3292a8abac
commit
95ebcd3ae9
@ -297,16 +297,16 @@ msleep_spin_sbt(void *ident, struct mtx *mtx, const char *wmesg,
|
||||
}
|
||||
|
||||
/*
|
||||
* 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_t pr, int flags)
|
||||
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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
@ -411,6 +411,8 @@ int pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr,
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user