Subject: Re: m_get(), MGET(), and MGETHDR() with M_WAIT
To: Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>
From: Thorsten Lockert <tholo@SigmaSoft.COM>
List: tech-kern
Date: 06/05/1996 23:30:23
> > > no, malloc(... M_WAIT) _cannot_ return NULL.  Like i noted, that's the
> > > current implementation, and i'm not as much concerned about that as I
> > > am about what the code using m_get(... M_WAIT ...) _should_ be doing.
> > 
> > malloc(..., M_WAIT) is not allowed to return NULL.  Checking for a NULL
> > return when called with M_WAIT is superflous.  However, perhaps some of
> > the cases that now use _MWAIT and do check should be changed to M_NOWAIT?
> 
> The question is not what the current implementation of m_get() does,
> it's what the definition of m_get() says that m_get() will do.

Ah.  Hm.  I thought the basic question was about the underlying malloc()
call...  I was wrong again.

> if the definition of m_get() says that m_get() may return NULL if
> M_WAIT is set, then we should be safe about using it, regardless of
> what our current implementation does.  Our implementation may change,
> or people might port our code to other systems.

Yes, I agree.  Did Stevens' book have anything to say about this?

Thorsten
--
Thorsten Lockert        | postmaster@sigmasoft.com | Universe, n.:
1238B Page Street       | hostmaster@sigmasoft.com |         The problem.
San Francisco, CA 94117 | tholo@sigmasoft.com      |