# Russian translation of manpages # This file is distributed under the same license as the manpages-l10n package. # Copyright © of this file: # Azamat Hackimov , 2016. # Konstantin Shvaykovskiy , 2012. # Yuri Kozlov , 2011-2019. # Иван Павлов , 2017. msgid "" msgstr "" "Project-Id-Version: manpages-l10n\n" "POT-Creation-Date: 2024-06-01 06:07+0200\n" "PO-Revision-Date: 2019-10-06 09:05+0300\n" "Last-Translator: Yuri Kozlov \n" "Language-Team: Russian \n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n" "%100>=11 && n%100<=14)? 2 : 3);\n" "X-Generator: Lokalize 2.0\n" #. type: TH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "open_by_handle_at" msgstr "open_by_handle_at" #. type: TH #: archlinux debian-unstable opensuse-tumbleweed #, no-wrap msgid "2024-05-02" msgstr "2 мая 2024 г." #. type: TH #: archlinux debian-unstable #, fuzzy, no-wrap #| msgid "Linux man-pages 6.7" msgid "Linux man-pages 6.8" msgstr "Linux man-pages 6.7" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "ИМЯ" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "name_to_handle_at, open_by_handle_at - obtain handle for a pathname and open " "file via a handle" msgstr "" "name_to_handle_at, open_by_handle_at - получение описателя для пути и " "открытие файла через описатель" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Standard C library (I, I<-lc>)" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "СИНТАКСИС" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" "B<#include Efcntl.hE>\n" msgstr "" "B<#define _GNU_SOURCE> /* см. feature_test_macros(7) */\n" "B<#include Efcntl.hE>\n" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy, no-wrap #| msgid "" #| "BIB<, const char *>IB<,>\n" #| "B< struct file_handle *>IB<,>\n" #| "B< int *>IB<, int >IB<);>\n" msgid "" "BIB<, const char *>IB<,>\n" "B< struct file_handle *>IB<,>\n" "B< int *>IB<, int >IB<);>\n" "BIB<, struct file_handle *>IB<,>\n" "B< int >IB<);>\n" msgstr "" "BIB<, const char *>IB<,>\n" "B< struct file_handle *>IB<,>\n" "B< int *>IB<, int >IB<);>\n" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "ОПИСАНИЕ" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The B() and B() system calls split " "the functionality of B(2) into two parts: B() " "returns an opaque handle that corresponds to a specified file; " "B() opens the file corresponding to a handle returned by " "a previous call to B() and returns an open file " "descriptor." msgstr "" "Функциональное назначение B(2) было разделено на две части и " "добавлено в системные вызовы B() и " "B(): B() возвращает описатель с " "произвольной формой(opaque), который соответствует указанному файлу; " "B() открывает файл по описателю, который был возвращён " "предыдущим вызовом B() и возвращает дескриптор открытого " "файла." #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "name_to_handle_at()" msgstr "name_to_handle_at()" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The B() system call returns a file handle and a mount ID " "corresponding to the file specified by the I and I " "arguments. The file handle is returned via the argument I, which is " "a pointer to a structure of the following form:" msgstr "" "Системный вызов B() возвращает файловый описатель и " "идентификатор монтирования для файла, указанного в аргументах I и " "I. Файловый описатель возвращается через аргумент I, " "который является указателем на следующую структуру:" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "struct file_handle {\n" " unsigned int handle_bytes; /* Size of f_handle [in, out] */\n" " int handle_type; /* Handle type [out] */\n" " unsigned char f_handle[0]; /* File identifier (sized by\n" " caller) [out] */\n" "};\n" msgstr "" "struct file_handle {\n" " unsigned int handle_bytes; /* размер f_handle [in, out] */\n" " int handle_type; /* тип описателя [out] */\n" " unsigned char f_handle[0]; /* идентификатор файла (размер\n" " задаёт вызывающий) [out] */\n" "};\n" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "It is the caller's responsibility to allocate the structure with a size " "large enough to hold the handle returned in I. Before the call, " "the I field should be initialized to contain the allocated " "size for I. (The constant B, defined in " "Ifcntl.hE>, specifies the maximum expected size for a file " "handle. It is not a guaranteed upper limit as future filesystems may " "require more space.) Upon successful return, the I field is " "updated to contain the number of bytes actually written to I." msgstr "" "Вызывающий должен выделить память достаточного размера под структуру " "описателя, возвращаемого в I. Перед вызовом поле I " "должно содержать размер выделенной памяти для I (константа " "B, определённая в Ifcntl.hE>, равна максимально " "ожидаемому размеру описателя файла. Это не гарантированное верхнее " "ограничение, так как файловые системы в будущем могут потребовать больше " "места). При успешном выполнении поле I обновляется и содержит " "количество байт действительно занятых под I." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The caller can discover the required size for the I structure " "by making a call in which Ihandle_bytes> is zero; in this case, " "the call fails with the error B and Ihandle_bytes> " "is set to indicate the required size; the caller can then use this " "information to allocate a structure of the correct size (see EXAMPLES " "below). Some care is needed here as B can also indicate that no " "file handle is available for this particular name in a filesystem which does " "normally support file-handle lookup. This case can be detected when the " "B error is returned without I being increased." msgstr "" "Вызывающий может определить требуемый размер структуры I указав " "при вызове значение Ihandle_bytes> равное нулю; в этому случае " "вызов завершается с ошибкой B, а в поле Ihandle_bytes> записывается требуемый размер; затем вызывающий может " "использовать эту информацию для выделения памяти под структуру правильного " "размера (смотрите ПРИМЕРЫ ниже). Здесь нужно учесть, что B может " "указывать на то, что файловый описатель недоступен для этого заданного имени " "в файловой системе, которая, обычно, поддерживает поиск файловых описателей. " "На данный случай указывает то, что ошибка B возвращается без " "увеличившегося значения I." #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "" "Other than the use of the I field, the caller should treat the " "I structure as an opaque data type: the I and " "I fields can be used in a subsequent call to " "B(). The caller can also use the opaque I " "to compare the identity of filesystem objects that were queried at different " "times and possibly at different paths. The B(7) subsystem can " "report events with an information record containing a I to " "identify the filesystem object." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, fuzzy #| msgid "" #| "The I argument is a bit mask constructed by ORing together zero or " #| "more of B and B, described below." msgid "" "The I argument is a bit mask constructed by ORing together zero or " "more of B, B, and B, " "described below." msgstr "" "Аргумент I представляет собой битовую маску (OR) из комбинации нуля " "или более флагов B и B, описанных ниже." #. commit 96b2b072ee62be8ae68c8ecf14854c4d0505a8f8 #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "" "When I contain the B (since Linux 6.5) flag, the " "caller indicates that the returned I is needed to identify the " "filesystem object, and not for opening the file later, so it should be " "expected that a subsequent call to B() with the returned " "I may fail." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Together, the I and I arguments identify the file for which " "a handle is to be obtained. There are four distinct cases:" msgstr "" "Аргументы I и I вместе задают файл, для которого будет " "получен описатель. Есть четыре различных варианта:" #. type: IP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "\\[bu]" msgstr "\\[bu]" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If I is a nonempty string containing an absolute pathname, then a " "handle is returned for the file referred to by that pathname. In this case, " "I is ignored." msgstr "" "Если значение I — непустая строка, содержащая абсолютный путь, то " "описатель возвращается для файла, на который указывает путь. В этом случае " "I игнорируется." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If I is a nonempty string containing a relative pathname and " "I has the special value B, then I is interpreted " "relative to the current working directory of the caller, and a handle is " "returned for the file to which it refers." msgstr "" "Если значение I — непустая строка, содержащая относительный путь и " "I равно специальному значению B, то I " "рассматривается относительно текущего рабочего каталога вызывающего и " "описатель возвращается для файла, на который он указывает." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If I is a nonempty string containing a relative pathname and " "I is a file descriptor referring to a directory, then I is " "interpreted relative to the directory referred to by I, and a handle " "is returned for the file to which it refers. (See B(2) for an " "explanation of why \"directory file descriptors\" are useful.)" msgstr "" "Если значение I — непустая строка, содержащая относительный путь и " "I равно файловому дескриптору, указывающему на каталог, то " "I рассматривается относительно каталога, на который указывает " "I, и описатель возвращается для файла, на который он указывает " "(смотрите в B(2) объяснение полезности «файловых дескрипторов " "каталогов»)." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If I is an empty string and I specifies the value " "B, then I can be an open file descriptor referring to " "any type of file, or B, meaning the current working directory, and " "a handle is returned for the file to which it refers." msgstr "" "Если значение I — пустая строка и значение I равно " "B, то I может быть открытым файловым дескриптором, " "указывающим на файл любого типа, или B, означающим текущий рабочий " "каталог, и описатель возвращается для файла, на который он указывает." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument returns an identifier for the filesystem mount that " "corresponds to I. This corresponds to the first field in one of " "the records in I. Opening the pathname in the fifth " "field of that record yields a file descriptor for the mount point; that file " "descriptor can be used in a subsequent call to B(). " "I is returned both for a successful call and for a call that " "results in the error B." msgstr "" "В аргументе I возвращается идентификатор точки монтирования в " "файловой системе, соответствующий I. Это значение соответствует " "первому полю одной из записей в I. Открытие пути из " "пятого поля этой записи возвращает файловый дескриптор этой точки " "монтирования; этот файловый дескриптор можно использовать в последующем " "вызове B(). Аргумент I возвращается при " "успешном выполнении, а также при ошибке B()." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "By default, B() does not dereference I if it " "is a symbolic link, and thus returns a handle for the link itself. If " "B is specified in I, I is dereferenced " "if it is a symbolic link (so that the call returns a handle for the file " "referred to by the link)." msgstr "" "По умолчанию, B() не разыменовывает I, если это " "символическая ссылка, и поэтому возвращается описатель самой ссылки. Если в " "I указан B, то I разыменовывается, если " "это символическая ссылка (то есть вызов возвращает описатель файла, на " "который указывает ссылка)." #. commit 20fa19027286983ab2734b5910c4a687436e0c31 #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "B() does not trigger a mount when the final component of " "the pathname is an automount point. When a filesystem supports both file " "handles and automount points, a B() call on an automount " "point will return with error B without having increased " "I. This can happen since Linux 4.13 with NFS when accessing a " "directory which is on a separate filesystem on the server. In this case, " "the automount can be triggered by adding a \"/\" to the end of the pathname." msgstr "" "Системный вызов B() не вызывает монтирования, если " "конечная часть пути является автоматической точкой монтирования. Если " "файловая система поддерживает файловые описатели и автоматические точки " "монтирования, то вызов B() для автоматической точки " "монтирования завершится ошибкой B без увеличения значения " "I. Это может происходить с NFS начиная с версии Linux 4.13, " "когда задействованный каталог находится в отдельной файловой системе на " "сервере. В этом случае автомонтирование можно получить добавлением «/» в " "конец пути." #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "open_by_handle_at()" msgstr "open_by_handle_at()" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The B() system call opens the file referred to by " "I, a file handle returned by a previous call to " "B()." msgstr "" "Системный вызов B() открывает файл, на который указывает " "I, файловый описатель, полученный от предшествующего вызова " "B()." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument is a file descriptor for any object (file, " "directory, etc.) in the mounted filesystem with respect to which I " "should be interpreted. The special value B can be specified, " "meaning the current working directory of the caller." msgstr "" "Аргумент I — это файловый дескриптор любого объекта (файла, " "каталога и т. д.) в смонтированной файловой системе, в которой должен " "находиться I. Может быть равен специальному значению B, " "которое обозначает текущий рабочий каталог вызывающего." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument is as for B(2). If I refers to a " "symbolic link, the caller must specify the B flag, and the symbolic " "link is not dereferenced; the B flag, if specified, is ignored." msgstr "" "Значение аргумента I как у B(2). Если I указывает на " "символическую ссылку, то вызывающий должен указать флаг B, и " "символическая ссылка не разыменовывается; флаг B игнорируется." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The caller must have the B capability to invoke " "B()." msgstr "" "Для вызова B() вызывающий должен иметь мандат " "B." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy #| msgid "" #| "On success, B() returns 0, and " #| "B() returns a nonnegative file descriptor." msgid "" "On success, B() returns 0, and B() " "returns a file descriptor (a nonnegative integer)." msgstr "" "При успешном выполнении B() возвращает 0, а " "B() возвращает неотрицательный файловый дескриптор." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy #| msgid "" #| "In the event of an error, both system calls return -1 and set I to " #| "indicate the cause of the error." msgid "" "In the event of an error, both system calls return -1 and set I to " "indicate the error." msgstr "" "В случае ошибки системные вызовы возвращают -1, а в I записывается " "код ошибки." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "ОШИБКИ" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "B() and B() can fail for the same " "errors as B(2). In addition, they can fail with the errors noted " "below." msgstr "" "Вызовы B() и B() могут завершиться с " "теми же ошибками что и B(2). Также могут возникать следующие ошибки:" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "B() can fail with the following errors:" msgstr "Вызов B() может завершиться со следующими ошибками:" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "I, I, or I points outside your accessible " "address space." msgstr "" "Значение I, I или I указывает за пределы " "доступного адресного пространства." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "I includes an invalid bit value." msgstr "Значение I содержит некорректно установленный бит." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Ihandle_bytes> is greater than B." msgstr "Значение Ihandle_bytes> больше B." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "I is an empty string, but B was not specified in " "I." msgstr "" "Значение I равно пустой строке, но в I не указано значение " "B." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The file descriptor supplied in I does not refer to a directory, and " "it is not the case that both I includes B and " "I is an empty string." msgstr "" "Файловый дескриптор, указанный в I, не ссылается на каталог и это не " "тот случай, когда I содержит B и I равно " "пустой строке." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The filesystem does not support decoding of a pathname to a file handle." msgstr "" "Файловая система не поддерживает преобразование пути в файловый описатель." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The Ihandle_bytes> value passed into the call was too small. " "When this error occurs, Ihandle_bytes> is updated to indicate " "the required size for the handle." msgstr "" "Значение Ihandle_bytes>, переданное в вызов, слишком мало. При " "этой ошибке Ihandle_bytes> присваивается требуемый размер для " "описателя." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "B() can fail with the following errors:" msgstr "Вызов B() может завершиться со следующими ошибками:" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "I is not an open file descriptor." msgstr "Значение I не является открытым файловым дескриптором." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "I is relative but I is neither B nor a valid file " "descriptor." msgstr "" "В I содержится относительный путь, но значение I не равно " "B и не является правильным файловым дескриптором." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "I points outside your accessible address space." msgstr "" "Значение I указывает за пределы доступного адресного пространства." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Ihandle_bytes> is greater than B or is equal to " "zero." msgstr "" "Значение Ihandle_bytes> больше B или равно нулю." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "I refers to a symbolic link, but B was not specified in " "I." msgstr "" "Значение I указывает на символическую ссылку, но в I не " "указан B." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The caller does not have the B capability." msgstr "Вызывающий не имеет мандата B." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "" "The specified I is not valid for opening a file. This error will " "occur if, for example, the file has been deleted. This error can also occur " "if the I was acquired using the B flag and the " "filesystem does not support B()." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "VERSIONS" msgstr "ВЕРСИИ" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "FreeBSD has a broadly similar pair of system calls in the form of " "B() and B()." msgstr "" "В FreeBSD есть относительно похожая пара системных вызовов B() и " "B()." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "СТАНДАРТЫ" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "Linux." msgstr "Linux." #. type: SH #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "ИСТОРИЯ" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "Linux 2.6.39, glibc 2.14." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "ПРИМЕЧАНИЯ" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "A file handle can be generated in one process using B() " "and later used in a different process that calls B()." msgstr "" "Файловый описатель может быть сгенерирован с помощью B() " "в одном процессе и использован в вызовах B() в другом." #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, fuzzy #| msgid "" #| "Some filesystem don't support the translation of pathnames to file " #| "handles, for example, I, I, and various network filesystems." msgid "" "Some filesystem don't support the translation of pathnames to file handles, " "for example, I, I, and various network filesystems. Some " "filesystems support the translation of pathnames to file handles, but do not " "support using those file handles in B()." msgstr "" "Некоторые файловые системы не поддерживают трансляцию путей в файловые " "описатели, например: I, I и различные сетевые файловые системы." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "A file handle may become invalid (\"stale\") if a file is deleted, or for " "other filesystem-specific reasons. Invalid handles are notified by an " "B error from B()." msgstr "" "Файловый описатель может стать некорректным («просроченным»), если файл " "удалён, или по другим причинам, относящимся к файловой системе. Для " "некорректных описателей B() возвращает ошибку B." #. https://lwn.net/Articles/375888/ #. "Open by handle" - Jonathan Corbet, 2010-02-23 #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "These system calls are designed for use by user-space file servers. For " "example, a user-space NFS server might generate a file handle and pass it to " "an NFS client. Later, when the client wants to open the file, it could pass " "the handle back to the server. This sort of functionality allows a user-" "space file server to operate in a stateless fashion with respect to the " "files it serves." msgstr "" "Данные системные вызовы предназначены для использования в файловых серверах " "пространства пользователя. Например, сервер пользовательского пространства " "NFS может генерировать файловый описатель и передавать его клиенту NFS. " "Позднее, когда клиент захочет открыть файл, он может передать описатель " "обратно серверу. Такого рода возможность позволяет файловому серверу " "пространства пользователя работать без формирования состояния (stateless " "fashion) для файлов, которые они обслуживают." #. commit bcda76524cd1fa32af748536f27f674a13e56700 #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If I refers to a symbolic link and I does not specify " "B, then B() returns a handle for the " "link (rather than the file to which it refers). The process receiving the " "handle can later perform operations on the symbolic link by converting the " "handle to a file descriptor using B() with the B " "flag, and then passing the file descriptor as the I argument in " "system calls such as B(2) and B(2)." msgstr "" "Если I указывает на символическую ссылку и в I отсутствует " "B, то B() возвращает описатель ссылки " "(а не файла, на который она ссылается). Процесс, получивший описатель, может " "позднее выполнить операции над символической ссылкой, преобразовав описатель " "в файловый дескриптор, используя B() с флагом B, " "и затем передав файловый дескриптор через аргумент I в системные " "вызовы B(2) и B(2)." #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Obtaining a persistent filesystem ID" msgstr "Получение постоянного идентификатора файловой системы" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The mount IDs in I can be reused as filesystems are " "unmounted and mounted. Therefore, the mount ID returned by " "B() (in I<*mount_id>) should not be treated as a " "persistent identifier for the corresponding mounted filesystem. However, an " "application can use the information in the I record that " "corresponds to the mount ID to derive a persistent identifier." msgstr "" "Идентификаторы монтирования в I могут быть " "использованы повторно после размонтирования и монтирования файловой системы. " "Поэтому, идентификатор монтирования, возвращаемый B() (в " "I<*mount_id>), не должен считаться постоянным идентификатором " "соответствующей файловой системы. Однако, приложение может использовать " "информацию в записи I, которая соответствует идентификатору " "монтирования, для получения постоянного идентификатора." #. e.g., http://stackoverflow.com/questions/6748429/using-libblkid-to-find-uuid-of-a-partition #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "For example, one can use the device name in the fifth field of the " "I record to search for the corresponding device UUID via the " "symbolic links in I. (A more comfortable way of " "obtaining the UUID is to use the B(3) library.) That process can " "then be reversed, using the UUID to look up the device name, and then " "obtaining the corresponding mount point, in order to produce the I " "argument used by B()." msgstr "" "Например, можно использовать имя устройства в пятом поле записи I " "для поиска соответствующего устройству UUID через символические ссылки в I (более удобный способ получения UUID — использовать " "библиотеку B(3)). Этот процесс может быть и обратным — используя " "UUID найти имя устройства, и затем получить соответствующую точку " "монтирования, чтобы создать аргумент I, используемый для " "B()." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "ПРИМЕРЫ" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The two programs below demonstrate the use of B() and " "B(). The first program (I) uses " "B() to obtain the file handle and mount ID for the file " "specified in its command-line argument; the handle and mount ID are written " "to standard output." msgstr "" "Две представленные далее программы демонстрируют использование " "B() и B(). Первая программа " "(I) использует B() для получения " "файлового описателя и идентификатора монтирования для файла, указанного в " "аргументе командной строки; описатель и идентификатор монтирования " "записываются в стандартный вывод." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The second program (I) reads a mount ID and file " "handle from standard input. The program then employs " "B() to open the file using that handle. If an optional " "command-line argument is supplied, then the I argument for " "B() is obtained by opening the directory named in that " "argument. Otherwise, I is obtained by scanning I to find a record whose mount ID matches the mount ID read from " "standard input, and the mount directory specified in that record is opened. " "(These programs do not deal with the fact that mount IDs are not persistent.)" msgstr "" "Вторая программа (I) читает идентификатор " "монтирования и файловый описатель из стандартного ввода. Затем программа, " "используя описатель, применяет B() для открытия файла. " "Если указан необязательный параметр командной строки, то аргумент " "I для B() создаётся из открытия каталога, " "указанного в аргументе. В противном случае I заполняется " "результатом сканированием I в целях найти запись, чей " "идентификатор монтирования совпадает с идентификатором монтирования из " "стандартного ввода, и открывается каталог монтирования, указанный в этой " "записи (эти программы не учитывают, что идентификатор монтирования не " "постоянен)." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The following shell session demonstrates the use of these two programs:" msgstr "" "Следующий сеанс работы в оболочке показывает использование этих программ:" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy, no-wrap #| msgid "" #| "$ B cecilia.txt>\n" #| "$ B<./t_name_to_handle_at cecilia.txt E fh>\n" #| "$ B<./t_open_by_handle_at E fh>\n" #| "open_by_handle_at: Operation not permitted\n" #| "$ B fh> # Need CAP_SYS_ADMIN\n" #| "Read 31 bytes\n" #| "$ B\n" msgid "" "$ B cecilia.txt>\n" "$ B<./t_name_to_handle_at cecilia.txt E fh>\n" "$ B<./t_open_by_handle_at E fh>\n" "open_by_handle_at: Operation not permitted\n" "$ B fh> # Need CAP_SYS_ADMIN\n" "Read 31 bytes\n" "$ B\n" msgstr "" "$ B cecilia.txt>\n" "$ B<./t_name_to_handle_at cecilia.txt E fh>\n" "$ B<./t_open_by_handle_at E fh>\n" "open_by_handle_at: Operation not permitted\n" "$ B fh> # требуется CAP_SYS_ADMIN\n" "Read 31 bytes\n" "$ B\n" #. Christoph Hellwig: That's why the file handles contain a generation #. counter that gets incremented in this case. #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Now we delete and (quickly) re-create the file so that it has the same " "content and (by chance) the same inode. Nevertheless, " "B() recognizes that the original file referred to by the " "file handle no longer exists." msgstr "" "Теперь мы удаляем и (быстро) пересоздаём файл с тем же содержимым и (если " "повезёт) с той же инодой. Не смотря на это, B() " "распознаёт, что первоначальный файл, на который указывал файловый описатель, " "больше не существует." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy, no-wrap #| msgid "" #| "$ B # Display inode number\n" #| "4072121\n" #| "$ B\n" #| "$ B cecilia.txt>\n" #| "$ B # Check inode number\n" #| "4072121\n" #| "$ B fh>\n" #| "open_by_handle_at: Stale NFS file handle\n" msgid "" "$ B # Display inode number\n" "4072121\n" "$ B\n" "$ B cecilia.txt>\n" "$ B # Check inode number\n" "4072121\n" "$ B fh>\n" "open_by_handle_at: Stale NFS file handle\n" msgstr "" "$ B # вывести номер иноды\n" "4072121\n" "$ B\n" "$ B cecilia.txt>\n" "$ B # проверить номер иноды\n" "4072121\n" "$ B fh>\n" "open_by_handle_at: Stale NFS file handle\n" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Program source: t_name_to_handle_at.c" msgstr "Исходный код программы: t_name_to_handle_at.c" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int mount_id, fhsize, flags, dirfd;\n" " char *pathname;\n" " struct file_handle *fhp;\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s pathname\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " pathname = argv[1];\n" "\\&\n" " /* Allocate file_handle structure. */\n" "\\&\n" " fhsize = sizeof(*fhp);\n" " fhp = malloc(fhsize);\n" " if (fhp == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " /* Make an initial call to name_to_handle_at() to discover\n" " the size required for file handle. */\n" "\\&\n" " dirfd = AT_FDCWD; /* For name_to_handle_at() calls */\n" " flags = 0; /* For name_to_handle_at() calls */\n" " fhp-Ehandle_bytes = 0;\n" " if (name_to_handle_at(dirfd, pathname, fhp,\n" " &mount_id, flags) != -1\n" " || errno != EOVERFLOW)\n" " {\n" " fprintf(stderr, \"Unexpected result from name_to_handle_at()\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Reallocate file_handle structure with correct size. */\n" "\\&\n" " fhsize = sizeof(*fhp) + fhp-Ehandle_bytes;\n" " fhp = realloc(fhp, fhsize); /* Copies fhp-Ehandle_bytes */\n" " if (fhp == NULL)\n" " err(EXIT_FAILURE, \"realloc\");\n" "\\&\n" " /* Get file handle from pathname supplied on command line. */\n" "\\&\n" " if (name_to_handle_at(dirfd, pathname, fhp, &mount_id, flags) == -1)\n" " err(EXIT_FAILURE, \"name_to_handle_at\");\n" "\\&\n" " /* Write mount ID, file handle size, and file handle to stdout,\n" " for later reuse by t_open_by_handle_at.c. */\n" "\\&\n" " printf(\"%d\\en\", mount_id);\n" " printf(\"%u %d \", fhp-Ehandle_bytes, fhp-Ehandle_type);\n" " for (size_t j = 0; j E fhp-Ehandle_bytes; j++)\n" " printf(\" %02x\", fhp-Ef_handle[j]);\n" " printf(\"\\en\");\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. SRC END #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Program source: t_open_by_handle_at.c" msgstr "Исходный код программы: t_open_by_handle_at.c" #. type: Plain text #: archlinux debian-unstable opensuse-tumbleweed #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Esys/types.hE\n" "#include Eunistd.hE\n" "\\&\n" "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n" " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n" " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n" " Open the corresponding mount path and return the resulting file\n" " descriptor. */\n" "\\&\n" "static int\n" "open_mount_path_by_id(int mount_id)\n" "{\n" " int mi_mount_id, found;\n" " char mount_path[PATH_MAX];\n" " char *linep;\n" " FILE *fp;\n" " size_t lsize;\n" " ssize_t nread;\n" "\\&\n" " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n" " if (fp == NULL)\n" " err(EXIT_FAILURE, \"fopen\");\n" "\\&\n" " found = 0;\n" " linep = NULL;\n" " while (!found) {\n" " nread = getline(&linep, &lsize, fp);\n" " if (nread == -1)\n" " break;\n" "\\&\n" " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n" " &mi_mount_id, mount_path);\n" " if (nread != 2) {\n" " fprintf(stderr, \"Bad sscanf()\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (mi_mount_id == mount_id)\n" " found = 1;\n" " }\n" " free(linep);\n" "\\&\n" " fclose(fp);\n" "\\&\n" " if (!found) {\n" " fprintf(stderr, \"Could not find mount point\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " return open(mount_path, O_RDONLY);\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int mount_id, fd, mount_fd, handle_bytes;\n" " char buf[1000];\n" "#define LINE_SIZE 100\n" " char line1[LINE_SIZE], line2[LINE_SIZE];\n" " char *nextp;\n" " ssize_t nread;\n" " struct file_handle *fhp;\n" "\\&\n" " if ((argc E 1 && strcmp(argv[1], \"--help\") == 0) || argc E 2) {\n" " fprintf(stderr, \"Usage: %s [mount-path]\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Standard input contains mount ID and file handle information:\n" "\\&\n" " Line 1: Emount_idE\n" " Line 2: Ehandle_bytesE Ehandle_typeE Ebytes of handle in hexE\n" " */\n" "\\&\n" " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n" " fgets(line2, sizeof(line2), stdin) == NULL)\n" " {\n" " fprintf(stderr, \"Missing mount_id / file handle\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mount_id = atoi(line1);\n" "\\&\n" " handle_bytes = strtoul(line2, &nextp, 0);\n" "\\&\n" " /* Given handle_bytes, we can now allocate file_handle structure. */\n" "\\&\n" " fhp = malloc(sizeof(*fhp) + handle_bytes);\n" " if (fhp == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " fhp-Ehandle_bytes = handle_bytes;\n" "\\&\n" " fhp-Ehandle_type = strtoul(nextp, &nextp, 0);\n" "\\&\n" " for (size_t j = 0; j E fhp-Ehandle_bytes; j++)\n" " fhp-Ef_handle[j] = strtoul(nextp, &nextp, 16);\n" "\\&\n" " /* Obtain file descriptor for mount point, either by opening\n" " the pathname specified on the command line, or by scanning\n" " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n" " that we received from stdin. */\n" "\\&\n" " if (argc E 1)\n" " mount_fd = open(argv[1], O_RDONLY);\n" " else\n" " mount_fd = open_mount_path_by_id(mount_id);\n" "\\&\n" " if (mount_fd == -1)\n" " err(EXIT_FAILURE, \"opening mount fd\");\n" "\\&\n" " /* Open file using handle and mount point. */\n" "\\&\n" " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n" " if (fd == -1)\n" " err(EXIT_FAILURE, \"open_by_handle_at\");\n" "\\&\n" " /* Try reading a few bytes from the file. */\n" "\\&\n" " nread = read(fd, buf, sizeof(buf));\n" " if (nread == -1)\n" " err(EXIT_FAILURE, \"read\");\n" "\\&\n" " printf(\"Read %zd bytes\\en\", nread);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. SRC END #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "СМОТРИТЕ ТАКЖЕ" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "B(2), B(3), B(8), B(8), B(8)" msgstr "B(2), B(3), B(8), B(8), B(8)" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I and I documentation in the latest I " "release at E<.UR https://www.kernel.org/pub/linux/utils/util-linux/> E<.UE>" msgstr "" "Документация I и I в последнем выпуске I E<." "UR https://www.kernel.org/pub/linux/utils/util-linux/> E<.UE>" #. type: TH #: debian-bookworm #, no-wrap msgid "2023-02-05" msgstr "5 февраля 2023 г." #. type: TH #: debian-bookworm #, no-wrap msgid "Linux man-pages 6.03" msgstr "Linux man-pages 6.03" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "Other than the use of the I field, the caller should treat the " "I structure as an opaque data type: the I and " "I fields are needed only by a subsequent call to " "B()." msgstr "" "Все остальные поля, кроме I структуры I, " "вызывающий должен считать неизвестными: поля I и I " "требуются только в последующих вызовах B()." #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "The I argument is a bit mask constructed by ORing together zero or " "more of B and B, described below." msgstr "" "Аргумент I представляет собой битовую маску (OR) из комбинации нуля " "или более флагов B и B, описанных ниже." #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "The specified I is not valid. This error will occur if, for " "example, the file has been deleted." msgstr "" "Значение I некорректно. Эта ошибка возникает, например, из-за " "удаления файла." #. type: Plain text #: debian-bookworm #, fuzzy #| msgid "" #| "These system calls first appeared in Linux 2.6.39. Library support is " #| "provided in glibc since version 2.14." msgid "" "These system calls first appeared in Linux 2.6.39. Library support is " "provided since glibc 2.14." msgstr "" "Данные системные вызовы впервые появились в Linux 2.6.39. Поддержка в glibc " "появилась в версии 2.14." #. type: Plain text #: debian-bookworm msgid "These system calls are nonstandard Linux extensions." msgstr "Данные системные вызовы являются нестандартными расширениями Linux." #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "Some filesystem don't support the translation of pathnames to file handles, " "for example, I, I, and various network filesystems." msgstr "" "Некоторые файловые системы не поддерживают трансляцию путей в файловые " "описатели, например: I, I и различные сетевые файловые системы." #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" msgstr "" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int mount_id, fhsize, flags, dirfd;\n" " char *pathname;\n" " struct file_handle *fhp;\n" msgstr "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int mount_id, fhsize, flags, dirfd;\n" " char *pathname;\n" " struct file_handle *fhp;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s pathname\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" " if (argc != 2) {\n" " fprintf(stderr, \"Использование: %s путь\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " pathname = argv[1];\n" msgstr " pathname = argv[1];\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Allocate file_handle structure. */\n" msgstr " /* выделяем место под структуру file_handle */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " fhsize = sizeof(*fhp);\n" " fhp = malloc(fhsize);\n" " if (fhp == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" msgstr "" " fhsize = sizeof(*fhp);\n" " fhp = malloc(fhsize);\n" " if (fhp == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Make an initial call to name_to_handle_at() to discover\n" " the size required for file handle. */\n" msgstr "" " /* выполняем первоначальный вызов name_to_handle_at() для\n" " определения требуемого размера файлового описателя */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| " dirfd = AT_FDCWD; /* For name_to_handle_at() calls */\n" #| " flags = 0; /* For name_to_handle_at() calls */\n" #| " fhp-Ehandle_bytes = 0;\n" #| " if (name_to_handle_at(dirfd, pathname, fhp,\n" #| " &mount_id, flags) != -1 || errno != EOVERFLOW) {\n" #| " fprintf(stderr, \"Unexpected result from name_to_handle_at()\\en\");\n" #| " exit(EXIT_FAILURE);\n" #| " }\n" msgid "" " dirfd = AT_FDCWD; /* For name_to_handle_at() calls */\n" " flags = 0; /* For name_to_handle_at() calls */\n" " fhp-Ehandle_bytes = 0;\n" " if (name_to_handle_at(dirfd, pathname, fhp,\n" " &mount_id, flags) != -1\n" " || errno != EOVERFLOW)\n" " {\n" " fprintf(stderr, \"Unexpected result from name_to_handle_at()\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" " dirfd = AT_FDCWD; /* для вызовов name_to_handle_at() */\n" " flags = 0; /* для вызовов name_to_handle_at() */\n" " fhp-Ehandle_bytes = 0;\n" " if (name_to_handle_at(dirfd, pathname, fhp,\n" " &mount_id, flags) != -1 || errno != EOVERFLOW) {\n" " fprintf(stderr, \"Unexpected result from name_to_handle_at()\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Reallocate file_handle structure with correct size. */\n" msgstr " /* перераспределяем структуру file_handle с правильным размером */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| " fhsize = sizeof(struct file_handle) + fhp-Ehandle_bytes;\n" #| " fhp = realloc(fhp, fhsize); /* Copies fhp-Ehandle_bytes */\n" #| " if (fhp == NULL)\n" #| " errExit(\"realloc\");\n" msgid "" " fhsize = sizeof(*fhp) + fhp-Ehandle_bytes;\n" " fhp = realloc(fhp, fhsize); /* Copies fhp-Ehandle_bytes */\n" " if (fhp == NULL)\n" " err(EXIT_FAILURE, \"realloc\");\n" msgstr "" " fhsize = sizeof(struct file_handle) + fhp-Ehandle_bytes;\n" " fhp = realloc(fhp, fhsize); /* копируем fhp-Ehandle_bytes */\n" " if (fhp == NULL)\n" " errExit(\"realloc\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Get file handle from pathname supplied on command line. */\n" msgstr "" " /* получаем файловый описатель из пути, который\n" " указан в командной строке */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (name_to_handle_at(dirfd, pathname, fhp, &mount_id, flags) == -1)\n" " err(EXIT_FAILURE, \"name_to_handle_at\");\n" msgstr "" " if (name_to_handle_at(dirfd, pathname, fhp, &mount_id, flags) == -1)\n" " err(EXIT_FAILURE, \"name_to_handle_at\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Write mount ID, file handle size, and file handle to stdout,\n" " for later reuse by t_open_by_handle_at.c. */\n" msgstr "" " /* пишем идентификатор монтирования, размер файлового описателя\n" " и файловый описатель в stdout\n" " для повторного использования в t_open_by_handle_at.c */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " printf(\"%d\\en\", mount_id);\n" " printf(\"%u %d \", fhp-Ehandle_bytes, fhp-Ehandle_type);\n" " for (size_t j = 0; j E fhp-Ehandle_bytes; j++)\n" " printf(\" %02x\", fhp-Ef_handle[j]);\n" " printf(\"\\en\");\n" msgstr "" " printf(\"%d\\en\", mount_id);\n" " printf(\"%u %d \", fhp-Ehandle_bytes, fhp-Ehandle_type);\n" " for (size_t j = 0; j E fhp-Ehandle_bytes; j++)\n" " printf(\" %02x\", fhp-Ef_handle[j]);\n" " printf(\"\\en\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" " exit(EXIT_SUCCESS);\n" "}\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Eunistd.hE\n" msgstr "" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Eunistd.hE\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n" #| " \\(aqmount_id\\(aq. (An easier way to do this is to install and use the\n" #| " \\(aqlibmount\\(aq library provided by the \\(aqutil-linux\\(aq project.)\n" #| " Open the corresponding mount path and return the resulting file\n" #| " descriptor. */\n" msgid "" "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n" " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n" " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n" " Open the corresponding mount path and return the resulting file\n" " descriptor. */\n" msgstr "" "/* сканируем /proc/self/mountinfo в поиске строки, чей идентификатор\n" " монтирования совпадает с \\(aqmount_id\\(aq (простейший способ,\n" " это установить и использовать библиотеку\n" " «libmount», предоставляемую проектом «util-linux»).\n" " Открываем соответствующий путь монтирования и возвращаем\n" " полученный файловый дескриптор. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "static int\n" "open_mount_path_by_id(int mount_id)\n" "{\n" " int mi_mount_id, found;\n" " char mount_path[PATH_MAX];\n" " char *linep;\n" " FILE *fp;\n" " size_t lsize;\n" " ssize_t nread;\n" msgstr "" "static int\n" "open_mount_path_by_id(int mount_id)\n" "{\n" " int mi_mount_id, found;\n" " char mount_path[PATH_MAX];\n" " char *linep;\n" " FILE *fp;\n" " size_t lsize;\n" " ssize_t nread;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n" " if (fp == NULL)\n" " err(EXIT_FAILURE, \"fopen\");\n" msgstr "" " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n" " if (fp == NULL)\n" " err(EXIT_FAILURE, \"fopen\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " found = 0;\n" " linep = NULL;\n" " while (!found) {\n" " nread = getline(&linep, &lsize, fp);\n" " if (nread == -1)\n" " break;\n" msgstr "" " found = 0;\n" " linep = NULL;\n" " while (!found) {\n" " nread = getline(&linep, &lsize, fp);\n" " if (nread == -1)\n" " break;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n" " &mi_mount_id, mount_path);\n" " if (nread != 2) {\n" " fprintf(stderr, \"Bad sscanf()\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n" " &mi_mount_id, mount_path);\n" " if (nread != 2) {\n" " fprintf(stderr, \"Bad sscanf()\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (mi_mount_id == mount_id)\n" " found = 1;\n" " }\n" " free(linep);\n" msgstr "" " if (mi_mount_id == mount_id)\n" " found = 1;\n" " }\n" " free(linep);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " fclose(fp);\n" msgstr " fclose(fp);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (!found) {\n" " fprintf(stderr, \"Could not find mount point\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" " if (!found) {\n" " fprintf(stderr, \"Could not find mount point\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " return open(mount_path, O_RDONLY);\n" "}\n" msgstr "" " return open(mount_path, O_RDONLY);\n" "}\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int mount_id, fd, mount_fd, handle_bytes;\n" " char buf[1000];\n" "#define LINE_SIZE 100\n" " char line1[LINE_SIZE], line2[LINE_SIZE];\n" " char *nextp;\n" " ssize_t nread;\n" " struct file_handle *fhp;\n" msgstr "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int mount_id, fd, mount_fd, handle_bytes;\n" " char buf[1000];\n" "#define LINE_SIZE 100\n" " char line1[LINE_SIZE], line2[LINE_SIZE];\n" " char *nextp;\n" " ssize_t nread;\n" " struct file_handle *fhp;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if ((argc E 1 && strcmp(argv[1], \"--help\") == 0) || argc E 2) {\n" " fprintf(stderr, \"Usage: %s [mount-path]\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" " if ((argc E 1 && strcmp(argv[1], \"--help\") == 0) || argc E 2) {\n" " fprintf(stderr, \"Использование: %s [путь-монт.]\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Standard input contains mount ID and file handle information:\n" msgstr "" " /* Стандартный ввод содержит идентификатор монтирования и\n" " информацию о файловом описателе:\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " Line 1: Emount_idE\n" " Line 2: Ehandle_bytesE Ehandle_typeE Ebytes of handle in hexE\n" " */\n" msgstr "" " Строка 1: Eидентификатор монтированияE\n" " Строка 2: Ehandle_bytesE Ehandle_typeE\n" " Eбайты описателя в шестнад. системе счисленияE\n" " */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| " if ((fgets(line1, sizeof(line1), stdin) == NULL) ||\n" #| " (fgets(line2, sizeof(line2), stdin) == NULL)) {\n" #| " fprintf(stderr, \"Missing mount_id / file handle\\en\");\n" #| " exit(EXIT_FAILURE);\n" #| " }\n" msgid "" " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n" " fgets(line2, sizeof(line2), stdin) == NULL)\n" " {\n" " fprintf(stderr, \"Missing mount_id / file handle\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" " if ((fgets(line1, sizeof(line1), stdin) == NULL) ||\n" " (fgets(line2, sizeof(line2), stdin) == NULL)) {\n" " fprintf(stderr, \"Missing mount_id / file handle\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " mount_id = atoi(line1);\n" msgstr " mount_id = atoi(line1);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " handle_bytes = strtoul(line2, &nextp, 0);\n" msgstr " handle_bytes = strtoul(line2, &nextp, 0);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Given handle_bytes, we can now allocate file_handle structure. */\n" msgstr "" " /* получаем handle_bytes, теперь мы можем выделить место\n" " под структуру file_handle */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " fhp = malloc(sizeof(*fhp) + handle_bytes);\n" " if (fhp == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" msgstr "" " fhp = malloc(sizeof(*fhp) + handle_bytes);\n" " if (fhp == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " fhp-Ehandle_bytes = handle_bytes;\n" msgstr " fhp-Ehandle_bytes = handle_bytes;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " fhp-Ehandle_type = strtoul(nextp, &nextp, 0);\n" msgstr " fhp-Ehandle_type = strtoul(nextp, &nextp, 0);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " for (size_t j = 0; j E fhp-Ehandle_bytes; j++)\n" " fhp-Ef_handle[j] = strtoul(nextp, &nextp, 16);\n" msgstr "" " for (size_t j = 0; j E fhp-Ehandle_bytes; j++)\n" " fhp-Ef_handle[j] = strtoul(nextp, &nextp, 16);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| " /* Obtain file descriptor for mount point, either by opening\n" #| " the pathname specified on the command line, or by scanning\n" #| " /proc/self/mounts to find a mount that matches the \\(aqmount_id\\(aq\n" #| " that we received from stdin. */\n" msgid "" " /* Obtain file descriptor for mount point, either by opening\n" " the pathname specified on the command line, or by scanning\n" " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n" " that we received from stdin. */\n" msgstr "" " /* получаем файловый дескриптор для точки монтирования, или\n" " открываем путь, указанный в командной строке, или сканируем\n" " /proc/self/mounts в поиске монтирования, которое совпадает с\n" " «mount_id», который мы получили из stdin. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (argc E 1)\n" " mount_fd = open(argv[1], O_RDONLY);\n" " else\n" " mount_fd = open_mount_path_by_id(mount_id);\n" msgstr "" " if (argc E 1)\n" " mount_fd = open(argv[1], O_RDONLY);\n" " else\n" " mount_fd = open_mount_path_by_id(mount_id);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (mount_fd == -1)\n" " err(EXIT_FAILURE, \"opening mount fd\");\n" msgstr "" " if (mount_fd == -1)\n" " err(EXIT_FAILURE, \"opening mount fd\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Open file using handle and mount point. */\n" msgstr " /* открываем файл, используя описатель и точку монтирования */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n" " if (fd == -1)\n" " err(EXIT_FAILURE, \"open_by_handle_at\");\n" msgstr "" " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n" " if (fd == -1)\n" " err(EXIT_FAILURE, \"open_by_handle_at\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Try reading a few bytes from the file. */\n" msgstr " /* пытаемся прочитать несколько байт из файла */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " nread = read(fd, buf, sizeof(buf));\n" " if (nread == -1)\n" " err(EXIT_FAILURE, \"read\");\n" msgstr "" " nread = read(fd, buf, sizeof(buf));\n" " if (nread == -1)\n" " err(EXIT_FAILURE, \"read\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " printf(\"Read %zd bytes\\en\", nread);\n" msgstr " printf(\"Read %zd bytes\\en\", nread);\n" #. type: TH #: fedora-40 fedora-rawhide mageia-cauldron #, no-wrap msgid "2023-10-31" msgstr "31 октября 2023 г." #. type: TH #: fedora-40 mageia-cauldron #, no-wrap msgid "Linux man-pages 6.06" msgstr "Linux man-pages 6.06" #. type: Plain text #: fedora-40 fedora-rawhide mageia-cauldron #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Efcntl.hE\n" "#include Elimits.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Eunistd.hE\n" "\\&\n" "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n" " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n" " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n" " Open the corresponding mount path and return the resulting file\n" " descriptor. */\n" "\\&\n" "static int\n" "open_mount_path_by_id(int mount_id)\n" "{\n" " int mi_mount_id, found;\n" " char mount_path[PATH_MAX];\n" " char *linep;\n" " FILE *fp;\n" " size_t lsize;\n" " ssize_t nread;\n" "\\&\n" " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n" " if (fp == NULL)\n" " err(EXIT_FAILURE, \"fopen\");\n" "\\&\n" " found = 0;\n" " linep = NULL;\n" " while (!found) {\n" " nread = getline(&linep, &lsize, fp);\n" " if (nread == -1)\n" " break;\n" "\\&\n" " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n" " &mi_mount_id, mount_path);\n" " if (nread != 2) {\n" " fprintf(stderr, \"Bad sscanf()\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (mi_mount_id == mount_id)\n" " found = 1;\n" " }\n" " free(linep);\n" "\\&\n" " fclose(fp);\n" "\\&\n" " if (!found) {\n" " fprintf(stderr, \"Could not find mount point\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " return open(mount_path, O_RDONLY);\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int mount_id, fd, mount_fd, handle_bytes;\n" " char buf[1000];\n" "#define LINE_SIZE 100\n" " char line1[LINE_SIZE], line2[LINE_SIZE];\n" " char *nextp;\n" " ssize_t nread;\n" " struct file_handle *fhp;\n" "\\&\n" " if ((argc E 1 && strcmp(argv[1], \"--help\") == 0) || argc E 2) {\n" " fprintf(stderr, \"Usage: %s [mount-path]\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Standard input contains mount ID and file handle information:\n" "\\&\n" " Line 1: Emount_idE\n" " Line 2: Ehandle_bytesE Ehandle_typeE Ebytes of handle in hexE\n" " */\n" "\\&\n" " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n" " fgets(line2, sizeof(line2), stdin) == NULL)\n" " {\n" " fprintf(stderr, \"Missing mount_id / file handle\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mount_id = atoi(line1);\n" "\\&\n" " handle_bytes = strtoul(line2, &nextp, 0);\n" "\\&\n" " /* Given handle_bytes, we can now allocate file_handle structure. */\n" "\\&\n" " fhp = malloc(sizeof(*fhp) + handle_bytes);\n" " if (fhp == NULL)\n" " err(EXIT_FAILURE, \"malloc\");\n" "\\&\n" " fhp-Ehandle_bytes = handle_bytes;\n" "\\&\n" " fhp-Ehandle_type = strtoul(nextp, &nextp, 0);\n" "\\&\n" " for (size_t j = 0; j E fhp-Ehandle_bytes; j++)\n" " fhp-Ef_handle[j] = strtoul(nextp, &nextp, 16);\n" "\\&\n" " /* Obtain file descriptor for mount point, either by opening\n" " the pathname specified on the command line, or by scanning\n" " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n" " that we received from stdin. */\n" "\\&\n" " if (argc E 1)\n" " mount_fd = open(argv[1], O_RDONLY);\n" " else\n" " mount_fd = open_mount_path_by_id(mount_id);\n" "\\&\n" " if (mount_fd == -1)\n" " err(EXIT_FAILURE, \"opening mount fd\");\n" "\\&\n" " /* Open file using handle and mount point. */\n" "\\&\n" " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n" " if (fd == -1)\n" " err(EXIT_FAILURE, \"open_by_handle_at\");\n" "\\&\n" " /* Try reading a few bytes from the file. */\n" "\\&\n" " nread = read(fd, buf, sizeof(buf));\n" " if (nread == -1)\n" " err(EXIT_FAILURE, \"read\");\n" "\\&\n" " printf(\"Read %zd bytes\\en\", nread);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. type: TH #: fedora-rawhide #, no-wrap msgid "Linux man-pages 6.7" msgstr "Linux man-pages 6.7" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "2023-03-30" msgstr "30 марта 2023 г." #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "Linux man-pages 6.04" msgstr "Linux man-pages 6.04" #. type: TH #: opensuse-tumbleweed #, fuzzy, no-wrap #| msgid "Linux man-pages 6.7" msgid "Linux man-pages (unreleased)" msgstr "Linux man-pages 6.7"