summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf_compat.h
diff options
context:
space:
mode:
authorbmilekic <bmilekic@FreeBSD.org>2002-12-19 22:58:27 +0000
committerbmilekic <bmilekic@FreeBSD.org>2002-12-19 22:58:27 +0000
commit514c635ee6d3ff47b542ec91a037e7a241c1357c (patch)
treefb78678839efbdec9c58873ff5e7df1cf42aa7f5 /sys/net/bpf_compat.h
parent13bc2a4ca63803cb5287e5acd86ed9b2e3238689 (diff)
downloadFreeBSD-src-514c635ee6d3ff47b542ec91a037e7a241c1357c.zip
FreeBSD-src-514c635ee6d3ff47b542ec91a037e7a241c1357c.tar.gz
o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} and
the mbuf allocator flags {M_TRYWAIT, M_DONTWAIT}. o Fix a bpf_compat issue where malloc() was defined to just call bpf_alloc() and pass the 'canwait' flag(s) along. It's been changed to call bpf_alloc() but pass the corresponding M_TRYWAIT or M_DONTWAIT flag (and only one of those two). Submitted by: Hiten Pandya <hiten@unixdaemons.com> (hiten->commit_count++)
Diffstat (limited to 'sys/net/bpf_compat.h')
-rw-r--r--sys/net/bpf_compat.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/net/bpf_compat.h b/sys/net/bpf_compat.h
index cac9aff..212ac5f 100644
--- a/sys/net/bpf_compat.h
+++ b/sys/net/bpf_compat.h
@@ -40,14 +40,14 @@
/*
* Some hacks for compatibility across SunOS and 4.4BSD. We emulate malloc
* and free with mbuf clusters. We store a pointer to the mbuf in the first
- * word of the mbuf and return 8 bytes passed the start of data (for double
+ * word of the mbuf and return 8 bytes past the start of data (for double
* word alignment). We cannot just use offsets because clusters are not at
* a fixed offset from the associated mbuf. Sorry for this kludge.
*/
-#define malloc(size, type, canwait) bpf_alloc(size, canwait)
+#define malloc(size, type, canwait) \
+bpf_alloc(size, (canwait & M_NOWAIT) ? M_DONTWAIT : M_TRYWAIT)
+
#define free(cp, type) m_free(*(struct mbuf **)(cp - 8))
-#define M_WAITOK M_TRYWAIT
-#define M_NOWAIT M_DONTWAIT
/* This mapping works for our purposes. */
#define ERESTART EINTR
OpenPOWER on IntegriCloud