shmget.2
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 2 代码 · 共 158 行
2
158 行
.\" SCCSID: @(#)shmget.2 8.1 9/11/90.TH shmget 2.SH Nameshmget \- get shared memory segment.SH Syntax.nf.ft B#include <sys/types.h>#include <sys/ipc.h>#include <sys/shm.h>.PP.ft Bint shmget (key, size, shmflg)key_t key;int size, shmflg;.fi.SH Description.NXR "shmget system call".NXA "shmget system call" "ftok subroutine".NXA "shmget system call" "shmctl system call".NXA "shmget system call" "shmop system call".NXR "shared memory" "getting"The.PN shmgetsystem callreturns the shared memory identifier associated with.I key..spA shared memory identifier and associated datastructure and shared memorysegment of size.I sizebytes are created for.IR key ,if one of the following is true:.RS 5.PPThe.I keyis equal to IPC_PRIVATE.For further information, see .MS intro 2 ..PPThe.I keydoes not already have a shared memoryidentifier associated with it, and .RI ( shmflg& IPC_CREAT ) is true..RE.PPUpon creation, the data structure associated with the new shared memoryidentifier is initialized as follows:.RS 5.PPThe.PN shm_perm.cuid , .PN shm_perm.uid , .PN shm_perm.cgid ,and.PN shm_perm.gidare set equal to the effective user IDand effective group ID ofthe calling process..PPThe low-order nine bits of .PN shm_perm.modeare set equal to the low-order nine bits of.IR shmflg .The.PN shm_segsz is set equal to the value of.IR size ..PPThe.PN shm_lpid , .PN shm_nattch , .PN shm_atime ,and.PN shm_dtimeare set equal to zero (0).The.B shm_ctimeis set equal to the current time..RE.SH Return ValuesUpon successful completion,a non-negative integer, namely, a shared memoryidentifier is returned. Otherwise, a value of \-1 is returned and.I errnois set to indicated the error..SH Diagnostics.NXR "shmget system call" "diagnostics"The.PN shmgetsystem callfails if any of the following is true:.TP 15[EINVAL]The.I sizeis less than the system-imposed minimumor greater than the system-imposed maximum. .TP 15[EACCES]A shared memory identifier exists for .IR key ,but operations permission,as specified by the low-order nine bits of .IR shmflg ,would not be granted. For further information, see .MS errno 2 ..TP 15[EINVAL]A shared memory identifier exists for.IR key ,but the size of the segment associated with it is less than.I sizeand.I sizeis not equal to zero. .TP 15[ENOENT]A shared memory identifier does not exist for.IR key ,and.RI ( shmflg& IPC_CREAT )is false. .TP 15[ENOSPC]A shared memory identifier is to becreated, but the system-imposed limit on themaximum number of allowed shared memoryidentifiers would be exceeded. .TP 15[ENOMEM]A shared memory identifier andthe associated shared memory segment are to becreated, but the amount of availablephysical memory is not sufficient to fillthe request. .TP 15[EEXIST]A shared memory identifier exists for .IR key ,but .RI (( shmflg& IPC_CREAT )and .RI ( shmflg& IPC_EXCL ))is true. .SH See Alsoshmctl(2), shmop(2), ftok(3)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?