OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / release / man2 / umount.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 1993 Rickard E. Faith <faith@cs.unc.edu>
4 .\" and Copyright (C) 1994 Andries E. Brouwer <aeb@cwi.nl>
5 .\" and Copyright (C) 2002, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
6 .\"
7 .\" Permission is granted to make and distribute verbatim copies of this
8 .\" manual provided the copyright notice and this permission notice are
9 .\" preserved on all copies.
10 .\"
11 .\" Permission is granted to copy and distribute modified versions of this
12 .\" manual under the conditions for verbatim copying, provided that the
13 .\" entire resulting derived work is distributed under the terms of a
14 .\" permission notice identical to this one.
15 .\"
16 .\" Since the Linux kernel and libraries are constantly changing, this
17 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
18 .\" responsibility for errors or omissions, or for damages resulting from
19 .\" the use of the information contained herein.  The author(s) may not
20 .\" have taken the same level of care in the production of this manual,
21 .\" which is licensed free of charge, as they might when working
22 .\" professionally.
23 .\"
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
26 .\"
27 .\" 2008-10-06, mtk: Created this as a new page by splitting
28 .\"     umount/umount2 material out of mount.2
29 .\"
30 .\" Japanese Version Copyright (c) 2008  Akihiro MOTOKI
31 .\"         all rights reserved.
32 .\" Translated 2008-11-20, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.13
33 .\" 
34 .TH UMOUNT 2 2009-09-03 "Linux" "Linux Programmer's Manual"
35 .SH 名前
36 umount, umount2 \- ファイルシステムをアンマウントする
37 .SH 書式
38 .nf
39 .B "#include <sys/mount.h>"
40 .sp
41 .BI "int umount(const char *" target );
42 .sp
43 .BI "int umount2(const char *" target ", int " flags );
44 .fi
45 .SH 説明
46 .BR umount ()
47
48 .BR umount2 ()
49
50 .I target
51 にマウントされている (最上位の) ファイルシステムを外す。
52 .\" Note: the kernel naming differs from the glibc naming
53 .\" umount2 is the glibc name for what the kernel now calls umount
54 .\" and umount is the glibc name for oldumount
55
56 ファイルシステムのアンマウントを行うには、
57 適切な権限 (Linux では
58 .B CAP_SYS_ADMIN
59 ケーパビリティ) が必要である。
60
61 Linux 2.1.116 から、
62 .BR umount2 ()
63 システムコールが追加された。これは
64 .BR umount ()
65 と同様に
66 .I target
67 をアンマウントするが、
68 .I flags
69 が追加されており、操作時の振る舞いを制御できる。
70 .TP
71 .BR MNT_FORCE " (2.1.116 以降)"
72 使用中 (busy) でも強制的にアンマウントを実行する。
73 これを行うとデータを失う可能性がある。
74 (NFS マウント専用)
75 .TP
76 .BR MNT_DETACH " (2.4.11 以降)"
77 遅延アンマウントを行う。マウントポイントに対する新規のアクセスは
78 不可能となり、実際のアンマウントはマウントポイントがビジーで
79 なくなった時点で行う。
80 .TP
81 .BR MNT_EXPIRE " (Linux 2.6.8 以降)"
82 マウントポイントに期限切れの印をつける。
83 マウントポイントが現在使用中でない場合、このフラグをつけて
84 .BR umount2 ()
85 を初めて呼び出すと
86 .B EAGAIN
87 エラーで失敗するが、マウントポイントには期限切れ (expire)
88 の印がつけられる。
89 そのマウントポイントはいずれかのプロセスがアクセスしない限り
90 期限切れの印がついたままとなる。
91 もう一度
92 .B MNT_EXPIRE
93 をつけて
94 .BR umount2 ()
95 を呼び出すと、期限切れの印のついたマウントポイントが
96 アンマウントされる。
97 このフラグを
98 .B MNT_FORCE
99 もしくは
100 .B MNT_DETACH
101 と同時に指定することはできない。
102 .SH 返り値
103 成功した場合 0 が返る。
104 エラーの場合、\-1 が返り、
105 .I errno
106 がエラーの内容にしたがって設定される。
107 .SH エラー
108 以下に示すエラーは、ファイルシステムに依存しないものである。
109 それぞれのファイルシステムタイプには固有のエラーが存在する場合があり、
110 独自の動作をすることもある。詳しくはカーネルのソースを見て欲しい。
111 .TP
112 .B EAGAIN
113 .B MNT_EXPIRE
114 を指定した
115 .BR umount2 ()
116 の呼び出しで、正常に未使用のファイルシステムに期限切れの印を
117 つけることができた。
118 .TP
119 .B EBUSY
120 使用中 (busy) のため、
121 .I target
122 をアンマウントできなかった。
123 .TP
124 .B EFAULT
125 .I target
126 がユーザアドレス空間の外を指している。
127 .TP
128 .B EINVAL
129 .I target
130 がマウントポイントではない。
131 または、
132 .BR umount2 ()
133 で、
134 .B MNT_EXPIRE
135 が指定された
136 .BR umount2 ()
137 で、
138 .B MNT_DETACH
139
140 .B MNT_FORCE
141 が同時に指定された。
142 .TP
143 .B ENAMETOOLONG
144 パス名の長さが
145 .B MAXPATHLEN
146 より長かった。
147 .TP
148 .B ENOENT
149 パス名が空である。もしくは指定されたパスが存在しない。
150 .TP
151 .B ENOMEM
152 カーネルがファイル名やデータをコピーするための空きページを確保できなかった。
153 .TP
154 .B EPERM
155 呼び出し元が必要な権限を持っていない。
156 .SH バージョン
157 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=10092
158 .BR MNT_DETACH
159
160 .BR MNT_EXPIRE
161 はバージョン 2.11 以降の glibc でのみ利用できる。
162 .SH 準拠
163 この関数は Linux 固有の関数であり、移植を考慮したプログラムでは
164 使用すべきでない。
165 .SH 注意
166 元々の
167 .BR umount ()
168 関数は \fIumount(device)\fP の形で呼び出され、
169 ブロックデバイス以外を指定して呼び出すと
170 .B ENOTBLK
171 を返した。
172 Linux 0.98p4 で、無名デバイス (anonymous device) に対応するために
173 \fIumount(dir)\fP の形での呼び出しが加えられた。
174 Linux 2.3.99-pre7 で、\fIumount(device)\fP は削除され、
175 \fIumount(dir)\fP だけが残された
176 (一つのデバイスを複数の位置にマウント出来るようになったため、
177 デバイスを指定しただけでは不十分だからである)。
178 .SH 関連項目
179 .BR mount (2),
180 .BR path_resolution (7),
181 .BR mount (8),
182 .BR umount (8)