Debian Codegraph @

po/pl/man2/shmop.2.po

raw
1 # Polish translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Rafał Lewczuk <[email protected]>, 1999.
5 # Andrzej Krzysztofowicz <[email protected]>, 2003.
6 # Robert Luberda <[email protected]>, 2013, 2019.
7 # Michał Kułach <[email protected]>, 2013, 2014, 2016, 2024, 2025.
8 msgid ""
9 msgstr ""
10 "Project-Id-Version: manpages-pl\n"
11 "POT-Creation-Date: 2026-06-05 06:43+0200\n"
12 "PO-Revision-Date: 2025-11-26 21:04+0100\n"
13 "Last-Translator: Michał Kułach <[email protected]>\n"
14 "Language-Team: Polish <[email protected]>\n"
15 "Language: pl\n"
16 "MIME-Version: 1.0\n"
17 "Content-Type: text/plain; charset=UTF-8\n"
18 "Content-Transfer-Encoding: 8bit\n"
19 "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
20 "|| n%100>=20) ? 1 : 2);\n"
21 "X-Generator: Lokalize 25.04.0\n"
22
23 #. type: TH
24 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
25 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
26 #, no-wrap
27 msgid "SHMOP"
28 msgstr "SHMOP"
29
30 #. type: TH
31 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
32 #: opensuse-tumbleweed
33 #, no-wrap
34 msgid "2026-02-08"
35 msgstr "8 lutego 2026 r."
36
37 #. type: TH
38 #: archlinux debian-unstable
39 #, no-wrap
40 msgid "Linux man-pages 6.18"
41 msgstr "Linux man-pages 6.18"
42
43 #. type: SH
44 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
45 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
46 #, no-wrap
47 msgid "NAME"
48 msgstr "NAZWA"
49
50 #. type: Plain text
51 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
52 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
53 msgid "shmat, shmdt - System V shared memory operations"
54 msgstr "shmat, shmdt - operacje na segmentach pamięci dzielonej Systemu V"
55
56 #. type: SH
57 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
58 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
59 #, no-wrap
60 msgid "LIBRARY"
61 msgstr "BIBLIOTEKA"
62
63 #. type: Plain text
64 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
65 #: opensuse-leap-16-1 opensuse-tumbleweed
66 msgid "Standard C library (I<libc>,\\ I<-lc>)"
67 msgstr "Standardowa biblioteka C (I<libc>,\\ I<-lc>)"
68
69 #. type: SH
70 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
71 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
72 #, no-wrap
73 msgid "SYNOPSIS"
74 msgstr "SKŁADNIA"
75
76 #
77 #. type: Plain text
78 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
79 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
80 #, no-wrap
81 msgid "B<#include E<lt>sys/shm.hE<gt>>\n"
82 msgstr "B<#include E<lt>sys/shm.hE<gt>>\n"
83
84 #. type: Plain text
85 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
86 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
87 #, no-wrap
88 msgid ""
89 "B<void *shmat(int >I<shmid>B<, const void *_Nullable >I<shmaddr>B<, int >I<shmflg>B<);>\n"
90 "B<int shmdt(const void *>I<shmaddr>B<);>\n"
91 msgstr ""
92 "B<void *shmat(int >I<shmid>B<, const void *_Nullable >I<shmaddr>B<, int >I<shmflg>B<);>\n"
93 "B<int shmdt(const void *>I<shmaddr>B<);>\n"
94
95 #. type: SH
96 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
97 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
98 #, no-wrap
99 msgid "DESCRIPTION"
100 msgstr "OPIS"
101
102 #. type: SS
103 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
104 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
105 #, no-wrap
106 msgid "shmat()"
107 msgstr "shmat()"
108
109 #. type: Plain text
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 msgid ""
113 "B<shmat>() attaches the System\\ V shared memory segment identified by "
114 "I<shmid> to the address space of the calling process. The attaching address "
115 "is specified by I<shmaddr> with one of the following criteria:"
116 msgstr ""
117 "B<shmat>() dołącza segment pamięci dzielonej Systemu\\ V identyfikowany "
118 "przez I<shmid> do przestrzeni adresowej procesu, który ją wywołał. Adres, "
119 "pod którym segment ma być widoczny jest przekazywany w parametrze "
120 "I<shmaddr>, przy czym system może przetworzyć ten adres w następujący sposób:"
121
122 #. type: IP
123 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
124 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
125 #, no-wrap
126 msgid "\\[bu]"
127 msgstr "\\[bu]"
128
129 #. type: Plain text
130 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
131 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
132 msgid ""
133 "If I<shmaddr> is NULL, the system chooses a suitable (unused) page-aligned "
134 "address to attach the segment."
135 msgstr ""
136 "Jeśli I<shmaddr> jest równy NULL, to system sam wybierze odpowiedni "
137 "wyrównany do rozmiaru strony (nieużywany) adres, pod którym segment będzie "
138 "widoczny."
139
140 #. type: Plain text
141 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
142 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
143 msgid ""
144 "If I<shmaddr> isn't NULL and B<SHM_RND> is specified in I<shmflg>, the "
145 "attach occurs at the address equal to I<shmaddr> rounded down to the nearest "
146 "multiple of B<SHMLBA>."
147 msgstr ""
148 "Jeśli I<shmaddr> jest różny od NULL i w I<shmflg> przekazany został znacznik "
149 "B<SHM_RND>, wówczas segment zostanie dołączony pod adresem I<shmaddr> "
150 "zaokrąglonym w dół do wielokrotności B<SHMLBA>."
151
152 #. type: Plain text
153 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
154 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
155 msgid ""
156 "Otherwise, I<shmaddr> must be a page-aligned address at which the attach "
157 "occurs."
158 msgstr ""
159 "W innym przypadku I<shmaddr> musi być wyrównanym do granicy strony adresem, "
160 "pod którym nastąpi dołączenie segmentu."
161
162 #. type: Plain text
163 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
164 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
165 msgid ""
166 "In addition to B<SHM_RND>, the following flags may be specified in the "
167 "I<shmflg> bit-mask argument:"
168 msgstr ""
169 "Oprócz B<SHM_RND> można określić następujące znaczniki w argumencie maski "
170 "bitowej I<shmflg>:"
171
172 #. type: TP
173 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
174 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
175 #, no-wrap
176 msgid "B<SHM_EXEC> (Linux-specific; since Linux 2.6.9)"
177 msgstr "B<SHM_EXEC> (charakterystyczne dla Linuksa; od Linuksa w wersji 2.6.9)"
178
179 #. type: Plain text
180 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
181 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
182 msgid ""
183 "Allow the contents of the segment to be executed. The caller must have "
184 "execute permission on the segment."
185 msgstr ""
186 "Pozwala na wykonanie zawartości segmentu. Wywołujący musi mieć prawo "
187 "wykonania segmentu."
188
189 #. type: TP
190 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
191 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
192 #, no-wrap
193 msgid "B<SHM_RDONLY>"
194 msgstr "B<SHM_RDONLY>"
195
196 #. type: Plain text
197 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
198 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
199 msgid ""
200 "Attach the segment for read-only access. The process must have read "
201 "permission for the segment. If this flag is not specified, the segment is "
202 "attached for read and write access, and the process must have read and write "
203 "permission for the segment. There is no notion of a write-only shared "
204 "memory segment."
205 msgstr ""
206 "Dołącza segment do dostępu tylko do odczytu. Proces wywołujący musi mieć "
207 "prawa odczytu segmentu. Jeśli znacznik nie jest określona, w dołączanym "
208 "segmencie możliwy jest dostęp do odczytu jak i zapisu, przy czym proces musi "
209 "mieć prawa do odczytu i zapisu segmentu. Nie istnieje pojęcie segmentu "
210 "pamięci dzielonej tylko do zapisu."
211
212 #. type: TP
213 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
214 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
215 #, no-wrap
216 msgid "B<SHM_REMAP> (Linux-specific)"
217 msgstr "B<SHM_REMAP> (charakterystyczne dla Linuksa)"
218
219 #. type: Plain text
220 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
221 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
222 msgid ""
223 "This flag specifies that the mapping of the segment should replace any "
224 "existing mapping in the range starting at I<shmaddr> and continuing for the "
225 "size of the segment. (Normally, an B<EINVAL> error would result if a "
226 "mapping already exists in this address range.) In this case, I<shmaddr> "
227 "must not be NULL."
228 msgstr ""
229 "Ten znacznik oznacza, że odwzorowanie tego segmentu powinno zastąpić "
230 "jakiekolwiek istniejące wcześniej odwzorowanie w zakresie rozpoczynającym "
231 "się od I<shmaddr> i rozciągającym się na rozmiar segmentu. (Normalnie, gdy "
232 "odwzorowanie w tym zakresie adresów już istnieje, powinien wystąpić błąd "
233 "B<EINVAL>). W tym przypadku I<shmaddr> nie może być równy NULL."
234
235 #. type: Plain text
236 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
237 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
238 msgid ""
239 "The B<brk>(2) value of the calling process is not altered by the attach. "
240 "The segment will automatically be detached at process exit. The same "
241 "segment may be attached as a read and as a read-write one, and more than "
242 "once, in the process's address space."
243 msgstr ""
244 "Wartość B<brk>(2) procesu wywołującego nie jest zmieniana podczas dołączania "
245 "segmentu. Segment zostanie automatycznie odłączony, gdy proces się zakończy. "
246 "Ten sam segment może być dołączony do przestrzeni adresowej procesu jako \\"
247 "[Bq]tylko do odczytu\\[rq] lub \\[Bq]do odczytu i zapisu\\[rq] więcej niż "
248 "raz."
249
250 #. type: Plain text
251 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
252 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
253 msgid ""
254 "A successful B<shmat>() call updates the members of the I<shmid_ds> "
255 "structure (see B<shmctl>(2)) associated with the shared memory segment as "
256 "follows:"
257 msgstr ""
258 "Pomyślne wywołanie B<shmdt> aktualizuje pola struktury I<shmid_ds> (patrz "
259 "B<shmctl>(2)) opisującej segment w następujący sposób:"
260
261 #. type: Plain text
262 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
263 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
264 msgid "I<shm_atime> is set to the current time."
265 msgstr "I<shm_atime> przypisywany jest bieżący czas."
266
267 #. type: Plain text
268 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
269 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
270 msgid "I<shm_lpid> is set to the process-ID of the calling process."
271 msgstr "I<shm_lpid> jest ustawiane na identyfikator procesu wywołującego."
272
273 #. type: Plain text
274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
276 msgid "I<shm_nattch> is incremented by one."
277 msgstr "I<shm_nattch> jest zwiększane o jeden."
278
279 #. type: SS
280 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
281 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
282 #, no-wrap
283 msgid "shmdt()"
284 msgstr "shmdt()"
285
286 #. type: Plain text
287 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
288 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
289 msgid ""
290 "B<shmdt>() detaches the shared memory segment located at the address "
291 "specified by I<shmaddr> from the address space of the calling process. The "
292 "to-be-detached segment must be currently attached with I<shmaddr> equal to "
293 "the value returned by the attaching B<shmat>() call."
294 msgstr ""
295 "B<shmdt> odłącza segment pamięci dzielonej odwzorowany pod adresem podanym w "
296 "I<shmaddr> z przestrzeni adresowej procesu wywołującego tę funkcję. "
297 "Przekazany funkcji w parametrze I<shmaddr> adres musi być równy adresowi "
298 "zwróconemu wcześniej przez wywołanie B<shmat>()."
299
300 #. type: Plain text
301 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
302 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
303 msgid ""
304 "On a successful B<shmdt>() call, the system updates the members of the "
305 "I<shmid_ds> structure associated with the shared memory segment as follows:"
306 msgstr ""
307 "Pomyślne wywołanie B<shmdt> aktualizuje pola struktury I<shmid_ds> "
308 "opisującej segment w następujący sposób:"
309
310 #. type: Plain text
311 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
312 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
313 msgid "I<shm_dtime> is set to the current time."
314 msgstr "I<shm_dtime> przypisywany jest bieżący czas."
315
316 #. type: Plain text
317 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
318 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
319 msgid ""
320 "I<shm_nattch> is decremented by one. If it becomes 0 and the segment is "
321 "marked for deletion, the segment is deleted."
322 msgstr ""
323 "I<shm_nattch> jest zmniejszane o jeden. Jeśli pole to osiągnie 0 i segment "
324 "jest zaznaczony do usunięcia, wówczas zostanie on usunięty."
325
326 #. type: SH
327 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
328 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
329 #, no-wrap
330 msgid "RETURN VALUE"
331 msgstr "WARTOŚĆ ZWRACANA"
332
333 #. type: Plain text
334 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
335 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
336 msgid ""
337 "On success, B<shmat>() returns the address of the attached shared memory "
338 "segment; on error, I<(void\\ *)\\ -1> is returned, and I<errno> is set to "
339 "indicate the error."
340 msgstr ""
341 "Jeśli się powiedzie, B<shmat>() zwraca adres dołączonego segmentu pamięci "
342 "dzielonej; w razie błędu zwracane jest I<(void\\ *)\\ -1>, a zmienna "
343 "I<errno> wskazuje błąd."
344
345 #. type: Plain text
346 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
347 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
348 msgid ""
349 "On success, B<shmdt>() returns 0; on error -1 is returned, and I<errno> is "
350 "set to indicate the error."
351 msgstr ""
352 "Jeśli się powiedzie, B<shmdt>() zwraca 0; w razie błędu zwracane jest -1, a "
353 "zmienna I<errno> wskazuje błąd."
354
355 #. type: SH
356 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
357 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
358 #, no-wrap
359 msgid "ERRORS"
360 msgstr "BŁĘDY"
361
362 #. type: Plain text
363 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
364 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
365 msgid "B<shmat>() can fail with one of the following errors:"
366 msgstr "B<shmat>() może zawieść z powodu następujących błędów:"
367
368 #. type: TP
369 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
370 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
371 #, no-wrap
372 msgid "B<EACCES>"
373 msgstr "B<EACCES>"
374
375 #. type: Plain text
376 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
377 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
378 msgid ""
379 "The calling process does not have the required permissions for the requested "
380 "attach type, and does not have the B<CAP_IPC_OWNER> capability in the user "
381 "namespace that governs its IPC namespace."
382 msgstr ""
383 "Proces wywołujący nie ma wystarczających uprawnień do dołączenia segmentu w "
384 "żądany sposób oraz nie ma przywileju B<CAP_IPC_OWNER> (ang. capability) w "
385 "tej przestrzeni nazw użytkownika, która odpowiada za przestrzeń nazw IPC."
386
387 #. type: TP
388 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
389 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
390 #, no-wrap
391 msgid "B<EIDRM>"
392 msgstr "B<EIDRM>"
393
394 #. type: Plain text
395 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
396 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
397 msgid "I<shmid> points to a removed identifier."
398 msgstr "I<shmid> wskazuje na usunięty identyfikator."
399
400 #. type: TP
401 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
402 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
403 #, no-wrap
404 msgid "B<EINVAL>"
405 msgstr "B<EINVAL>"
406
407 #. type: Plain text
408 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
409 #: opensuse-tumbleweed
410 msgid ""
411 "Invalid I<shmid> value, unaligned (i.e., not page-aligned and B<SHM_RND> was "
412 "not specified) or invalid I<shmaddr> value, or can't attach segment at "
413 "I<shmaddr>, or B<SHM_REMAP> was specified and I<shmaddr> was NULL."
414 msgstr ""
415 "Niewłaściwa wartość parametru I<shmid>, niewyrównana (do granicy strony i "
416 "nie podano B<SHM_RND>) lub niepoprawna wartość I<shmaddr> albo nieudane "
417 "dołączenie pod adresem I<shmaddr> lub został podany znacznik B<SHM_REMAP>, "
418 "podczas gdy I<shmaddr> było równe NULL."
419
420 #. type: TP
421 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
422 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
423 #, no-wrap
424 msgid "B<ENOMEM>"
425 msgstr "B<ENOMEM>"
426
427 #. type: Plain text
428 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
429 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
430 msgid "Could not allocate memory for the descriptor or for the page tables."
431 msgstr "Brak pamięci na deskryptor lub tablice stron."
432
433 #. type: Plain text
434 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
435 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
436 msgid "B<shmdt>() can fail with one of the following errors:"
437 msgstr "B<shmdt>() może zawieść z powodu następujących błędów:"
438
439 #. The following since Linux 2.6.17-rc1:
440 #. type: Plain text
441 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
442 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
443 msgid ""
444 "There is no shared memory segment attached at I<shmaddr>; or, I<shmaddr> is "
445 "not aligned on a page boundary."
446 msgstr ""
447 "Żaden segment pamięci dzielonej nie jest podłączony pod adresem I<shmaddr> "
448 "lub I<shmaddr> nie jest wyrównany do granicy strony."
449
450 #. type: SH
451 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
452 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
453 #, no-wrap
454 msgid "STANDARDS"
455 msgstr "STANDARDY"
456
457 #. type: Plain text
458 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
459 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
460 msgid "POSIX.1-2008."
461 msgstr "POSIX.1-2008."
462
463 #. type: SH
464 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
465 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
466 #, no-wrap
467 msgid "HISTORY"
468 msgstr "HISTORIA"
469
470 #. SVr4 documents an additional error condition EMFILE.
471 #. type: Plain text
472 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
473 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
474 msgid "POSIX.1-2001, SVr4."
475 msgstr "POSIX.1-2001, SVr4."
476
477 #. type: Plain text
478 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
479 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
480 msgid ""
481 "In SVID 3 (or perhaps earlier), the type of the I<shmaddr> argument was "
482 "changed from I<char\\ *> into I<const void\\ *>, and the returned type of "
483 "B<shmat>() from I<char\\ *> into I<void\\ *>."
484 msgstr ""
485 "W SVID 3 (lub być może wcześniejszym) typ parametru I<shmaddr> został "
486 "zmieniony z I<char\\ *> na I<const void\\ *>, a typ wyniku zwracanego przez "
487 "B<shmat>() z I<char\\ *> na I<void\\ *>."
488
489 #. type: Plain text
490 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
491 #: opensuse-tumbleweed
492 msgid ""
493 "POSIX.1-2024 changed the error code from I<(void\\ *)\\ -1> to B<SHM_FAILED>."
494 msgstr "POSIX.1-2024 zmienił kod błędu z I<(void\\ *)\\ -1> na B<SHM_FAILED>."
495
496 #. type: SH
497 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
498 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
499 #, no-wrap
500 msgid "NOTES"
501 msgstr "UWAGI"
502
503 #. type: Plain text
504 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
505 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
506 msgid ""
507 "After a B<fork>(2), the child inherits the attached shared memory segments."
508 msgstr ""
509 "W wyniku wywołania B<fork>(2) proces potomny dziedziczy dołączone segmenty "
510 "pamięci dzielonej."
511
512 #. type: Plain text
513 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
514 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
515 msgid ""
516 "After an B<execve>(2), all attached shared memory segments are detached from "
517 "the process."
518 msgstr ""
519 "Po wykonaniu B<exec>(2) wszystkie dołączone segmenty pamięci dzielonej są "
520 "odłączane od procesu."
521
522 #. type: Plain text
523 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
524 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
525 msgid ""
526 "Upon B<_exit>(2), all attached shared memory segments are detached from the "
527 "process."
528 msgstr ""
529 "Po wykonaniu B<_exit>(2) wszystkie dołączone segmenty pamięci dzielonej są "
530 "odłączane od procesu."
531
532 #. type: Plain text
533 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
534 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
535 msgid ""
536 "Using B<shmat>() with I<shmaddr> equal to NULL is the preferred, portable "
537 "way of attaching a shared memory segment. Be aware that the shared memory "
538 "segment attached in this way may be attached at different addresses in "
539 "different processes. Therefore, any pointers maintained within the shared "
540 "memory must be made relative (typically to the starting address of the "
541 "segment), rather than absolute."
542 msgstr ""
543 "Używanie B<shmat>() z I<shmaddr> równym NULL jest zalecaną i przenośną "
544 "metodą dołączania segmentu pamięci dzielonej. Trzeba jednak być świadomym, "
545 "że ta metoda dołączania segmentu pamięci dzielonej może spowodować jego "
546 "dołączenie pod różnymi adresami w różnych procesach. W związku z tym "
547 "wszystkie wskaźniki obsługiwane w pamięci dzielonej muszą być względne "
548 "(zazwyczaj względem adresu początkowego segmentu), nie zaś bezwzględne."
549
550 #. type: Plain text
551 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
552 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
553 msgid ""
554 "On Linux, it is possible to attach a shared memory segment even if it is "
555 "already marked to be deleted. However, POSIX.1 does not specify this "
556 "behavior and many other implementations do not support it."
557 msgstr ""
558 "Linux pozwala na dołączenie segmentu pamięci dzielonej, nawet jeśli już "
559 "został zaznaczony do usunięcia. Jednakże POSIX.1 nie określa takiego "
560 "zachowania i wiele innych implementacji go nie obsługuje."
561
562 #. type: Plain text
563 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
564 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
565 msgid "The following system parameter affects B<shmat>():"
566 msgstr "Na wywołanie B<shmat>() wpływa następujący parametr systemowy:"
567
568 #. type: TP
569 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
570 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
571 #, no-wrap
572 msgid "B<SHMLBA>"
573 msgstr "B<SHMLBA>"
574
575 #. type: Plain text
576 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
577 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
578 msgid ""
579 "Segment low boundary address multiple. When explicitly specifying an attach "
580 "address in a call to B<shmat>(), the caller should ensure that the address "
581 "is a multiple of this value. This is necessary on some architectures, in "
582 "order either to ensure good CPU cache performance or to ensure that "
583 "different attaches of the same segment have consistent views within the CPU "
584 "cache. B<SHMLBA> is normally some multiple of the system page size. (On "
585 "many Linux architectures, B<SHMLBA> is the same as the system page size.)"
586 msgstr ""
587 "Wielokrotność dolnej granicy adresu segmentu. Podczas bezpośredniego "
588 "wskazania dołączonego adresu w wywołaniu do B<shmat>(), wywołujący powinien "
589 "się upewnić, że adres jest wielokrotnością tej wartości. Jest to konieczne w "
590 "przypadku niektórych architektur, aby zapewnić dobrą wydajność pamięci "
591 "podręcznej procesora lub aby zapewnić, że różne dołączenia tego samego "
592 "segmentu mają spójne widoki w pamięci podręcznej procesora. B<SHMLBA> jest "
593 "zwykle jakąś wielokrotnością systemowego rozmiaru strony. (W wielu "
594 "architekturach linuksowych wartość B<SHMLBA> jest taka sama, jak systemowy "
595 "rozmiar strony)."
596
597 #. type: Plain text
598 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
599 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
600 msgid ""
601 "The implementation places no intrinsic per-process limit on the number of "
602 "shared memory segments (B<SHMSEG>)."
603 msgstr ""
604 "Aktualna implementacja nie ma wewnętrznego ograniczenia na liczbę segmentów "
605 "pamięci dzielonej dołączanych do jednego procesu (B<SHMSEG>)."
606
607 #. type: SH
608 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
609 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
610 #, no-wrap
611 msgid "EXAMPLES"
612 msgstr "PRZYKŁADY"
613
614 #. type: Plain text
615 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
616 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
617 msgid ""
618 "The two programs shown below exchange a string using a shared memory "
619 "segment. Further details about the programs are given below. First, we "
620 "show a shell session demonstrating their use."
621 msgstr ""
622 "Dwa programy pokazane poniżej, wymieniają łańcuch za pomocą segmentu pamięci "
623 "dzielonej. Więcej szczegółów na temat programów podano poniżej. Na początku "
624 "zademonstrujmy sesję powłoki pokazującą działanie programów."
625
626 #. type: Plain text
627 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
628 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
629 msgid ""
630 "In one terminal window, we run the \"reader\" program, which creates a "
631 "System V shared memory segment and a System V semaphore set. The program "
632 "prints out the IDs of the created objects, and then waits for the semaphore "
633 "to change value."
634 msgstr ""
635 "W jednym oknie terminala, uruchamiamy program \\[Bq]odczytujący\\[rq], który "
636 "tworzy segment pamięci dzielonej Systemu\\ V oraz zestaw semaforów Systemu\\ "
637 "V. Program wypisuje identyfikatory dzielonych obiektów, a następnie oczekuje "
638 "na zmianę wartości przez semafor."
639
640 #. type: Plain text
641 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
642 #: opensuse-tumbleweed
643 #, no-wrap
644 msgid ""
645 "$B< ./svshm_string_read>;\n"
646 "shmid = 1114194\n"
647 "semid = 15\n"
648 msgstr ""
649 "$B< ./svshm_string_read>;\n"
650 "shmid = 1114194\n"
651 "semid = 15\n"
652
653 #. type: Plain text
654 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
655 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
656 msgid ""
657 "In another terminal window, we run the \"writer\" program. The \"writer\" "
658 "program takes three command-line arguments: the IDs of the shared memory "
659 "segment and semaphore set created by the \"reader\", and a string. It "
660 "attaches the existing shared memory segment, copies the string to the shared "
661 "memory, and modifies the semaphore value."
662 msgstr ""
663 "W drugim oknie terminala, uruchamiamy program \\[Bq]zapisujący\\[rq]. "
664 "Przyjmuje on trzy argumenty w wierszu polecenia: identyfikatory: segmentu "
665 "pamięci dzielonej i zestawu semaforów utworzone przez program \\"
666 "[Bq]odczytujący\\[rq] oraz łańcuch. Dołącza on istniejący segment pamięci "
667 "dzielonej, kopiuje łańcuch do pamięci dzielonej i modyfikuje wartość "
668 "semafora."
669
670 #. type: Plain text
671 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
672 #: opensuse-tumbleweed
673 #, no-wrap
674 msgid "$B< ./svshm_string_write 1114194 15 \\[aq]Hello, world\\[aq]>;\n"
675 msgstr "$B< ./svshm_string_write 1114194 15 \\[aq]Witaj świecie!\\[aq]>;\n"
676
677 #. type: Plain text
678 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
679 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
680 msgid ""
681 "Returning to the terminal where the \"reader\" is running, we see that the "
682 "program has ceased waiting on the semaphore and has printed the string that "
683 "was copied into the shared memory segment by the writer:"
684 msgstr ""
685 "Powracając do terminala, gdzie działa program \\[Bq]odczytujący\\[rq] "
686 "widzimy, że program przestał oczekiwać na semafor i wypisał łańcuch, który "
687 "został skopiowany do segmentu pamięci dzielonej przez program \\"
688 "[Bq]zapisujący\\[rq]:"
689
690 #. type: Plain text
691 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
692 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
693 #, no-wrap
694 msgid "Hello, world\n"
695 msgstr "Witaj świecie!\n"
696
697 #. type: SS
698 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
699 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
700 #, no-wrap
701 msgid "Program source: svshm_string.h"
702 msgstr "Kod źródłowy: svshm_string.h"
703
704 #. type: Plain text
705 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
706 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
707 msgid ""
708 "The following header file is included by the \"reader\" and \"writer\" "
709 "programs:"
710 msgstr ""
711 "Poniższy plik nagłówkowy jest dołączany przez programy: \\[Bq]odczytujący\\"
712 "[rq] i \\[Bq]zapisujący\\[rq]:"
713
714 #. type: Plain text
715 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
716 #: opensuse-tumbleweed
717 #, no-wrap
718 msgid ""
719 "/* svshm_string.h\n"
720 "\\&\n"
721 " Licensed under GNU General Public License v2 or later.\n"
722 "*/\n"
723 "#ifndef SVSHM_STRING_H\n"
724 "#define SVSHM_STRING_H\n"
725 "\\&\n"
726 "#include E<lt>err.hE<gt>\n"
727 "#include E<lt>stdio.hE<gt>\n"
728 "#include E<lt>stdlib.hE<gt>\n"
729 "#include E<lt>sys/sem.hE<gt>\n"
730 "\\&\n"
731 "union semun { /* Used in calls to semctl() */\n"
732 " int val;\n"
733 " struct semid_ds *buf;\n"
734 " unsigned short *array;\n"
735 "#if defined(__linux__)\n"
736 " struct seminfo *__buf;\n"
737 "#endif\n"
738 "};\n"
739 "\\&\n"
740 "#define MEM_SIZE 4096\n"
741 "\\&\n"
742 "#endif // include guard\n"
743 msgstr ""
744 "/* svshm_string.h\n"
745 "\\&\n"
746 " Na licencji GNU General Public License v2 lub późniejszej.\n"
747 "*/\n"
748 "#ifndef SVSHM_STRING_H\n"
749 "#define SVSHM_STRING_H\n"
750 "\\&\n"
751 "#include E<lt>err.hE<gt>\n"
752 "#include E<lt>stdio.hE<gt>\n"
753 "#include E<lt>stdlib.hE<gt>\n"
754 "#include E<lt>sys/sem.hE<gt>\n"
755 "\\&\n"
756 "union semun { /* Używane w wywołaniach do semctl() */\n"
757 " int val;\n"
758 " struct semid_ds *buf;\n"
759 " unsigned short *array;\n"
760 "#if defined(__linux__)\n"
761 " struct seminfo *__buf;\n"
762 "#endif\n"
763 "};\n"
764 "\\&\n"
765 "#define MEM_SIZE 4096\n"
766 "\\&\n"
767 "#endif // include guard (ochr. przed wielokr. przetw.)\n"
768
769 #. type: SS
770 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
771 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
772 #, no-wrap
773 msgid "Program source: svshm_string_read.c"
774 msgstr "Kod źródłowy programu: svshm_string_read.c"
775
776 #. type: Plain text
777 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
778 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
779 msgid ""
780 "The \"reader\" program creates a shared memory segment and a semaphore set "
781 "containing one semaphore. It then attaches the shared memory object into "
782 "its address space and initializes the semaphore value to 1. Finally, the "
783 "program waits for the semaphore value to become 0, and afterwards prints the "
784 "string that has been copied into the shared memory segment by the \"writer\"."
785 msgstr ""
786 "Program \\[Bq]odczytujący\\[rq] tworzy segment pamięci dzielonej i zestaw "
787 "semaforów, zawierający jeden semafor. Następnie dołącza obiekt pamięci "
788 "dzielonej do swojej przestrzeni adresowej i inicjuje wartość semafora na 1. "
789 "Na końcu, oczekuje na przyjęcie przez semafor wartości 0; wówczas wypisuje "
790 "łańcuch, który został skopiowany do segmentu pamięci dzielonej przez program "
791 "\\[Bq]zapisujący\\[rq]."
792
793 #. type: Plain text
794 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
795 #: opensuse-tumbleweed
796 #, no-wrap
797 msgid ""
798 "/* svshm_string_read.c\n"
799 "\\&\n"
800 " Licensed under GNU General Public License v2 or later.\n"
801 "*/\n"
802 "#include E<lt>err.hE<gt>\n"
803 "#include E<lt>stdio.hE<gt>\n"
804 "#include E<lt>stdlib.hE<gt>\n"
805 "#include E<lt>sys/ipc.hE<gt>\n"
806 "#include E<lt>sys/sem.hE<gt>\n"
807 "#include E<lt>sys/shm.hE<gt>\n"
808 "\\&\n"
809 "#include \"svshm_string.h\"\n"
810 "\\&\n"
811 "int\n"
812 "main(void)\n"
813 "{\n"
814 " int semid, shmid;\n"
815 " char *addr;\n"
816 " union semun arg, dummy;\n"
817 " struct sembuf sop;\n"
818 "\\&\n"
819 " /* Create shared memory and semaphore set containing one\n"
820 " semaphore. */\n"
821 "\\&\n"
822 " shmid = shmget(IPC_PRIVATE, MEM_SIZE, IPC_CREAT | 0600);\n"
823 " if (shmid == -1)\n"
824 " err(EXIT_FAILURE, \"shmget\");\n"
825 "\\&\n"
826 " semid = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600);\n"
827 " if (semid == -1)\n"
828 " err(EXIT_FAILURE, \"semget\");\n"
829 "\\&\n"
830 " /* Attach shared memory into our address space. */\n"
831 "\\&\n"
832 " addr = shmat(shmid, NULL, SHM_RDONLY);\n"
833 " if (addr == (void *) -1)\n"
834 " err(EXIT_FAILURE, \"shmat\");\n"
835 "\\&\n"
836 " /* Initialize semaphore 0 in set with value 1. */\n"
837 "\\&\n"
838 " arg.val = 1;\n"
839 " if (semctl(semid, 0, SETVAL, arg) == -1)\n"
840 " err(EXIT_FAILURE, \"semctl\");\n"
841 "\\&\n"
842 " printf(\"shmid = %d\\[rs]n\", shmid);\n"
843 " printf(\"semid = %d\\[rs]n\", semid);\n"
844 "\\&\n"
845 " /* Wait for semaphore value to become 0. */\n"
846 "\\&\n"
847 " sop.sem_num = 0;\n"
848 " sop.sem_op = 0;\n"
849 " sop.sem_flg = 0;\n"
850 "\\&\n"
851 " if (semop(semid, &sop, 1) == -1)\n"
852 " err(EXIT_FAILURE, \"semop\");\n"
853 "\\&\n"
854 " /* Print the string from shared memory. */\n"
855 "\\&\n"
856 " printf(\"%s\\[rs]n\", addr);\n"
857 "\\&\n"
858 " /* Remove shared memory and semaphore set. */\n"
859 "\\&\n"
860 " if (shmctl(shmid, IPC_RMID, NULL) == -1)\n"
861 " err(EXIT_FAILURE, \"shmctl\");\n"
862 " if (semctl(semid, 0, IPC_RMID, dummy) == -1)\n"
863 " err(EXIT_FAILURE, \"semctl\");\n"
864 "\\&\n"
865 " exit(EXIT_SUCCESS);\n"
866 "}\n"
867 msgstr ""
868 "/* svshm_string_read.c\n"
869 "\\&\n"
870 " Na licencji GNU General Public License v2 lub późniejszej.\n"
871 "*/\n"
872 "#include E<lt>err.hE<gt>\n"
873 "#include E<lt>stdio.hE<gt>\n"
874 "#include E<lt>stdlib.hE<gt>\n"
875 "#include E<lt>sys/ipc.hE<gt>\n"
876 "#include E<lt>sys/sem.hE<gt>\n"
877 "#include E<lt>sys/shm.hE<gt>\n"
878 "\\&\n"
879 "#include \"svshm_string.h\"\n"
880 "\\&\n"
881 "int\n"
882 "main(void)\n"
883 "{\n"
884 " int semid, shmid;\n"
885 " char *addr;\n"
886 " union semun arg, dummy;\n"
887 " struct sembuf sop;\n"
888 "\\&\n"
889 " /* Utworzenie pamięci dzielonej i zestawu semaforów, zawierającego\n"
890 " jeden semafor. */\n"
891 "\\&\n"
892 " shmid = shmget(IPC_PRIVATE, MEM_SIZE, IPC_CREAT | 0600);\n"
893 " if (shmid == -1)\n"
894 " err(EXIT_FAILURE, \"shmget\");\n"
895 "\\&\n"
896 " semid = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600);\n"
897 " if (semid == -1)\n"
898 " err(EXIT_FAILURE, \"semget\");\n"
899 "\\&\n"
900 " /* Dołączenie pamięci dzielonej do naszej przestrzeni adresowej. */\n"
901 "\\&\n"
902 " addr = shmat(shmid, NULL, SHM_RDONLY);\n"
903 " if (addr == (void *) -1)\n"
904 " err(EXIT_FAILURE, \"shmat\");\n"
905 "\\&\n"
906 " /* Zainicjowanie semafora 0 w zestawie, z wartością 1. */\n"
907 "\\&\n"
908 " arg.val = 1;\n"
909 " if (semctl(semid, 0, SETVAL, arg) == -1)\n"
910 " err(EXIT_FAILURE, \"semctl\");\n"
911 "\\&\n"
912 " printf(\"shmid = %d\\[rs]n\", shmid);\n"
913 " printf(\"semid = %d\\[rs]n\", semid);\n"
914 "\\&\n"
915 " /* Oczekiwanie na przyjęcie przez semafor wartości 0. */\n"
916 "\\&\n"
917 " sop.sem_num = 0;\n"
918 " sop.sem_op = 0;\n"
919 " sop.sem_flg = 0;\n"
920 "\\&\n"
921 " if (semop(semid, &sop, 1) == -1)\n"
922 " err(EXIT_FAILURE, \"semop\");\n"
923 "\\&\n"
924 " /* Wypisanie łańcucha z pamięci dzielonej. */\n"
925 "x\\&\n"
926 " printf(\"%s\\[rs]n\", addr);\n"
927 "\\&\n"
928 " /* Usunięcie pamięci dzielonej i zestawu semaforów. */\n"
929 "\\&\n"
930 " if (shmctl(shmid, IPC_RMID, NULL) == -1)\n"
931 " err(EXIT_FAILURE, \"shmctl\");\n"
932 " if (semctl(semid, 0, IPC_RMID, dummy) == -1)\n"
933 " err(EXIT_FAILURE, \"semctl\");\n"
934 "\\&\n"
935 " exit(EXIT_SUCCESS);\n"
936 "}\n"
937
938 #. type: SS
939 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
940 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
941 #, no-wrap
942 msgid "Program source: svshm_string_write.c"
943 msgstr "Kod źródłowy programu: svshm_string_write.c"
944
945 #. type: Plain text
946 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
947 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
948 msgid ""
949 "The writer program takes three command-line arguments: the IDs of the shared "
950 "memory segment and semaphore set that have already been created by the "
951 "\"reader\", and a string. It attaches the shared memory segment into its "
952 "address space, and then decrements the semaphore value to 0 in order to "
953 "inform the \"reader\" that it can now examine the contents of the shared "
954 "memory."
955 msgstr ""
956 "Program \\[Bq]zapisujący\\[rq] przyjmuje trzy argumenty w wierszu polecenia: "
957 "identyfikatory: segmentu pamięci dzielonej i zestawu semaforów utworzone "
958 "przez program \\[Bq]odczytujący\\[rq] oraz łańcuch. Dołącza on istniejący "
959 "segment pamięci dzielonej do swojej przestrzeni adresowej i zmniejsza "
960 "wartość semafora na 0, w celu poinformowania programu \\[Bq]odczytującego\\"
961 "[rq], że może on teraz sprawdzić zawartość pamięci dzielonej."
962
963 #. type: Plain text
964 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
965 #: opensuse-tumbleweed
966 #, no-wrap
967 msgid ""
968 "/* svshm_string_write.c\n"
969 "\\&\n"
970 " Licensed under GNU General Public License v2 or later.\n"
971 "*/\n"
972 "#include E<lt>err.hE<gt>\n"
973 "#include E<lt>stdio.hE<gt>\n"
974 "#include E<lt>stdlib.hE<gt>\n"
975 "#include E<lt>string.hE<gt>\n"
976 "#include E<lt>sys/sem.hE<gt>\n"
977 "#include E<lt>sys/shm.hE<gt>\n"
978 "\\&\n"
979 "#include \"svshm_string.h\"\n"
980 "\\&\n"
981 "int\n"
982 "main(int argc, char *argv[])\n"
983 "{\n"
984 " int semid, shmid;\n"
985 " char *addr;\n"
986 " size_t size;\n"
987 " struct sembuf sop;\n"
988 "\\&\n"
989 " if (argc != 4) {\n"
990 " fprintf(stderr, \"Usage: %s shmid semid string\\[rs]n\", argv[0]);\n"
991 " exit(EXIT_FAILURE);\n"
992 " }\n"
993 "\\&\n"
994 " size = strlen(argv[3]) + 1; /* +1 to include trailing \\[aq]\\[rs]0\\[aq] */\n"
995 " if (size E<gt> MEM_SIZE) {\n"
996 " fprintf(stderr, \"String is too big!\\[rs]n\");\n"
997 " exit(EXIT_FAILURE);\n"
998 " }\n"
999 "\\&\n"
1000 " /* Get object IDs from command-line. */\n"
1001 "\\&\n"
1002 " shmid = atoi(argv[1]);\n"
1003 " semid = atoi(argv[2]);\n"
1004 "\\&\n"
1005 " /* Attach shared memory into our address space and copy string\n"
1006 " (including trailing null byte) into memory. */\n"
1007 "\\&\n"
1008 " addr = shmat(shmid, NULL, 0);\n"
1009 " if (addr == (void *) -1)\n"
1010 " err(EXIT_FAILURE, \"shmat\");\n"
1011 "\\&\n"
1012 " memcpy(addr, argv[3], size);\n"
1013 "\\&\n"
1014 " /* Decrement semaphore to 0. */\n"
1015 "\\&\n"
1016 " sop.sem_num = 0;\n"
1017 " sop.sem_op = -1;\n"
1018 " sop.sem_flg = 0;\n"
1019 "\\&\n"
1020 " if (semop(semid, &sop, 1) == -1)\n"
1021 " err(EXIT_FAILURE, \"semop\");\n"
1022 "\\&\n"
1023 " exit(EXIT_SUCCESS);\n"
1024 "}\n"
1025 msgstr ""
1026 "/* svshm_string_write.c\n"
1027 "\\&\n"
1028 " Na licencji GNU General Public License v2 lub późniejszej.\n"
1029 "*/\n"
1030 "#include E<lt>err.hE<gt>\n"
1031 "#include E<lt>stdio.hE<gt>\n"
1032 "#include E<lt>stdlib.hE<gt>\n"
1033 "#include E<lt>string.hE<gt>\n"
1034 "#include E<lt>sys/sem.hE<gt>\n"
1035 "#include E<lt>sys/shm.hE<gt>\n"
1036 "\\&\n"
1037 "#include \"svshm_string.h\"\n"
1038 "\\&\n"
1039 "int\n"
1040 "main(int argc, char *argv[])\n"
1041 "{\n"
1042 " int semid, shmid;\n"
1043 " char *addr;\n"
1044 " size_t size;\n"
1045 " struct sembuf sop;\n"
1046 "\\&\n"
1047 " if (argc != 4) {\n"
1048 " fprintf(stderr, \"Użycie: %s shmid semid łańcuch\\[rs]n\", argv[0]);\n"
1049 " exit(EXIT_FAILURE);\n"
1050 " }\n"
1051 "\\&\n"
1052 " size = strlen(argv[3]) + 1; /* +1 aby objąć końcowe \\[aq]\\[rs]0\\[aq] */\n"
1053 " if (size E<gt> MEM_SIZE) {\n"
1054 " fprintf(stderr, \"Łańcuch jest zbyt długi!\\[rs]n\");\n"
1055 " exit(EXIT_FAILURE);\n"
1056 " }\n"
1057 "\\&\n"
1058 " /* Pobranie ID obiektów z wiersza polecenia. */\n"
1059 "\\&\n"
1060 " shmid = atoi(argv[1]);\n"
1061 " semid = atoi(argv[2]);\n"
1062 "\\&\n"
1063 " /* Dołączenie pamięci dzielonej do naszej przestrzeni adresowej\n"
1064 " i skopiowanie łańcucha (wraz z końcowym bajtem null) do pamięci. */\n"
1065 "\\&\n"
1066 " addr = shmat(shmid, NULL, 0);\n"
1067 " if (addr == (void *) -1)\n"
1068 " err(EXIT_FAILURE, \"shmat\");\n"
1069 "\\&\n"
1070 " memcpy(addr, argv[3], size);\n"
1071 "\\&\n"
1072 " /* Zmniejszenie semafora do 0. */\n"
1073 "\\&\n"
1074 " sop.sem_num = 0;\n"
1075 " sop.sem_op = -1;\n"
1076 " sop.sem_flg = 0;\n"
1077 "\\&\n"
1078 " if (semop(semid, &sop, 1) == -1)\n"
1079 " err(EXIT_FAILURE, \"semop\");\n"
1080 "\\&\n"
1081 " exit(EXIT_SUCCESS);\n"
1082 "}\n"
1083
1084 #. type: SH
1085 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1086 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1087 #, no-wrap
1088 msgid "SEE ALSO"
1089 msgstr "ZOBACZ TAKŻE"
1090
1091 #. type: Plain text
1092 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1093 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1094 msgid ""
1095 "B<brk>(2), B<mmap>(2), B<shmctl>(2), B<shmget>(2), B<capabilities>(7), "
1096 "B<shm_overview>(7), B<sysvipc>(7)"
1097 msgstr ""
1098 "B<brk>(2), B<mmap>(2), B<shmctl>(2), B<shmget>(2), B<capabilities>(7), "
1099 "B<shm_overview>(7), B<sysvipc>(7)"
1100
1101 #. type: TH
1102 #: debian-trixie
1103 #, no-wrap
1104 msgid "2024-06-15"
1105 msgstr "15 czerwca 2024 r."
1106
1107 #. type: TH
1108 #: debian-trixie
1109 #, no-wrap
1110 msgid "Linux man-pages 6.9.1"
1111 msgstr "Linux man-pages 6.9.1"
1112
1113 #. type: Plain text
1114 #: debian-trixie
1115 msgid "Standard C library (I<libc>, I<-lc>)"
1116 msgstr "Standardowa biblioteka C (I<libc>, I<-lc>)"
1117
1118 #. type: Plain text
1119 #: debian-trixie fedora-44 fedora-rawhide
1120 msgid ""
1121 "Invalid I<shmid> value, unaligned (i.e., not page-aligned and B<SHM_RND> was "
1122 "not specified) or invalid I<shmaddr> value, or can't attach segment at "
1123 "I<shmaddr>, or B<SHM_REMAP> was specified and I<shmaddr> was NULL."
1124 msgstr ""
1125 "Niewłaściwa wartość parametru I<shmid>, niewyrównana (do granicy strony i "
1126 "nie podano B<SHM_RND>) lub niepoprawna wartość I<shmaddr> albo nieudane "
1127 "dołączenie pod adresem I<shmaddr> lub został podany znacznik B<SHM_REMAP>, "
1128 "podczas gdy I<shmaddr> było równe NULL."
1129
1130 #. type: Plain text
1131 #: debian-trixie fedora-44 fedora-rawhide
1132 #, no-wrap
1133 msgid ""
1134 "$ B<./svshm_string_read>\n"
1135 "shmid = 1114194; semid = 15\n"
1136 msgstr ""
1137 "$ B<./svshm_string_read>\n"
1138 "shmid = 1114194; semid = 15\n"
1139
1140 #. type: Plain text
1141 #: debian-trixie fedora-44 fedora-rawhide
1142 #, no-wrap
1143 msgid "$ B<./svshm_string_write 1114194 15 \\[aq]Hello, world\\[aq]>\n"
1144 msgstr "$ B<./svshm_string_write 1114194 15 \\[aq]Witaj świecie!\\[aq]>\n"
1145
1146 #. type: Plain text
1147 #: debian-trixie fedora-44 fedora-rawhide
1148 #, no-wrap
1149 msgid ""
1150 "/* svshm_string.h\n"
1151 "\\&\n"
1152 " Licensed under GNU General Public License v2 or later.\n"
1153 "*/\n"
1154 "#ifndef SVSHM_STRING_H\n"
1155 "#define SVSHM_STRING_H\n"
1156 "\\&\n"
1157 "#include E<lt>stdio.hE<gt>\n"
1158 "#include E<lt>stdlib.hE<gt>\n"
1159 "#include E<lt>sys/sem.hE<gt>\n"
1160 "\\&\n"
1161 "#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\[rs]\n"
1162 " } while (0)\n"
1163 "\\&\n"
1164 "union semun { /* Used in calls to semctl() */\n"
1165 " int val;\n"
1166 " struct semid_ds *buf;\n"
1167 " unsigned short *array;\n"
1168 "#if defined(__linux__)\n"
1169 " struct seminfo *__buf;\n"
1170 "#endif\n"
1171 "};\n"
1172 "\\&\n"
1173 "#define MEM_SIZE 4096\n"
1174 "\\&\n"
1175 "#endif // include guard\n"
1176 msgstr ""
1177 "/* svshm_string.h\n"
1178 "\\&\n"
1179 " Na licencji GNU General Public License v2 lub późniejszej.\n"
1180 "*/\n"
1181 "#ifndef SVSHM_STRING_H\n"
1182 "#define SVSHM_STRING_H\n"
1183 "\\&\n"
1184 "#include E<lt>stdio.hE<gt>\n"
1185 "#include E<lt>stdlib.hE<gt>\n"
1186 "#include E<lt>sys/sem.hE<gt>\n"
1187 "\\&\n"
1188 "#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\[rs]\n"
1189 " } while (0)\n"
1190 "\\&\n"
1191 "union semun { /* Używane w wywołaniach do semctl() */\n"
1192 " int val;\n"
1193 " struct semid_ds *buf;\n"
1194 " unsigned short *array;\n"
1195 "#if defined(__linux__)\n"
1196 " struct seminfo *__buf;\n"
1197 "#endif\n"
1198 "};\n"
1199 "\\&\n"
1200 "#define MEM_SIZE 4096\n"
1201 "\\&\n"
1202 "#endif // include guard (ochr. przed wielokr. przetw.)\n"
1203
1204 #. type: Plain text
1205 #: debian-trixie fedora-44 fedora-rawhide
1206 #, no-wrap
1207 msgid ""
1208 "/* svshm_string_read.c\n"
1209 "\\&\n"
1210 " Licensed under GNU General Public License v2 or later.\n"
1211 "*/\n"
1212 "#include E<lt>stdio.hE<gt>\n"
1213 "#include E<lt>stdlib.hE<gt>\n"
1214 "#include E<lt>sys/ipc.hE<gt>\n"
1215 "#include E<lt>sys/sem.hE<gt>\n"
1216 "#include E<lt>sys/shm.hE<gt>\n"
1217 "\\&\n"
1218 "#include \"svshm_string.h\"\n"
1219 "\\&\n"
1220 "int\n"
1221 "main(void)\n"
1222 "{\n"
1223 " int semid, shmid;\n"
1224 " char *addr;\n"
1225 " union semun arg, dummy;\n"
1226 " struct sembuf sop;\n"
1227 "\\&\n"
1228 " /* Create shared memory and semaphore set containing one\n"
1229 " semaphore. */\n"
1230 "\\&\n"
1231 " shmid = shmget(IPC_PRIVATE, MEM_SIZE, IPC_CREAT | 0600);\n"
1232 " if (shmid == -1)\n"
1233 " errExit(\"shmget\");\n"
1234 "\\&\n"
1235 " semid = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600);\n"
1236 " if (semid == -1)\n"
1237 " errExit(\"semget\");\n"
1238 "\\&\n"
1239 " /* Attach shared memory into our address space. */\n"
1240 "\\&\n"
1241 " addr = shmat(shmid, NULL, SHM_RDONLY);\n"
1242 " if (addr == (void *) -1)\n"
1243 " errExit(\"shmat\");\n"
1244 "\\&\n"
1245 " /* Initialize semaphore 0 in set with value 1. */\n"
1246 "\\&\n"
1247 " arg.val = 1;\n"
1248 " if (semctl(semid, 0, SETVAL, arg) == -1)\n"
1249 " errExit(\"semctl\");\n"
1250 "\\&\n"
1251 " printf(\"shmid = %d; semid = %d\\[rs]n\", shmid, semid);\n"
1252 "\\&\n"
1253 " /* Wait for semaphore value to become 0. */\n"
1254 "\\&\n"
1255 " sop.sem_num = 0;\n"
1256 " sop.sem_op = 0;\n"
1257 " sop.sem_flg = 0;\n"
1258 "\\&\n"
1259 " if (semop(semid, &sop, 1) == -1)\n"
1260 " errExit(\"semop\");\n"
1261 "\\&\n"
1262 " /* Print the string from shared memory. */\n"
1263 "\\&\n"
1264 " printf(\"%s\\[rs]n\", addr);\n"
1265 "\\&\n"
1266 " /* Remove shared memory and semaphore set. */\n"
1267 "\\&\n"
1268 " if (shmctl(shmid, IPC_RMID, NULL) == -1)\n"
1269 " errExit(\"shmctl\");\n"
1270 " if (semctl(semid, 0, IPC_RMID, dummy) == -1)\n"
1271 " errExit(\"semctl\");\n"
1272 "\\&\n"
1273 " exit(EXIT_SUCCESS);\n"
1274 "}\n"
1275 msgstr ""
1276 "/* svshm_string_read.c\n"
1277 "\\&\n"
1278 " Na licencji GNU General Public License v2 lub późniejszej.\n"
1279 "*/\n"
1280 "#include E<lt>stdio.hE<gt>\n"
1281 "#include E<lt>stdlib.hE<gt>\n"
1282 "#include E<lt>sys/ipc.hE<gt>\n"
1283 "#include E<lt>sys/sem.hE<gt>\n"
1284 "#include E<lt>sys/shm.hE<gt>\n"
1285 "\\&\n"
1286 "#include \"svshm_string.h\"\n"
1287 "\\&\n"
1288 "int\n"
1289 "main(void)\n"
1290 "{\n"
1291 " int semid, shmid;\n"
1292 " char *addr;\n"
1293 " union semun arg, dummy;\n"
1294 " struct sembuf sop;\n"
1295 "\\&\n"
1296 " /* Utworzenie pamięci dzielonej i zestawu semaforów, zawierającego\n"
1297 " jeden semafor. */\n"
1298 "\\&\n"
1299 " shmid = shmget(IPC_PRIVATE, MEM_SIZE, IPC_CREAT | 0600);\n"
1300 " if (shmid == -1)\n"
1301 " errExit(\"shmget\");\n"
1302 "\\&\n"
1303 " semid = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600);\n"
1304 " if (semid == -1)\n"
1305 " errExit(\"semget\");\n"
1306 "\\&\n"
1307 " /* Dołączenie pamięci dzielonej do naszej przestrzeni adresowej. */\n"
1308 "\\&\n"
1309 " addr = shmat(shmid, NULL, SHM_RDONLY);\n"
1310 " if (addr == (void *) -1)\n"
1311 " errExit(\"shmat\");\n"
1312 "\\&\n"
1313 " /* Zainicjowanie semafora 0 w zestawie, z wartością 1. */\n"
1314 "\\&\n"
1315 " arg.val = 1;\n"
1316 " if (semctl(semid, 0, SETVAL, arg) == -1)\n"
1317 " errExit(\"semctl\");\n"
1318 "\\&\n"
1319 " printf(\"shmid = %d; semid = %d\\[rs]n\", shmid, semid);\n"
1320 "\\&\n"
1321 " /* Oczekiwanie na przyjęcie przez semafor wartości 0. */\n"
1322 "\\&\n"
1323 " sop.sem_num = 0;\n"
1324 " sop.sem_op = 0;\n"
1325 " sop.sem_flg = 0;\n"
1326 "\\&\n"
1327 " if (semop(semid, &sop, 1) == -1)\n"
1328 " errExit(\"semop\");\n"
1329 "\\&\n"
1330 " /* Wypisanie łańcucha z pamięci dzielonej. */\n"
1331 "\\&\n"
1332 " printf(\"%s\\[rs]n\", addr);\n"
1333 "\\&\n"
1334 " /* Usunięcie pamięci dzielonej i zestawu semaforów. */\n"
1335 "\\&\n"
1336 " if (shmctl(shmid, IPC_RMID, NULL) == -1)\n"
1337 " errExit(\"shmctl\");\n"
1338 " if (semctl(semid, 0, IPC_RMID, dummy) == -1)\n"
1339 " errExit(\"semctl\");\n"
1340 "\\&\n"
1341 " exit(EXIT_SUCCESS);\n"
1342 "}\n"
1343
1344 #. type: Plain text
1345 #: debian-trixie
1346 #, no-wrap
1347 msgid ""
1348 "/* svshm_string_write.c\n"
1349 "\\&\n"
1350 " Licensed under GNU General Public License v2 or later.\n"
1351 "*/\n"
1352 "#include E<lt>stdio.hE<gt>\n"
1353 "#include E<lt>stdlib.hE<gt>\n"
1354 "#include E<lt>string.hE<gt>\n"
1355 "#include E<lt>sys/sem.hE<gt>\n"
1356 "#include E<lt>sys/shm.hE<gt>\n"
1357 "\\&\n"
1358 "#include \"svshm_string.h\"\n"
1359 "\\&\n"
1360 "int\n"
1361 "main(int argc, char *argv[])\n"
1362 "{\n"
1363 " int semid, shmid;\n"
1364 " char *addr;\n"
1365 " size_t len;\n"
1366 " struct sembuf sop;\n"
1367 "\\&\n"
1368 " if (argc != 4) {\n"
1369 " fprintf(stderr, \"Usage: %s shmid semid string\\[rs]n\", argv[0]);\n"
1370 " exit(EXIT_FAILURE);\n"
1371 " }\n"
1372 "\\&\n"
1373 " len = strlen(argv[3]) + 1; /* +1 to include trailing \\[aq]\\[rs]0\\[aq] */\n"
1374 " if (len E<gt> MEM_SIZE) {\n"
1375 " fprintf(stderr, \"String is too big!\\[rs]n\");\n"
1376 " exit(EXIT_FAILURE);\n"
1377 " }\n"
1378 "\\&\n"
1379 " /* Get object IDs from command-line. */\n"
1380 "\\&\n"
1381 " shmid = atoi(argv[1]);\n"
1382 " semid = atoi(argv[2]);\n"
1383 "\\&\n"
1384 " /* Attach shared memory into our address space and copy string\n"
1385 " (including trailing null byte) into memory. */\n"
1386 "\\&\n"
1387 " addr = shmat(shmid, NULL, 0);\n"
1388 " if (addr == (void *) -1)\n"
1389 " errExit(\"shmat\");\n"
1390 "\\&\n"
1391 " memcpy(addr, argv[3], len);\n"
1392 "\\&\n"
1393 " /* Decrement semaphore to 0. */\n"
1394 "\\&\n"
1395 " sop.sem_num = 0;\n"
1396 " sop.sem_op = -1;\n"
1397 " sop.sem_flg = 0;\n"
1398 "\\&\n"
1399 " if (semop(semid, &sop, 1) == -1)\n"
1400 " errExit(\"semop\");\n"
1401 "\\&\n"
1402 " exit(EXIT_SUCCESS);\n"
1403 "}\n"
1404 msgstr ""
1405 "/* svshm_string_write.c\n"
1406 "\\&\n"
1407 " Na licencji GNU General Public License v2 lub późniejszej.\n"
1408 "*/\n"
1409 "#include E<lt>stdio.hE<gt>\n"
1410 "#include E<lt>stdlib.hE<gt>\n"
1411 "#include E<lt>string.hE<gt>\n"
1412 "#include E<lt>sys/sem.hE<gt>\n"
1413 "#include E<lt>sys/shm.hE<gt>\n"
1414 "\\&\n"
1415 "#include \"svshm_string.h\"\n"
1416 "\\&\n"
1417 "int\n"
1418 "main(int argc, char *argv[])\n"
1419 "{\n"
1420 " int semid, shmid;\n"
1421 " char *addr;\n"
1422 " size_t len;\n"
1423 " struct sembuf sop;\n"
1424 "\\&\n"
1425 " if (argc != 4) {\n"
1426 " fprintf(stderr, \"Użycie: %s shmid semid łańcuch\\[rs]n\", argv[0]);\n"
1427 " exit(EXIT_FAILURE);\n"
1428 " }\n"
1429 "\\&\n"
1430 " len = strlen(argv[3]) + 1; /* +1 aby objąć końcowe \\[aq]\\[rs]0\\[aq] */\n"
1431 " if (len E<gt> MEM_SIZE) {\n"
1432 " fprintf(stderr, \"Łańcuch jest zbyt długi!\\[rs]n\");\n"
1433 " exit(EXIT_FAILURE);\n"
1434 " }\n"
1435 "\\&\n"
1436 " /* Pobranie ID obiektów z wiersza polecenia. */\n"
1437 "\\&\n"
1438 " shmid = atoi(argv[1]);\n"
1439 " semid = atoi(argv[2]);\n"
1440 "\\&\n"
1441 " /* Dołączenie pamięci dzielonej do naszej przestrzeni adresowej\n"
1442 " i skopiowanie łańcucha (wraz z końcowym bajtem null) do pamięci. */\n"
1443 "\\&\n"
1444 " addr = shmat(shmid, NULL, 0);\n"
1445 " if (addr == (void *) -1)\n"
1446 " errExit(\"shmat\");\n"
1447 "\\&\n"
1448 " memcpy(addr, argv[3], len);\n"
1449 "\\&\n"
1450 " /* Zmniejszenie semafora do 0. */\n"
1451 "\\&\n"
1452 " sop.sem_num = 0;\n"
1453 " sop.sem_op = -1;\n"
1454 " sop.sem_flg = 0;\n"
1455 "\\&\n"
1456 " if (semop(semid, &sop, 1) == -1)\n"
1457 " errExit(\"semop\");\n"
1458 "\\&\n"
1459 " exit(EXIT_SUCCESS);\n"
1460 "}\n"
1461
1462 #. type: TH
1463 #: fedora-44 fedora-rawhide
1464 #, no-wrap
1465 msgid "2024-11-17"
1466 msgstr "17 listopada 2024 r."
1467
1468 #. type: TH
1469 #: fedora-44 fedora-rawhide
1470 #, no-wrap
1471 msgid "Linux man-pages 6.13"
1472 msgstr "Linux man-pages 6.13"
1473
1474 #. type: Plain text
1475 #: fedora-44 fedora-rawhide
1476 #, no-wrap
1477 msgid ""
1478 "/* svshm_string_write.c\n"
1479 "\\&\n"
1480 " Licensed under GNU General Public License v2 or later.\n"
1481 "*/\n"
1482 "#include E<lt>stdio.hE<gt>\n"
1483 "#include E<lt>stdlib.hE<gt>\n"
1484 "#include E<lt>string.hE<gt>\n"
1485 "#include E<lt>sys/sem.hE<gt>\n"
1486 "#include E<lt>sys/shm.hE<gt>\n"
1487 "\\&\n"
1488 "#include \"svshm_string.h\"\n"
1489 "\\&\n"
1490 "int\n"
1491 "main(int argc, char *argv[])\n"
1492 "{\n"
1493 " int semid, shmid;\n"
1494 " char *addr;\n"
1495 " size_t size;\n"
1496 " struct sembuf sop;\n"
1497 "\\&\n"
1498 " if (argc != 4) {\n"
1499 " fprintf(stderr, \"Usage: %s shmid semid string\\[rs]n\", argv[0]);\n"
1500 " exit(EXIT_FAILURE);\n"
1501 " }\n"
1502 "\\&\n"
1503 " size = strlen(argv[3]) + 1; /* +1 to include trailing \\[aq]\\[rs]0\\[aq] */\n"
1504 " if (size E<gt> MEM_SIZE) {\n"
1505 " fprintf(stderr, \"String is too big!\\[rs]n\");\n"
1506 " exit(EXIT_FAILURE);\n"
1507 " }\n"
1508 "\\&\n"
1509 " /* Get object IDs from command-line. */\n"
1510 "\\&\n"
1511 " shmid = atoi(argv[1]);\n"
1512 " semid = atoi(argv[2]);\n"
1513 "\\&\n"
1514 " /* Attach shared memory into our address space and copy string\n"
1515 " (including trailing null byte) into memory. */\n"
1516 "\\&\n"
1517 " addr = shmat(shmid, NULL, 0);\n"
1518 " if (addr == (void *) -1)\n"
1519 " errExit(\"shmat\");\n"
1520 "\\&\n"
1521 " memcpy(addr, argv[3], size);\n"
1522 "\\&\n"
1523 " /* Decrement semaphore to 0. */\n"
1524 "\\&\n"
1525 " sop.sem_num = 0;\n"
1526 " sop.sem_op = -1;\n"
1527 " sop.sem_flg = 0;\n"
1528 "\\&\n"
1529 " if (semop(semid, &sop, 1) == -1)\n"
1530 " errExit(\"semop\");\n"
1531 "\\&\n"
1532 " exit(EXIT_SUCCESS);\n"
1533 "}\n"
1534 msgstr ""
1535 "/* svshm_string_write.c\n"
1536 "\\&\n"
1537 " Na licencji GNU General Public License v2 lub późniejszej.\n"
1538 "*/\n"
1539 "#include E<lt>stdio.hE<gt>\n"
1540 "#include E<lt>stdlib.hE<gt>\n"
1541 "#include E<lt>string.hE<gt>\n"
1542 "#include E<lt>sys/sem.hE<gt>\n"
1543 "#include E<lt>sys/shm.hE<gt>\n"
1544 "\\&\n"
1545 "#include \"svshm_string.h\"\n"
1546 "\\&\n"
1547 "int\n"
1548 "main(int argc, char *argv[])\n"
1549 "{\n"
1550 " int semid, shmid;\n"
1551 " char *addr;\n"
1552 " size_t size;\n"
1553 " struct sembuf sop;\n"
1554 "\\&\n"
1555 " if (argc != 4) {\n"
1556 " fprintf(stderr, \"Użycie: %s shmid semid łańcuch\\[rs]n\", argv[0]);\n"
1557 " exit(EXIT_FAILURE);\n"
1558 " }\n"
1559 "\\&\n"
1560 " size = strlen(argv[3]) + 1; /* +1 aby objąć końcowe \\[aq]\\[rs]0\\[aq] */\n"
1561 " if (size E<gt> MEM_SIZE) {\n"
1562 " fprintf(stderr, \"Łańcuch jest zbyt długi!\\[rs]n\");\n"
1563 " exit(EXIT_FAILURE);\n"
1564 " }\n"
1565 "\\&\n"
1566 " /* Pobranie ID obiektów z wiersza polecenia. */\n"
1567 "\\&\n"
1568 " shmid = atoi(argv[1]);\n"
1569 " semid = atoi(argv[2]);\n"
1570 "\\&\n"
1571 " /* Dołączenie pamięci dzielonej do naszej przestrzeni adresowej\n"
1572 " i skopiowanie łańcucha (wraz z końcowym bajtem null) do pamięci. */\n"
1573 "\\&\n"
1574 " addr = shmat(shmid, NULL, 0);\n"
1575 " if (addr == (void *) -1)\n"
1576 " errExit(\"shmat\");\n"
1577 "\\&\n"
1578 " memcpy(addr, argv[3], size);\n"
1579 "\\&\n"
1580 " /* Zmniejszenie semafora do 0. */\n"
1581 "\\&\n"
1582 " sop.sem_num = 0;\n"
1583 " sop.sem_op = -1;\n"
1584 " sop.sem_flg = 0;\n"
1585 "\\&\n"
1586 " if (semop(semid, &sop, 1) == -1)\n"
1587 " errExit(\"semop\");\n"
1588 "\\&\n"
1589 " exit(EXIT_SUCCESS);\n"
1590 "}\n"
1591
1592 #. type: TH
1593 #: mageia-cauldron
1594 #, no-wrap
1595 msgid "Linux man-pages 6.17"
1596 msgstr "Linux man-pages 6.17"
1597
1598 #. type: TH
1599 #: opensuse-leap-16-1 opensuse-tumbleweed
1600 #, no-wrap
1601 msgid "Linux man-pages (unreleased)"
1602 msgstr "Linux man-pages (niewydane)"