kmem_zalloc(D3)
kmem_zalloc - allocate and clear space from kernel free memory
As shipped in IRIX 6.5.5. Unchanged since IRIX 6.5.
NAME kmem_zalloc - allocate and clear space from kernel free memory SYNOPSIS #include <sys/types.h> #include <sys/kmem.h> #include <sys/ddi.h> void *kmem_zalloc(size_t size, int flag); Arguments size Number of bytes to allocate. flag Specifies whether the caller is willing to sleep waiting for memory, also other flags accepted by kmem_alloc. DESCRIPTION kmem_zalloc allocates size bytes of kernel memory, clears the memory by filling it with zeros, and returns a pointer to the allocated memory. If flag is set to KM_SLEEP, the caller will sleep if necessary until the specified amount of memory is available. If flag is set to KM_NOSLEEP, the caller will not sleep, but kmem_zalloc will return NULL if the specified amount of memory is not immediately available. Return Values Upon successful completion, kmem_zalloc returns a pointer to the allocated memory. If KM_NOSLEEP is specified and sufficient memory is not immediately available, kmem_zalloc returns a NULL pointer. If size is set to 0, kmem_zalloc returns NULL regardless of the value of flag. USAGE Kernel memory is a limited resource and should be used judiciously. Memory allocated using kmem_zalloc should be freed as soon as possible. Drivers should not use local freelists for memory or similar schemes that cause the memory to be held for longer than necessary. Since holding memory allocated using kmem_zalloc for extended periods of time (e.g allocating memory at system startup and never freeing it) can have an adverse effect on overall memory usage and system performance, memory needed for such extended periods should be statically allocated whenever possible. The address returned by a successful call to kmem_zalloc is word-aligned. Level Initialization or Base if flag is set to KM_SLEEP. Initialization, Base or Interrupt if flag is set to KM_NOSLEEP. Synchronization Constraints May sleep if flag is set to KM_SLEEP. Driver-defined basic locks, read/write locks, and sleep locks may be held across calls to this function if flag is KM_NOSLEEP, but may not be held if flag is KM_SLEEP. Driver-defined sleep locks may be held across calls to this function regardless of the value of flag. REFERENCES kmem_alloc(D3), kmem_free(D3)