OSDN Git Service

(split) LDP: Update release pages based on LDP 3.54 release
[linuxjm/LDP_man-pages.git] / release / man3 / getmntent.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified Sat Jul 24 21:46:57 1993 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified 961109, 031115, aeb
31 .\"
32 .\"*******************************************************************
33 .\"
34 .\" This file was generated with po4a. Translate the source file.
35 .\"
36 .\"*******************************************************************
37 .\"
38 .\" Japanese Version Copyright (c) 1998 NAKANO Takeo all rights reserved.
39 .\" Translated 1998-03-01, NAKANO Takeo <nakano@apm.seikei.ac.jp>
40 .\" Updated 2000-09-03, Kentaro Shirakata <argrath@ub32.org>
41 .\" Updated 2005-03-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
42 .\"
43 .TH GETMNTENT 3 2009\-09\-15 "" "Linux Programmer's Manual"
44 .SH 名前
45 getmntent, setmntent, addmntent, endmntent, hasmntopt, getmntent_r \- get
46 filesystem descriptor file entry
47 .SH 書式
48 .nf
49 \fB#include <stdio.h>\fP
50 \fB#include <mntent.h>\fP
51 .sp
52 \fBFILE *setmntent(const char *\fP\fIfilename\fP\fB, const char *\fP\fItype\fP\fB);\fP
53 .sp
54 \fBstruct mntent *getmntent(FILE *\fP\fIfp\fP\fB);\fP
55 .sp
56 \fBint addmntent(FILE *\fP\fIfp\fP\fB, const struct mntent *\fP\fImnt\fP\fB);\fP
57 .sp
58 \fBint endmntent(FILE *\fP\fIfp\fP\fB);\fP
59 .sp
60 \fBchar *hasmntopt(const struct mntent *\fP\fImnt\fP\fB, const char *\fP\fIopt\fP\fB);\fP
61 .sp
62 /* GNU による拡張 */
63 \fB#include <mntent.h>\fP
64 .sp
65 \fBstruct mntent *getmntent_r(FILE *\fP\fIfp\fP\fB, struct mntent *\fP\fImntbuf\fP\fB,\fP
66 \fB                           char *\fP\fIbuf\fP\fB, int \fP\fIbuflen\fP\fB);\fP
67 .fi
68 .sp
69 .in -4n
70 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
71 .in
72 .sp
73 \fBgetmntent_r\fP(): _BSD_SOURCE || _SVID_SOURCE
74 .SH 説明
75 These routines are used to access the filesystem description file
76 \fI/etc/fstab\fP and the mounted filesystem description file \fI/etc/mtab\fP.
77 .PP
78 The \fBsetmntent\fP()  function opens the filesystem description file
79 \fIfilename\fP and returns a file pointer which can be used by \fBgetmntent\fP().
80 The argument \fItype\fP is the type of access required and can take the same
81 values as the \fImode\fP argument of \fBfopen\fP(3).
82 .PP
83 The \fBgetmntent\fP()  function reads the next line from the filesystem
84 description file \fIfp\fP and returns a pointer to a structure containing the
85 broken out fields from a line in the file.  The pointer points to a static
86 area of memory which is overwritten by subsequent calls to \fBgetmntent\fP().
87 .PP
88 \fBaddmntent\fP()  関数は \fImntent\fP 構造体 \fImnt\fP の内容を、オープンされているファイル \fIfp\fP の最後に追加する。
89 .PP
90 The \fBendmntent\fP()  function closes the filesystem description file \fIfp\fP.
91 .PP
92 \fBhasmntopt\fP()  関数は \fImntent\fP 構造体 \fImnt\fP の \fImnt_opts\fP フィールド (下記 参照) をスキャンし、
93 \fIopt\fP に一致する部分文字列があるかを調べる。 有効なマウントオプションについては \fI<mntent.h>\fP と
94 \fBmount\fP(8)  を参照のこと。
95 .PP
96 リエントラントな関数 \fBgetmntent_r\fP()  は \fBgetmntent\fP()  と同じだが、 ユーザが用意した \fI*mntbuf\fP に
97 \fIstruct mount\fP を格納し、その構造体の各エントリが指し示す文字列を ユーザが用意した大きさ \fIbuflen\fP の配列 \fIbuf\fP
98 に書き込む。
99 .PP
100 \fImntent\fP 構造体は \fI<mntent.h>\fP で以下のように定義されている。
101 .sp
102 .in +4n
103 .nf
104 struct mntent {
105     char *mnt_fsname;   /* name of mounted filesystem */
106     char *mnt_dir;      /* filesystem path prefix */
107     char *mnt_type;     /* mount type (see mntent.h) */
108     char *mnt_opts;     /* mount options (see mntent.h) */
109     int   mnt_freq;     /* dump frequency in days */
110     int   mnt_passno;   /* pass number on parallel fsck */
111 };
112 .fi
113 .in
114
115 mtab や fstab ファイルでは、各フィールドは空白で区切られているので、 スペース、タブ、改行、バックスラッシュの 4文字をこれらのファイルで
116 使いたい場合で、かつ \fImntent\fP 構造体の 4つの文字列メンバーのいずれかに対応するフィールド内で
117 使いたい場合には、8進のエスケープ表記を使って表現する: スペース (\e040), タブ (\e011), 改行 (\e012), バックスラッシュ
118 (\e134)。 \fBaddmntent\fP()  と \fBgetmntent\fP()  は、文字列表現から エスケープ表現への変換、およびその逆を行う。
119 .SH 返り値
120 \fBgetmntent\fP()  と \fBgetmntent_r\fP()  は \fImntent\fP 構造体へのポインタを返す。 失敗した場合は NULL
121 を返す。
122 .PP
123 \fBaddmntent\fP()  関数は成功したら 0 を返し、失敗したら 1 を返す。
124 .PP
125 \fBendmntent\fP()  関数はつねに 1 を返す。
126 .PP
127 \fBhasmntopt\fP()  関数は、マッチした場合は部分文字列へのアドレスを返し、 マッチしなければ NULL を返す。
128 .SH ファイル
129 .nf
130 /etc/fstab          filesystem description file
131 /etc/mtab           mounted filesystem description file
132 .fi
133 .SH 準拠
134 リエントラントでない関数は SunOS 4.1.3 由来のものである。 \fBgetmntent_r\fP()  関数は HPUX 10
135 で導入されたが、このバージョンでは int を返す。 上記に示したプロトタイプは glibc 独自のものである。
136 .SH 注意
137 System V にも \fBgetmntent\fP()  関数はあるが、 呼び出し手順が異なり、返される構造体も異なる。 System V では
138 \fI/etc/mnttab\fP が用いられる。 4.4BSD と Digital UNIX には \fBgetmntinfo\fP()  があるが、
139 システムコール \fBgetfsstat\fP()  のラッパー関数である。
140 .SH 関連項目
141 \fBfopen\fP(3), \fBfstab\fP(5), \fBmount\fP(8)
142 .SH この文書について
143 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部
144 である。プロジェクトの説明とバグ報告に関する情報は
145 http://www.kernel.org/doc/man\-pages/ に書かれている。