Index Index for
Section 3
Index Alphabetical
listing for N
Bottom of page Bottom of
page

nshmget(3)

NAME

nshmget - Returns (or creates) the ID for a shared memory region (libnuma library)

SYNOPSIS

#include <numa.h> #include <sys/shm.h> int nshmget( key_t key, size_t size, int shmflg, memalloc_attr_t *attr );

PARAMETERS

key 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. size Specifies the minimum number of bytes to allocate for the region. shmflg Specifies the creation flags. See shmget(2) for a description of these flags. attr 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 memory region.

DESCRIPTION

If the attr argument is NULL, the nshmget() function behaves identically to the shmget() function. If the attr argument is non-NULL, it points to a memory allocation policy and attributes structure that specifies where the pages should be allocated for a newly created shared memory region. To change the policy 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

ID of a shared memory region Success. -1 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() function sets errno for the following: [EFAULT] A non-NULL attr argument points to an invalid address. [EINVAL] The structure pointed to by the attr argument contains 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)

Index Index for
Section 3
Index Alphabetical
listing for N
Top of page Top of
page