Debian Codegraph @

upstream/opensuse-tumbleweed/man3/IPC::SharedMem.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "IPC::SharedMem 3pm"
61 .TH IPC::SharedMem 3pm 2026-03-09 "perl v5.42.1" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 IPC::SharedMem \- SysV Shared Memory IPC object class
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 2
71 \& use IPC::SysV qw(IPC_PRIVATE S_IRUSR S_IWUSR);
72 \& use IPC::SharedMem;
73 \&
74 \& $shm = IPC::SharedMem\->new(IPC_PRIVATE, 8, S_IRWXU);
75 \&
76 \& $shm\->write(pack("S", 4711), 2, 2);
77 \&
78 \& $data = $shm\->read(0, 2);
79 \&
80 \& $ds = $shm\->stat;
81 \&
82 \& $shm\->remove;
83 .Ve
84 .SH DESCRIPTION
85 .IX Header "DESCRIPTION"
86 A class providing an object based interface to SysV IPC shared memory.
87 .SH METHODS
88 .IX Header "METHODS"
89 .IP "new ( KEY , SIZE , FLAGS )" 4
90 .IX Item "new ( KEY , SIZE , FLAGS )"
91 Creates a new shared memory segment of \f(CW\*(C`SIZE\*(C'\fR bytes size associated
92 with \f(CW\*(C`KEY\*(C'\fR. A new segment is created if
93 .RS 4
94 .IP \(bu 4
95 \&\f(CW\*(C`KEY\*(C'\fR is equal to \f(CW\*(C`IPC_PRIVATE\*(C'\fR
96 .IP \(bu 4
97 \&\f(CW\*(C`KEY\*(C'\fR does not already have a shared memory segment associated
98 with it, and \f(CW\*(C`\fR\f(CIFLAGS\fR\f(CW & IPC_CREAT\*(C'\fR is true.
99 .RE
100 .RS 4
101 .Sp
102 On creation of a new shared memory segment \f(CW\*(C`FLAGS\*(C'\fR is used to
103 set the permissions. Be careful not to set any flags that the
104 Sys V IPC implementation does not allow: in some systems setting
105 execute bits makes the operations fail.
106 .RE
107 .IP id 4
108 .IX Item "id"
109 Returns the shared memory identifier.
110 .IP "read ( POS, SIZE )" 4
111 .IX Item "read ( POS, SIZE )"
112 Read \f(CW\*(C`SIZE\*(C'\fR bytes from the shared memory segment at \f(CW\*(C`POS\*(C'\fR. Returns
113 the string read, or \f(CW\*(C`undef\*(C'\fR if there was an error. The return value
114 becomes tainted. See shmread.
115 .IP "write ( STRING, POS, SIZE )" 4
116 .IX Item "write ( STRING, POS, SIZE )"
117 Write \f(CW\*(C`SIZE\*(C'\fR bytes to the shared memory segment at \f(CW\*(C`POS\*(C'\fR. Returns
118 true if successful, or false if there is an error. See shmwrite.
119 .IP remove 4
120 .IX Item "remove"
121 Remove the shared memory segment from the system or mark it as
122 removed as long as any processes are still attached to it.
123 .IP is_removed 4
124 .IX Item "is_removed"
125 Returns true if the shared memory segment has been removed or
126 marked for removal.
127 .IP stat 4
128 .IX Item "stat"
129 Returns an object of type \f(CW\*(C`IPC::SharedMem::stat\*(C'\fR which is a sub\-class
130 of \f(CW\*(C`Class::Struct\*(C'\fR. It provides the following fields. For a description
131 of these fields see you system documentation.
132 .Sp
133 .Vb 12
134 \& uid
135 \& gid
136 \& cuid
137 \& cgid
138 \& mode
139 \& segsz
140 \& lpid
141 \& cpid
142 \& nattch
143 \& atime
144 \& dtime
145 \& ctime
146 .Ve
147 .IP "attach ( [FLAG] )" 4
148 .IX Item "attach ( [FLAG] )"
149 Permanently attach to the shared memory segment. When a \f(CW\*(C`IPC::SharedMem\*(C'\fR
150 object is attached, it will use memread and memwrite instead of
151 shmread and shmwrite for accessing the shared memory segment.
152 Returns true if successful, or false on error. See \fBshmat\fR\|(2).
153 .IP detach 4
154 .IX Item "detach"
155 Detach from the shared memory segment that previously has been attached
156 to. Returns true if successful, or false on error. See \fBshmdt\fR\|(2).
157 .IP addr 4
158 .IX Item "addr"
159 Returns the address of the shared memory that has been attached to in a
160 format suitable for use with \f(CWpack(\*(AqP\*(Aq)\fR. Returns \f(CW\*(C`undef\*(C'\fR if the shared
161 memory has not been attached.
162 .SH "SEE ALSO"
163 .IX Header "SEE ALSO"
164 IPC::SysV, Class::Struct
165 .SH AUTHORS
166 .IX Header "AUTHORS"
167 Marcus Holland\-Moritz <[email protected]>
168 .SH COPYRIGHT
169 .IX Header "COPYRIGHT"
170 Version 2.x, Copyright (C) 2007\-2013, Marcus Holland\-Moritz.
171 .PP
172 Version 1.x, Copyright (c) 1997, Graham Barr.
173 .PP
174 This program is free software; you can redistribute it and/or
175 modify it under the same terms as Perl itself.