.\" Copyright (C) 1993 Rickard E. Faith .\" and Copyright (C) 1994 Andries E. Brouwer .\" and Copyright (C) 2002, 2005 Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" 2008-10-06, mtk: Created this as a new page by splitting .\" umount/umount2 material out of mount.2 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2008 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2008-11-20, Akihiro MOTOKI , LDP v3.13 .\" Updated 2012-04-30, Akihiro MOTOKI .\" .TH UMOUNT 2 2014\-02\-26 Linux "Linux Programmer's Manual" .SH 名前 umount, umount2 \- ファイルシステムをアンマウントする .SH 書式 .nf \fB#include \fP .sp \fBint umount(const char *\fP\fItarget\fP\fB);\fP .sp \fBint umount2(const char *\fP\fItarget\fP\fB, int \fP\fIflags\fP\fB);\fP .fi .SH 説明 .\" Note: the kernel naming differs from the glibc naming .\" umount2 is the glibc name for what the kernel now calls umount .\" and umount is the glibc name for oldumount \fBumount\fP() と \fBumount2\fP() は \fItarget\fP にマウントされている (最上位の) ファイルシステムを外す。 ファイルシステムのアンマウントを行うには、 適切な権限 (Linux では \fBCAP_SYS_ADMIN\fP ケーパビリティ) が必要である。 Linux 2.1.116 から、 \fBumount2\fP() システムコールが追加された。これは \fBumount\fP() と同様に \fItarget\fP をアンマウントするが、 \fIflags\fP が追加されており、操作時の振る舞いを制御できる。 .TP \fBMNT_FORCE\fP (2.1.116 以降) 使用中 (busy) でも強制的にアンマウントを実行する。 これを行うとデータを失う可能性がある。 (NFS マウント専用) .TP \fBMNT_DETACH\fP (2.4.11 以降) 遅延アンマウントを行う。マウントポイントに対する新規のアクセスは 不可能となり、実際のアンマウントはマウントポイントがビジーで なくなった時点で行う。 .TP \fBMNT_EXPIRE\fP (Linux 2.6.8 以降) マウントポイントに期限切れの印をつける。 マウントポイントが現在使用中でない場合、このフラグをつけて \fBumount2\fP() を初めて呼び出すと \fBEAGAIN\fP エラーで失敗するが、マウントポイントには期限切れ (expire) の印がつけられる。 そのマウントポイントはいずれかのプロセスがアクセスしない限り 期限切れの印がついたままとなる。 もう一度 \fBMNT_EXPIRE\fP をつけて \fBumount2\fP() を呼び出すと、期限切れの印のついたマウントポイントが アンマウントされる。 このフラグを \fBMNT_FORCE\fP もしくは \fBMNT_DETACH\fP と同時に指定することはできない。 .TP \fBUMOUNT_NOFOLLOW\fP (Linux 2.6.34 以降) .\" Later added to 2.6.33-stable \fItarget\fP がシンボリックリンクの場合に、シンボリックリンクの展開を行わない。 このフラグを使うと、 \fIroot\fP に set\-user\-ID されたプログラムにおいて、 非特権ユーザーがファイルシステムのアンマウントをできてしまうという セキュリティ問題を回避することができる。 .SH 返り値 成功した場合、0 が返される。 失敗した場合、 \-1 が返され、 \fIerrno\fP に適切な値がセットされる。 .SH エラー 以下に示すエラーは、ファイルシステムに依存しないものである。 それぞれのファイルシステムタイプには固有のエラーが存在する場合があり、 独自の動作をすることもある。詳しくは Linux カーネルのソースを見て欲しい。 .TP \fBEAGAIN\fP \fBMNT_EXPIRE\fP を指定した \fBumount2\fP() の呼び出しで、正常に未使用のファイルシステムに期限切れの印を つけることができた。 .TP \fBEBUSY\fP 使用中 (busy) のため、 \fItarget\fP をアンマウントできなかった。 .TP \fBEFAULT\fP \fItarget\fP がユーザーアドレス空間の外を指している。 .TP \fBEINVAL\fP \fItarget\fP がマウントポイントではない。 .TP \fBEINVAL\fP \fBMNT_EXPIRE\fP が指定された \fBumount2\fP() で、 \fBMNT_DETACH\fP か \fBMNT_FORCE\fP が同時に指定された。 .TP \fBEINVAL\fP (Linux 2.6.34 以降) \fIflags\fP に無効なフラグが指定されて \fBumount2\fP() が呼び出された。 .TP \fBENAMETOOLONG\fP パス名の長さが \fBMAXPATHLEN\fP より長かった。 .TP \fBENOENT\fP パス名が空である。もしくは指定されたパスが存在しない。 .TP \fBENOMEM\fP カーネルがファイル名やデータをコピーするための空きページを確保できなかった。 .TP \fBEPERM\fP 呼び出し元が必要な権限を持っていない。 .SH バージョン .\" http://sourceware.org/bugzilla/show_bug.cgi?id=10092 \fBMNT_DETACH\fP と \fBMNT_EXPIRE\fP はバージョン 2.11 以降の glibc で利用できる。 .SH 準拠 この関数は Linux 固有の関数であり、移植を考慮したプログラムでは 使用すべきでない。 .SH 注意 元々の \fBumount\fP() 関数は \fIumount(device)\fP の形で呼び出され、 ブロックデバイス以外を指定して呼び出すと \fBENOTBLK\fP を返した。 Linux 0.98p4 で、無名デバイス (anonymous device) に対応するために \fIumount(dir)\fP の形での呼び出しが加えられた。 Linux 2.3.99\-pre7 で、\fIumount(device)\fP は削除され、 \fIumount(dir)\fP だけが残された (一つのデバイスを複数の位置にマウント出来るようになったため、 デバイスを指定しただけでは不十分だからである)。 .SH 関連項目 \fBmount\fP(2), \fBpath_resolution\fP(7), \fBmount\fP(8), \fBumount\fP(8) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。