Debian Codegraph @

po/ru/man2/shmop.2.po

raw
1 # Russian translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Alexander Golubev <[email protected]>, 2018.
5 # Azamat Hackimov <[email protected]>, 2011, 2014-2016.
6 # Hotellook, 2014.
7 # Nikita <[email protected]>, 2014.
8 # Spiros Georgaras <[email protected]>, 2016.
9 # Vladislav <[email protected]>, 2015.
10 # Yuri Kozlov <[email protected]>, 2011-2019.
11 # Иван Павлов <[email protected]>, 2017.
12 msgid ""
13 msgstr ""
14 "Project-Id-Version: manpages-l10n\n"
15 "POT-Creation-Date: 2026-06-05 06:43+0200\n"
16 "PO-Revision-Date: 2024-12-21 19:49+0300\n"
17 "Last-Translator: Yuri Kozlov <[email protected]>\n"
18 "Language-Team: Russian <[email protected]>\n"
19 "Language: ru\n"
20 "MIME-Version: 1.0\n"
21 "Content-Type: text/plain; charset=UTF-8\n"
22 "Content-Transfer-Encoding: 8bit\n"
23 "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
24 "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
25 "(n%100>=11 && n%100<=14)? 2 : 3);\n"
26 "X-Generator: Lokalize 2.0\n"
27
28 #. type: TH
29 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
30 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
31 #, no-wrap
32 msgid "SHMOP"
33 msgstr "SHMOP"
34
35 #. type: TH
36 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
37 #: opensuse-tumbleweed
38 #, no-wrap
39 msgid "2026-02-08"
40 msgstr "8 февраля 2026 г."
41
42 #. type: TH
43 #: archlinux debian-unstable
44 #, fuzzy, no-wrap
45 #| msgid "Linux man-pages 6.17"
46 msgid "Linux man-pages 6.18"
47 msgstr "Справочные страницы Linux 6.17"
48
49 #. type: SH
50 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
51 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
52 #, no-wrap
53 msgid "NAME"
54 msgstr "НАИМЕНОВАНИЕ"
55
56 #. type: Plain text
57 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
58 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
59 msgid "shmat, shmdt - System V shared memory operations"
60 msgstr "shmat, shmdt - операции с общей памятью System V"
61
62 #. type: SH
63 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
64 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
65 #, no-wrap
66 msgid "LIBRARY"
67 msgstr "БИБЛИОТЕКА"
68
69 #. type: Plain text
70 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
71 #: opensuse-leap-16-1 opensuse-tumbleweed
72 msgid "Standard C library (I<libc>,\\ I<-lc>)"
73 msgstr "Стандартная библиотека языка C (I<libc>,\\ I<-lc>)"
74
75 #. type: SH
76 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
77 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
78 #, no-wrap
79 msgid "SYNOPSIS"
80 msgstr "СИНТАКСИС"
81
82 #. type: Plain text
83 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
84 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
85 #, no-wrap
86 msgid "B<#include E<lt>sys/shm.hE<gt>>\n"
87 msgstr "B<#include E<lt>sys/shm.hE<gt>>\n"
88
89 #. type: Plain text
90 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
91 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
92 #, no-wrap
93 msgid ""
94 "B<void *shmat(int >I<shmid>B<, const void *_Nullable >I<shmaddr>B<, int >I<shmflg>B<);>\n"
95 "B<int shmdt(const void *>I<shmaddr>B<);>\n"
96 msgstr ""
97 "B<void *shmat(int >I<shmid>B<, const void *_Nullable >I<shmaddr>B<, int >I<shmflg>B<);>\n"
98 "B<int shmdt(const void *>I<shmaddr>B<);>\n"
99
100 #. type: SH
101 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
102 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
103 #, no-wrap
104 msgid "DESCRIPTION"
105 msgstr "ОПИСАНИЕ"
106
107 #. type: SS
108 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
109 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
110 #, no-wrap
111 msgid "shmat()"
112 msgstr "shmat()"
113
114 #. type: Plain text
115 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
116 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
117 msgid ""
118 "B<shmat>() attaches the System\\ V shared memory segment identified by "
119 "I<shmid> to the address space of the calling process. The attaching address "
120 "is specified by I<shmaddr> with one of the following criteria:"
121 msgstr ""
122 "Вызов B<shmat>() подключает сегмент общей памяти System\\ V с "
123 "идентификатором I<shmid> к адресному пространству вызывающего процесса. "
124 "Адрес подключения, указанный в I<shmaddr>, учитывается следующим образом:"
125
126 #. type: IP
127 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
128 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
129 #, no-wrap
130 msgid "\\[bu]"
131 msgstr "\\[bu]"
132
133 #. type: Plain text
134 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
135 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
136 msgid ""
137 "If I<shmaddr> is NULL, the system chooses a suitable (unused) page-aligned "
138 "address to attach the segment."
139 msgstr ""
140 "Если значение I<shmaddr> равно NULL, то система выбирает подходящий "
141 "(неиспользуемый) выровненный по странице адрес для подключения сегмента."
142
143 #. type: Plain text
144 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
145 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
146 msgid ""
147 "If I<shmaddr> isn't NULL and B<SHM_RND> is specified in I<shmflg>, the "
148 "attach occurs at the address equal to I<shmaddr> rounded down to the nearest "
149 "multiple of B<SHMLBA>."
150 msgstr ""
151 "Если значение I<shmaddr> не равно NULL, а в I<shmflg> указан флаг "
152 "B<SHM_RND>, то подключение производится по адресу I<shmaddr>, округлённому "
153 "до ближайшего значения кратного B<SHMLBA>."
154
155 #. type: Plain text
156 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
157 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
158 msgid ""
159 "Otherwise, I<shmaddr> must be a page-aligned address at which the attach "
160 "occurs."
161 msgstr ""
162 "В противном случае I<shmaddr> должно быть выровнено по адресу страницы, к "
163 "которому производится подключение."
164
165 #. type: Plain text
166 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
167 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
168 msgid ""
169 "In addition to B<SHM_RND>, the following flags may be specified in the "
170 "I<shmflg> bit-mask argument:"
171 msgstr ""
172 "В дополнении к B<SHM_RND>, в аргументе битовой маски I<shmflg> могут быть "
173 "указаны следующие флаги:"
174
175 #. type: TP
176 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
177 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
178 #, no-wrap
179 msgid "B<SHM_EXEC> (Linux-specific; since Linux 2.6.9)"
180 msgstr "B<SHM_EXEC> (есть только в Linux; начиная с Linux 2.6.9)"
181
182 #. type: Plain text
183 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
184 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
185 msgid ""
186 "Allow the contents of the segment to be executed. The caller must have "
187 "execute permission on the segment."
188 msgstr ""
189 "Разрешить выполнение содержимого сегмента. Вызывающий должен иметь права на "
190 "выполнение сегмента."
191
192 #. type: TP
193 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
194 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
195 #, no-wrap
196 msgid "B<SHM_RDONLY>"
197 msgstr "B<SHM_RDONLY>"
198
199 #. type: Plain text
200 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
201 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
202 msgid ""
203 "Attach the segment for read-only access. The process must have read "
204 "permission for the segment. If this flag is not specified, the segment is "
205 "attached for read and write access, and the process must have read and write "
206 "permission for the segment. There is no notion of a write-only shared "
207 "memory segment."
208 msgstr ""
209 "Разрешить доступ к сегменту только для чтения. Процесс должен иметь права на "
210 "чтение сегмента. Если этот флаг не указан, то сегмент подключается с правом "
211 "чтения и записи, и процесс должен иметь права на чтение и запись сегмента. "
212 "Об общих сегментах памяти, доступных только на запись, ничего не упоминается."
213
214 #. type: TP
215 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
216 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
217 #, no-wrap
218 msgid "B<SHM_REMAP> (Linux-specific)"
219 msgstr "B<SHM_REMAP> (есть только в Linux)"
220
221 #. type: Plain text
222 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
223 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
224 msgid ""
225 "This flag specifies that the mapping of the segment should replace any "
226 "existing mapping in the range starting at I<shmaddr> and continuing for the "
227 "size of the segment. (Normally, an B<EINVAL> error would result if a "
228 "mapping already exists in this address range.) In this case, I<shmaddr> "
229 "must not be NULL."
230 msgstr ""
231 "Этот флаг указывает, что отображение сегмента должно замещать любые "
232 "существующие отображения в диапазоне, начиная с I<shmaddr> и до размера "
233 "сегмента (обычно выдается ошибка B<EINVAL>, если в этом диапазоне адресов "
234 "уже есть отображение). В этом случае значение I<shmaddr> не должно быть "
235 "равно NULL."
236
237 #. type: Plain text
238 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
239 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
240 msgid ""
241 "The B<brk>(2) value of the calling process is not altered by the attach. "
242 "The segment will automatically be detached at process exit. The same "
243 "segment may be attached as a read and as a read-write one, and more than "
244 "once, in the process's address space."
245 msgstr ""
246 "Значение B<brk>(2) вызывающего процесса от подключения не изменяется. При "
247 "завершении работы процесса сегмент будет автоматически отсоединён. Один и "
248 "тот же сегмент может быть подключён в адресное пространство процесса "
249 "несколько раз, как только для чтения, так и для чтения-записи."
250
251 #. type: Plain text
252 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
253 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
254 msgid ""
255 "A successful B<shmat>() call updates the members of the I<shmid_ds> "
256 "structure (see B<shmctl>(2)) associated with the shared memory segment as "
257 "follows:"
258 msgstr ""
259 "При успешном выполнении системный вызов B<shmat>() обновляет поля структуры "
260 "I<shmid_ds> (см. B<shmctl>(2)), связанной с общим сегментом памяти, "
261 "следующим образом:"
262
263 #. type: Plain text
264 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
265 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
266 msgid "I<shm_atime> is set to the current time."
267 msgstr "Полю I<shm_atime> присваивается значение текущего времени."
268
269 #. type: Plain text
270 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
271 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
272 msgid "I<shm_lpid> is set to the process-ID of the calling process."
273 msgstr ""
274 "Значение I<shm_lpid> устанавливается равным идентификатору вызывающего "
275 "процесса."
276
277 #. type: Plain text
278 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
279 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
280 msgid "I<shm_nattch> is incremented by one."
281 msgstr "Значение I<shm_nattch> увеличивается на 1."
282
283 #. type: SS
284 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
285 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
286 #, no-wrap
287 msgid "shmdt()"
288 msgstr "shmdt()"
289
290 #. type: Plain text
291 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
292 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
293 msgid ""
294 "B<shmdt>() detaches the shared memory segment located at the address "
295 "specified by I<shmaddr> from the address space of the calling process. The "
296 "to-be-detached segment must be currently attached with I<shmaddr> equal to "
297 "the value returned by the attaching B<shmat>() call."
298 msgstr ""
299 "Вызов B<shmdt>() отключает сегмент общей памяти, находящийся по адресу "
300 "I<shmaddr>, от адресного пространства вызывающего процесса. Отключаемый "
301 "сегмент должен быть подключён по адресу I<shmaddr> с помощью вызова "
302 "B<shmat>()."
303
304 #. type: Plain text
305 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
306 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
307 msgid ""
308 "On a successful B<shmdt>() call, the system updates the members of the "
309 "I<shmid_ds> structure associated with the shared memory segment as follows:"
310 msgstr ""
311 "При успешном выполнении вызов B<shmdt>() обновляет поля структуры "
312 "I<shmid_ds>, связанной с общим сегментом памяти, следующим образом:"
313
314 #. type: Plain text
315 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
316 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
317 msgid "I<shm_dtime> is set to the current time."
318 msgstr "Полю I<shm_dtime> присваивается значение текущего времени."
319
320 #. type: Plain text
321 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
322 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
323 msgid ""
324 "I<shm_nattch> is decremented by one. If it becomes 0 and the segment is "
325 "marked for deletion, the segment is deleted."
326 msgstr ""
327 "Значение I<shm_nattch> уменьшается на 1. Если оно становится равным 0 и "
328 "сегмент помечен для удаления, то сегмент удаляется."
329
330 #. type: SH
331 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
332 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
333 #, no-wrap
334 msgid "RETURN VALUE"
335 msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ"
336
337 #. type: Plain text
338 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
339 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
340 #, fuzzy
341 #| msgid ""
342 #| "On success, B<shmat>() returns the address of the attached shared memory "
343 #| "segment; on error, I<(void\\ *)\\ -1> is returned, and I<errno> is set to "
344 #| "indicate the cause of the error."
345 msgid ""
346 "On success, B<shmat>() returns the address of the attached shared memory "
347 "segment; on error, I<(void\\ *)\\ -1> is returned, and I<errno> is set to "
348 "indicate the error."
349 msgstr ""
350 "При успешном выполнении B<shmat>() возвращается адрес подключённого общего "
351 "сегмента памяти; при ошибке возвращается I<(void\\ *)\\ -1>, а в I<errno> "
352 "содержится код ошибки."
353
354 #. type: Plain text
355 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
356 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
357 #, fuzzy
358 #| msgid ""
359 #| "On success, B<shmdt>() returns 0; on error -1 is returned, and I<errno> "
360 #| "is set to indicate the cause of the error."
361 msgid ""
362 "On success, B<shmdt>() returns 0; on error -1 is returned, and I<errno> is "
363 "set to indicate the error."
364 msgstr ""
365 "При успешном выполнении B<shmdt>() возвращается 0; при ошибке возвращается "
366 "-1, а в I<errno> содержится код ошибки."
367
368 #. type: SH
369 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
370 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
371 #, no-wrap
372 msgid "ERRORS"
373 msgstr "ОШИБКИ"
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 "B<shmat>() can fail with one of the following errors:"
379 msgstr "B<shmat>() может завершиться ошибкой из-за следующих ошибок:"
380
381 #. type: TP
382 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
383 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
384 #, no-wrap
385 msgid "B<EACCES>"
386 msgstr "B<EACCES>"
387
388 #. type: Plain text
389 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
390 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
391 msgid ""
392 "The calling process does not have the required permissions for the requested "
393 "attach type, and does not have the B<CAP_IPC_OWNER> capability in the user "
394 "namespace that governs its IPC namespace."
395 msgstr ""
396 "Вызывающий процесс не имеет прав для подключения заданного типа и не имеет "
397 "мандата B<CAP_IPC_OWNER> в пространстве имён пользователя, который управляет "
398 "его пространством имён IPC."
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<EIDRM>"
405 msgstr "B<EIDRM>"
406
407 #. type: Plain text
408 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
409 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
410 msgid "I<shmid> points to a removed identifier."
411 msgstr "Значение I<shmid> указывает на удалённый идентификатор."
412
413 #. type: TP
414 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
415 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
416 #, no-wrap
417 msgid "B<EINVAL>"
418 msgstr "B<EINVAL>"
419
420 #. type: Plain text
421 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
422 #: opensuse-tumbleweed
423 #, fuzzy
424 #| msgid ""
425 #| "Invalid I<shmid> value, unaligned (i.e., not page-aligned and B<SHM_RND> "
426 #| "was not specified) or invalid I<shmaddr> value, or can't attach segment "
427 #| "at I<shmaddr>, or B<SHM_REMAP> was specified and I<shmaddr> was NULL."
428 msgid ""
429 "Invalid I<shmid> value, unaligned (i.e., not page-aligned and B<SHM_RND> was "
430 "not specified) or invalid I<shmaddr> value, or can't attach segment at "
431 "I<shmaddr>, or B<SHM_REMAP> was specified and I<shmaddr> was NULL."
432 msgstr ""
433 "Неправильное значение I<shmid>, не выровненное (по границе страницы и не "
434 "указан B<SHM_RND>) или неправильное значение I<shmaddr>, или невозможно "
435 "подключить сегмент по адресу I<shmaddr>, или был указан B<SHM_REMAP>, но "
436 "I<shmaddr> равно NULL."
437
438 #. type: TP
439 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
440 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
441 #, no-wrap
442 msgid "B<ENOMEM>"
443 msgstr "B<ENOMEM>"
444
445 #. type: Plain text
446 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
447 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
448 msgid "Could not allocate memory for the descriptor or for the page tables."
449 msgstr "Невозможно выделить память для дескриптора или страничных таблиц."
450
451 #. type: Plain text
452 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
453 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
454 msgid "B<shmdt>() can fail with one of the following errors:"
455 msgstr "B<shmdt>() может завершиться ошибкой с одной из следующих ошибок:"
456
457 #. The following since Linux 2.6.17-rc1:
458 #. type: Plain text
459 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
460 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
461 msgid ""
462 "There is no shared memory segment attached at I<shmaddr>; or, I<shmaddr> is "
463 "not aligned on a page boundary."
464 msgstr ""
465 "По адресу I<shmaddr> подключённый общий сегмент памяти отсутствует; или "
466 "значение I<shmaddr> не выровнено по границе страницы."
467
468 #. type: SH
469 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
470 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
471 #, no-wrap
472 msgid "STANDARDS"
473 msgstr "СТАНДАРТЫ"
474
475 #. type: Plain text
476 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
477 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
478 msgid "POSIX.1-2008."
479 msgstr "POSIX.1-2008."
480
481 #. type: SH
482 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
483 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
484 #, no-wrap
485 msgid "HISTORY"
486 msgstr "ИСТОРИЯ"
487
488 #. SVr4 documents an additional error condition EMFILE.
489 #. type: Plain text
490 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
491 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
492 msgid "POSIX.1-2001, SVr4."
493 msgstr "POSIX.1-2001, SVr4."
494
495 #. type: Plain text
496 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
497 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
498 msgid ""
499 "In SVID 3 (or perhaps earlier), the type of the I<shmaddr> argument was "
500 "changed from I<char\\ *> into I<const void\\ *>, and the returned type of "
501 "B<shmat>() from I<char\\ *> into I<void\\ *>."
502 msgstr ""
503 "В SVID 3 (возможно, чуть раньше) тип аргумента I<shmaddr> изменён с I<char\\ "
504 "*> на I<const void\\ *>, а тип возвращаемого значения B<shmat>() с I<char\\ "
505 "*> на I<void\\ *>."
506
507 #. type: Plain text
508 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
509 #: opensuse-tumbleweed
510 msgid ""
511 "POSIX.1-2024 changed the error code from I<(void\\ *)\\ -1> to B<SHM_FAILED>."
512 msgstr ""
513
514 #. type: SH
515 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
516 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
517 #, no-wrap
518 msgid "NOTES"
519 msgstr "ПРИМЕЧАНИЯ"
520
521 #. type: Plain text
522 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
523 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
524 msgid ""
525 "After a B<fork>(2), the child inherits the attached shared memory segments."
526 msgstr ""
527 "При вызове B<fork>(2) потомки наследуют подключённые общие сегменты памяти."
528
529 #. type: Plain text
530 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
531 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
532 msgid ""
533 "After an B<execve>(2), all attached shared memory segments are detached from "
534 "the process."
535 msgstr ""
536 "При вызове B<execve>(2) все подключённые общие сегменты памяти отключаются."
537
538 #. type: Plain text
539 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
540 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
541 msgid ""
542 "Upon B<_exit>(2), all attached shared memory segments are detached from the "
543 "process."
544 msgstr ""
545 "При вызове B<_exit>(2) все подключённые общие сегменты памяти отключаются."
546
547 #. type: Plain text
548 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
549 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
550 msgid ""
551 "Using B<shmat>() with I<shmaddr> equal to NULL is the preferred, portable "
552 "way of attaching a shared memory segment. Be aware that the shared memory "
553 "segment attached in this way may be attached at different addresses in "
554 "different processes. Therefore, any pointers maintained within the shared "
555 "memory must be made relative (typically to the starting address of the "
556 "segment), rather than absolute."
557 msgstr ""
558 "Для улучшения переносимости программ при подключении общего сегмента памяти "
559 "рекомендуется использовать B<shmat>() с аргументом I<shmaddr>, установленным "
560 "в NULL. Необходимо учитывать, что сегмент памяти, подключаемый таким "
561 "способом, в разных процессах может подключаться по разным адресам. Поэтому "
562 "все указатели в области общей памяти должны быть не абсолютными, а "
563 "относительными (как правило относительно адреса начала сегмента)."
564
565 #. type: Plain text
566 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
567 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
568 msgid ""
569 "On Linux, it is possible to attach a shared memory segment even if it is "
570 "already marked to be deleted. However, POSIX.1 does not specify this "
571 "behavior and many other implementations do not support it."
572 msgstr ""
573 "В Linux сегмент общей памяти можно подключить даже, если он помечен для "
574 "удаление. Однако в POSIX.1 об этом ничего не сказано, и многие другие "
575 "реализации это не поддерживают."
576
577 #. type: Plain text
578 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
579 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
580 msgid "The following system parameter affects B<shmat>():"
581 msgstr "На работу B<shmat>() влияют следующие системные параметры:"
582
583 #. type: TP
584 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
585 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
586 #, no-wrap
587 msgid "B<SHMLBA>"
588 msgstr "B<SHMLBA>"
589
590 #. type: Plain text
591 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
592 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
593 msgid ""
594 "Segment low boundary address multiple. When explicitly specifying an attach "
595 "address in a call to B<shmat>(), the caller should ensure that the address "
596 "is a multiple of this value. This is necessary on some architectures, in "
597 "order either to ensure good CPU cache performance or to ensure that "
598 "different attaches of the same segment have consistent views within the CPU "
599 "cache. B<SHMLBA> is normally some multiple of the system page size. (On "
600 "many Linux architectures, B<SHMLBA> is the same as the system page size.)"
601 msgstr ""
602 "Кратность адреса нижней границы сегмента. При явном указании в вызове "
603 "B<shmat>() подключаемого адреса вызывающий должен убедиться, что адрес "
604 "кратен этому значению. Это необходимо у некоторых архитектур, чтобы точно "
605 "получить хорошую производительность от кэша ЦП или чтобы различные "
606 "подключения одного сегмента имели целостный вид внутри кэша ЦП. Параметр "
607 "B<SHMLBA>, обычно, кратен нескольким размерам системной страницы (у многих "
608 "архитектур Linux B<SHMLBA> совпадает с размером системной страницы)."
609
610 #. type: Plain text
611 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
612 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
613 msgid ""
614 "The implementation places no intrinsic per-process limit on the number of "
615 "shared memory segments (B<SHMSEG>)."
616 msgstr ""
617 "Реализацией не ограничивается количество общих сегментов общей памяти на "
618 "процесс (B<SHMSEG>)."
619
620 #. type: SH
621 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
622 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
623 #, no-wrap
624 msgid "EXAMPLES"
625 msgstr "ПРИМЕРЫ"
626
627 #. type: Plain text
628 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
629 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
630 msgid ""
631 "The two programs shown below exchange a string using a shared memory "
632 "segment. Further details about the programs are given below. First, we "
633 "show a shell session demonstrating their use."
634 msgstr ""
635
636 #. type: Plain text
637 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
638 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
639 msgid ""
640 "In one terminal window, we run the \"reader\" program, which creates a "
641 "System V shared memory segment and a System V semaphore set. The program "
642 "prints out the IDs of the created objects, and then waits for the semaphore "
643 "to change value."
644 msgstr ""
645
646 #. type: Plain text
647 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
648 #: opensuse-tumbleweed
649 #, no-wrap
650 msgid ""
651 "$B< ./svshm_string_read>;\n"
652 "shmid = 1114194\n"
653 "semid = 15\n"
654 msgstr ""
655
656 #. type: Plain text
657 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
658 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
659 msgid ""
660 "In another terminal window, we run the \"writer\" program. The \"writer\" "
661 "program takes three command-line arguments: the IDs of the shared memory "
662 "segment and semaphore set created by the \"reader\", and a string. It "
663 "attaches the existing shared memory segment, copies the string to the shared "
664 "memory, and modifies the semaphore value."
665 msgstr ""
666
667 #. type: Plain text
668 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
669 #: opensuse-tumbleweed
670 #, no-wrap
671 msgid "$B< ./svshm_string_write 1114194 15 \\[aq]Hello, world\\[aq]>;\n"
672 msgstr ""
673
674 #. type: Plain text
675 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
676 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
677 msgid ""
678 "Returning to the terminal where the \"reader\" is running, we see that the "
679 "program has ceased waiting on the semaphore and has printed the string that "
680 "was copied into the shared memory segment by the writer:"
681 msgstr ""
682
683 #. type: Plain text
684 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
685 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
686 #, no-wrap
687 msgid "Hello, world\n"
688 msgstr ""
689
690 #. type: SS
691 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
692 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
693 #, no-wrap
694 msgid "Program source: svshm_string.h"
695 msgstr "Исходный код программы: svshm_string.h"
696
697 #. type: Plain text
698 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
699 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
700 #, fuzzy
701 #| msgid "The following shell session demonstrates the use of the program:"
702 msgid ""
703 "The following header file is included by the \"reader\" and \"writer\" "
704 "programs:"
705 msgstr "Следующий сеанс работы в оболочке показывает работу с программой:"
706
707 #. type: Plain text
708 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
709 #: opensuse-tumbleweed
710 #, no-wrap
711 msgid ""
712 "/* svshm_string.h\n"
713 "\\&\n"
714 " Licensed under GNU General Public License v2 or later.\n"
715 "*/\n"
716 "#ifndef SVSHM_STRING_H\n"
717 "#define SVSHM_STRING_H\n"
718 "\\&\n"
719 "#include E<lt>err.hE<gt>\n"
720 "#include E<lt>stdio.hE<gt>\n"
721 "#include E<lt>stdlib.hE<gt>\n"
722 "#include E<lt>sys/sem.hE<gt>\n"
723 "\\&\n"
724 "union semun { /* Used in calls to semctl() */\n"
725 " int val;\n"
726 " struct semid_ds *buf;\n"
727 " unsigned short *array;\n"
728 "#if defined(__linux__)\n"
729 " struct seminfo *__buf;\n"
730 "#endif\n"
731 "};\n"
732 "\\&\n"
733 "#define MEM_SIZE 4096\n"
734 "\\&\n"
735 "#endif // include guard\n"
736 msgstr ""
737
738 #. type: SS
739 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
740 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
741 #, no-wrap
742 msgid "Program source: svshm_string_read.c"
743 msgstr ""
744
745 #. type: Plain text
746 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
747 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
748 msgid ""
749 "The \"reader\" program creates a shared memory segment and a semaphore set "
750 "containing one semaphore. It then attaches the shared memory object into "
751 "its address space and initializes the semaphore value to 1. Finally, the "
752 "program waits for the semaphore value to become 0, and afterwards prints the "
753 "string that has been copied into the shared memory segment by the \"writer\"."
754 msgstr ""
755
756 #. type: Plain text
757 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
758 #: opensuse-tumbleweed
759 #, no-wrap
760 msgid ""
761 "/* svshm_string_read.c\n"
762 "\\&\n"
763 " Licensed under GNU General Public License v2 or later.\n"
764 "*/\n"
765 "#include E<lt>err.hE<gt>\n"
766 "#include E<lt>stdio.hE<gt>\n"
767 "#include E<lt>stdlib.hE<gt>\n"
768 "#include E<lt>sys/ipc.hE<gt>\n"
769 "#include E<lt>sys/sem.hE<gt>\n"
770 "#include E<lt>sys/shm.hE<gt>\n"
771 "\\&\n"
772 "#include \"svshm_string.h\"\n"
773 "\\&\n"
774 "int\n"
775 "main(void)\n"
776 "{\n"
777 " int semid, shmid;\n"
778 " char *addr;\n"
779 " union semun arg, dummy;\n"
780 " struct sembuf sop;\n"
781 "\\&\n"
782 " /* Create shared memory and semaphore set containing one\n"
783 " semaphore. */\n"
784 "\\&\n"
785 " shmid = shmget(IPC_PRIVATE, MEM_SIZE, IPC_CREAT | 0600);\n"
786 " if (shmid == -1)\n"
787 " err(EXIT_FAILURE, \"shmget\");\n"
788 "\\&\n"
789 " semid = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600);\n"
790 " if (semid == -1)\n"
791 " err(EXIT_FAILURE, \"semget\");\n"
792 "\\&\n"
793 " /* Attach shared memory into our address space. */\n"
794 "\\&\n"
795 " addr = shmat(shmid, NULL, SHM_RDONLY);\n"
796 " if (addr == (void *) -1)\n"
797 " err(EXIT_FAILURE, \"shmat\");\n"
798 "\\&\n"
799 " /* Initialize semaphore 0 in set with value 1. */\n"
800 "\\&\n"
801 " arg.val = 1;\n"
802 " if (semctl(semid, 0, SETVAL, arg) == -1)\n"
803 " err(EXIT_FAILURE, \"semctl\");\n"
804 "\\&\n"
805 " printf(\"shmid = %d\\[rs]n\", shmid);\n"
806 " printf(\"semid = %d\\[rs]n\", semid);\n"
807 "\\&\n"
808 " /* Wait for semaphore value to become 0. */\n"
809 "\\&\n"
810 " sop.sem_num = 0;\n"
811 " sop.sem_op = 0;\n"
812 " sop.sem_flg = 0;\n"
813 "\\&\n"
814 " if (semop(semid, &sop, 1) == -1)\n"
815 " err(EXIT_FAILURE, \"semop\");\n"
816 "\\&\n"
817 " /* Print the string from shared memory. */\n"
818 "\\&\n"
819 " printf(\"%s\\[rs]n\", addr);\n"
820 "\\&\n"
821 " /* Remove shared memory and semaphore set. */\n"
822 "\\&\n"
823 " if (shmctl(shmid, IPC_RMID, NULL) == -1)\n"
824 " err(EXIT_FAILURE, \"shmctl\");\n"
825 " if (semctl(semid, 0, IPC_RMID, dummy) == -1)\n"
826 " err(EXIT_FAILURE, \"semctl\");\n"
827 "\\&\n"
828 " exit(EXIT_SUCCESS);\n"
829 "}\n"
830 msgstr ""
831
832 #. type: SS
833 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
834 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
835 #, no-wrap
836 msgid "Program source: svshm_string_write.c"
837 msgstr ""
838
839 #. type: Plain text
840 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
841 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
842 msgid ""
843 "The writer program takes three command-line arguments: the IDs of the shared "
844 "memory segment and semaphore set that have already been created by the "
845 "\"reader\", and a string. It attaches the shared memory segment into its "
846 "address space, and then decrements the semaphore value to 0 in order to "
847 "inform the \"reader\" that it can now examine the contents of the shared "
848 "memory."
849 msgstr ""
850
851 #. type: Plain text
852 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
853 #: opensuse-tumbleweed
854 #, no-wrap
855 msgid ""
856 "/* svshm_string_write.c\n"
857 "\\&\n"
858 " Licensed under GNU General Public License v2 or later.\n"
859 "*/\n"
860 "#include E<lt>err.hE<gt>\n"
861 "#include E<lt>stdio.hE<gt>\n"
862 "#include E<lt>stdlib.hE<gt>\n"
863 "#include E<lt>string.hE<gt>\n"
864 "#include E<lt>sys/sem.hE<gt>\n"
865 "#include E<lt>sys/shm.hE<gt>\n"
866 "\\&\n"
867 "#include \"svshm_string.h\"\n"
868 "\\&\n"
869 "int\n"
870 "main(int argc, char *argv[])\n"
871 "{\n"
872 " int semid, shmid;\n"
873 " char *addr;\n"
874 " size_t size;\n"
875 " struct sembuf sop;\n"
876 "\\&\n"
877 " if (argc != 4) {\n"
878 " fprintf(stderr, \"Usage: %s shmid semid string\\[rs]n\", argv[0]);\n"
879 " exit(EXIT_FAILURE);\n"
880 " }\n"
881 "\\&\n"
882 " size = strlen(argv[3]) + 1; /* +1 to include trailing \\[aq]\\[rs]0\\[aq] */\n"
883 " if (size E<gt> MEM_SIZE) {\n"
884 " fprintf(stderr, \"String is too big!\\[rs]n\");\n"
885 " exit(EXIT_FAILURE);\n"
886 " }\n"
887 "\\&\n"
888 " /* Get object IDs from command-line. */\n"
889 "\\&\n"
890 " shmid = atoi(argv[1]);\n"
891 " semid = atoi(argv[2]);\n"
892 "\\&\n"
893 " /* Attach shared memory into our address space and copy string\n"
894 " (including trailing null byte) into memory. */\n"
895 "\\&\n"
896 " addr = shmat(shmid, NULL, 0);\n"
897 " if (addr == (void *) -1)\n"
898 " err(EXIT_FAILURE, \"shmat\");\n"
899 "\\&\n"
900 " memcpy(addr, argv[3], size);\n"
901 "\\&\n"
902 " /* Decrement semaphore to 0. */\n"
903 "\\&\n"
904 " sop.sem_num = 0;\n"
905 " sop.sem_op = -1;\n"
906 " sop.sem_flg = 0;\n"
907 "\\&\n"
908 " if (semop(semid, &sop, 1) == -1)\n"
909 " err(EXIT_FAILURE, \"semop\");\n"
910 "\\&\n"
911 " exit(EXIT_SUCCESS);\n"
912 "}\n"
913 msgstr ""
914
915 #. type: SH
916 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
917 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
918 #, no-wrap
919 msgid "SEE ALSO"
920 msgstr "СМОТРИТЕ ТАКЖЕ"
921
922 #. type: Plain text
923 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
924 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
925 msgid ""
926 "B<brk>(2), B<mmap>(2), B<shmctl>(2), B<shmget>(2), B<capabilities>(7), "
927 "B<shm_overview>(7), B<sysvipc>(7)"
928 msgstr ""
929 "B<brk>(2), B<mmap>(2), B<shmctl>(2), B<shmget>(2), B<capabilities>(7), "
930 "B<shm_overview>(7), B<sysvipc>(7)"
931
932 #. type: TH
933 #: debian-trixie
934 #, no-wrap
935 msgid "2024-06-15"
936 msgstr "15 июня 2024 г."
937
938 #. type: TH
939 #: debian-trixie
940 #, no-wrap
941 msgid "Linux man-pages 6.9.1"
942 msgstr "Страницы руководства Linux 6.9.1"
943
944 #. type: Plain text
945 #: debian-trixie
946 msgid "Standard C library (I<libc>, I<-lc>)"
947 msgstr "Стандартная библиотека языка C (I<libc>, I<-lc>)"
948
949 #. type: Plain text
950 #: debian-trixie fedora-44 fedora-rawhide
951 msgid ""
952 "Invalid I<shmid> value, unaligned (i.e., not page-aligned and B<SHM_RND> was "
953 "not specified) or invalid I<shmaddr> value, or can't attach segment at "
954 "I<shmaddr>, or B<SHM_REMAP> was specified and I<shmaddr> was NULL."
955 msgstr ""
956 "Неправильное значение I<shmid>, не выровненное (по границе страницы и не "
957 "указан B<SHM_RND>) или неправильное значение I<shmaddr>, или невозможно "
958 "подключить сегмент по адресу I<shmaddr>, или был указан B<SHM_REMAP>, но "
959 "I<shmaddr> равно NULL."
960
961 #. type: Plain text
962 #: debian-trixie fedora-44 fedora-rawhide
963 #, no-wrap
964 msgid ""
965 "$ B<./svshm_string_read>\n"
966 "shmid = 1114194; semid = 15\n"
967 msgstr ""
968
969 #. type: Plain text
970 #: debian-trixie fedora-44 fedora-rawhide
971 #, no-wrap
972 msgid "$ B<./svshm_string_write 1114194 15 \\[aq]Hello, world\\[aq]>\n"
973 msgstr ""
974
975 #. type: Plain text
976 #: debian-trixie fedora-44 fedora-rawhide
977 #, no-wrap
978 msgid ""
979 "/* svshm_string.h\n"
980 "\\&\n"
981 " Licensed under GNU General Public License v2 or later.\n"
982 "*/\n"
983 "#ifndef SVSHM_STRING_H\n"
984 "#define SVSHM_STRING_H\n"
985 "\\&\n"
986 "#include E<lt>stdio.hE<gt>\n"
987 "#include E<lt>stdlib.hE<gt>\n"
988 "#include E<lt>sys/sem.hE<gt>\n"
989 "\\&\n"
990 "#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\[rs]\n"
991 " } while (0)\n"
992 "\\&\n"
993 "union semun { /* Used in calls to semctl() */\n"
994 " int val;\n"
995 " struct semid_ds *buf;\n"
996 " unsigned short *array;\n"
997 "#if defined(__linux__)\n"
998 " struct seminfo *__buf;\n"
999 "#endif\n"
1000 "};\n"
1001 "\\&\n"
1002 "#define MEM_SIZE 4096\n"
1003 "\\&\n"
1004 "#endif // include guard\n"
1005 msgstr ""
1006
1007 #. type: Plain text
1008 #: debian-trixie fedora-44 fedora-rawhide
1009 #, no-wrap
1010 msgid ""
1011 "/* svshm_string_read.c\n"
1012 "\\&\n"
1013 " Licensed under GNU General Public License v2 or later.\n"
1014 "*/\n"
1015 "#include E<lt>stdio.hE<gt>\n"
1016 "#include E<lt>stdlib.hE<gt>\n"
1017 "#include E<lt>sys/ipc.hE<gt>\n"
1018 "#include E<lt>sys/sem.hE<gt>\n"
1019 "#include E<lt>sys/shm.hE<gt>\n"
1020 "\\&\n"
1021 "#include \"svshm_string.h\"\n"
1022 "\\&\n"
1023 "int\n"
1024 "main(void)\n"
1025 "{\n"
1026 " int semid, shmid;\n"
1027 " char *addr;\n"
1028 " union semun arg, dummy;\n"
1029 " struct sembuf sop;\n"
1030 "\\&\n"
1031 " /* Create shared memory and semaphore set containing one\n"
1032 " semaphore. */\n"
1033 "\\&\n"
1034 " shmid = shmget(IPC_PRIVATE, MEM_SIZE, IPC_CREAT | 0600);\n"
1035 " if (shmid == -1)\n"
1036 " errExit(\"shmget\");\n"
1037 "\\&\n"
1038 " semid = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600);\n"
1039 " if (semid == -1)\n"
1040 " errExit(\"semget\");\n"
1041 "\\&\n"
1042 " /* Attach shared memory into our address space. */\n"
1043 "\\&\n"
1044 " addr = shmat(shmid, NULL, SHM_RDONLY);\n"
1045 " if (addr == (void *) -1)\n"
1046 " errExit(\"shmat\");\n"
1047 "\\&\n"
1048 " /* Initialize semaphore 0 in set with value 1. */\n"
1049 "\\&\n"
1050 " arg.val = 1;\n"
1051 " if (semctl(semid, 0, SETVAL, arg) == -1)\n"
1052 " errExit(\"semctl\");\n"
1053 "\\&\n"
1054 " printf(\"shmid = %d; semid = %d\\[rs]n\", shmid, semid);\n"
1055 "\\&\n"
1056 " /* Wait for semaphore value to become 0. */\n"
1057 "\\&\n"
1058 " sop.sem_num = 0;\n"
1059 " sop.sem_op = 0;\n"
1060 " sop.sem_flg = 0;\n"
1061 "\\&\n"
1062 " if (semop(semid, &sop, 1) == -1)\n"
1063 " errExit(\"semop\");\n"
1064 "\\&\n"
1065 " /* Print the string from shared memory. */\n"
1066 "\\&\n"
1067 " printf(\"%s\\[rs]n\", addr);\n"
1068 "\\&\n"
1069 " /* Remove shared memory and semaphore set. */\n"
1070 "\\&\n"
1071 " if (shmctl(shmid, IPC_RMID, NULL) == -1)\n"
1072 " errExit(\"shmctl\");\n"
1073 " if (semctl(semid, 0, IPC_RMID, dummy) == -1)\n"
1074 " errExit(\"semctl\");\n"
1075 "\\&\n"
1076 " exit(EXIT_SUCCESS);\n"
1077 "}\n"
1078 msgstr ""
1079
1080 #. type: Plain text
1081 #: debian-trixie
1082 #, no-wrap
1083 msgid ""
1084 "/* svshm_string_write.c\n"
1085 "\\&\n"
1086 " Licensed under GNU General Public License v2 or later.\n"
1087 "*/\n"
1088 "#include E<lt>stdio.hE<gt>\n"
1089 "#include E<lt>stdlib.hE<gt>\n"
1090 "#include E<lt>string.hE<gt>\n"
1091 "#include E<lt>sys/sem.hE<gt>\n"
1092 "#include E<lt>sys/shm.hE<gt>\n"
1093 "\\&\n"
1094 "#include \"svshm_string.h\"\n"
1095 "\\&\n"
1096 "int\n"
1097 "main(int argc, char *argv[])\n"
1098 "{\n"
1099 " int semid, shmid;\n"
1100 " char *addr;\n"
1101 " size_t len;\n"
1102 " struct sembuf sop;\n"
1103 "\\&\n"
1104 " if (argc != 4) {\n"
1105 " fprintf(stderr, \"Usage: %s shmid semid string\\[rs]n\", argv[0]);\n"
1106 " exit(EXIT_FAILURE);\n"
1107 " }\n"
1108 "\\&\n"
1109 " len = strlen(argv[3]) + 1; /* +1 to include trailing \\[aq]\\[rs]0\\[aq] */\n"
1110 " if (len E<gt> MEM_SIZE) {\n"
1111 " fprintf(stderr, \"String is too big!\\[rs]n\");\n"
1112 " exit(EXIT_FAILURE);\n"
1113 " }\n"
1114 "\\&\n"
1115 " /* Get object IDs from command-line. */\n"
1116 "\\&\n"
1117 " shmid = atoi(argv[1]);\n"
1118 " semid = atoi(argv[2]);\n"
1119 "\\&\n"
1120 " /* Attach shared memory into our address space and copy string\n"
1121 " (including trailing null byte) into memory. */\n"
1122 "\\&\n"
1123 " addr = shmat(shmid, NULL, 0);\n"
1124 " if (addr == (void *) -1)\n"
1125 " errExit(\"shmat\");\n"
1126 "\\&\n"
1127 " memcpy(addr, argv[3], len);\n"
1128 "\\&\n"
1129 " /* Decrement semaphore to 0. */\n"
1130 "\\&\n"
1131 " sop.sem_num = 0;\n"
1132 " sop.sem_op = -1;\n"
1133 " sop.sem_flg = 0;\n"
1134 "\\&\n"
1135 " if (semop(semid, &sop, 1) == -1)\n"
1136 " errExit(\"semop\");\n"
1137 "\\&\n"
1138 " exit(EXIT_SUCCESS);\n"
1139 "}\n"
1140 msgstr ""
1141
1142 #. type: TH
1143 #: fedora-44 fedora-rawhide
1144 #, no-wrap
1145 msgid "2024-11-17"
1146 msgstr "17 ноября 2024 г."
1147
1148 #. type: TH
1149 #: fedora-44 fedora-rawhide
1150 #, no-wrap
1151 msgid "Linux man-pages 6.13"
1152 msgstr "Страницы руководства Linux 6.13"
1153
1154 #. type: Plain text
1155 #: fedora-44 fedora-rawhide
1156 #, no-wrap
1157 msgid ""
1158 "/* svshm_string_write.c\n"
1159 "\\&\n"
1160 " Licensed under GNU General Public License v2 or later.\n"
1161 "*/\n"
1162 "#include E<lt>stdio.hE<gt>\n"
1163 "#include E<lt>stdlib.hE<gt>\n"
1164 "#include E<lt>string.hE<gt>\n"
1165 "#include E<lt>sys/sem.hE<gt>\n"
1166 "#include E<lt>sys/shm.hE<gt>\n"
1167 "\\&\n"
1168 "#include \"svshm_string.h\"\n"
1169 "\\&\n"
1170 "int\n"
1171 "main(int argc, char *argv[])\n"
1172 "{\n"
1173 " int semid, shmid;\n"
1174 " char *addr;\n"
1175 " size_t size;\n"
1176 " struct sembuf sop;\n"
1177 "\\&\n"
1178 " if (argc != 4) {\n"
1179 " fprintf(stderr, \"Usage: %s shmid semid string\\[rs]n\", argv[0]);\n"
1180 " exit(EXIT_FAILURE);\n"
1181 " }\n"
1182 "\\&\n"
1183 " size = strlen(argv[3]) + 1; /* +1 to include trailing \\[aq]\\[rs]0\\[aq] */\n"
1184 " if (size E<gt> MEM_SIZE) {\n"
1185 " fprintf(stderr, \"String is too big!\\[rs]n\");\n"
1186 " exit(EXIT_FAILURE);\n"
1187 " }\n"
1188 "\\&\n"
1189 " /* Get object IDs from command-line. */\n"
1190 "\\&\n"
1191 " shmid = atoi(argv[1]);\n"
1192 " semid = atoi(argv[2]);\n"
1193 "\\&\n"
1194 " /* Attach shared memory into our address space and copy string\n"
1195 " (including trailing null byte) into memory. */\n"
1196 "\\&\n"
1197 " addr = shmat(shmid, NULL, 0);\n"
1198 " if (addr == (void *) -1)\n"
1199 " errExit(\"shmat\");\n"
1200 "\\&\n"
1201 " memcpy(addr, argv[3], size);\n"
1202 "\\&\n"
1203 " /* Decrement semaphore to 0. */\n"
1204 "\\&\n"
1205 " sop.sem_num = 0;\n"
1206 " sop.sem_op = -1;\n"
1207 " sop.sem_flg = 0;\n"
1208 "\\&\n"
1209 " if (semop(semid, &sop, 1) == -1)\n"
1210 " errExit(\"semop\");\n"
1211 "\\&\n"
1212 " exit(EXIT_SUCCESS);\n"
1213 "}\n"
1214 msgstr ""
1215
1216 #. type: TH
1217 #: mageia-cauldron
1218 #, no-wrap
1219 msgid "Linux man-pages 6.17"
1220 msgstr "Страницы руководства Linux 6.17"
1221
1222 #. type: TH
1223 #: opensuse-leap-16-1 opensuse-tumbleweed
1224 #, no-wrap
1225 msgid "Linux man-pages (unreleased)"
1226 msgstr "Страницы руководства Linux (не выпущены)"