nshmget(3)nshmget(3)NAMEnshmget - Returns (or creates) the ID for a shared memory region (lib‐
numa library)
SYNOPSIS
#include <numa.h> #include <sys/shm.h>
int nshmget(
key_t key,
size_t size,
int shmflg,
memalloc_attr_t *attr );
PARAMETERS
Specifies the key that identifies the shared memory region. The value
for the key parameter can be IPC_PRIVATE or a random number other than
zero (0). If the value of key is IPC_PRIVATE, it can be used to assure
the return of a new, unused shared memory region. Specifies the mini‐
mum number of bytes to allocate for the region. Specifies the creation
flags. See shmget(2) for a description of these flags. Points to a
memory allocation policy and attributes structure. If the specified key
does not exist, and a shared memory region is created, these attributes
will be assigned to the memory object created to manage the shared mem‐
ory region.
DESCRIPTION
If the attr argument is NULL, the nshmget() function behaves identi‐
cally to the shmget() function.
If the attr argument is non-NULL, it points to a memory allocation pol‐
icy and attributes structure that specifies where the pages should be
allocated for a newly created shared memory region. To change the pol‐
icy of an existing shared memory region, use the nmadvise() function.
If the mattr_policy member of the structure pointed to by attr is
MPOL_DIRECTED and the mattr_rad member is RAD_NONE, the system will
choose the Resource Affinity Domain (RAD) where the pages of the shared
memory region will be allocated from among the RADs specified in the
mattr_radset member of *attr. If the mattr_radset member is the empty
set, the system will select a RAD for the memory object from among all
of the RADs in the caller's partition, and the overflow set will be the
empty set.
RETURN VALUES
Success. Failure. In this case, errno is set to indicate the error.
ERRORS
The nshmget() function returns errors for all the conditions that are
documented for the shmget() function. In addition, the nshmget() func‐
tion sets errno for the following: A non-NULL attr argument points to
an invalid address. The structure pointed to by the attr argument con‐
tains an invalid memory allocation policy or an invalid RAD number.
(The RAD number is less than 0 or greater than nrads.) This error can
also occur if the memory allocation policy is MPOL_STRIPED, but the
specified stride (stripe width) is 0 pages.
SEE ALSO
Functions: shmget(2), nmadvise(3), numa_intro(3)
Files: numa_types(4), shmid_ds(4)nshmget(3)