📄 shmctl.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>shmctl</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_008_552"> </a>NAME</h4><blockquote>shmctl - shared memory control operations</blockquote><h4><a name = "tag_000_008_553"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="sysshm.h.html">sys/shm.h</a>>int shmctl(int <i>shmid</i>, int <i>cmd</i>, struct shmid_ds *<i>buf</i>);</code></pre></blockquote><h4><a name = "tag_000_008_554"> </a>DESCRIPTION</h4><blockquote>The<i>shmctl()</i>function provides a variety of shared memory control operations as specifiedby<i>cmd</i>.The following values for<i>cmd</i>are available:<dl compact><dt>IPC_STAT<dd>Place the current value of each member of the<b>shmid_ds</b>datastructure associated with<i>shmid</i>into the structure pointed to by<i>buf</i>.The contents of the structure are defined in<i><a href="sysshm.h.html"><sys/shm.h></a></i>.<dt>IPC_SET<dd>Set the value of the following members of the<b>shmid_ds</b>data structureassociated with<i>shmid</i>to the corresponding value foundin the structure pointed to by<i>buf</i>:<pre><code>shm_perm.uidshm_perm.gidshm_perm.mode low-order nine bits</code></pre>IPC_SET can only be executed by a process that has aneffective user ID equal to either that of a processwith appropriate privileges orto the value of<b>shm_perm.cuid</b>or<b>shm_perm.uid</b>in the<b>shmid_ds</b>data structure associated with<i>shmid</i>.<dt>IPC_RMID<dd>Remove the shared memory identifier specified by<i>shmid</i>from the system and destroy the sharedmemory segment and<b>shmid_ds</b>data structure associated with it.IPC_RMID can only be executed by a process that has aneffective user ID equal to either that of a process withappropriate privileges orto the value of<i>shm_perm.cuid</i>or<i>shm_perm.uid</i>in the<b>shmid_ds</b>data structure associated with<i>shmid</i>.</dl></blockquote><h4><a name = "tag_000_008_555"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>shmctl()</i>returns 0. Otherwise, it returns -1 and<i>errno</i>will be set to indicate the error.</blockquote><h4><a name = "tag_000_008_556"> </a>ERRORS</h4><blockquote>The<i>shmctl()</i>function will fail if:<dl compact><dt>[EACCES]<dd>The argument<i>cmd</i>is equal to IPC_STAT and the calling process does not have read permission,see<a href="ipc.html">IPC</a>.<dt>[EINVAL]<dd>The value of<i>shmid</i>is not a valid shared memory identifier,or the value of<i>cmd</i>is not a valid command.<dt>[EPERM]<dd>The argument<i>cmd</i>is equal to IPC_RMID or IPC_SETand the effective user ID of the calling processis not equal to that ofa process with appropriate privilegesand it is not equal to the value of<b>shm_perm.cuid</b>or<b>shm_perm.uid</b>in the data structure associated with<i>shmid</i>.</dl><p>The<i>shmctl()</i>function may fail if:<dl compact><dt>[EOVERFLOW]<dd>The <i>cmd</i> argument is IPC_STAT and the <b>gid</b> or <b>uid</b> value is toolarge to be stored in the structure pointed to by the <i>buf</i> argument.</dl></blockquote><h4><a name = "tag_000_008_557"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_008_558"> </a>APPLICATION USAGE</h4><blockquote>The POSIX Realtime Extension defines alternative interfaces for interprocess communication.Application developers who need to use IPC should design theirapplications so that modules using the IPC routines described in<a href="ipc.html">IPC</a>can be easily modified to use the alternative interfaces.</blockquote><h4><a name = "tag_000_008_559"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_008_560"> </a>SEE ALSO</h4><blockquote><i><a href="shmat.html">shmat()</a></i>,<i><a href="shmdt.html">shmdt()</a></i>,<i><a href="shmget.html">shmget()</a></i>,<i><a href="shm_open.html">shm_open()</a></i>,<i><a href="shm_unlink.html">shm_unlink()</a></i>,<i><a href="sysshm.h.html"><sys/shm.h></a></i>,<a href="ipc.html">IPC</a>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from Issue 2 of the SVID.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -