Add MBTOM(), a macro that converts from an mbuf blocking disposition

flag (M_DONTWAIT / M_TRYWAIT) to a malloc(9) blocking disposition flag
(M_NOWAIT, M_WAITOK).  The semantic match isn't perfect, but for
scenarios where malloc data is used in the network stack, such as for
MAC labeling or for m_tags, we sometimes need to map from one to the
other to get the right blocking behavior.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
This commit is contained in:
Robert Watson 2003-03-26 20:29:15 +00:00
parent 03b920e1a8
commit c26adbe322

View File

@ -272,6 +272,7 @@ struct mbstat {
#define M_DONTWAIT 0x4 /* don't conflict with M_NOWAIT */
#define M_TRYWAIT 0x8 /* or M_WAITOK */
#define M_WAIT M_TRYWAIT /* XXX: Deprecated. */
#define MBTOM(how) ((how) == M_TRYWAIT ? M_WAITOK : M_NOWAIT)
#ifdef _KERNEL
/*-