1 Star 0 Fork 4.9K

平凡 / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
shm-h.md 15.74 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

shm.h

Overview

Related Modules:

MEM

Description:

Declares APIs for creating, mapping, deleting, and controlling shared memory.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

shmid_ds

Stores information about a shared memory segment.

shminfo

Describes limitations and attributes of system-level shared memory.

shm_info

Describes system resource information about the shared memory.

Macros

Macro Name and Value

Description

SHMLBA   4096

Aligns the shared memory address.

SHM_R   0400

Indicates that the shared memory segment is readable. This macro is used for setting the shmflg parameter passed to functions such as shmget().

SHM_W   0200

Indicates that the shared memory segment is writable. This macro is used for setting the shmflg parameter passed to functions such as shmget().

SHM_RDONLY   010000

Indicates that the attached shared memory segment is read-only. This macro is used for setting the shmflg parameter passed to functions such as shmat().

SHM_RND   020000

Indicates that the shared memory address can be rounded to a value meeting the requirement (SHMLBA). This macro is used for setting the shmflg parameter passed to functions such as shmat().

SHM_REMAP   040000

Indicates that the memory segment can be remapped. This macro is used for setting the shmflg parameter passed to functions such as shmat().

SHM_EXEC   0100000

Indicates that the attached shared memory segment is executable. This macro is used for setting the shmflg parameter passed to functions such as shmat().

SHM_LOCK   11

Locks the shared memory segment in memory so that it cannot be swapped to the swap partition. This macro is used for setting the shmflg parameter passed to functions such as shmget().

SHM_UNLOCK   12

Unlocks the shared memory segment. This macro is used for setting the shmflg parameter passed to functions such as shmget().

SHM_STAT   (13 | (IPC_STAT & 0x100))

Obtains a shmid_ds data structure. This macro is used for setting the cmd parameter passed to shmctl().

SHM_INFO   14

Obtains a shm_info data structure that includes system resource information about this shared memory segment. This macro is used for setting the cmd parameter passed to shmctl().

SHM_STAT_ANY   (15 | (IPC_STAT & 0x100))

Obtains a shmid_ds data structure without permission check. This macro is used for setting the cmd parameter passed to shmctl().

Functions

Function Name

Description

shmat (int shmid, const void *shmaddr, int shmflg)

void * 

Attaches the shared memory segment identified by shmid to the address space of the current process.

shmctl (int shmid, int cmd, struct shmid_ds *buf)

int 

Performs a control operation specified by the cmd parameter on the shared memory segment identified by shmid.

shmdt (const void *shmaddr)

int 

Detaches the shared memory segment attached to the address pointed to by shmaddr from the address space of the calling process.

shmget (key_t key, size_t size, int shmflg)

int 

Obtains or creates a shared memory segment with the specified size based on the ID specified by key.

1
https://gitee.com/pingfan_vs_hs/docs.git
git@gitee.com:pingfan_vs_hs/docs.git
pingfan_vs_hs
docs
docs
master

搜索帮助