cnet's Application Programming Interface

NAME
CNET_shmem, CNET_shmem2- create, or attach to, a memory segment shared by all nodes.

SYNOPSIS
#include <cnet.h>

void *CNET_shmem(size_t length);
void *CNET_shmem2(const char *name, size_t length);

DESCRIPTION
CNET_shmem() returns a pointer to a block of memory of at least the requested number of bytes. If multiple nodes each make the same request, they will each receive a pointer to the same shared memory. When first allocated, the memory is cleared using memset(addr,0,length).

CNET_shmem2() also accepts a string, name, to identify one of many named shared memory segments.

The shared memory can be used to conveniently maintain some global statistics, accessible by all nodes. The provision of CNET_shmem() and CNET_shmem2() is not intended to provide a covert communication channel between nodes.

RETURN VALUE
On success, a valid pointer is returned. On failure, the NULL pointer is returned, and the global variable cnet_errno is set to one of the following values to describe the error:

ER_BADARG
length is equal to zero.
ER_BADSIZE
The node has requested a shared memory segment whose length is greater than the currently available shared segment.

 cnet v3.3.4, written by Chris.McDonald@uwa.edu.au
 Last modified: Tue Mar 1 7:43AM 2016