summaryrefslogtreecommitdiff
path: root/sys/kern/subr_mbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/subr_mbuf.c')
-rw-r--r--sys/kern/subr_mbuf.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/kern/subr_mbuf.c b/sys/kern/subr_mbuf.c
index 7906ab1bdda7..285d376f10b7 100644
--- a/sys/kern/subr_mbuf.c
+++ b/sys/kern/subr_mbuf.c
@@ -614,6 +614,21 @@ mb_alloc(struct mb_lstmngr *mb_list, int how, short type, short persist,
struct mb_bucket *bucket;
void *m;
+/* #ifdef INVARIANTS */
+ int flags;
+
+ flags = how & (M_WAITOK | M_NOWAIT | M_DONTWAIT | M_TRYWAIT);
+ if (flags != M_DONTWAIT && flags != M_TRYWAIT) {
+ static struct timeval lasterr;
+ static int curerr;
+ if (ppsratecheck(&lasterr, &curerr, 1)) {
+ printf("Bad mbuf alloc flags: %x\n", flags);
+ backtrace();
+ how = M_TRYWAIT;
+ }
+ }
+/* #endif */
+
m = NULL;
if ((persist & MBP_PERSISTENT) != 0) {
/*