GETFSENT

Section: Linux Programmer's Manual (3)
Updated: 2017-09-15
Index JM Home Page
 

名前

getfsent, getfsspec, getfsfile, setfsent, endfsent - fstab エントリーの処理  

書式

#include <fstab.h>

void endfsent(void);

struct fstab *getfsent(void);

struct fstab *getfsfile(const char *mount_point);

struct fstab *getfsspec(const char *special_file);

int setfsent(void);  

説明

これらの関数は /etc/fstab ファイルから情報を読み込む。fstab 構造体は次のように定義されている。

struct fstab {
    char       *fs_spec;       /* block device name */
    char       *fs_file;       /* mount point */
    char       *fs_vfstype;    /* file-system type */
    char       *fs_mntops;     /* mount options */
    const char *fs_type;       /* rw/rq/ro/sw/xx option */
    int         fs_freq;       /* dump frequency, in days */
    int         fs_passno;     /* pass number on parallel dump */ };

*BSD システムの場合、 fs_type フィールドには、5 つの文字列 "rw", "rq", "ro", "sw", "xx" のいずれかが入る (それぞれ read-write, quota 付き read-write, read-only, swap, ignore)。

関数 setfsent() は呼び出されると fstab ファイルをオープンし、 最初の行に移動する。

関数 getfsent() は fstab ファイルから次の行をパースする (必要な場合はファイルをオープンする)。

関数 endfsent() は呼び出されると fstab ファイルをクローズする。

関数 getfsspec() は fstab ファイルを先頭から検索し、 fs_spec フィールドが special_file 引数にマッチするエントリーが見つかったら、その最初のものを返す。

関数 getfsfile() は fstab ファイルを先頭から検索し、 fs_file フィールドが mount_point 引数にマッチするエントリーが見つかったら、その最初のものを返す。  

返り値

成功すると、 getfsent(), getfsfile(), getfsspec() の各関数は fstab 構造体へのポインターを返し、 setfsent() 関数は 1 を返す。 失敗するとこれらの関数は NULL を返し、 end-of-file になったら 0 を返す。  

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース 属性 値
endfsent(),
setfsent()
Thread safety MT-Unsafe race:fsent
getfsent(),
getfsspec(),
getfsfile()
Thread safety MT-Unsafe race:fsent locale
 

準拠

These functions are not in POSIX.1. Several operating systems have them, for example, *BSD, SunOS, Digital UNIX, AIX (which also has a getfstype()). HP-UX has functions of the same names, that however use a struct checklist instead of a struct fstab, and calls these functions obsolete, superseded by getmntent(3).  

注意

これらの関数はスレッドセーフではない。

Linux ではブロックスペシャルデバイスを複数の場所にマウントでき、 また複数のデバイスが同じマウントポイントを共有できる (この場合はそのマウントポイントに最後にマウントされたデバイスが意味を持つ) が、 getfsfile() と getfsspec() はマッチした最初のエントリーしか返さないので、 これらの 2 つの関数は Linux での利用には適していない。  

関連項目

getmntent(3), fstab(5)  

この文書について

この man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は https://www.kernel.org/doc/man-pages/ に書かれている。

関連キーワード

fstab   エントリー   最初   マウント   point   type   read   マッチ   functions   デバイス   getfsent   getfsspec   getfsfile   setfsent   endfsent   構造体   spec   mount   dump   オープン   Thread   safety   race   fsent   複数

Linux マニュアル 一覧

関連するコマンド・関数

endfsent.3   getfsent.3   getfsspec.3   setfsent.3   addmntent.3   endmntent.3
 

Index

名前
書式
説明
返り値
属性
準拠
注意
関連項目
この文書について

This document was created by man2html, using the manual pages.
Time: 04:39:18 GMT, October 11, 2026