CAllocSleepOK

Allocates memory on a resource tag.

Library:LibC
Classification:NetWare OS
Service:NetWare Platform

Syntax

  #include <netware.h> 
   
  void *CAllocSleepOK (
     size_t   size,
     rtag_t   rTag
     int     *slept);
  

Parameters

size

(IN) Specifies, in bytes, the size of the memory block.

rTag

(IN) Specifies the resource tag.

slept

(OUT) If a pointer is passed, indicates whether the function had to wait for memory:

  • 0 Didn't wait
  • Nonzero Waited

Return Values

If successful, returns a pointer to the newly allocated memory. Otherwise, returns NULL.

Remarks

The NetWare operating system counts the allocated memory that each NLM uses. To have it count the memory for a particular component of your NLM, allocate a resource tag by calling AllocateResourceTag and then call the CAllocSleepOK function. If memory is available, the CAllocSleepOK returns successfully with a pointer to a piece of memory at least as large as the size requested. The function initializes all the memory to binary zeroes.

CAllocSleepOK might sleep. If you need to know whether it slept, pass a pointer in the slept parameter. If this information is not important to your application, you can pass a NULL pointer for the slept parameter.

You must use the Free function to return memory allocated with the AllocSleepOK function.

See Also