| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 2: System Calls Oracle Solaris 11 Information Library |
- shared memory control operations
#include <sys/types.h>#include <sys/ipc.h>#include <sys/shm.h>intshmctl(intshmid,intcmd,struct shmid_ds *buf);
Theshmctl() function provides a variety of shared memory control operations asspecified bycmd. The permission required for a shared memory control operationis given as {token}, wheretoken is the type of permission needed. Thetypes of permission are interpreted as follows:
00400 READ by user00200 WRITE by user00040 READ by group00020 WRITE by group00004 READ by others00002 WRITE by others
See theShared Memory Operation Permissions section ofIntro(2) for more information.
The following operations require the specified tokens:
Place the current value of each member of the data structure associated withshmid into the structure pointed to bybuf. The contents of this structure are defined inIntro(2). {READ}
Set the value of the following members of the data structure associated withshmid to the corresponding value found in the structure pointed to bybuf:
shm_perm.uidshm_perm.gidshm_perm.mode /* access permission bits only */
This command can be executed only by a process that has appropriate privileges or an effective user ID equal to the value ofshm_perm.cuid orshm_perm.uid in the data structure associated withshmid.
Remove the shared memory identifier specified byshmid from the system. The segment referenced by the identifier will be destroyed when all processes with the segment attached have either detached the segment or exited. If the segment is not attached to any process whenIPC_RMID is invoked, it will be destroyed immediately. This command can be executed only by a process that has appropriate privileges or an effective user ID equal to the value ofshm_perm.cuid orshm_perm.uid in the data structure associated withshmid.
Lock the shared memory segment specified byshmid in memory. This command can be executed only by a process that has appropriate privileges.
Unlock the shared memory segment specified byshmid. This command can be executed only by a process that has appropriate privileges.
A shared memory segment must be explicitly removed usingIPC_RMID before thesystem can deallocate it and the resources it uses.
Upon successful completion,0 is returned. Otherwise,-1 is returned anderrnois set to indicate the error.
Theshmctl() function will fail if:
Thecmd argument is equal toIPC_STAT and {READ} operation permission is denied to the calling process.
Thebuf argument points to an illegal address.
Theshmid argument is not a valid shared memory identifier; or thecmd argument is not a valid command or isIPC_SET andshm_perm.uid orshm_perm.gid is not valid.
Thecmd argument is equal toSHM_LOCK and there is not enough memory, or the operation would exceed a limit or resource control on locked memory.
Thecmd argument isIPC_STAT anduid orgid is too large to be stored in the structure pointed to bybuf.
Thecmd argument is equal toIPC_RMID orIPC_SET, the effective user ID of the calling process is not equal to the value ofshm_perm.cuid orshm_perm.uid in the data structure associated withshmid, and {PRIV_IPC_OWNER} is not asserted in the effective set of the calling process.
Thecmd argument is equal toSHM_LOCK orSHM_UNLOCK and {PRIV_PROC_LOCK_MEMORY} is not asserted in the effective set of the calling process.
Seeattributes(5) for descriptions of the following attributes:
|
ipcs(1),Intro(2),shmget(2),shmop(2),attributes(5),privileges(5),standards(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |