The shmem_alloc function allocates a region of shared memory of the given size, using the given name to avoid conflicts between multiple regions in the program. The size of the region will not be automatically increased if its boundaries are overrun. Use the shmem_realloc function for that automatic increases.
This function must be called before any daemon workers are spawned in order for the handle to the shared region to be inherited by the children.
Because the region must be inherited by the children, the region cannot be reallocated with a larger size when necessary.
#include <base/shmem.h> shmem_s *shmem_alloc(char *name, int size, int expose);
A pointer to a new shared memory region.
char *name is the name for the region of shared memory being created. The value of name must be unique to the program that calls the shmem_alloc() function or conflicts will occur.
int size is the number of characters of memory to be allocated for the shared memory.
int expose is either zero or nonzero. If nonzero, then on systems that support it, the file that is used to create the shared memory becomes visible to other processes running on the system.