Subject: m_get(), MGET(), and MGETHDR() with M_WAIT
To: None <tech-kern@NetBSD.ORG>
From: Chris G Demetriou <>
List: tech-kern
Date: 06/05/1996 15:04:42
So, looking through the kernel I noticed that the treatment of
uses of m_get(), MGET() and MGETHDR() with the M_WAIT flag is

In particular, some uses check the return value against NULL, lots
of places don't, and some do things that are ... odd.

By file which uses one of the above functions/macros with M_WAIT:
(all == all returns checked, none == none checked, etc.)

compat/hpux/hpux_net.c		all, but some probably buggy
compat/sunos/sunos_misc.c	all
compat/ultrix/ultrix_misc.c	all
kern/uipc_socket.c		none
kern/uipc_syscalls.c		some
net/bpf.c			all
net/ppp_tty.c			all
net/route.c			none
netinet/ip_mroute.c		none
netinet/ip_output.c		none
netinet/tcp_usrreq.c		none
netiso/clnp_raw.c		none
netiso/if_cons.c		all
netiso/tp_usrreq.c		all
nfs/krpc_subr.c			some, and some buggy
nfs/nfs_boot.c			none
nfs/nfs_nqlease.c		none
nfs/nfs_serv.c			none
nfs/nfs_socket.c		none
nfs/nfs_subs.c			none
nfs/nfs_syscalls.c		none
nfs/nfs_vfsops.c		all
nfs/nfsm_subs.h			none

In the current implementation, none of those functions/macros will
ever return NULL if used with M_WAIT.

What i'm wondering is, in their 'well-documented' definitions, are
they ever allowed to return NULL in that case?

If so, a lot more return-checking code should probably be added (or at
least, it should be noted that it may be needed).  If not, the
existing return-checking code should be tossed...

The problem is, I can't find any 'good documentation' for them.  the
4.3 daemon book doesn't cover them in detail, and I don't currently
have access to a copy of the 4.4 daemon book (and, given the 4.3
book's coverage, i doubt that it would include the details that I

Anybody know the answer?