⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shmop.2

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 2
字号:
.\" SCCSID: @(#)shmop.2	8.1	9/11/90.TH shmop 2.SH Nameshmop, shmat, shmdt \- shared memory operations.SH Syntax.ft B.nf#include <sys/types.h>#include <sys/ipc.h>#include <sys/shm.h>.PP.ft Bchar *shmat (shmid, shmaddr, shmflg)int shmid;char *shmaddr;int shmflg;.PP.ft Bint shmdt (shmaddr)char *shmaddr;.fi.SH Description.NXR "shmop system call".NXR "shmat system call".NXR "shmdt system call".NXA "shmat system call" "shmctl system call".NXA "shmdt system call" "shmget system call".NXR "shared memory" "operations"The.PN shmatsystem call attaches the shared memory segmentassociated with the shared memory identifier specified by .I shmidto the data segment of the calling process.The segment is attached at the addressspecified by one of the following criteria:.PPIf.I shmaddr is equal to zero, the segment is attachedat the first available address asselected by the system..PPIf.I shmaddris not equal to zero and .RI ( shmflg& SHM_RND )is true, the segment is attachedat the address given by .RI ( shmaddr \- .RI ( shmaddrmodulusSHMLBA ))..PPIf.I shmaddris not equal to zero and .RI ( shmflg& SHM_RND )is false, the segment is attachedat the address given by.I shmaddr..PPThe segment is attached for reading if .RI ( shmflg& SHM_RDONLY )is true. Otherwise, it isattached for reading and writing. .PPThe.PN shmdtsystem call detaches from the calling process'sdata segment the shared memory segmentlocated at the address specified by.I shmaddr..SH Return ValuesUpon successful completion, the return values are as follows:.IP \(bu 4The.PN shmatsystem callreturns the data segment start addressof the attached shared memory segment..IP \(buThe.PN shmdtsystem call returns a value of zero (0)..PPOtherwise, a value of \-1 is returned, and .I errnois set to indicate the error..SH DiagnosticsThe.PN shmatsystem callfails and not attach the shared memory segment, if any of thefollowing is true:.TP 15[EINVAL]The.I shmid is not a valid shared memory identifier. .TP 15[EACCES]Operation permission is denied to the calling process.  For furtherinformation, see .MS errno 2 . .TP 15[ENOMEM]The available data space is not largeenough to accommodate the shared memory segment. .TP 15[EINVAL]The.I shmaddris not equal to zero, and the value of .RI ( shmaddr \-.RI ( shmaddrmodulus SHMLBA ))is an illegal address..TP 15[EINVAL]The.I shmaddris not equal to zero, .RI ( shmflg& SHM_RND )is false, and the value of.I shmaddris an illegal address. .TP 15[EMFILE]The number of shared memory segmentsattached to the calling process wouldexceed the system imposed limit. .PPThe.PN shmdtfails and does not detach the shared memory segment if:.TP 15[EINVAL]The.I shmaddris not the data segment startaddress of a shared memory segment. .SH See Alsoexecve(2), exit(2), fork(2), shmctl(2), shmget(2)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -