Alternative VE Offloading  2.13.0
VEO VH-VE SHM API (low-level)

VH-VE SHM API functions for VEO. More...

Functions

int veo_shmget (veo_proc_handle *h, key_t key, size_t size, int shmflag)
 This function gets the identifier of system V shared memory on VH. More...
 
void * veo_shmat (veo_proc_handle *h, int shmid, const void *shmaddr, int shmflag, void **vehva)
 This function attaches system V shared memory on VH and register it with DMAATB. More...
 
int veo_shmdt (veo_proc_handle *h, const void *shmaddr)
 This function detaches system V shared memory on VH and releases DMAATB entry. More...
 

Detailed Description

VH-VE SHM API functions for VEO.

This API is a low-level API and is intended to be called by upper layer software. This API is not intended to be called by a user program. To use VEO VH-VE SHM API functions, include "ve_offload.h" header and "veo_vhveshm.h" header.

Function Documentation

int veo_shmget ( veo_proc_handle *  h,
key_t  key,
size_t  size,
int  shmflag 
)

This function gets the identifier of system V shared memory on VH.

Note
Argument is similar to shmget(2). Different points are shown below.
If a specified size is smaller than actual shared memory size, actual shared memory size is used.
Invoking this function is not required if the program knows the shared memory identifier.
Parameters
[in]hVEO process handle
[in]keyA key value associated with System V shared memory segment on VH. Don't specify IPC_PRIVATE.
[in]sizeSize of System V shared memory segment on VH
[in]shmflagSHM_HUGETLB must be specified. Don't specify SHM_NORESERVE IPC_EXCL and IPC_CREAT.
Returns
A valid shared memory identifier on success, -1 and set errno on failure.
  • EINVAL SHM_HUGETLB is not specified as 3rd argument. SHM_NORESERVE or IPC_EXCL or IPC_CREAT are specified as 3rd argument.
  • EINVAL IPC_PRIVATE is specified as 1st argument.
  • EINVAL A segment with given key existed, but size is greater than the size of the segment.
  • EACCES The user does not have permission to access the shared memory segment, and does not have the CAP_IPC_OWNER capability.
  • ENOENT No segment exists for the given key.
  • ENOTSUP Library load or symbol retrieval failed.
  • EBUSY Starting VH-VE SHM creation on VE or result wait failed.
void* veo_shmat ( veo_proc_handle *  h,
int  shmid,
const void *  shmaddr,
int  shmflag,
void **  vehva 
)

This function attaches system V shared memory on VH and register it with DMAATB.

Note
Argument is similar to shmat(2). Different points are shown below.
On Linux, it is possible to attach a shared memory segment even if it is already marked to be deleted. vh_shmat() follows it.
Parameters
[in]hVEO process handle
[in]shmidSystem V shared memory segment identifier.
[in]shmaddrThis argument must be NULL.
[in]shmflagSHM_RDONLY can be specified. Don't specify SHM_EXEC, SHM_REMAP and SHM_RND.
[out]vehvaAn address of pointer to store VEHVA.
Returns
A valid shared memory identifier on success, (void *)-1 and set errno on failure.
  • EINVAL shmaddr is not NULL.
  • EINVAL SHM_EXEC, SHM_REMAP or SHM_RND are specified.
  • EINVAL Invalid shmid value.
  • EFAULT vehva is invalid or the specified segment is not huge page.
  • ENOMEM Can't allocate DMAATB more. No enough memory at VH side.
  • ECANCELED Failed to update resource information (VEOS internal error).
  • EACCES The calling process does not have the required permissions for the requested attach type, and does not have the CAP_IPC_OWNER capability.
  • ENOTSUP VEOS does not connect to IVED.
  • ENOTSUP Library load or symbol retrieval failed.
  • EIDRM shmid points to a removed identifier.
  • EBUSY Starting VH-VE SHM attachment on VE or result wait failed.
int veo_shmdt ( veo_proc_handle *  h,
const void *  shmaddr 
)

This function detaches system V shared memory on VH and releases DMAATB entry.

Parameters
[in]hVEO process handle
[in]shmaddrAn address returned by veo_shmat(), which is attached to System V shared memory on VH
Returns
0 on success, -1 and set errno on failure.
  • ECANCELED Failed to update resource information (VEOS internal error).
  • EINVAL shmaddr is invalid. There is no shared memory segment attached at shmaddr, or shmaddr is not aligned on a page boundary.
  • ENOTSUP Library load or symbol retrieval failed.
  • EBUSY Starting VH-VE SHM detachment on VE or result wait failed.