#include <sys/shm.h>

sys/shm.h

$NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $
6 macros · 5 functions · 1 typedef · 1 struct

typedefshmatt_t

[XSI] The unsigned integer type used for the number of current attaches that MUST be able to store values at least as large as a type unsigned short.
typedef unsigned short shmatt_t

macroSHM_RDONLY

Possible flag values which may be OR'ed into the third argument to shmat()
#define SHM_RDONLY 010000
[XSI] Attach read-only (else read-write)

macroSHM_RND

#define SHM_RND 020000
[XSI] Round attach address to SHMLBA

macroSHMLBA

This value is symbolic, and generally not expected to be sed by user programs directly, although such ise is permitted by the standard. Its value in our implementation is equal to the number of bytes per page. NOTE: We DO NOT obtain this value from the appropriate system headers at this time, to avoid the resulting namespace pollution, which is why we discourages its use.
#define SHMLBA (16*1024)
[XSI] Segment low boundary address multiple

macroSHM_R

"official" access mode definitions; somewhat braindead since you have to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions
#define SHM_R (IPC_R)

macroSHM_W

#define SHM_W (IPC_W)

macroshmid_ds

#define shmid_ds __shmid_ds_new

struct__shmid_ds_new

size 76, align 4
struct ipc_permshm_perm[XSI] Operation permission value
size_tshm_segsz[XSI] Size of segment in bytes
pid_tshm_lpid[XSI] PID of last shared memory op
pid_tshm_cpid[XSI] PID of creator
shmatt_tshm_nattch[XSI] Number of current attaches
time_tshm_atime[XSI] Time of last shmat()
time_tshm_dtime[XSI] Time of last shmdt()
time_tshm_ctime[XSI] Time of last shmctl() change
void *shm_internalreserved for kernel use

functionshmsys

int shmsys(int, ...)

functionshmat

void *shmat(int, const void *, int)
man page · August 17, 1995
shmat(2) — map/unmap shared memory

functionshmctl

__DARWIN_ALIAS(shmctl)
int shmctl(int, int, struct shmid_ds *)
man page · August 17, 1995
shmctl(2) — shared memory control operations
⚠ the man page prototype differs from the current header — man: int shmctl(int, int, struct shmid_ds*) · header: int shmctl(int, int, struct __shmid_ds_new*)

functionshmdt

int shmdt(const void *)
man page · August 17, 1995
shmdt(2) — map/unmap shared memory

functionshmget

int shmget(key_t, size_t, int)
man page · August 17, 1995
shmget(2) — get shared memory area identifier