.\" -*- coding: UTF-8 -*- '\" t .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH getmntent 3 "28 июня 2025 г." "Справочные страницы Linux 6.15" .SH НАИМЕНОВАНИЕ getmntent, setmntent, addmntent, endmntent, hasmntopt, getmntent_r \- возвращают запись из файла описания файловых систем .SH БИБЛИОТЕКА Стандартная библиотека языка C (\fIlibc\fP,\ \fI\-lc\fP) .SH ОБЗОР .nf \fB#include \fP \fB#include \fP .P \fBFILE *setmntent(const char *\fP\fIpath\fP\fB, const char *\fP\fItype\fP\fB);\fP .P \fBstruct mntent *getmntent(FILE *\fP\fIstream\fP\fB);\fP .P \fBint addmntent(FILE *restrict \fP\fIstream\fP\fB,\fP \fB const struct mntent *restrict \fP\fImnt\fP\fB);\fP .P \fBint endmntent(FILE *\fP\fIstreamp\fP\fB);\fP .P \fBchar *hasmntopt(const struct mntent *\fP\fImnt\fP\fB, const char *\fP\fIopt\fP\fB);\fP .P /* Расширение GNU */ \fB#include \fP .P \fBstruct mntent *getmntent_r(\fPint size; \fB FILE *restrict \fP\fIstreamp\fP\fB,\fP \fB struct mntent *restrict \fP\fImntbuf\fP\fB,\fP \fB char \fP\fIbuf\fP\fB[restrict \fP\fIsize\fP\fB], int \fP\fIsize\fP\fB);\fP .fi .P .RS -4 Требования макроса тестирования свойств для glibc (см. \fBfeature_test_macros\fP(7)): .RE .P \fBgetmntent_r\fP(): .nf начиная с glibc 2.19: _DEFAULT_SOURCE в glibc 2.19 и старее: _BSD_SOURCE || _SVID_SOURCE .fi .SH ОПИСАНИЕ Эти функции используются для доступа к файлу описаний файловых систем \fI/etc/fstab\fP и к файлу описаний смонтированных файловых систем \fI/etc/mtab\fP. .P The \fBsetmntent\fP() function opens the filesystem description file \fIpath\fP and returns a file pointer which can be used by \fBgetmntent\fP(). The argument \fItype\fP is the type of access required and can take the same values as the \fImode\fP argument of \fBfopen\fP(3). The returned stream should be closed using \fBendmntent\fP() rather than \fBfclose\fP(3). .P Функция \fBgetmntent\fP() считывает следующую строку из файла описаний файловых систем \fIstream\fP и возвращает указатель на структуру, содержащую поля строки файла. Указатель ссылается на статическую область памяти, которая перезаписывается последующими вызовами \fBgetmntent\fP(). .P Функция \fBaddmntent\fP() добавляет структуру \fImnt\fP типа \fImntent\fP к концу открытого \fIstream\fP. .P Функция \fBendmntent\fP() закрывает \fIstream\fP, связанный с файл описаний файловых систем. .P Функция \fBhashmntopt\fP() ищет в полях \fImnt_opts\fP (смотрите ниже) структуры \fImnt\fP типа \fImntent\fP подстроку, совпадающую с \fIopt\fP. Список возможных параметров монтирования приведён в \fI\fP и \fBmount\fP(8). .P The reentrant \fBgetmntent_r\fP() function is similar to \fBgetmntent\fP(), but stores the \fImntent\fP structure in the provided \fI*mntbuf\fP, and stores the strings pointed to by the entries in that structure in the provided array \fIbuf\fP of size \fIsize\fP. .P Структура \fImntent\fP определена в \fI\fP следующим образом: .P .in +4n .EX struct mntent { char *mnt_fsname; /* название смонтированной файловой системы */ char *mnt_dir; /* префикс пути к файловой системе */ char *mnt_type; /* тип монтирования (смотрите mntent.h) */ char *mnt_opts; /* параметры монтирования (смотрите mntent.h) */ int mnt_freq; /* периодичность запуска dump, в днях */ int mnt_passno; /* номер прохода при параллельном fsck */ }; .EE .in .P Since fields in the mtab and fstab files are separated by whitespace, octal escapes are used to represent the characters space (\[rs]040), tab (\[rs]011), newline (\[rs]012), and backslash (\[rs]\[rs]) in those files when they occur in one of the four strings in a \fImntent\fP structure. The routines \fBaddmntent\fP() and \fBgetmntent\fP() will convert from string representation to escaped representation and back. When converting from escaped representation, the sequence \[rs]134 is also converted to a backslash. .SH "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ" Функции \fBgetmntent\fP() и \fBgetmntent_r\fP() возвращают указатель на структуру типа \fImntent\fP или NULL при ошибке. .P Функция \fBaddmntent\fP() возвращает 0 при успешном выполнении и 1 при ошибке. .P Функция \fBendmntent\fP() всегда возвращает 1. .P Функция \fBhasmntopt\fP() возвращает адрес подстроки, если она была найдена, в противном случае NULL. .SH ФАЙЛЫ .TP \fI/etc/fstab\fP файл описаний файловых систем .TP \fI/etc/mtab\fP файл описаний смонтированных файловых систем .SH АТРИБУТЫ Описание терминов данного раздела смотрите в \fBattributes\fP(7). .TS allbox; lb lb lbx l l l. Интерфейс Атрибут Значение T{ .na .nh \fBsetmntent\fP(), \fBendmntent\fP(), \fBhasmntopt\fP() T} Безвредность в нитях MT\-Safe T{ .na .nh \fBgetmntent\fP() T} Безвредность в нитях T{ .na .nh MT\-Unsafe race:mntentbuf locale T} T{ .na .nh \fBaddmntent\fP() T} Безвредность в нитях T{ .na .nh MT\-Safe race:stream locale T} T{ .na .nh \fBgetmntent_r\fP() T} Безвредность в нитях MT\-Safe locale .TE .SH СТАНДАРТЫ Отсутствуют. .SH ИСТОРИЯ The nonreentrant functions are from SunOS 4.1.3. A routine \fBgetmntent_r\fP() was introduced in HP\-UX 10, but it returns an \fIint\fP. The prototype shown above is glibc\-only. .P System V also has a \fBgetmntent\fP() function but the calling sequence differs, and the returned structure is different. Under System V \fI/etc/mnttab\fP is used. 4.4BSD and Digital UNIX have a routine \fB\%getmntinfo\fP(), a wrapper around the system call \fBgetfsstat\fP(). .SH "СМОТРИТЕ ТАКЖЕ" \fBfopen\fP(3), \fBfstab\fP(5), \fBmount\fP(8) .PP .SH ПЕРЕВОД Русский перевод этой страницы руководства разработал(и) Azamat Hackimov , Dmitry Bolkhovskikh , Vladislav , Yuri Kozlov , Иван Павлов и Kirill Rekhov . .PP Этот перевод является свободной программной документацией; он распространяется на условиях общедоступной лицензии GNU (GNU General Public License - GPL, .UR https://www.gnu.org/licenses/gpl-3.0.html .UE версии 3 или более поздней) в отношении авторского права, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ. .PP Если вы обнаружите какие-либо ошибки в переводе этой страницы руководства, пожалуйста, сообщите об этом разработчику(ам) по его(их) адресу(ам) электронной почты или по адресу .MT списка рассылки русских переводчиков .ME .