Debian Codegraph @

po/ru/man2/open_by_handle_at.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 # Azamat Hackimov <[email protected]>, 2016.
5 # Konstantin Shvaykovskiy <[email protected]>, 2012.
6 # Yuri Kozlov <[email protected]>, 2011-2019.
7 # Иван Павлов <[email protected]>, 2017.
8 msgid ""
9 msgstr ""
10 "Project-Id-Version: manpages-l10n\n"
11 "POT-Creation-Date: 2026-06-05 06:33+0200\n"
12 "PO-Revision-Date: 2024-12-21 19:49+0300\n"
13 "Last-Translator: Yuri Kozlov <[email protected]>\n"
14 "Language-Team: Russian <[email protected]>\n"
15 "Language: ru\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=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
20 "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
21 "(n%100>=11 && n%100<=14)? 2 : 3);\n"
22 "X-Generator: Lokalize 2.0\n"
23
24 #. type: TH
25 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
26 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
27 #, no-wrap
28 msgid "open_by_handle_at"
29 msgstr "open_by_handle_at"
30
31 #. type: TH
32 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
33 #, no-wrap
34 msgid "2026-02-22"
35 msgstr "22 февраля 2026 г."
36
37 #. type: TH
38 #: archlinux debian-unstable
39 #, fuzzy, no-wrap
40 #| msgid "Linux man-pages 6.17"
41 msgid "Linux man-pages 6.18"
42 msgstr "Справочные страницы Linux 6.17"
43
44 #. type: SH
45 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
46 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
47 #, no-wrap
48 msgid "NAME"
49 msgstr "НАИМЕНОВАНИЕ"
50
51 #. type: Plain text
52 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
53 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
54 msgid ""
55 "name_to_handle_at, open_by_handle_at - obtain handle for a pathname and open "
56 "file via a handle"
57 msgstr ""
58 "name_to_handle_at, open_by_handle_at - получение описателя для пути и "
59 "открытие файла через описатель"
60
61 #. type: SH
62 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
63 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
64 #, no-wrap
65 msgid "LIBRARY"
66 msgstr "БИБЛИОТЕКА"
67
68 #. type: Plain text
69 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
70 #: opensuse-leap-16-1 opensuse-tumbleweed
71 msgid "Standard C library (I<libc>,\\ I<-lc>)"
72 msgstr "Стандартная библиотека языка C (I<libc>,\\ I<-lc>)"
73
74 #. type: SH
75 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
76 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
77 #, no-wrap
78 msgid "SYNOPSIS"
79 msgstr "СИНТАКСИС"
80
81 #. type: Plain text
82 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
83 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
84 #, no-wrap
85 msgid ""
86 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
87 "B<#include E<lt>fcntl.hE<gt>>\n"
88 msgstr ""
89 "B<#define _GNU_SOURCE> /* см. feature_test_macros(7) */\n"
90 "B<#include E<lt>fcntl.hE<gt>>\n"
91
92 #. type: Plain text
93 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
94 #: opensuse-tumbleweed
95 #, fuzzy, no-wrap
96 #| msgid ""
97 #| "B<int name_to_handle_at(int >I<dirfd>B<, const char *>I<pathname>B<,>\n"
98 #| "B< struct file_handle *>I<handle>B<,>\n"
99 #| "B< int *>I<mount_id>B<, int >I<flags>B<);>\n"
100 msgid ""
101 "B<int name_to_handle_at(int >I<dirfd>B<, const char *>I<path>B<,>\n"
102 "B< struct file_handle *>I<handle>B<,>\n"
103 "B< int *>I<mount_id>B<, int >I<flags>B<);>\n"
104 "B<int open_by_handle_at(int >I<mount_fd>B<, struct file_handle *>I<handle>B<,>\n"
105 "B< int >I<flags>B<);>\n"
106 msgstr ""
107 "B<int name_to_handle_at(int >I<dirfd>B<, const char *>I<pathname>B<,>\n"
108 "B< struct file_handle *>I<handle>B<,>\n"
109 "B< int *>I<mount_id>B<, int >I<flags>B<);>\n"
110
111 #. type: SH
112 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
113 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
114 #, no-wrap
115 msgid "DESCRIPTION"
116 msgstr "ОПИСАНИЕ"
117
118 #. type: Plain text
119 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
120 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
121 msgid ""
122 "The B<name_to_handle_at>() and B<open_by_handle_at>() system calls split "
123 "the functionality of B<openat>(2) into two parts: B<name_to_handle_at>() "
124 "returns an opaque handle that corresponds to a specified file; "
125 "B<open_by_handle_at>() opens the file corresponding to a handle returned by "
126 "a previous call to B<name_to_handle_at>() and returns an open file "
127 "descriptor."
128 msgstr ""
129 "Функциональное назначение B<openat>(2) было разделено на две части и "
130 "добавлено в системные вызовы B<name_to_handle_at>() и "
131 "B<open_by_handle_at>(): B<name_to_handle_at>() возвращает описатель с "
132 "произвольной формой(opaque), который соответствует указанному файлу; "
133 "B<open_by_handle_at>() открывает файл по описателю, который был возвращён "
134 "предыдущим вызовом B<name_to_handle_at>() и возвращает дескриптор открытого "
135 "файла."
136
137 #. type: SS
138 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
139 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
140 #, no-wrap
141 msgid "name_to_handle_at()"
142 msgstr "name_to_handle_at()"
143
144 #. type: Plain text
145 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
146 #: opensuse-tumbleweed
147 #, fuzzy
148 #| msgid ""
149 #| "The B<name_to_handle_at>() system call returns a file handle and a mount "
150 #| "ID corresponding to the file specified by the I<dirfd> and I<pathname> "
151 #| "arguments. The file handle is returned via the argument I<handle>, which "
152 #| "is a pointer to a structure of the following form:"
153 msgid ""
154 "The B<name_to_handle_at>() system call returns a file handle and a mount ID "
155 "corresponding to the file specified by the I<dirfd> and I<path> arguments. "
156 "The file handle is returned via the argument I<handle>, which is a pointer "
157 "to a structure of the following form:"
158 msgstr ""
159 "Системный вызов B<name_to_handle_at>() возвращает файловый описатель и "
160 "идентификатор монтирования для файла, указанного в аргументах I<dirfd> и "
161 "I<pathname>. Файловый описатель возвращается через аргумент I<handle>, "
162 "который является указателем на следующую структуру:"
163
164 #. type: Plain text
165 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
166 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
167 #, no-wrap
168 msgid ""
169 "struct file_handle {\n"
170 " unsigned int handle_bytes; /* Size of f_handle [in, out] */\n"
171 " int handle_type; /* Handle type [out] */\n"
172 " unsigned char f_handle[0]; /* File identifier (sized by\n"
173 " caller) [out] */\n"
174 "};\n"
175 msgstr ""
176 "struct file_handle {\n"
177 " unsigned int handle_bytes; /* размер f_handle [in, out] */\n"
178 " int handle_type; /* тип описателя [out] */\n"
179 " unsigned char f_handle[0]; /* идентификатор файла (размер\n"
180 " задаёт вызывающий) [out] */\n"
181 "};\n"
182
183 #. type: Plain text
184 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
185 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
186 msgid ""
187 "It is the caller's responsibility to allocate the structure with a size "
188 "large enough to hold the handle returned in I<f_handle>. Before the call, "
189 "the I<handle_bytes> field should be initialized to contain the allocated "
190 "size for I<f_handle>. (The constant B<MAX_HANDLE_SZ>, defined in "
191 "I<E<lt>fcntl.hE<gt>>, specifies the maximum expected size for a file "
192 "handle. It is not a guaranteed upper limit as future filesystems may "
193 "require more space.) Upon successful return, the I<handle_bytes> field is "
194 "updated to contain the number of bytes actually written to I<f_handle>."
195 msgstr ""
196 "Вызывающий должен выделить память достаточного размера под структуру "
197 "описателя, возвращаемого в I<f_handle>. Перед вызовом поле I<handle_bytes> "
198 "должно содержать размер выделенной памяти для I<f_handle> (константа "
199 "B<MAX_HANDLE_SZ>, определённая в I<E<lt>fcntl.hE<gt>>, равна максимально "
200 "ожидаемому размеру описателя файла. Это не гарантированное верхнее "
201 "ограничение, так как файловые системы в будущем могут потребовать больше "
202 "места). При успешном выполнении поле I<handle_bytes> обновляется и содержит "
203 "количество байт действительно занятых под I<f_handle>."
204
205 #. type: Plain text
206 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
207 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
208 msgid ""
209 "The caller can discover the required size for the I<file_handle> structure "
210 "by making a call in which I<handle-E<gt>handle_bytes> is zero; in this case, "
211 "the call fails with the error B<EOVERFLOW> and I<handle-E<gt>handle_bytes> "
212 "is set to indicate the required size; the caller can then use this "
213 "information to allocate a structure of the correct size (see EXAMPLES "
214 "below). Some care is needed here as B<EOVERFLOW> can also indicate that no "
215 "file handle is available for this particular name in a filesystem which does "
216 "normally support file-handle lookup. This case can be detected when the "
217 "B<EOVERFLOW> error is returned without I<handle_bytes> being increased."
218 msgstr ""
219 "Вызывающий может определить требуемый размер структуры I<file_handle> указав "
220 "при вызове значение I<handle-E<gt>handle_bytes> равное нулю; в этому случае "
221 "вызов завершается с ошибкой B<EOVERFLOW>, а в поле I<handle-"
222 "E<gt>handle_bytes> записывается требуемый размер; затем вызывающий может "
223 "использовать эту информацию для выделения памяти под структуру правильного "
224 "размера (смотрите ПРИМЕРЫ ниже). Здесь нужно учесть, что B<EOVERFLOW> может "
225 "указывать на то, что файловый описатель недоступен для этого заданного имени "
226 "в файловой системе, которая, обычно, поддерживает поиск файловых описателей. "
227 "На данный случай указывает то, что ошибка B<EOVERFLOW> возвращается без "
228 "увеличившегося значения I<handle_bytes>."
229
230 #. type: Plain text
231 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
232 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
233 msgid ""
234 "Other than the use of the I<handle_bytes> field, the caller should treat the "
235 "I<file_handle> structure as an opaque data type: the I<handle_type> and "
236 "I<f_handle> fields can be used in a subsequent call to "
237 "B<open_by_handle_at>(). The caller can also use the opaque I<file_handle> "
238 "to compare the identity of filesystem objects that were queried at different "
239 "times and possibly at different paths. The B<fanotify>(7) subsystem can "
240 "report events with an information record containing a I<file_handle> to "
241 "identify the filesystem object."
242 msgstr ""
243
244 #. type: Plain text
245 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
246 #: opensuse-tumbleweed
247 #, fuzzy
248 #| msgid ""
249 #| "The I<flags> argument is a bit mask constructed by ORing together zero or "
250 #| "more of B<AT_EMPTY_PATH> and B<AT_SYMLINK_FOLLOW>, described below."
251 msgid ""
252 "The I<flags> argument is a bit mask constructed by ORing together zero or "
253 "more of B<AT_HANDLE_FID>, B<AT_HANDLE_MNT_ID_UNIQUE>, "
254 "B<AT_HANDLE_CONNECTABLE>, B<AT_EMPTY_PATH>, and B<AT_SYMLINK_FOLLOW>, "
255 "described below."
256 msgstr ""
257 "Аргумент I<flags> представляет собой битовую маску (OR) из комбинации нуля "
258 "или более флагов B<AT_EMPTY_PATH> и B<AT_SYMLINK_FOLLOW>, описанных ниже."
259
260 #. commit 96b2b072ee62be8ae68c8ecf14854c4d0505a8f8
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 ""
265 "When I<flags> contain the B<AT_HANDLE_FID> (since Linux 6.5) flag, the "
266 "caller indicates that the returned I<file_handle> is needed to identify the "
267 "filesystem object, and not for opening the file later, so it should be "
268 "expected that a subsequent call to B<open_by_handle_at>() with the returned "
269 "I<file_handle> may fail."
270 msgstr ""
271
272 #. commit 4356d575ef0f39a3e8e0ce0c40d84ce900ac3b61
273 #. type: Plain text
274 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
275 #: opensuse-tumbleweed
276 msgid ""
277 "When I<flags> contain the B<AT_HANDLE_MNT_ID_UNIQUE> (since Linux 6.12) "
278 "flag, the caller indicates that the width of the I<mount_id> buffer is at "
279 "least 64 bits, and then the mount id returned in that buffer is the unique "
280 "mount id as the one returned by B<statx>(2) with the B<STATX_MNT_ID_UNIQUE> "
281 "flag."
282 msgstr ""
283
284 #. commit a20853ab8296d4a8754482cb5e9adde8ab426a25
285 #. type: Plain text
286 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
287 #: opensuse-tumbleweed
288 msgid ""
289 "When I<flags> contain the B<AT_HANDLE_CONNECTABLE> (since Linux 6.13) flag, "
290 "the caller indicates that the returned I<file_handle> is needed to open a "
291 "file with known path later, so it should be expected that a subsequent call "
292 "to B<open_by_handle_at>() with the returned I<file_handle> may fail if the "
293 "file was moved, but otherwise, the path of the opened file is expected to be "
294 "visible from the I</proc/>pidI</fd/>* magic link. This flag can not be used "
295 "in combination with the flags B<AT_HANDLE_FID> and/or B<AT_EMPTY_PATH>."
296 msgstr ""
297
298 #. type: Plain text
299 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
300 #: opensuse-tumbleweed
301 #, fuzzy
302 #| msgid ""
303 #| "Together, the I<pathname> and I<dirfd> arguments identify the file for "
304 #| "which a handle is to be obtained. There are four distinct cases:"
305 msgid ""
306 "Together, the I<path> and I<dirfd> arguments identify the file for which a "
307 "handle is to be obtained. There are four distinct cases:"
308 msgstr ""
309 "Аргументы I<pathname> и I<dirfd> вместе задают файл, для которого будет "
310 "получен описатель. Есть четыре различных варианта:"
311
312 #. type: IP
313 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
314 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
315 #, no-wrap
316 msgid "\\[bu]"
317 msgstr "\\[bu]"
318
319 #. type: Plain text
320 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
321 #: opensuse-tumbleweed
322 #, fuzzy
323 #| msgid ""
324 #| "If I<pathname> is a nonempty string containing an absolute pathname, then "
325 #| "a handle is returned for the file referred to by that pathname. In this "
326 #| "case, I<dirfd> is ignored."
327 msgid ""
328 "If I<path> is a nonempty string containing an absolute pathname, then a "
329 "handle is returned for the file referred to by that pathname. In this case, "
330 "I<dirfd> is ignored."
331 msgstr ""
332 "Если значение I<pathname> — непустая строка, содержащая абсолютный путь, то "
333 "описатель возвращается для файла, на который указывает путь. В этом случае "
334 "I<dirfd> игнорируется."
335
336 #. type: Plain text
337 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
338 #: opensuse-tumbleweed
339 #, fuzzy
340 #| msgid ""
341 #| "If I<pathname> is a nonempty string containing a relative pathname and "
342 #| "I<dirfd> has the special value B<AT_FDCWD>, then I<pathname> is "
343 #| "interpreted relative to the current working directory of the caller, and "
344 #| "a handle is returned for the file to which it refers."
345 msgid ""
346 "If I<path> is a nonempty string containing a relative pathname and I<dirfd> "
347 "has the special value B<AT_FDCWD>, then I<path> is interpreted relative to "
348 "the current working directory of the caller, and a handle is returned for "
349 "the file to which it refers."
350 msgstr ""
351 "Если значение I<pathname> — непустая строка, содержащая относительный путь и "
352 "I<dirfd> равно специальному значению B<AT_FDCWD>, то I<pathname> "
353 "рассматривается относительно текущего рабочего каталога вызывающего и "
354 "описатель возвращается для файла, на который он указывает."
355
356 #. type: Plain text
357 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
358 #: opensuse-tumbleweed
359 #, fuzzy
360 #| msgid ""
361 #| "If I<pathname> is a nonempty string containing a relative pathname and "
362 #| "I<dirfd> is a file descriptor referring to a directory, then I<pathname> "
363 #| "is interpreted relative to the directory referred to by I<dirfd>, and a "
364 #| "handle is returned for the file to which it refers. (See B<openat>(2) "
365 #| "for an explanation of why \"directory file descriptors\" are useful.)"
366 msgid ""
367 "If I<path> is a nonempty string containing a relative pathname and I<dirfd> "
368 "is a file descriptor referring to a directory, then I<path> is interpreted "
369 "relative to the directory referred to by I<dirfd>, and a handle is returned "
370 "for the file to which it refers. (See B<openat>(2) for an explanation of "
371 "why \"directory file descriptors\" are useful.)"
372 msgstr ""
373 "Если значение I<pathname> — непустая строка, содержащая относительный путь и "
374 "I<dirfd> равно файловому дескриптору, указывающему на каталог, то "
375 "I<pathname> рассматривается относительно каталога, на который указывает "
376 "I<dirfd>, и описатель возвращается для файла, на который он указывает "
377 "(смотрите в B<openat>(2) объяснение полезности «файловых дескрипторов "
378 "каталогов»)."
379
380 #. type: Plain text
381 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
382 #: opensuse-tumbleweed
383 #, fuzzy
384 #| msgid ""
385 #| "If I<pathname> is an empty string and I<flags> specifies the value "
386 #| "B<AT_EMPTY_PATH>, then I<dirfd> can be an open file descriptor referring "
387 #| "to any type of file, or B<AT_FDCWD>, meaning the current working "
388 #| "directory, and a handle is returned for the file to which it refers."
389 msgid ""
390 "If I<path> is an empty string and I<flags> specifies the value "
391 "B<AT_EMPTY_PATH>, then I<dirfd> can be an open file descriptor referring to "
392 "any type of file, or B<AT_FDCWD>, meaning the current working directory, and "
393 "a handle is returned for the file to which it refers."
394 msgstr ""
395 "Если значение I<pathname> — пустая строка и значение I<flags> равно "
396 "B<AT_EMPTY_PATH>, то I<dirfd> может быть открытым файловым дескриптором, "
397 "указывающим на файл любого типа, или B<AT_FDCWD>, означающим текущий рабочий "
398 "каталог, и описатель возвращается для файла, на который он указывает."
399
400 #. type: Plain text
401 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
402 #: opensuse-tumbleweed
403 #, fuzzy
404 #| msgid ""
405 #| "The I<mount_id> argument returns an identifier for the filesystem mount "
406 #| "that corresponds to I<pathname>. This corresponds to the first field in "
407 #| "one of the records in I</proc/self/mountinfo>. Opening the pathname in "
408 #| "the fifth field of that record yields a file descriptor for the mount "
409 #| "point; that file descriptor can be used in a subsequent call to "
410 #| "B<open_by_handle_at>(). I<mount_id> is returned both for a successful "
411 #| "call and for a call that results in the error B<EOVERFLOW>."
412 msgid ""
413 "The I<mount_id> argument returns an identifier for the filesystem mount that "
414 "corresponds to I<path>. This corresponds to the first field in one of the "
415 "records in I</proc/self/mountinfo>. Opening the pathname in the fifth field "
416 "of that record yields a file descriptor for the mount point; that file "
417 "descriptor can be used in a subsequent call to B<open_by_handle_at>(). "
418 "I<mount_id> is returned both for a successful call and for a call that "
419 "results in the error B<EOVERFLOW>."
420 msgstr ""
421 "В аргументе I<mount_id> возвращается идентификатор точки монтирования в "
422 "файловой системе, соответствующий I<pathname>. Это значение соответствует "
423 "первому полю одной из записей в I</proc/self/mountinfo>. Открытие пути из "
424 "пятого поля этой записи возвращает файловый дескриптор этой точки "
425 "монтирования; этот файловый дескриптор можно использовать в последующем "
426 "вызове B<open_by_handle_at>(). Аргумент I<mount_id> возвращается при "
427 "успешном выполнении, а также при ошибке B<EOVERFLOW>()."
428
429 #. type: Plain text
430 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
431 #: opensuse-tumbleweed
432 #, fuzzy
433 #| msgid ""
434 #| "By default, B<name_to_handle_at>() does not dereference I<pathname> if "
435 #| "it is a symbolic link, and thus returns a handle for the link itself. If "
436 #| "B<AT_SYMLINK_FOLLOW> is specified in I<flags>, I<pathname> is "
437 #| "dereferenced if it is a symbolic link (so that the call returns a handle "
438 #| "for the file referred to by the link)."
439 msgid ""
440 "By default, B<name_to_handle_at>() does not dereference I<path> if it is a "
441 "symbolic link, and thus returns a handle for the link itself. If "
442 "B<AT_SYMLINK_FOLLOW> is specified in I<flags>, I<path> is dereferenced if it "
443 "is a symbolic link (so that the call returns a handle for the file referred "
444 "to by the link)."
445 msgstr ""
446 "По умолчанию, B<name_to_handle_at>() не разыменовывает I<pathname>, если это "
447 "символическая ссылка, и поэтому возвращается описатель самой ссылки. Если в "
448 "I<flags> указан B<AT_SYMLINK_FOLLOW>, то I<pathname> разыменовывается, если "
449 "это символическая ссылка (то есть вызов возвращает описатель файла, на "
450 "который указывает ссылка)."
451
452 #. commit 20fa19027286983ab2734b5910c4a687436e0c31
453 #. type: Plain text
454 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
455 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
456 msgid ""
457 "B<name_to_handle_at>() does not trigger a mount when the final component of "
458 "the pathname is an automount point. When a filesystem supports both file "
459 "handles and automount points, a B<name_to_handle_at>() call on an automount "
460 "point will return with error B<EOVERFLOW> without having increased "
461 "I<handle_bytes>. This can happen since Linux 4.13 with NFS when accessing a "
462 "directory which is on a separate filesystem on the server. In this case, "
463 "the automount can be triggered by adding a \"/\" to the end of the pathname."
464 msgstr ""
465 "Системный вызов B<name_to_handle_at>() не вызывает монтирования, если "
466 "конечная часть пути является автоматической точкой монтирования. Если "
467 "файловая система поддерживает файловые описатели и автоматические точки "
468 "монтирования, то вызов B<name_to_handle_at>() для автоматической точки "
469 "монтирования завершится ошибкой B<EOVERFLOW> без увеличения значения "
470 "I<handle_bytes>. Это может происходить с NFS начиная с версии Linux 4.13, "
471 "когда задействованный каталог находится в отдельной файловой системе на "
472 "сервере. В этом случае автомонтирование можно получить добавлением «/» в "
473 "конец пути."
474
475 #. type: SS
476 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
477 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
478 #, no-wrap
479 msgid "open_by_handle_at()"
480 msgstr "open_by_handle_at()"
481
482 #. type: Plain text
483 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
484 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
485 msgid ""
486 "The B<open_by_handle_at>() system call opens the file referred to by "
487 "I<handle>, a file handle returned by a previous call to "
488 "B<name_to_handle_at>()."
489 msgstr ""
490 "Системный вызов B<open_by_handle_at>() открывает файл, на который указывает "
491 "I<handle>, файловый описатель, полученный от предшествующего вызова "
492 "B<name_to_handle_at>()."
493
494 #. type: Plain text
495 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
496 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
497 msgid ""
498 "The I<mount_fd> argument is a file descriptor for any object (file, "
499 "directory, etc.) in the mounted filesystem with respect to which I<handle> "
500 "should be interpreted. The special value B<AT_FDCWD> can be specified, "
501 "meaning the current working directory of the caller."
502 msgstr ""
503 "Аргумент I<mount_fd> — это файловый дескриптор любого объекта (файла, "
504 "каталога и т. д.) в смонтированной файловой системе, в которой должен "
505 "находиться I<handle>. Может быть равен специальному значению B<AT_FDCWD>, "
506 "которое обозначает текущий рабочий каталог вызывающего."
507
508 #. type: Plain text
509 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
510 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
511 msgid ""
512 "The I<flags> argument is as for B<open>(2). If I<handle> refers to a "
513 "symbolic link, the caller must specify the B<O_PATH> flag, and the symbolic "
514 "link is not dereferenced; the B<O_NOFOLLOW> flag, if specified, is ignored."
515 msgstr ""
516 "Значение аргумента I<flags> как у B<open>(2). Если I<handle> указывает на "
517 "символическую ссылку, то вызывающий должен указать флаг B<O_PATH>, и "
518 "символическая ссылка не разыменовывается; флаг B<O_NOFOLLOW> игнорируется."
519
520 #. type: Plain text
521 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
522 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
523 msgid ""
524 "The caller must have the B<CAP_DAC_READ_SEARCH> capability to invoke "
525 "B<open_by_handle_at>()."
526 msgstr ""
527 "Для вызова B<open_by_handle_at>() вызывающий должен иметь мандат "
528 "B<CAP_DAC_READ_SEARCH>."
529
530 #. type: SH
531 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
532 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
533 #, no-wrap
534 msgid "RETURN VALUE"
535 msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ"
536
537 #. type: Plain text
538 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
539 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
540 #, fuzzy
541 #| msgid ""
542 #| "On success, B<name_to_handle_at>() returns 0, and "
543 #| "B<open_by_handle_at>() returns a nonnegative file descriptor."
544 msgid ""
545 "On success, B<name_to_handle_at>() returns 0, and B<open_by_handle_at>() "
546 "returns a file descriptor (a nonnegative integer)."
547 msgstr ""
548 "При успешном выполнении B<name_to_handle_at>() возвращает 0, а "
549 "B<open_by_handle_at>() возвращает неотрицательный файловый дескриптор."
550
551 #. type: Plain text
552 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
553 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
554 #, fuzzy
555 #| msgid ""
556 #| "In the event of an error, both system calls return -1 and set I<errno> to "
557 #| "indicate the cause of the error."
558 msgid ""
559 "In the event of an error, both system calls return -1 and set I<errno> to "
560 "indicate the error."
561 msgstr ""
562 "В случае ошибки системные вызовы возвращают -1, а в I<errno> записывается "
563 "код ошибки."
564
565 #. type: SH
566 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
567 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
568 #, no-wrap
569 msgid "ERRORS"
570 msgstr "ОШИБКИ"
571
572 #. type: Plain text
573 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
574 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
575 msgid ""
576 "B<name_to_handle_at>() and B<open_by_handle_at>() can fail for the same "
577 "errors as B<openat>(2). In addition, they can fail with the errors noted "
578 "below."
579 msgstr ""
580 "Вызовы B<name_to_handle_at>() и B<open_by_handle_at>() могут завершиться с "
581 "теми же ошибками что и B<openat>(2). Также могут возникать следующие ошибки:"
582
583 #. type: Plain text
584 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
585 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
586 msgid "B<name_to_handle_at>() can fail with the following errors:"
587 msgstr "Вызов B<name_to_handle_at>() может завершиться со следующими ошибками:"
588
589 #. type: TP
590 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
591 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
592 #, no-wrap
593 msgid "B<EFAULT>"
594 msgstr "B<EFAULT>"
595
596 #. type: Plain text
597 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
598 #: opensuse-tumbleweed
599 #, fuzzy
600 #| msgid ""
601 #| "I<pathname>, I<mount_id>, or I<handle> points outside your accessible "
602 #| "address space."
603 msgid ""
604 "I<path>, I<mount_id>, or I<handle> points outside your accessible address "
605 "space."
606 msgstr ""
607 "Значение I<pathname>, I<mount_id> или I<handle> указывает за пределы "
608 "доступного адресного пространства."
609
610 #. type: TP
611 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
612 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
613 #, no-wrap
614 msgid "B<EINVAL>"
615 msgstr "B<EINVAL>"
616
617 #. type: Plain text
618 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
619 #: opensuse-tumbleweed
620 #, fuzzy
621 #| msgid "I<flags> includes an invalid bit value."
622 msgid "I<flags> includes an invalid bit value or an invalid bit combination."
623 msgstr "Значение I<flags> содержит некорректно установленный бит."
624
625 #. type: Plain text
626 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
627 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
628 msgid "I<handle-E<gt>handle_bytes> is greater than B<MAX_HANDLE_SZ>."
629 msgstr "Значение I<handle-E<gt>handle_bytes> больше B<MAX_HANDLE_SZ>."
630
631 #. type: TP
632 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
633 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
634 #, no-wrap
635 msgid "B<ENOENT>"
636 msgstr "B<ENOENT>"
637
638 #. type: Plain text
639 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
640 #: opensuse-tumbleweed
641 #, fuzzy
642 #| msgid ""
643 #| "I<pathname> is an empty string, but B<AT_EMPTY_PATH> was not specified in "
644 #| "I<flags>."
645 msgid ""
646 "I<path> is an empty string, but B<AT_EMPTY_PATH> was not specified in "
647 "I<flags>."
648 msgstr ""
649 "Значение I<pathname> равно пустой строке, но в I<flags> не указано значение "
650 "B<AT_EMPTY_PATH>."
651
652 #. type: TP
653 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
654 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
655 #, no-wrap
656 msgid "B<ENOTDIR>"
657 msgstr "B<ENOTDIR>"
658
659 #. type: Plain text
660 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
661 #: opensuse-tumbleweed
662 #, fuzzy
663 #| msgid ""
664 #| "The file descriptor supplied in I<dirfd> does not refer to a directory, "
665 #| "and it is not the case that both I<flags> includes B<AT_EMPTY_PATH> and "
666 #| "I<pathname> is an empty string."
667 msgid ""
668 "The file descriptor supplied in I<dirfd> does not refer to a directory, and "
669 "it is not the case that both I<flags> includes B<AT_EMPTY_PATH> and I<path> "
670 "is an empty string."
671 msgstr ""
672 "Файловый дескриптор, указанный в I<dirfd>, не ссылается на каталог и это не "
673 "тот случай, когда I<flags> содержит B<AT_EMPTY_PATH> и I<pathname> равно "
674 "пустой строке."
675
676 #. type: TP
677 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
678 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
679 #, no-wrap
680 msgid "B<EOPNOTSUPP>"
681 msgstr "B<EOPNOTSUPP>"
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 msgid ""
687 "The filesystem does not support decoding of a pathname to a file handle."
688 msgstr ""
689 "Файловая система не поддерживает преобразование пути в файловый описатель."
690
691 #. type: TP
692 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
693 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
694 #, no-wrap
695 msgid "B<EOVERFLOW>"
696 msgstr "B<EOVERFLOW>"
697
698 #. type: Plain text
699 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
700 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
701 msgid ""
702 "The I<handle-E<gt>handle_bytes> value passed into the call was too small. "
703 "When this error occurs, I<handle-E<gt>handle_bytes> is updated to indicate "
704 "the required size for the handle."
705 msgstr ""
706 "Значение I<handle-E<gt>handle_bytes>, переданное в вызов, слишком мало. При "
707 "этой ошибке I<handle-E<gt>handle_bytes> присваивается требуемый размер для "
708 "описателя."
709
710 #. type: Plain text
711 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
712 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
713 msgid "B<open_by_handle_at>() can fail with the following errors:"
714 msgstr "Вызов B<open_by_handle_at>() может завершиться со следующими ошибками:"
715
716 #. type: TP
717 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
718 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
719 #, no-wrap
720 msgid "B<EBADF>"
721 msgstr "B<EBADF>"
722
723 #. type: Plain text
724 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
725 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
726 msgid "I<mount_fd> is not an open file descriptor."
727 msgstr "Значение I<mount_fd> не является открытым файловым дескриптором."
728
729 #. type: Plain text
730 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
731 #: opensuse-tumbleweed
732 #, fuzzy
733 #| msgid ""
734 #| "I<pathname> is relative but I<dirfd> is neither B<AT_FDCWD> nor a valid "
735 #| "file descriptor."
736 msgid ""
737 "I<path> is relative but I<dirfd> is neither B<AT_FDCWD> nor a valid file "
738 "descriptor."
739 msgstr ""
740 "В I<pathname> содержится относительный путь, но значение I<dirfd> не равно "
741 "B<AT_FDCWD> и не является правильным файловым дескриптором."
742
743 #. type: Plain text
744 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
745 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
746 msgid "I<handle> points outside your accessible address space."
747 msgstr ""
748 "Значение I<handle> указывает за пределы доступного адресного пространства."
749
750 #. type: Plain text
751 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
752 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
753 msgid ""
754 "I<handle-E<gt>handle_bytes> is greater than B<MAX_HANDLE_SZ> or is equal to "
755 "zero."
756 msgstr ""
757 "Значение I<handle-E<gt>handle_bytes> больше B<MAX_HANDLE_SZ> или равно нулю."
758
759 #. type: TP
760 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
761 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
762 #, no-wrap
763 msgid "B<ELOOP>"
764 msgstr "B<ELOOP>"
765
766 #. type: Plain text
767 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
768 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
769 msgid ""
770 "I<handle> refers to a symbolic link, but B<O_PATH> was not specified in "
771 "I<flags>."
772 msgstr ""
773 "Значение I<handle> указывает на символическую ссылку, но в I<flags> не "
774 "указан B<O_PATH>."
775
776 #. type: TP
777 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
778 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
779 #, no-wrap
780 msgid "B<EPERM>"
781 msgstr "B<EPERM>"
782
783 #. type: Plain text
784 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
785 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
786 msgid "The caller does not have the B<CAP_DAC_READ_SEARCH> capability."
787 msgstr "Вызывающий не имеет мандата B<CAP_DAC_READ_SEARCH>."
788
789 #. type: TP
790 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
791 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
792 #, no-wrap
793 msgid "B<ESTALE>"
794 msgstr "B<ESTALE>"
795
796 #. type: Plain text
797 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
798 #: opensuse-tumbleweed
799 msgid ""
800 "The specified I<handle> is not valid for opening a file. This error will "
801 "occur if, for example, the file has been deleted. This error can also occur "
802 "if the I<handle> was acquired using the B<AT_HANDLE_FID> flag and the "
803 "filesystem does not support B<open_by_handle_at>(). This error can also "
804 "occur if the I<handle> was acquired using the B<AT_HANDLE_CONNECTABLE> flag "
805 "and the file was moved to a different parent."
806 msgstr ""
807
808 #. type: SH
809 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
810 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
811 #, no-wrap
812 msgid "VERSIONS"
813 msgstr "ВЕРСИИ"
814
815 #. type: Plain text
816 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
817 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
818 #, fuzzy
819 #| msgid ""
820 #| "FreeBSD has a broadly similar pair of system calls in the form of "
821 #| "B<getfh>() and B<openfh>()."
822 msgid ""
823 "FreeBSD has a broadly similar pair of system calls in the form of "
824 "B<getfh>() and B<fhopen>()."
825 msgstr ""
826 "В FreeBSD есть относительно похожая пара системных вызовов B<getfh>() и "
827 "B<openfh>()."
828
829 #. type: SH
830 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
831 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
832 #, no-wrap
833 msgid "STANDARDS"
834 msgstr "СТАНДАРТЫ"
835
836 #. type: Plain text
837 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
838 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
839 msgid "Linux."
840 msgstr "Linux."
841
842 #. type: SH
843 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
844 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
845 #, no-wrap
846 msgid "HISTORY"
847 msgstr "ИСТОРИЯ"
848
849 #. type: Plain text
850 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
851 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
852 msgid "Linux 2.6.39, glibc 2.14."
853 msgstr ""
854
855 #. type: SH
856 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
857 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
858 #, no-wrap
859 msgid "NOTES"
860 msgstr "ПРИМЕЧАНИЯ"
861
862 #. type: Plain text
863 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
864 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
865 msgid ""
866 "A file handle can be generated in one process using B<name_to_handle_at>() "
867 "and later used in a different process that calls B<open_by_handle_at>()."
868 msgstr ""
869 "Файловый описатель может быть сгенерирован с помощью B<name_to_handle_at>() "
870 "в одном процессе и использован в вызовах B<open_by_handle_at>() в другом."
871
872 #. type: Plain text
873 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
874 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
875 #, fuzzy
876 #| msgid ""
877 #| "Some filesystem don't support the translation of pathnames to file "
878 #| "handles, for example, I</proc>, I</sys>, and various network filesystems."
879 msgid ""
880 "Some filesystem don't support the translation of pathnames to file handles, "
881 "for example, I</proc>, I</sys>, and various network filesystems. Some "
882 "filesystems support the translation of pathnames to file handles, but do not "
883 "support using those file handles in B<open_by_handle_at>()."
884 msgstr ""
885 "Некоторые файловые системы не поддерживают трансляцию путей в файловые "
886 "описатели, например: I</proc>, I</sys> и различные сетевые файловые системы."
887
888 #. type: Plain text
889 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
890 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
891 msgid ""
892 "A file handle may become invalid (\"stale\") if a file is deleted, or for "
893 "other filesystem-specific reasons. Invalid handles are notified by an "
894 "B<ESTALE> error from B<open_by_handle_at>()."
895 msgstr ""
896 "Файловый описатель может стать некорректным («просроченным»), если файл "
897 "удалён, или по другим причинам, относящимся к файловой системе. Для "
898 "некорректных описателей B<open_by_handle_at>() возвращает ошибку B<ESTALE>."
899
900 #. https://lwn.net/Articles/375888/
901 #. "Open by handle" - Jonathan Corbet, 2010-02-23
902 #. type: Plain text
903 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
904 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
905 msgid ""
906 "These system calls are designed for use by user-space file servers. For "
907 "example, a user-space NFS server might generate a file handle and pass it to "
908 "an NFS client. Later, when the client wants to open the file, it could pass "
909 "the handle back to the server. This sort of functionality allows a user-"
910 "space file server to operate in a stateless fashion with respect to the "
911 "files it serves."
912 msgstr ""
913 "Данные системные вызовы предназначены для использования в файловых серверах "
914 "пространства пользователя. Например, сервер пользовательского пространства "
915 "NFS может генерировать файловый описатель и передавать его клиенту NFS. "
916 "Позднее, когда клиент захочет открыть файл, он может передать описатель "
917 "обратно серверу. Такого рода возможность позволяет файловому серверу "
918 "пространства пользователя работать без формирования состояния (stateless "
919 "fashion) для файлов, которые они обслуживают."
920
921 #. commit bcda76524cd1fa32af748536f27f674a13e56700
922 #. type: Plain text
923 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
924 #: opensuse-tumbleweed
925 #, fuzzy
926 #| msgid ""
927 #| "If I<pathname> refers to a symbolic link and I<flags> does not specify "
928 #| "B<AT_SYMLINK_FOLLOW>, then B<name_to_handle_at>() returns a handle for "
929 #| "the link (rather than the file to which it refers). The process "
930 #| "receiving the handle can later perform operations on the symbolic link by "
931 #| "converting the handle to a file descriptor using B<open_by_handle_at>() "
932 #| "with the B<O_PATH> flag, and then passing the file descriptor as the "
933 #| "I<dirfd> argument in system calls such as B<readlinkat>(2) and "
934 #| "B<fchownat>(2)."
935 msgid ""
936 "If I<path> refers to a symbolic link and I<flags> does not specify "
937 "B<AT_SYMLINK_FOLLOW>, then B<name_to_handle_at>() returns a handle for the "
938 "link (rather than the file to which it refers). The process receiving the "
939 "handle can later perform operations on the symbolic link by converting the "
940 "handle to a file descriptor using B<open_by_handle_at>() with the B<O_PATH> "
941 "flag, and then passing the file descriptor as the I<dirfd> argument in "
942 "system calls such as B<readlinkat>(2) and B<fchownat>(2)."
943 msgstr ""
944 "Если I<pathname> указывает на символическую ссылку и в I<flags> отсутствует "
945 "B<AT_SYMLINK_FOLLOW>, то B<name_to_handle_at>() возвращает описатель ссылки "
946 "(а не файла, на который она ссылается). Процесс, получивший описатель, может "
947 "позднее выполнить операции над символической ссылкой, преобразовав описатель "
948 "в файловый дескриптор, используя B<open_by_handle_at>() с флагом B<O_PATH>, "
949 "и затем передав файловый дескриптор через аргумент I<dirfd> в системные "
950 "вызовы B<readlinkat>(2) и B<fchownat>(2)."
951
952 #. type: SS
953 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
954 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
955 #, no-wrap
956 msgid "Obtaining a persistent filesystem ID"
957 msgstr "Получение постоянного идентификатора файловой системы"
958
959 #. type: Plain text
960 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
961 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
962 msgid ""
963 "The mount IDs in I</proc/self/mountinfo> can be reused as filesystems are "
964 "unmounted and mounted. Therefore, the mount ID returned by "
965 "B<name_to_handle_at>() (in I<*mount_id>) should not be treated as a "
966 "persistent identifier for the corresponding mounted filesystem. However, an "
967 "application can use the information in the I<mountinfo> record that "
968 "corresponds to the mount ID to derive a persistent identifier."
969 msgstr ""
970 "Идентификаторы монтирования в I</proc/self/mountinfo> могут быть "
971 "использованы повторно после размонтирования и монтирования файловой системы. "
972 "Поэтому, идентификатор монтирования, возвращаемый B<name_to_handle_at>() (в "
973 "I<*mount_id>), не должен считаться постоянным идентификатором "
974 "соответствующей файловой системы. Однако, приложение может использовать "
975 "информацию в записи I<mountinfo>, которая соответствует идентификатору "
976 "монтирования, для получения постоянного идентификатора."
977
978 #. e.g., http://stackoverflow.com/questions/6748429/using-libblkid-to-find-uuid-of-a-partition
979 #. type: Plain text
980 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
981 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
982 msgid ""
983 "For example, one can use the device name in the fifth field of the "
984 "I<mountinfo> record to search for the corresponding device UUID via the "
985 "symbolic links in I</dev/disks/by-uuid>. (A more comfortable way of "
986 "obtaining the UUID is to use the B<libblkid>(3) library.) That process can "
987 "then be reversed, using the UUID to look up the device name, and then "
988 "obtaining the corresponding mount point, in order to produce the I<mount_fd> "
989 "argument used by B<open_by_handle_at>()."
990 msgstr ""
991 "Например, можно использовать имя устройства в пятом поле записи I<mountinfo> "
992 "для поиска соответствующего устройству UUID через символические ссылки в I</"
993 "dev/disks/by-uuid> (более удобный способ получения UUID — использовать "
994 "библиотеку B<libblkid>(3)). Этот процесс может быть и обратным — используя "
995 "UUID найти имя устройства, и затем получить соответствующую точку "
996 "монтирования, чтобы создать аргумент I<mount_fd>, используемый для "
997 "B<open_by_handle_at>()."
998
999 #. type: SH
1000 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1001 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1002 #, no-wrap
1003 msgid "EXAMPLES"
1004 msgstr "ПРИМЕРЫ"
1005
1006 #. type: Plain text
1007 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1008 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1009 msgid ""
1010 "The two programs below demonstrate the use of B<name_to_handle_at>() and "
1011 "B<open_by_handle_at>(). The first program (I<t_name_to_handle_at.c>) uses "
1012 "B<name_to_handle_at>() to obtain the file handle and mount ID for the file "
1013 "specified in its command-line argument; the handle and mount ID are written "
1014 "to standard output."
1015 msgstr ""
1016 "Две представленные далее программы демонстрируют использование "
1017 "B<name_to_handle_at>() и B<open_by_handle_at>(). Первая программа "
1018 "(I<t_name_to_handle_at.c>) использует B<name_to_handle_at>() для получения "
1019 "файлового описателя и идентификатора монтирования для файла, указанного в "
1020 "аргументе командной строки; описатель и идентификатор монтирования "
1021 "записываются в стандартный вывод."
1022
1023 #. type: Plain text
1024 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1025 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1026 msgid ""
1027 "The second program (I<t_open_by_handle_at.c>) reads a mount ID and file "
1028 "handle from standard input. The program then employs "
1029 "B<open_by_handle_at>() to open the file using that handle. If an optional "
1030 "command-line argument is supplied, then the I<mount_fd> argument for "
1031 "B<open_by_handle_at>() is obtained by opening the directory named in that "
1032 "argument. Otherwise, I<mount_fd> is obtained by scanning I</proc/self/"
1033 "mountinfo> to find a record whose mount ID matches the mount ID read from "
1034 "standard input, and the mount directory specified in that record is opened. "
1035 "(These programs do not deal with the fact that mount IDs are not persistent.)"
1036 msgstr ""
1037 "Вторая программа (I<t_open_by_handle_at.c>) читает идентификатор "
1038 "монтирования и файловый описатель из стандартного ввода. Затем программа, "
1039 "используя описатель, применяет B<open_by_handle_at>() для открытия файла. "
1040 "Если указан необязательный параметр командной строки, то аргумент "
1041 "I<mount_fd> для B<open_by_handle_at>() создаётся из открытия каталога, "
1042 "указанного в аргументе. В противном случае I<mount_fd> заполняется "
1043 "результатом сканированием I</proc/self/mountinfo> в целях найти запись, чей "
1044 "идентификатор монтирования совпадает с идентификатором монтирования из "
1045 "стандартного ввода, и открывается каталог монтирования, указанный в этой "
1046 "записи (эти программы не учитывают, что идентификатор монтирования не "
1047 "постоянен)."
1048
1049 #. type: Plain text
1050 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1051 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1052 msgid "The following shell session demonstrates the use of these two programs:"
1053 msgstr ""
1054 "Следующий сеанс работы в оболочке показывает использование этих программ:"
1055
1056 #. type: Plain text
1057 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1058 #: opensuse-tumbleweed
1059 #, fuzzy, no-wrap
1060 #| msgid ""
1061 #| "$ B<echo \\(aqCan you please think about it?\\(aq E<gt> cecilia.txt>\n"
1062 #| "$ B<./t_name_to_handle_at cecilia.txt E<gt> fh>\n"
1063 #| "$ B<./t_open_by_handle_at E<lt> fh>\n"
1064 #| "open_by_handle_at: Operation not permitted\n"
1065 #| "$ B<sudo ./t_open_by_handle_at E<lt> fh> # Need CAP_SYS_ADMIN\n"
1066 #| "Read 31 bytes\n"
1067 #| "$ B<rm cecilia.txt>\n"
1068 msgid ""
1069 "$B< echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>;\n"
1070 "$B< ./t_name_to_handle_at cecilia.txt E<gt> fh>;\n"
1071 "$B< ./t_open_by_handle_at E<lt> fh>;\n"
1072 "open_by_handle_at: Operation not permitted\n"
1073 "$B< sudo ./t_open_by_handle_at E<lt> fh>; # Need CAP_SYS_ADMIN\n"
1074 "Read 31 bytes\n"
1075 "$B< rm cecilia.txt>;\n"
1076 msgstr ""
1077 "$ B<echo \\(aqCan you please think about it?\\(aq E<gt> cecilia.txt>\n"
1078 "$ B<./t_name_to_handle_at cecilia.txt E<gt> fh>\n"
1079 "$ B<./t_open_by_handle_at E<lt> fh>\n"
1080 "open_by_handle_at: Operation not permitted\n"
1081 "$ B<sudo ./t_open_by_handle_at E<lt> fh> # требуется CAP_SYS_ADMIN\n"
1082 "Read 31 bytes\n"
1083 "$ B<rm cecilia.txt>\n"
1084
1085 #. Christoph Hellwig: That's why the file handles contain a generation
1086 #. counter that gets incremented in this case.
1087 #. type: Plain text
1088 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1089 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1090 msgid ""
1091 "Now we delete and (quickly) re-create the file so that it has the same "
1092 "content and (by chance) the same inode. Nevertheless, "
1093 "B<open_by_handle_at>() recognizes that the original file referred to by the "
1094 "file handle no longer exists."
1095 msgstr ""
1096 "Теперь мы удаляем и (быстро) пересоздаём файл с тем же содержимым и (если "
1097 "повезёт) с той же инодой. Не смотря на это, B<open_by_handle_at>() "
1098 "распознаёт, что первоначальный файл, на который указывал файловый описатель, "
1099 "больше не существует."
1100
1101 #. type: Plain text
1102 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1103 #: opensuse-tumbleweed
1104 #, fuzzy, no-wrap
1105 #| msgid ""
1106 #| "$ B<stat --printf=\"%i\\en\" cecilia.txt> # Display inode number\n"
1107 #| "4072121\n"
1108 #| "$ B<rm cecilia.txt>\n"
1109 #| "$ B<echo \\(aqCan you please think about it?\\(aq E<gt> cecilia.txt>\n"
1110 #| "$ B<stat --printf=\"%i\\en\" cecilia.txt> # Check inode number\n"
1111 #| "4072121\n"
1112 #| "$ B<sudo ./t_open_by_handle_at E<lt> fh>\n"
1113 #| "open_by_handle_at: Stale NFS file handle\n"
1114 msgid ""
1115 "$B< stat --printf=\\[dq]%i\\[rs]n\\[dq] cecilia.txt>; # Display inode number\n"
1116 "4072121\n"
1117 "$B< rm cecilia.txt>;\n"
1118 "$B< echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>;\n"
1119 "$B< stat --printf=\\[dq]%i\\[rs]n\\[dq] cecilia.txt>; # Check inode number\n"
1120 "4072121\n"
1121 "$B< sudo ./t_open_by_handle_at E<lt> fh>;\n"
1122 "open_by_handle_at: Stale NFS file handle\n"
1123 msgstr ""
1124 "$ B<stat --printf=\"%i\\en\" cecilia.txt> # вывести номер иноды\n"
1125 "4072121\n"
1126 "$ B<rm cecilia.txt>\n"
1127 "$ B<echo \\(aqCan you please think about it?\\(aq E<gt> cecilia.txt>\n"
1128 "$ B<stat --printf=\"%i\\en\" cecilia.txt> # проверить номер иноды\n"
1129 "4072121\n"
1130 "$ B<sudo ./t_open_by_handle_at E<lt> fh>\n"
1131 "open_by_handle_at: Stale NFS file handle\n"
1132
1133 #. type: SS
1134 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1135 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1136 #, no-wrap
1137 msgid "Program source: t_name_to_handle_at.c"
1138 msgstr "Исходный код программы: t_name_to_handle_at.c"
1139
1140 #. type: Plain text
1141 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1142 #: opensuse-tumbleweed
1143 #, no-wrap
1144 msgid ""
1145 "#define _GNU_SOURCE\n"
1146 "#include E<lt>err.hE<gt>\n"
1147 "#include E<lt>errno.hE<gt>\n"
1148 "#include E<lt>fcntl.hE<gt>\n"
1149 "#include E<lt>stdio.hE<gt>\n"
1150 "#include E<lt>stdlib.hE<gt>\n"
1151 "\\&\n"
1152 "int\n"
1153 "main(int argc, char *argv[])\n"
1154 "{\n"
1155 " int mount_id, fhsize, flags, dirfd;\n"
1156 " char *path;\n"
1157 " struct file_handle *fhp;\n"
1158 "\\&\n"
1159 " if (argc != 2) {\n"
1160 " fprintf(stderr, \"Usage: %s path\\[rs]n\", argv[0]);\n"
1161 " exit(EXIT_FAILURE);\n"
1162 " }\n"
1163 "\\&\n"
1164 " path = argv[1];\n"
1165 "\\&\n"
1166 " /* Allocate file_handle structure. */\n"
1167 "\\&\n"
1168 " fhsize = sizeof(*fhp);\n"
1169 " fhp = malloc(fhsize);\n"
1170 " if (fhp == NULL)\n"
1171 " err(EXIT_FAILURE, \"malloc\");\n"
1172 "\\&\n"
1173 " /* Make an initial call to name_to_handle_at() to discover\n"
1174 " the size required for file handle. */\n"
1175 "\\&\n"
1176 " dirfd = AT_FDCWD; /* For name_to_handle_at() calls */\n"
1177 " flags = 0; /* For name_to_handle_at() calls */\n"
1178 " fhp-E<gt>handle_bytes = 0;\n"
1179 " if (name_to_handle_at(dirfd, path, fhp, &mount_id, flags) != -1\n"
1180 " || errno != EOVERFLOW)\n"
1181 " {\n"
1182 " fprintf(stderr, \"Unexpected result from name_to_handle_at()\\[rs]n\");\n"
1183 " exit(EXIT_FAILURE);\n"
1184 " }\n"
1185 "\\&\n"
1186 " /* Reallocate file_handle structure with correct size. */\n"
1187 "\\&\n"
1188 " fhsize = sizeof(*fhp) + fhp-E<gt>handle_bytes;\n"
1189 " fhp = realloc(fhp, fhsize); /* Copies fhp-E<gt>handle_bytes */\n"
1190 " if (fhp == NULL)\n"
1191 " err(EXIT_FAILURE, \"realloc\");\n"
1192 "\\&\n"
1193 " /* Get file handle from pathname supplied on command line. */\n"
1194 "\\&\n"
1195 " if (name_to_handle_at(dirfd, path, fhp, &mount_id, flags) == -1)\n"
1196 " err(EXIT_FAILURE, \"name_to_handle_at\");\n"
1197 "\\&\n"
1198 " /* Write mount ID, file handle size, and file handle to stdout,\n"
1199 " for later reuse by t_open_by_handle_at.c. */\n"
1200 "\\&\n"
1201 " printf(\"%d\\[rs]n\", mount_id);\n"
1202 " printf(\"%u %d \", fhp-E<gt>handle_bytes, fhp-E<gt>handle_type);\n"
1203 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1204 " printf(\" %02x\", fhp-E<gt>f_handle[j]);\n"
1205 " printf(\"\\[rs]n\");\n"
1206 "\\&\n"
1207 " exit(EXIT_SUCCESS);\n"
1208 "}\n"
1209 msgstr ""
1210
1211 #. SRC END
1212 #. type: SS
1213 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1214 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1215 #, no-wrap
1216 msgid "Program source: t_open_by_handle_at.c"
1217 msgstr "Исходный код программы: t_open_by_handle_at.c"
1218
1219 #. type: Plain text
1220 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
1221 #, no-wrap
1222 msgid ""
1223 "#define _GNU_SOURCE\n"
1224 "#include E<lt>err.hE<gt>\n"
1225 "#include E<lt>fcntl.hE<gt>\n"
1226 "#include E<lt>limits.hE<gt>\n"
1227 "#include E<lt>stdio.hE<gt>\n"
1228 "#include E<lt>stdlib.hE<gt>\n"
1229 "#include E<lt>string.hE<gt>\n"
1230 "#include E<lt>sys/types.hE<gt>\n"
1231 "#include E<lt>unistd.hE<gt>\n"
1232 "\\&\n"
1233 "#define streq(...) (strcmp(__VA_ARGS__) == 0)\n"
1234 "\\&\n"
1235 "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n"
1236 " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n"
1237 " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n"
1238 " Open the corresponding mount path and return the resulting file\n"
1239 " descriptor. */\n"
1240 "\\&\n"
1241 "static int\n"
1242 "open_mount_path_by_id(int mount_id)\n"
1243 "{\n"
1244 " int mi_mount_id, found;\n"
1245 " char mount_path[PATH_MAX];\n"
1246 " char *linep;\n"
1247 " FILE *fp;\n"
1248 " size_t lsize;\n"
1249 " ssize_t nread;\n"
1250 "\\&\n"
1251 " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n"
1252 " if (fp == NULL)\n"
1253 " err(EXIT_FAILURE, \"fopen\");\n"
1254 "\\&\n"
1255 " found = 0;\n"
1256 " linep = NULL;\n"
1257 " while (!found) {\n"
1258 " nread = getline(&linep, &lsize, fp);\n"
1259 " if (nread == -1)\n"
1260 " break;\n"
1261 "\\&\n"
1262 " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n"
1263 " &mi_mount_id, mount_path);\n"
1264 " if (nread != 2) {\n"
1265 " fprintf(stderr, \"Bad sscanf()\\[rs]n\");\n"
1266 " exit(EXIT_FAILURE);\n"
1267 " }\n"
1268 "\\&\n"
1269 " if (mi_mount_id == mount_id)\n"
1270 " found = 1;\n"
1271 " }\n"
1272 " free(linep);\n"
1273 "\\&\n"
1274 " fclose(fp);\n"
1275 "\\&\n"
1276 " if (!found) {\n"
1277 " fprintf(stderr, \"Could not find mount point\\[rs]n\");\n"
1278 " exit(EXIT_FAILURE);\n"
1279 " }\n"
1280 "\\&\n"
1281 " return open(mount_path, O_RDONLY);\n"
1282 "}\n"
1283 "\\&\n"
1284 "int\n"
1285 "main(int argc, char *argv[])\n"
1286 "{\n"
1287 " int mount_id, fd, mount_fd, handle_bytes;\n"
1288 " char buf[1000];\n"
1289 "#define LINE_SIZE 100\n"
1290 " char line1[LINE_SIZE], line2[LINE_SIZE];\n"
1291 " char *nextp;\n"
1292 " ssize_t nread;\n"
1293 " struct file_handle *fhp;\n"
1294 "\\&\n"
1295 " if ((argc E<gt> 1 && streq(argv[1], \"--help\")) || argc E<gt> 2) {\n"
1296 " fprintf(stderr, \"Usage: %s [mount-path]\\[rs]n\", argv[0]);\n"
1297 " exit(EXIT_FAILURE);\n"
1298 " }\n"
1299 "\\&\n"
1300 " /* Standard input contains mount ID and file handle information:\n"
1301 "\\&\n"
1302 " Line 1: E<lt>mount_idE<gt>\n"
1303 " Line 2: E<lt>handle_bytesE<gt> E<lt>handle_typeE<gt> E<lt>bytes of handle in hexE<gt>\n"
1304 " */\n"
1305 "\\&\n"
1306 " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n"
1307 " fgets(line2, sizeof(line2), stdin) == NULL)\n"
1308 " {\n"
1309 " fprintf(stderr, \"Missing mount_id / file handle\\[rs]n\");\n"
1310 " exit(EXIT_FAILURE);\n"
1311 " }\n"
1312 "\\&\n"
1313 " mount_id = atoi(line1);\n"
1314 "\\&\n"
1315 " handle_bytes = strtoul(line2, &nextp, 0);\n"
1316 "\\&\n"
1317 " /* Given handle_bytes, we can now allocate file_handle structure. */\n"
1318 "\\&\n"
1319 " fhp = malloc(sizeof(*fhp) + handle_bytes);\n"
1320 " if (fhp == NULL)\n"
1321 " err(EXIT_FAILURE, \"malloc\");\n"
1322 "\\&\n"
1323 " fhp-E<gt>handle_bytes = handle_bytes;\n"
1324 "\\&\n"
1325 " fhp-E<gt>handle_type = strtoul(nextp, &nextp, 0);\n"
1326 "\\&\n"
1327 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1328 " fhp-E<gt>f_handle[j] = strtoul(nextp, &nextp, 16);\n"
1329 "\\&\n"
1330 " /* Obtain file descriptor for mount point, either by opening\n"
1331 " the pathname specified on the command line, or by scanning\n"
1332 " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n"
1333 " that we received from stdin. */\n"
1334 "\\&\n"
1335 " if (argc E<gt> 1)\n"
1336 " mount_fd = open(argv[1], O_RDONLY);\n"
1337 " else\n"
1338 " mount_fd = open_mount_path_by_id(mount_id);\n"
1339 "\\&\n"
1340 " if (mount_fd == -1)\n"
1341 " err(EXIT_FAILURE, \"opening mount fd\");\n"
1342 "\\&\n"
1343 " /* Open file using handle and mount point. */\n"
1344 "\\&\n"
1345 " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n"
1346 " if (fd == -1)\n"
1347 " err(EXIT_FAILURE, \"open_by_handle_at\");\n"
1348 "\\&\n"
1349 " /* Try reading a few bytes from the file. */\n"
1350 "\\&\n"
1351 " nread = read(fd, buf, sizeof(buf));\n"
1352 " if (nread == -1)\n"
1353 " err(EXIT_FAILURE, \"read\");\n"
1354 "\\&\n"
1355 " printf(\"Read %zd bytes\\[rs]n\", nread);\n"
1356 "\\&\n"
1357 " exit(EXIT_SUCCESS);\n"
1358 "}\n"
1359 msgstr ""
1360
1361 #. SRC END
1362 #. type: SH
1363 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1364 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1365 #, no-wrap
1366 msgid "SEE ALSO"
1367 msgstr "СМОТРИТЕ ТАКЖЕ"
1368
1369 #. type: Plain text
1370 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1371 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1372 msgid "B<open>(2), B<libblkid>(3), B<blkid>(8), B<findfs>(8), B<mount>(8)"
1373 msgstr "B<open>(2), B<libblkid>(3), B<blkid>(8), B<findfs>(8), B<mount>(8)"
1374
1375 #. type: Plain text
1376 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1377 #: opensuse-tumbleweed
1378 #, fuzzy
1379 #| msgid ""
1380 #| "The I<libblkid> and I<libmount> documentation in the latest I<util-linux> "
1381 #| "release at E<.UR https://www.kernel.org/pub/linux/utils/util-linux/> "
1382 #| "E<.UE>"
1383 msgid ""
1384 "The I<libblkid> and I<libmount> documentation in the latest I<util-linux> "
1385 "release at E<.UR https:\\://www.kernel.org/pub/linux/utils/util-linux/> "
1386 "E<.UE>"
1387 msgstr ""
1388 "Документация I<libblkid> и I<libmount> в последнем выпуске I<util-linux> "
1389 "E<.UR https://www.kernel.org/pub/linux/utils/util-linux/> E<.UE>"
1390
1391 #. type: TH
1392 #: debian-trixie
1393 #, no-wrap
1394 msgid "2024-06-15"
1395 msgstr "15 июня 2024 г."
1396
1397 #. type: TH
1398 #: debian-trixie
1399 #, no-wrap
1400 msgid "Linux man-pages 6.9.1"
1401 msgstr "Страницы руководства Linux 6.9.1"
1402
1403 #. type: Plain text
1404 #: debian-trixie
1405 msgid "Standard C library (I<libc>, I<-lc>)"
1406 msgstr "Стандартная библиотека языка C (I<libc>, I<-lc>)"
1407
1408 #. type: Plain text
1409 #: debian-trixie fedora-44 fedora-rawhide
1410 #, fuzzy, no-wrap
1411 #| msgid ""
1412 #| "B<int name_to_handle_at(int >I<dirfd>B<, const char *>I<pathname>B<,>\n"
1413 #| "B< struct file_handle *>I<handle>B<,>\n"
1414 #| "B< int *>I<mount_id>B<, int >I<flags>B<);>\n"
1415 msgid ""
1416 "B<int name_to_handle_at(int >I<dirfd>B<, const char *>I<pathname>B<,>\n"
1417 "B< struct file_handle *>I<handle>B<,>\n"
1418 "B< int *>I<mount_id>B<, int >I<flags>B<);>\n"
1419 "B<int open_by_handle_at(int >I<mount_fd>B<, struct file_handle *>I<handle>B<,>\n"
1420 "B< int >I<flags>B<);>\n"
1421 msgstr ""
1422 "B<int name_to_handle_at(int >I<dirfd>B<, const char *>I<pathname>B<,>\n"
1423 "B< struct file_handle *>I<handle>B<,>\n"
1424 "B< int *>I<mount_id>B<, int >I<flags>B<);>\n"
1425
1426 #. type: Plain text
1427 #: debian-trixie fedora-44 fedora-rawhide
1428 msgid ""
1429 "The B<name_to_handle_at>() system call returns a file handle and a mount ID "
1430 "corresponding to the file specified by the I<dirfd> and I<pathname> "
1431 "arguments. The file handle is returned via the argument I<handle>, which is "
1432 "a pointer to a structure of the following form:"
1433 msgstr ""
1434 "Системный вызов B<name_to_handle_at>() возвращает файловый описатель и "
1435 "идентификатор монтирования для файла, указанного в аргументах I<dirfd> и "
1436 "I<pathname>. Файловый описатель возвращается через аргумент I<handle>, "
1437 "который является указателем на следующую структуру:"
1438
1439 #. type: Plain text
1440 #: debian-trixie fedora-44 fedora-rawhide
1441 #, fuzzy
1442 #| msgid ""
1443 #| "The I<flags> argument is a bit mask constructed by ORing together zero or "
1444 #| "more of B<AT_EMPTY_PATH> and B<AT_SYMLINK_FOLLOW>, described below."
1445 msgid ""
1446 "The I<flags> argument is a bit mask constructed by ORing together zero or "
1447 "more of B<AT_HANDLE_FID>, B<AT_EMPTY_PATH>, and B<AT_SYMLINK_FOLLOW>, "
1448 "described below."
1449 msgstr ""
1450 "Аргумент I<flags> представляет собой битовую маску (OR) из комбинации нуля "
1451 "или более флагов B<AT_EMPTY_PATH> и B<AT_SYMLINK_FOLLOW>, описанных ниже."
1452
1453 #. type: Plain text
1454 #: debian-trixie fedora-44 fedora-rawhide
1455 msgid ""
1456 "Together, the I<pathname> and I<dirfd> arguments identify the file for which "
1457 "a handle is to be obtained. There are four distinct cases:"
1458 msgstr ""
1459 "Аргументы I<pathname> и I<dirfd> вместе задают файл, для которого будет "
1460 "получен описатель. Есть четыре различных варианта:"
1461
1462 #. type: Plain text
1463 #: debian-trixie fedora-44 fedora-rawhide
1464 msgid ""
1465 "If I<pathname> is a nonempty string containing an absolute pathname, then a "
1466 "handle is returned for the file referred to by that pathname. In this case, "
1467 "I<dirfd> is ignored."
1468 msgstr ""
1469 "Если значение I<pathname> — непустая строка, содержащая абсолютный путь, то "
1470 "описатель возвращается для файла, на который указывает путь. В этом случае "
1471 "I<dirfd> игнорируется."
1472
1473 #. type: Plain text
1474 #: debian-trixie fedora-44 fedora-rawhide
1475 msgid ""
1476 "If I<pathname> is a nonempty string containing a relative pathname and "
1477 "I<dirfd> has the special value B<AT_FDCWD>, then I<pathname> is interpreted "
1478 "relative to the current working directory of the caller, and a handle is "
1479 "returned for the file to which it refers."
1480 msgstr ""
1481 "Если значение I<pathname> — непустая строка, содержащая относительный путь и "
1482 "I<dirfd> равно специальному значению B<AT_FDCWD>, то I<pathname> "
1483 "рассматривается относительно текущего рабочего каталога вызывающего и "
1484 "описатель возвращается для файла, на который он указывает."
1485
1486 #. type: Plain text
1487 #: debian-trixie fedora-44 fedora-rawhide
1488 msgid ""
1489 "If I<pathname> is a nonempty string containing a relative pathname and "
1490 "I<dirfd> is a file descriptor referring to a directory, then I<pathname> is "
1491 "interpreted relative to the directory referred to by I<dirfd>, and a handle "
1492 "is returned for the file to which it refers. (See B<openat>(2) for an "
1493 "explanation of why \"directory file descriptors\" are useful.)"
1494 msgstr ""
1495 "Если значение I<pathname> — непустая строка, содержащая относительный путь и "
1496 "I<dirfd> равно файловому дескриптору, указывающему на каталог, то "
1497 "I<pathname> рассматривается относительно каталога, на который указывает "
1498 "I<dirfd>, и описатель возвращается для файла, на который он указывает "
1499 "(смотрите в B<openat>(2) объяснение полезности «файловых дескрипторов "
1500 "каталогов»)."
1501
1502 #. type: Plain text
1503 #: debian-trixie fedora-44 fedora-rawhide
1504 msgid ""
1505 "If I<pathname> is an empty string and I<flags> specifies the value "
1506 "B<AT_EMPTY_PATH>, then I<dirfd> can be an open file descriptor referring to "
1507 "any type of file, or B<AT_FDCWD>, meaning the current working directory, and "
1508 "a handle is returned for the file to which it refers."
1509 msgstr ""
1510 "Если значение I<pathname> — пустая строка и значение I<flags> равно "
1511 "B<AT_EMPTY_PATH>, то I<dirfd> может быть открытым файловым дескриптором, "
1512 "указывающим на файл любого типа, или B<AT_FDCWD>, означающим текущий рабочий "
1513 "каталог, и описатель возвращается для файла, на который он указывает."
1514
1515 #. type: Plain text
1516 #: debian-trixie fedora-44 fedora-rawhide
1517 msgid ""
1518 "The I<mount_id> argument returns an identifier for the filesystem mount that "
1519 "corresponds to I<pathname>. This corresponds to the first field in one of "
1520 "the records in I</proc/self/mountinfo>. Opening the pathname in the fifth "
1521 "field of that record yields a file descriptor for the mount point; that file "
1522 "descriptor can be used in a subsequent call to B<open_by_handle_at>(). "
1523 "I<mount_id> is returned both for a successful call and for a call that "
1524 "results in the error B<EOVERFLOW>."
1525 msgstr ""
1526 "В аргументе I<mount_id> возвращается идентификатор точки монтирования в "
1527 "файловой системе, соответствующий I<pathname>. Это значение соответствует "
1528 "первому полю одной из записей в I</proc/self/mountinfo>. Открытие пути из "
1529 "пятого поля этой записи возвращает файловый дескриптор этой точки "
1530 "монтирования; этот файловый дескриптор можно использовать в последующем "
1531 "вызове B<open_by_handle_at>(). Аргумент I<mount_id> возвращается при "
1532 "успешном выполнении, а также при ошибке B<EOVERFLOW>()."
1533
1534 #. type: Plain text
1535 #: debian-trixie fedora-44 fedora-rawhide
1536 msgid ""
1537 "By default, B<name_to_handle_at>() does not dereference I<pathname> if it "
1538 "is a symbolic link, and thus returns a handle for the link itself. If "
1539 "B<AT_SYMLINK_FOLLOW> is specified in I<flags>, I<pathname> is dereferenced "
1540 "if it is a symbolic link (so that the call returns a handle for the file "
1541 "referred to by the link)."
1542 msgstr ""
1543 "По умолчанию, B<name_to_handle_at>() не разыменовывает I<pathname>, если это "
1544 "символическая ссылка, и поэтому возвращается описатель самой ссылки. Если в "
1545 "I<flags> указан B<AT_SYMLINK_FOLLOW>, то I<pathname> разыменовывается, если "
1546 "это символическая ссылка (то есть вызов возвращает описатель файла, на "
1547 "который указывает ссылка)."
1548
1549 #. type: Plain text
1550 #: debian-trixie fedora-44 fedora-rawhide
1551 msgid ""
1552 "I<pathname>, I<mount_id>, or I<handle> points outside your accessible "
1553 "address space."
1554 msgstr ""
1555 "Значение I<pathname>, I<mount_id> или I<handle> указывает за пределы "
1556 "доступного адресного пространства."
1557
1558 #. type: Plain text
1559 #: debian-trixie fedora-44 fedora-rawhide
1560 msgid "I<flags> includes an invalid bit value."
1561 msgstr "Значение I<flags> содержит некорректно установленный бит."
1562
1563 #. type: Plain text
1564 #: debian-trixie fedora-44 fedora-rawhide
1565 msgid ""
1566 "I<pathname> is an empty string, but B<AT_EMPTY_PATH> was not specified in "
1567 "I<flags>."
1568 msgstr ""
1569 "Значение I<pathname> равно пустой строке, но в I<flags> не указано значение "
1570 "B<AT_EMPTY_PATH>."
1571
1572 #. type: Plain text
1573 #: debian-trixie fedora-44 fedora-rawhide
1574 msgid ""
1575 "The file descriptor supplied in I<dirfd> does not refer to a directory, and "
1576 "it is not the case that both I<flags> includes B<AT_EMPTY_PATH> and "
1577 "I<pathname> is an empty string."
1578 msgstr ""
1579 "Файловый дескриптор, указанный в I<dirfd>, не ссылается на каталог и это не "
1580 "тот случай, когда I<flags> содержит B<AT_EMPTY_PATH> и I<pathname> равно "
1581 "пустой строке."
1582
1583 #. type: Plain text
1584 #: debian-trixie fedora-44 fedora-rawhide
1585 msgid ""
1586 "I<pathname> is relative but I<dirfd> is neither B<AT_FDCWD> nor a valid file "
1587 "descriptor."
1588 msgstr ""
1589 "В I<pathname> содержится относительный путь, но значение I<dirfd> не равно "
1590 "B<AT_FDCWD> и не является правильным файловым дескриптором."
1591
1592 #. type: Plain text
1593 #: debian-trixie fedora-44 fedora-rawhide
1594 msgid ""
1595 "The specified I<handle> is not valid for opening a file. This error will "
1596 "occur if, for example, the file has been deleted. This error can also occur "
1597 "if the I<handle> was acquired using the B<AT_HANDLE_FID> flag and the "
1598 "filesystem does not support B<open_by_handle_at>()."
1599 msgstr ""
1600
1601 #. commit bcda76524cd1fa32af748536f27f674a13e56700
1602 #. type: Plain text
1603 #: debian-trixie fedora-44 fedora-rawhide
1604 msgid ""
1605 "If I<pathname> refers to a symbolic link and I<flags> does not specify "
1606 "B<AT_SYMLINK_FOLLOW>, then B<name_to_handle_at>() returns a handle for the "
1607 "link (rather than the file to which it refers). The process receiving the "
1608 "handle can later perform operations on the symbolic link by converting the "
1609 "handle to a file descriptor using B<open_by_handle_at>() with the B<O_PATH> "
1610 "flag, and then passing the file descriptor as the I<dirfd> argument in "
1611 "system calls such as B<readlinkat>(2) and B<fchownat>(2)."
1612 msgstr ""
1613 "Если I<pathname> указывает на символическую ссылку и в I<flags> отсутствует "
1614 "B<AT_SYMLINK_FOLLOW>, то B<name_to_handle_at>() возвращает описатель ссылки "
1615 "(а не файла, на который она ссылается). Процесс, получивший описатель, может "
1616 "позднее выполнить операции над символической ссылкой, преобразовав описатель "
1617 "в файловый дескриптор, используя B<open_by_handle_at>() с флагом B<O_PATH>, "
1618 "и затем передав файловый дескриптор через аргумент I<dirfd> в системные "
1619 "вызовы B<readlinkat>(2) и B<fchownat>(2)."
1620
1621 #. type: Plain text
1622 #: debian-trixie fedora-44 fedora-rawhide
1623 #, fuzzy, no-wrap
1624 #| msgid ""
1625 #| "$ B<echo \\(aqCan you please think about it?\\(aq E<gt> cecilia.txt>\n"
1626 #| "$ B<./t_name_to_handle_at cecilia.txt E<gt> fh>\n"
1627 #| "$ B<./t_open_by_handle_at E<lt> fh>\n"
1628 #| "open_by_handle_at: Operation not permitted\n"
1629 #| "$ B<sudo ./t_open_by_handle_at E<lt> fh> # Need CAP_SYS_ADMIN\n"
1630 #| "Read 31 bytes\n"
1631 #| "$ B<rm cecilia.txt>\n"
1632 msgid ""
1633 "$ B<echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>\n"
1634 "$ B<./t_name_to_handle_at cecilia.txt E<gt> fh>\n"
1635 "$ B<./t_open_by_handle_at E<lt> fh>\n"
1636 "open_by_handle_at: Operation not permitted\n"
1637 "$ B<sudo ./t_open_by_handle_at E<lt> fh> # Need CAP_SYS_ADMIN\n"
1638 "Read 31 bytes\n"
1639 "$ B<rm cecilia.txt>\n"
1640 msgstr ""
1641 "$ B<echo \\(aqCan you please think about it?\\(aq E<gt> cecilia.txt>\n"
1642 "$ B<./t_name_to_handle_at cecilia.txt E<gt> fh>\n"
1643 "$ B<./t_open_by_handle_at E<lt> fh>\n"
1644 "open_by_handle_at: Operation not permitted\n"
1645 "$ B<sudo ./t_open_by_handle_at E<lt> fh> # требуется CAP_SYS_ADMIN\n"
1646 "Read 31 bytes\n"
1647 "$ B<rm cecilia.txt>\n"
1648
1649 #. type: Plain text
1650 #: debian-trixie fedora-44 fedora-rawhide
1651 #, fuzzy, no-wrap
1652 #| msgid ""
1653 #| "$ B<stat --printf=\"%i\\en\" cecilia.txt> # Display inode number\n"
1654 #| "4072121\n"
1655 #| "$ B<rm cecilia.txt>\n"
1656 #| "$ B<echo \\(aqCan you please think about it?\\(aq E<gt> cecilia.txt>\n"
1657 #| "$ B<stat --printf=\"%i\\en\" cecilia.txt> # Check inode number\n"
1658 #| "4072121\n"
1659 #| "$ B<sudo ./t_open_by_handle_at E<lt> fh>\n"
1660 #| "open_by_handle_at: Stale NFS file handle\n"
1661 msgid ""
1662 "$ B<stat --printf=\"%i\\[rs]n\" cecilia.txt> # Display inode number\n"
1663 "4072121\n"
1664 "$ B<rm cecilia.txt>\n"
1665 "$ B<echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>\n"
1666 "$ B<stat --printf=\"%i\\[rs]n\" cecilia.txt> # Check inode number\n"
1667 "4072121\n"
1668 "$ B<sudo ./t_open_by_handle_at E<lt> fh>\n"
1669 "open_by_handle_at: Stale NFS file handle\n"
1670 msgstr ""
1671 "$ B<stat --printf=\"%i\\en\" cecilia.txt> # вывести номер иноды\n"
1672 "4072121\n"
1673 "$ B<rm cecilia.txt>\n"
1674 "$ B<echo \\(aqCan you please think about it?\\(aq E<gt> cecilia.txt>\n"
1675 "$ B<stat --printf=\"%i\\en\" cecilia.txt> # проверить номер иноды\n"
1676 "4072121\n"
1677 "$ B<sudo ./t_open_by_handle_at E<lt> fh>\n"
1678 "open_by_handle_at: Stale NFS file handle\n"
1679
1680 #. type: Plain text
1681 #: debian-trixie fedora-44 fedora-rawhide
1682 #, no-wrap
1683 msgid ""
1684 "#define _GNU_SOURCE\n"
1685 "#include E<lt>err.hE<gt>\n"
1686 "#include E<lt>errno.hE<gt>\n"
1687 "#include E<lt>fcntl.hE<gt>\n"
1688 "#include E<lt>stdio.hE<gt>\n"
1689 "#include E<lt>stdlib.hE<gt>\n"
1690 "\\&\n"
1691 "int\n"
1692 "main(int argc, char *argv[])\n"
1693 "{\n"
1694 " int mount_id, fhsize, flags, dirfd;\n"
1695 " char *pathname;\n"
1696 " struct file_handle *fhp;\n"
1697 "\\&\n"
1698 " if (argc != 2) {\n"
1699 " fprintf(stderr, \"Usage: %s pathname\\[rs]n\", argv[0]);\n"
1700 " exit(EXIT_FAILURE);\n"
1701 " }\n"
1702 "\\&\n"
1703 " pathname = argv[1];\n"
1704 "\\&\n"
1705 " /* Allocate file_handle structure. */\n"
1706 "\\&\n"
1707 " fhsize = sizeof(*fhp);\n"
1708 " fhp = malloc(fhsize);\n"
1709 " if (fhp == NULL)\n"
1710 " err(EXIT_FAILURE, \"malloc\");\n"
1711 "\\&\n"
1712 " /* Make an initial call to name_to_handle_at() to discover\n"
1713 " the size required for file handle. */\n"
1714 "\\&\n"
1715 " dirfd = AT_FDCWD; /* For name_to_handle_at() calls */\n"
1716 " flags = 0; /* For name_to_handle_at() calls */\n"
1717 " fhp-E<gt>handle_bytes = 0;\n"
1718 " if (name_to_handle_at(dirfd, pathname, fhp,\n"
1719 " &mount_id, flags) != -1\n"
1720 " || errno != EOVERFLOW)\n"
1721 " {\n"
1722 " fprintf(stderr, \"Unexpected result from name_to_handle_at()\\[rs]n\");\n"
1723 " exit(EXIT_FAILURE);\n"
1724 " }\n"
1725 "\\&\n"
1726 " /* Reallocate file_handle structure with correct size. */\n"
1727 "\\&\n"
1728 " fhsize = sizeof(*fhp) + fhp-E<gt>handle_bytes;\n"
1729 " fhp = realloc(fhp, fhsize); /* Copies fhp-E<gt>handle_bytes */\n"
1730 " if (fhp == NULL)\n"
1731 " err(EXIT_FAILURE, \"realloc\");\n"
1732 "\\&\n"
1733 " /* Get file handle from pathname supplied on command line. */\n"
1734 "\\&\n"
1735 " if (name_to_handle_at(dirfd, pathname, fhp, &mount_id, flags) == -1)\n"
1736 " err(EXIT_FAILURE, \"name_to_handle_at\");\n"
1737 "\\&\n"
1738 " /* Write mount ID, file handle size, and file handle to stdout,\n"
1739 " for later reuse by t_open_by_handle_at.c. */\n"
1740 "\\&\n"
1741 " printf(\"%d\\[rs]n\", mount_id);\n"
1742 " printf(\"%u %d \", fhp-E<gt>handle_bytes, fhp-E<gt>handle_type);\n"
1743 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1744 " printf(\" %02x\", fhp-E<gt>f_handle[j]);\n"
1745 " printf(\"\\[rs]n\");\n"
1746 "\\&\n"
1747 " exit(EXIT_SUCCESS);\n"
1748 "}\n"
1749 msgstr ""
1750
1751 #. type: Plain text
1752 #: debian-trixie fedora-44 fedora-rawhide
1753 #, no-wrap
1754 msgid ""
1755 "#define _GNU_SOURCE\n"
1756 "#include E<lt>err.hE<gt>\n"
1757 "#include E<lt>fcntl.hE<gt>\n"
1758 "#include E<lt>limits.hE<gt>\n"
1759 "#include E<lt>stdio.hE<gt>\n"
1760 "#include E<lt>stdlib.hE<gt>\n"
1761 "#include E<lt>string.hE<gt>\n"
1762 "#include E<lt>sys/types.hE<gt>\n"
1763 "#include E<lt>unistd.hE<gt>\n"
1764 "\\&\n"
1765 "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n"
1766 " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n"
1767 " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n"
1768 " Open the corresponding mount path and return the resulting file\n"
1769 " descriptor. */\n"
1770 "\\&\n"
1771 "static int\n"
1772 "open_mount_path_by_id(int mount_id)\n"
1773 "{\n"
1774 " int mi_mount_id, found;\n"
1775 " char mount_path[PATH_MAX];\n"
1776 " char *linep;\n"
1777 " FILE *fp;\n"
1778 " size_t lsize;\n"
1779 " ssize_t nread;\n"
1780 "\\&\n"
1781 " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n"
1782 " if (fp == NULL)\n"
1783 " err(EXIT_FAILURE, \"fopen\");\n"
1784 "\\&\n"
1785 " found = 0;\n"
1786 " linep = NULL;\n"
1787 " while (!found) {\n"
1788 " nread = getline(&linep, &lsize, fp);\n"
1789 " if (nread == -1)\n"
1790 " break;\n"
1791 "\\&\n"
1792 " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n"
1793 " &mi_mount_id, mount_path);\n"
1794 " if (nread != 2) {\n"
1795 " fprintf(stderr, \"Bad sscanf()\\[rs]n\");\n"
1796 " exit(EXIT_FAILURE);\n"
1797 " }\n"
1798 "\\&\n"
1799 " if (mi_mount_id == mount_id)\n"
1800 " found = 1;\n"
1801 " }\n"
1802 " free(linep);\n"
1803 "\\&\n"
1804 " fclose(fp);\n"
1805 "\\&\n"
1806 " if (!found) {\n"
1807 " fprintf(stderr, \"Could not find mount point\\[rs]n\");\n"
1808 " exit(EXIT_FAILURE);\n"
1809 " }\n"
1810 "\\&\n"
1811 " return open(mount_path, O_RDONLY);\n"
1812 "}\n"
1813 "\\&\n"
1814 "int\n"
1815 "main(int argc, char *argv[])\n"
1816 "{\n"
1817 " int mount_id, fd, mount_fd, handle_bytes;\n"
1818 " char buf[1000];\n"
1819 "#define LINE_SIZE 100\n"
1820 " char line1[LINE_SIZE], line2[LINE_SIZE];\n"
1821 " char *nextp;\n"
1822 " ssize_t nread;\n"
1823 " struct file_handle *fhp;\n"
1824 "\\&\n"
1825 " if ((argc E<gt> 1 && strcmp(argv[1], \"--help\") == 0) || argc E<gt> 2) {\n"
1826 " fprintf(stderr, \"Usage: %s [mount-path]\\[rs]n\", argv[0]);\n"
1827 " exit(EXIT_FAILURE);\n"
1828 " }\n"
1829 "\\&\n"
1830 " /* Standard input contains mount ID and file handle information:\n"
1831 "\\&\n"
1832 " Line 1: E<lt>mount_idE<gt>\n"
1833 " Line 2: E<lt>handle_bytesE<gt> E<lt>handle_typeE<gt> E<lt>bytes of handle in hexE<gt>\n"
1834 " */\n"
1835 "\\&\n"
1836 " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n"
1837 " fgets(line2, sizeof(line2), stdin) == NULL)\n"
1838 " {\n"
1839 " fprintf(stderr, \"Missing mount_id / file handle\\[rs]n\");\n"
1840 " exit(EXIT_FAILURE);\n"
1841 " }\n"
1842 "\\&\n"
1843 " mount_id = atoi(line1);\n"
1844 "\\&\n"
1845 " handle_bytes = strtoul(line2, &nextp, 0);\n"
1846 "\\&\n"
1847 " /* Given handle_bytes, we can now allocate file_handle structure. */\n"
1848 "\\&\n"
1849 " fhp = malloc(sizeof(*fhp) + handle_bytes);\n"
1850 " if (fhp == NULL)\n"
1851 " err(EXIT_FAILURE, \"malloc\");\n"
1852 "\\&\n"
1853 " fhp-E<gt>handle_bytes = handle_bytes;\n"
1854 "\\&\n"
1855 " fhp-E<gt>handle_type = strtoul(nextp, &nextp, 0);\n"
1856 "\\&\n"
1857 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1858 " fhp-E<gt>f_handle[j] = strtoul(nextp, &nextp, 16);\n"
1859 "\\&\n"
1860 " /* Obtain file descriptor for mount point, either by opening\n"
1861 " the pathname specified on the command line, or by scanning\n"
1862 " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n"
1863 " that we received from stdin. */\n"
1864 "\\&\n"
1865 " if (argc E<gt> 1)\n"
1866 " mount_fd = open(argv[1], O_RDONLY);\n"
1867 " else\n"
1868 " mount_fd = open_mount_path_by_id(mount_id);\n"
1869 "\\&\n"
1870 " if (mount_fd == -1)\n"
1871 " err(EXIT_FAILURE, \"opening mount fd\");\n"
1872 "\\&\n"
1873 " /* Open file using handle and mount point. */\n"
1874 "\\&\n"
1875 " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n"
1876 " if (fd == -1)\n"
1877 " err(EXIT_FAILURE, \"open_by_handle_at\");\n"
1878 "\\&\n"
1879 " /* Try reading a few bytes from the file. */\n"
1880 "\\&\n"
1881 " nread = read(fd, buf, sizeof(buf));\n"
1882 " if (nread == -1)\n"
1883 " err(EXIT_FAILURE, \"read\");\n"
1884 "\\&\n"
1885 " printf(\"Read %zd bytes\\[rs]n\", nread);\n"
1886 "\\&\n"
1887 " exit(EXIT_SUCCESS);\n"
1888 "}\n"
1889 msgstr ""
1890
1891 #. type: Plain text
1892 #: debian-trixie fedora-44 fedora-rawhide
1893 msgid ""
1894 "The I<libblkid> and I<libmount> documentation in the latest I<util-linux> "
1895 "release at E<.UR https://www.kernel.org/pub/linux/utils/util-linux/> E<.UE>"
1896 msgstr ""
1897 "Документация I<libblkid> и I<libmount> в последнем выпуске I<util-linux> "
1898 "E<.UR https://www.kernel.org/pub/linux/utils/util-linux/> E<.UE>"
1899
1900 #. type: TH
1901 #: fedora-44 fedora-rawhide
1902 #, no-wrap
1903 msgid "2024-07-23"
1904 msgstr "23 июля 2024 г."
1905
1906 #. type: TH
1907 #: fedora-44 fedora-rawhide
1908 #, no-wrap
1909 msgid "Linux man-pages 6.13"
1910 msgstr "Страницы руководства Linux 6.13"
1911
1912 #. type: TH
1913 #: mageia-cauldron
1914 #, no-wrap
1915 msgid "2026-02-08"
1916 msgstr "8 февраля 2026 г."
1917
1918 #. type: TH
1919 #: mageia-cauldron
1920 #, no-wrap
1921 msgid "Linux man-pages 6.17"
1922 msgstr "Страницы руководства Linux 6.17"
1923
1924 #. type: Plain text
1925 #: mageia-cauldron
1926 #, no-wrap
1927 msgid ""
1928 "#define _GNU_SOURCE\n"
1929 "#include E<lt>err.hE<gt>\n"
1930 "#include E<lt>fcntl.hE<gt>\n"
1931 "#include E<lt>limits.hE<gt>\n"
1932 "#include E<lt>stdio.hE<gt>\n"
1933 "#include E<lt>stdlib.hE<gt>\n"
1934 "#include E<lt>string.hE<gt>\n"
1935 "#include E<lt>sys/types.hE<gt>\n"
1936 "#include E<lt>unistd.hE<gt>\n"
1937 "\\&\n"
1938 "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n"
1939 " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n"
1940 " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n"
1941 " Open the corresponding mount path and return the resulting file\n"
1942 " descriptor. */\n"
1943 "\\&\n"
1944 "static int\n"
1945 "open_mount_path_by_id(int mount_id)\n"
1946 "{\n"
1947 " int mi_mount_id, found;\n"
1948 " char mount_path[PATH_MAX];\n"
1949 " char *linep;\n"
1950 " FILE *fp;\n"
1951 " size_t lsize;\n"
1952 " ssize_t nread;\n"
1953 "\\&\n"
1954 " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n"
1955 " if (fp == NULL)\n"
1956 " err(EXIT_FAILURE, \"fopen\");\n"
1957 "\\&\n"
1958 " found = 0;\n"
1959 " linep = NULL;\n"
1960 " while (!found) {\n"
1961 " nread = getline(&linep, &lsize, fp);\n"
1962 " if (nread == -1)\n"
1963 " break;\n"
1964 "\\&\n"
1965 " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n"
1966 " &mi_mount_id, mount_path);\n"
1967 " if (nread != 2) {\n"
1968 " fprintf(stderr, \"Bad sscanf()\\[rs]n\");\n"
1969 " exit(EXIT_FAILURE);\n"
1970 " }\n"
1971 "\\&\n"
1972 " if (mi_mount_id == mount_id)\n"
1973 " found = 1;\n"
1974 " }\n"
1975 " free(linep);\n"
1976 "\\&\n"
1977 " fclose(fp);\n"
1978 "\\&\n"
1979 " if (!found) {\n"
1980 " fprintf(stderr, \"Could not find mount point\\[rs]n\");\n"
1981 " exit(EXIT_FAILURE);\n"
1982 " }\n"
1983 "\\&\n"
1984 " return open(mount_path, O_RDONLY);\n"
1985 "}\n"
1986 "\\&\n"
1987 "int\n"
1988 "main(int argc, char *argv[])\n"
1989 "{\n"
1990 " int mount_id, fd, mount_fd, handle_bytes;\n"
1991 " char buf[1000];\n"
1992 "#define LINE_SIZE 100\n"
1993 " char line1[LINE_SIZE], line2[LINE_SIZE];\n"
1994 " char *nextp;\n"
1995 " ssize_t nread;\n"
1996 " struct file_handle *fhp;\n"
1997 "\\&\n"
1998 " if ((argc E<gt> 1 && strcmp(argv[1], \"--help\") == 0) || argc E<gt> 2) {\n"
1999 " fprintf(stderr, \"Usage: %s [mount-path]\\[rs]n\", argv[0]);\n"
2000 " exit(EXIT_FAILURE);\n"
2001 " }\n"
2002 "\\&\n"
2003 " /* Standard input contains mount ID and file handle information:\n"
2004 "\\&\n"
2005 " Line 1: E<lt>mount_idE<gt>\n"
2006 " Line 2: E<lt>handle_bytesE<gt> E<lt>handle_typeE<gt> E<lt>bytes of handle in hexE<gt>\n"
2007 " */\n"
2008 "\\&\n"
2009 " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n"
2010 " fgets(line2, sizeof(line2), stdin) == NULL)\n"
2011 " {\n"
2012 " fprintf(stderr, \"Missing mount_id / file handle\\[rs]n\");\n"
2013 " exit(EXIT_FAILURE);\n"
2014 " }\n"
2015 "\\&\n"
2016 " mount_id = atoi(line1);\n"
2017 "\\&\n"
2018 " handle_bytes = strtoul(line2, &nextp, 0);\n"
2019 "\\&\n"
2020 " /* Given handle_bytes, we can now allocate file_handle structure. */\n"
2021 "\\&\n"
2022 " fhp = malloc(sizeof(*fhp) + handle_bytes);\n"
2023 " if (fhp == NULL)\n"
2024 " err(EXIT_FAILURE, \"malloc\");\n"
2025 "\\&\n"
2026 " fhp-E<gt>handle_bytes = handle_bytes;\n"
2027 "\\&\n"
2028 " fhp-E<gt>handle_type = strtoul(nextp, &nextp, 0);\n"
2029 "\\&\n"
2030 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
2031 " fhp-E<gt>f_handle[j] = strtoul(nextp, &nextp, 16);\n"
2032 "\\&\n"
2033 " /* Obtain file descriptor for mount point, either by opening\n"
2034 " the pathname specified on the command line, or by scanning\n"
2035 " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n"
2036 " that we received from stdin. */\n"
2037 "\\&\n"
2038 " if (argc E<gt> 1)\n"
2039 " mount_fd = open(argv[1], O_RDONLY);\n"
2040 " else\n"
2041 " mount_fd = open_mount_path_by_id(mount_id);\n"
2042 "\\&\n"
2043 " if (mount_fd == -1)\n"
2044 " err(EXIT_FAILURE, \"opening mount fd\");\n"
2045 "\\&\n"
2046 " /* Open file using handle and mount point. */\n"
2047 "\\&\n"
2048 " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n"
2049 " if (fd == -1)\n"
2050 " err(EXIT_FAILURE, \"open_by_handle_at\");\n"
2051 "\\&\n"
2052 " /* Try reading a few bytes from the file. */\n"
2053 "\\&\n"
2054 " nread = read(fd, buf, sizeof(buf));\n"
2055 " if (nread == -1)\n"
2056 " err(EXIT_FAILURE, \"read\");\n"
2057 "\\&\n"
2058 " printf(\"Read %zd bytes\\[rs]n\", nread);\n"
2059 "\\&\n"
2060 " exit(EXIT_SUCCESS);\n"
2061 "}\n"
2062 msgstr ""
2063
2064 #. type: TH
2065 #: opensuse-leap-16-1 opensuse-tumbleweed
2066 #, no-wrap
2067 msgid "Linux man-pages (unreleased)"
2068 msgstr "Страницы руководства Linux (не выпущены)"