diff options
author | bmilekic <bmilekic@FreeBSD.org> | 2000-12-21 21:44:31 +0000 |
---|---|---|
committer | bmilekic <bmilekic@FreeBSD.org> | 2000-12-21 21:44:31 +0000 |
commit | 4b6a7bddad70a11b35893cc1825a768e53fb28c7 (patch) | |
tree | cb3615d12a5b91954bedb7d2b4481c994b02b3d6 /sys/net | |
parent | 37eea88efd33920c8d4ef7e41923db5d5eec76cf (diff) | |
download | FreeBSD-src-4b6a7bddad70a11b35893cc1825a768e53fb28c7.zip FreeBSD-src-4b6a7bddad70a11b35893cc1825a768e53fb28c7.tar.gz |
* Rename M_WAIT mbuf subsystem flag to M_TRYWAIT.
This is because calls with M_WAIT (now M_TRYWAIT) may not wait
forever when nothing is available for allocation, and may end up
returning NULL. Hopefully we now communicate more of the right thing
to developers and make it very clear that it's necessary to check whether
calls with M_(TRY)WAIT also resulted in a failed allocation.
M_TRYWAIT basically means "try harder, block if necessary, but don't
necessarily wait forever." The time spent blocking is tunable with
the kern.ipc.mbuf_wait sysctl.
M_WAIT is now deprecated but still defined for the next little while.
* Fix a typo in a comment in mbuf.h
* Fix some code that was actually passing the mbuf subsystem's M_WAIT to
malloc(). Made it pass M_WAITOK instead. If we were ever to redefine the
value of the M_WAIT flag, this could have became a big problem.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/bpf.c | 4 | ||||
-rw-r--r-- | sys/net/bpf_compat.h | 2 | ||||
-rw-r--r-- | sys/net/if_ef.c | 4 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 4 | ||||
-rw-r--r-- | sys/net/if_fddisubr.c | 2 | ||||
-rw-r--r-- | sys/net/if_gif.c | 2 | ||||
-rw-r--r-- | sys/net/if_sl.c | 4 | ||||
-rw-r--r-- | sys/net/if_stf.c | 2 | ||||
-rw-r--r-- | sys/net/ppp_tty.c | 2 |
9 files changed, 13 insertions, 13 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 12e375e..21eeff3 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -231,12 +231,12 @@ bpf_movein(uio, linktype, mp, sockp, datlen) if ((unsigned)len > MCLBYTES) return (EIO); - MGETHDR(m, M_WAIT, MT_DATA); + MGETHDR(m, M_TRYWAIT, MT_DATA); if (m == 0) return (ENOBUFS); if (len > MHLEN) { #if BSD >= 199103 - MCLGET(m, M_WAIT); + MCLGET(m, M_TRYWAIT); if ((m->m_flags & M_EXT) == 0) { #else MCLGET(m); diff --git a/sys/net/bpf_compat.h b/sys/net/bpf_compat.h index 0936b84..8ccaa23 100644 --- a/sys/net/bpf_compat.h +++ b/sys/net/bpf_compat.h @@ -46,7 +46,7 @@ */ #define malloc(size, type, canwait) bpf_alloc(size, canwait) #define free(cp, type) m_free(*(struct mbuf **)(cp - 8)) -#define M_WAITOK M_WAIT +#define M_WAITOK M_TRYWAIT /* This mapping works for our purposes. */ #define ERESTART EINTR diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c index 4554a29..f11fa70 100644 --- a/sys/net/if_ef.c +++ b/sys/net/if_ef.c @@ -439,7 +439,7 @@ ef_output(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst, short *tp, type = htons(m->m_pkthdr.len); break; case ETHER_FT_8022: - M_PREPEND(m, ETHER_HDR_LEN + 3, M_WAIT); + M_PREPEND(m, ETHER_HDR_LEN + 3, M_TRYWAIT); if (m == NULL) { *mp = NULL; return ENOBUFS; @@ -462,7 +462,7 @@ ef_output(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst, short *tp, *hlen += 3; break; case ETHER_FT_SNAP: - M_PREPEND(m, 8, M_WAIT); + M_PREPEND(m, 8, M_TRYWAIT); if (m == NULL) { *mp = NULL; return ENOBUFS; diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index cfca498..ebd4b37 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -221,7 +221,7 @@ ether_output(ifp, m, dst, rt0) if ( aa->aa_flags & AFA_PHASE2 ) { struct llc llc; - M_PREPEND(m, sizeof(struct llc), M_WAIT); + M_PREPEND(m, sizeof(struct llc), M_TRYWAIT); llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP; llc.llc_control = LLC_UI; bcopy(at_org_code, llc.llc_snap_org_code, sizeof(at_org_code)); @@ -246,7 +246,7 @@ ether_output(ifp, m, dst, rt0) type = htons( m->m_pkthdr.len); break; case 0xe0e0: /* Novell 802.2 and Token-Ring */ - M_PREPEND(m, 3, M_WAIT); + M_PREPEND(m, 3, M_TRYWAIT); type = htons( m->m_pkthdr.len); cp = mtod(m, u_char *); *cp++ = 0xE0; diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 186fec5..b93414a 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -213,7 +213,7 @@ fddi_output(ifp, m, dst, rt0) if (aa->aa_flags & AFA_PHASE2) { struct llc llc; - M_PREPEND(m, sizeof(struct llc), M_WAIT); + M_PREPEND(m, sizeof(struct llc), M_TRYWAIT); if (m == 0) senderr(ENOBUFS); llc.llc_dsap = llc.llc_ssap = LLC_SNAP_LSAP; diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 143f06f..f8af910 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -118,7 +118,7 @@ gifattach(dummy) register int i; ngif = NGIF; - gif = sc = malloc (ngif * sizeof(struct gif_softc), M_DEVBUF, M_WAIT); + gif = sc = malloc (ngif * sizeof(struct gif_softc), M_DEVBUF, M_WAITOK); bzero(sc, ngif * sizeof(struct gif_softc)); for (i = 0; i < ngif; sc++, i++) { sc->gif_if.if_name = "gif"; diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index f7bc1f2..d3f8085 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -253,9 +253,9 @@ slcreate() MALLOC(sc, struct sl_softc *, sizeof(*sc), M_SL, M_WAITOK | M_ZERO); - m = m_gethdr(M_WAIT, MT_DATA); + m = m_gethdr(M_TRYWAIT, MT_DATA); if (m != NULL) { - MCLGET(m, M_WAIT); + MCLGET(m, M_TRYWAIT); if ((m->m_flags & M_EXT) == 0) { m_free(m); m = NULL; diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index 8ae33de..769e376 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -173,7 +173,7 @@ stfattach(dummy) const struct encaptab *p; nstf = NSTF; - stf = malloc(nstf * sizeof(struct stf_softc), M_DEVBUF, M_WAIT); + stf = malloc(nstf * sizeof(struct stf_softc), M_DEVBUF, M_WAITOK); bzero(stf, nstf * sizeof(struct stf_softc)); sc = stf; diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index 16cc009..3a95fdb 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -391,7 +391,7 @@ pppwrite(tp, uio, flag) s = spltty(); for (mp = &m0; uio->uio_resid; mp = &m->m_next) { - MGET(m, M_WAIT, MT_DATA); + MGET(m, M_TRYWAIT, MT_DATA); if ((*mp = m) == NULL) { m_freem(m0); splx(s); |