[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: kernel malloc
man 9 malloc
Quote:
Unlike its standard C library counterpart (malloc(3)), the kernel
version
takes two more arguments. The flags argument further qualifies
malloc()'s operational characteristics as follows:
M_NOWAIT
Causes malloc() to return NULL if the request cannot be
imme-
diately fulfilled due to resource shortage. Otherwise,
malloc() may call sleep to wait for resources to be released
by other processes. If this flag is not set, malloc() will
never return NULL. Note that M_WAITOK is conveniently
defined
to be 0, and hence maybe or'ed into the flags argument to
in-
dicate that it's Ok to wait for resources.
----- Original Message -----
From: "Wouter Clarie" <rimshot@pandora.be>
To: <tech@openbsd.org>
Sent: Friday, July 12, 2002 06:16
Subject: kernel malloc
> Hi,
>
> in malloc(9) you can find that if using kernel malloc with M_WAITOK, it
> can never return NULL. Is this true in 100% of the cases? I'm doing a
> return value check of kernelland and there are quite a few cases where the
> return value is still checked when using M_WAITOK.
>
> Could anyone make this clear?
>
> Thanks
>
> //Wouter