|
|
1.1 root 1: .TH SHMCTL 2
2: .SH NAME
3: shmctl \- shared memory control operations
4: .SH SYNOPSIS
5: .B #include <sys/types.h>
6: .br
7: .B #include <sys/ipc.h>
8: .br
9: .B #include <sys/shm.h>
10: .PP
11: .nf
12: .B int shmctl (shmid, cmd, buf)
13: .B int shmid, cmd;
14: .B struct shmid_ds \(**buf;
15: .fi
16: .SH DESCRIPTION
17: .I Shmctl
18: provides a variety of shared memory control operations as specified by
19: .IR cmd .
20: The following
21: .IR cmd s
22: are available:
23: .RS
24: .TP \w'IPC_RMID\ \ \ 'u
25: .SM
26: .B IPC_STAT
27: Place the current value of each member of the data structure associated with
28: .I shmid
29: into the structure pointed to by
30: .IR buf .
31: The contents of this structure are defined in
32: .IR intro (2).
33: .SM {READ}
34: .TP
35: .SM
36: .B IPC_SET
37: Set the value of the following members of the data structure associated with
38: .I shmid
39: to the corresponding value found in the structure pointed to by
40: .IR buf :
41: .nf
42: .RS
43: shm_perm.uid
44: shm_perm.gid
45: shm_perm.mode /\(** only low 9 bits \(**/
46: .fi
47: .RE
48: .IP
49: This \fIcmd\fP can only be executed by a process that has an effective user
50: .SM ID
51: equal to either that of super-user or to the value of
52: .B shm_perm.uid
53: in the data structure associated with
54: .IR shmid .
55: .TP
56: .SM
57: .B IPC_RMID
58: Remove the shared memory identifier specified by
59: .I shmid
60: from the system and destroy the shared memory segment and data structure
61: associated with it.
62: This \fIcmd\fP can only be executed by a process that has an effective user
63: .SM ID
64: equal to either that of super-user or to the value of
65: .B shm_perm.uid
66: in the data structure associated with
67: .IR shmid .
68: .PP
69: .I Shmctl
70: will fail if one or more of the following are true:
71: .TP 15
72: .SM
73: \%[EINVAL]
74: .I Shmid
75: is not a valid shared memory identifier.
76: .TP
77: .SM
78: \%[EINVAL]
79: .I Cmd
80: is not a valid command.
81: .TP
82: .SM
83: \%[EACCES]
84: .I Cmd
85: is equal to
86: .B IPC_STAT
87: and
88: .SM {READ}
89: operation permission is denied to the calling process (see
90: .IR intro (2)).
91: .TP
92: .SM
93: \%[EPERM]
94: .I Cmd
95: is equal to
96: .SM
97: .B IPC_RMID
98: or
99: .SM
100: .B IPC_SET
101: and the effective user
102: .SM ID
103: of the calling process is not equal to that of super-user and it is
104: not equal to the value of
105: .B shm_perm.uid
106: in the data structure associated with
107: .IR shmid .
108: .TP
109: .SM
110: \%[EFAULT]
111: .I Buf
112: points to an illegal address.
113: .SH "RETURN VALUE"
114: Upon successful completion, a value of 0 is returned. Otherwise, a
115: value of \-1 is returned and
116: .I errno\^
117: is set to indicate the error.
118: .SH SEE ALSO
119: intro(2), shmget(2), shmop(2).
120: .\" @(#)shmctl.2 6.2 of 9/6/83
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.