-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
.\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
.\"
+.\" %%%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.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.\" Modified by Michael Haardt <michael@moria.de>
.\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
.\" 2007-06-22 Ivana Varekova <varekova@redhat.com>, mtk
.\" Update text describing limit on number of swap files.
.\"
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Mon Mar 3 23:54:56 JST 1997
.\" Updated & Modified Fri Feb 11 07:40:12 JST 2005
.\" by Yuichi SATO <ysato444@yahoo.co.jp>
.\" Updated 2007-09-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.64
+.\" Updated 2012-04-30, Akihiro MOTOKI <amotoki@gmail.com>
.\"
-.\"WORD: swap スワップ
-.\"WORD: block device ブロック・デバイス
-.\"WORD: super-user スーパー・ユーザー
-.\"WORD: round robin ラウンド・ロビン
-.\"WORD: partition パーティション
-.\"WORD: page ページ
-.\"WORD: kernel カーネル
-.\"
-.TH SWAPON 2 2010-06-15 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
+.TH SWAPON 2 2014\-02\-26 Linux "Linux Programmer's Manual"
.SH 名前
-.\"O swapon, swapoff \- start/stop swapping to file/device
swapon, swapoff \- ファイル/デバイスへのスワップを開始/停止する
-.\"O .SH SYNOPSIS
.SH 書式
-.B #include <unistd.h>
+\fB#include <unistd.h>\fP
.br
-.\"O .B #include <asm/page.h> /* to find PAGE_SIZE */
-.B #include <asm/page.h> /* PAGE_SIZE を見つけるため */
+\fB#include <asm/page.h> /* PAGE_SIZE を見つけるため */\fP
.br
-.B #include <sys/swap.h>
+\fB#include <sys/swap.h>\fP
.sp
-.BI "int swapon(const char *" path ", int " swapflags );
+\fBint swapon(const char *\fP\fIpath\fP\fB, int \fP\fIswapflags\fP\fB);\fP
.br
-.BI "int swapoff(const char *" path );
-.\"O .SH DESCRIPTION
+\fBint swapoff(const char *\fP\fIpath\fP\fB);\fP
.SH 説明
-.\"O .BR swapon ()
-.\"O sets the swap area to the file or block device specified by
-.\"O .IR path .
-.BR swapon ()
-は
-.I path
-で指定されたファイルやブロック・デバイスにスワップ領域を設定する。
-.\"O .BR swapoff ()
-.\"O stops swapping to the file or block device specified by
-.\"O .IR path .
-.BR swapoff ()
-は
-.I path
-で指定されたファイルやブロック・デバイスへのスワップを停止する。
+\fBswapon\fP() は \fIpath\fP で指定されたファイルやブロックデバイスにスワップ領域を設定する。 \fBswapoff\fP() は
+\fIpath\fP で指定されたファイルやブロックデバイスへのスワップを停止する。
.PP
-.\"O .BR swapon ()
-.\"O takes a
-.\"O .I swapflags
-.\"O argument.
-.BR swapon ()
-は
-.I swapflags
-引き数を取る。
-.\"O If
-.\"O .I swapflags
-.\"O has the
-.\"O .B SWAP_FLAG_PREFER
-.\"O bit turned on, the new swap area will have a higher priority than default.
-.I swapflags
-に
-.B SWAP_FLAG_PREFER
-ビットが設定された場合は、新しいスワップ領域はデフォルトよりも高い
-優先度を持つ。
-.\"O The priority is encoded within
-.\"O .I swapflags
-.\"O as:
-優先度は
-.I swapflags
-に以下のようにコード化されている。
+\fBswapon\fP() の \fIswapflags\fP 引き数に \fBSWAP_FLAG_PREFER\fP フラグが指定された場合、
+新しいスワップ領域はデフォルトよりも高い優先度を持つ。
+優先度は以下のように変換されて \fIswapflags\fP に指定する。
.br
.sp
-.I " (prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK"
+\fI(prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK\fP
.br
.PP
-.\"O These functions may only be used by a privileged process (one having the
-.\"O .B CAP_SYS_ADMIN
-.\"O capability).
-これらの関数は特権プロセス
-.RB ( CAP_SYS_ADMIN
-ケーパビリティ (capability) を持つプロセス) のみが使用できる。
-.\"O .SS Priority
+\fBSWAP_FLAG_DISCARD\fP フラグが \fBswapon\fP() の \fIswapflags\fP 引き数に指定された場合、
+スワップデバイスが破棄 (discard) 操作や trim 操作をサポートしている場合には、
+解放されたスワップページは再利用される前に破棄される
+(これにより、SSD (Solid State Device) によっては性能が向上することがあるが、
+たいていは性能の向上はない)。
+「注意」も参照のこと。
+.PP
+これらの関数は特権プロセス (\fBCAP_SYS_ADMIN\fP ケーパビリティ (capability) を持つプロセス) のみが使用できる。
.SS 優先度
-.\"O Each swap area has a priority, either high or low.
-.\"O The default priority is low.
-.\"O Within the low-priority areas,
-.\"O newer areas are even lower priority than older areas.
-それぞれのスワップ領域は高 (high) と低 (low) のどちらかの優先度を持つ。
-デフォルトの優先度は低である。
-低い優先度の領域において、新しい領域は古い領域よりさらに低い
-優先度を持つ。
+それぞれのスワップ領域は高 (high) と低 (low) のどちらかの優先度を持つ。 デフォルトの優先度は低である。
+低い優先度の領域において、新しい領域は古い領域よりさらに低い 優先度を持つ。
.PP
-.\"O All priorities set with
-.\"O .I swapflags
-.\"O are high-priority, higher than default.
-.\"O They may have any nonnegative value chosen by the caller.
-.\"O Higher numbers mean higher priority.
-.I swapflags
-が設定されたものは全て高い優先度となり、デフォルトよりも高い優先度を持つ。
-使用者はそれらに負でない値が指定できる。
+\fIswapflags\fP が設定されたものは全て高い優先度となり、デフォルトよりも高い優先度を持つ。 使用者はそれらに負でない値が指定できる。
大きな数字は高い優先度を意味する。
.PP
-.\"O Swap pages are allocated from areas in priority order,
-.\"O highest priority first.
-.\"O For areas with different priorities,
-.\"O a higher-priority area is exhausted before using a lower-priority area.
-.\"O If two or more areas have the same priority,
-.\"O and it is the highest priority available,
-.\"O pages are allocated on a round-robin basis between them.
-高い優先度の領域から順にスワップ・ページとして使用される。
-より低い優先度の領域を使用する前により高い優先度の
-領域を使い切る。もし二つ以上の領域が同じ優先度を持ち、
-使える中で一番高い優先度であれば、それらのページは間で
-ラウンド・ロビン方式で配分される。
+高い優先度の領域から順にスワップページとして使用される。 より低い優先度の領域を使用する前により高い優先度の
+領域を使い切る。もし二つ以上の領域が同じ優先度を持ち、 使える中で一番高い優先度であれば、それらのページは間で ラウンドロビン方式で配分される。
.PP
-.\"O As of Linux 1.3.6, the kernel usually follows these rules,
-.\"O but there are exceptions.
-Linux 1.3.6 において、カーネルは通常はこれらの規則に従っている。
-しかし例外も存在している。
-.\"O .SH "RETURN VALUE"
+Linux 1.3.6 において、カーネルは通常はこれらの規則に従っている。 しかし例外も存在している。
.SH 返り値
-.\"O On success, zero is returned.
-.\"O On error, \-1 is returned, and
-.\"O .I errno
-.\"O is set appropriately.
-成功した場合は 0 が返される。エラーの場合は \-1 が返され、
-.I errno
-が適切に設定される。
-.\"O .SH ERRORS
+成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
.SH エラー
-.TP
-.B EBUSY
-.\"O (for
-.\"O .BR swapon ())
-.\"O The specified
-.\"O .I path
-.\"O is already being used as a swap area.
-.RB ( swapon ()
-において) 指定された
-.I path
-が既にスワップ領域として使用されている。
-.TP
-.B EINVAL
-.\"O The file
-.\"O .I path
-.\"O exists, but refers neither to a regular file nor to a block device;
-ファイル
-.I path
-は存在するが、通常のファイルもブロック・デバイスも参照していない。
-.\"O or, for
-.\"O .BR swapon (),
-.\"O the indicated path does not contain a valid swap signature or
-.\"O resides on an in-memory file system like tmpfs; or, for
-.\"O or, for
-.\"O .BR swapoff (),
-.\"O .I path
-.\"O is not currently a swap area.
-または
-.BR swapon ()
-において、指定された path のファイルが有効なスワップの署名 (signature) を
-含んでいないか、tmpfs のようなインメモリ (in-memory) のファイルシステム
-上にある。
-または
-.BR swapoff ()
-において、
-.I path
-が現在のところスワップ領域でない。
-.TP
-.B ENFILE
-.\"O The system limit on the total number of open files has been reached.
-オープンされたファイルの総数がシステムの制限に達した。
-.TP
-.B ENOENT
-.\"O The file
-.\"O .I path
-.\"O does not exist.
-ファイル
-.I path
-が存在しない。
-.TP
-.B ENOMEM
-.\"O The system has insufficient memory to start swapping.
+.TP
+\fBEBUSY\fP
+(\fBswapon\fP() において) 指定された \fIpath\fP が既にスワップ領域として使用されている。
+.TP
+\fBEINVAL\fP
+ファイル \fIpath\fP は存在するが、通常のファイルもブロックデバイスも参照していない。
+.TP
+\fBEINVAL\fP
+(\fBswapon\fP()) 指定されたパスが有効なスワップの署名 (signature) を含んでいないか、tmpfs
+のようなインメモリファイルシステム上にある。
+.TP
+\fBEINVAL\fP (Linux 3.4 以降)
+(\fBswapon\fP()) \fIflags\fP に無効なフラグ値が指定された。
+.TP
+\fBEINVAL\fP
+(\fBswapoff\fP()) \fIpath\fP が現在スワップ領域ではない。
+.TP
+\fBENFILE\fP
+オープンされたファイルの総数がシステム全体の上限に達していた。
+.TP
+\fBENOENT\fP
+ファイル \fIpath\fP が存在しない。
+.TP
+\fBENOMEM\fP
スワップを開始するのに十分なメモリーがシステムにない。
-.TP
-.B EPERM
-.\"O The caller does not have the
-.\"O .B CAP_SYS_ADMIN
-.\"O capability.
-.\"O Alternatively, the maximum number of swap files are already in use;
-.\"O see NOTES below.
-使用者が
-.B CAP_SYS_ADMIN
-ケーパビリティを持っていない。
-もしくは、最大数のスワップファイルがすでに使用されている
+.TP
+\fBEPERM\fP
+使用者が \fBCAP_SYS_ADMIN\fP ケーパビリティを持っていない。 もしくは、最大数のスワップファイルがすでに使用されている
(下記の「注意」の節を参照)。
-.\"O .SH "CONFORMING TO"
.SH 準拠
-.\"O These functions are Linux-specific and should not be used in programs
-.\"O intended to be portable.
-これらの関数は Linux 特有であり、移植を意図したプログラムでは
-使用してはいけない。
-.\"O The second
-.\"O .I swapflags
-.\"O argument was introduced in Linux 1.3.2.
-二番目の
-.I swapflags
-引き数は Linux 1.3.2 から導入された。
-.\"O .SH NOTES
+これらの関数は Linux 特有であり、移植を意図したプログラムでは 使用してはいけない。 二番目の \fIswapflags\fP 引き数は Linux
+1.3.2 から導入された。
.SH 注意
-.\"O The partition or path must be prepared with
-.\"O .BR mkswap (8).
-パーティションやパスは
-.BR mkswap (8)
-によって準備されていなければならない。
+パーティションやパスは \fBmkswap\fP(8) によって準備されていなければならない。
+
+使用できるスワップファイルの数には上限があり、その上限は カーネル定数 \fBMAX_SWAPFILES\fP で定義される。
+\fBMAX_SWAPFILES\fP の値は、カーネル 2.4.10 より前では 8、 カーネル 2.4.10 以降では 32 である。 カーネル
+2.6.18 以降では、カーネルが \fBCONFIG_MIGRATION\fP オプションを有効にして作成された場合、 この上限が 2 少ない値 (つまり
+30) となる (このカーネルでは、 \fBmbind\fP(2) と \fBmigrate_pages\fP(2)
+のページマイグレーション機能用にスワップテーブルのエントリーが 二つ予約される)。 カーネル 2.6.32 以降では、カーネルが
+\fBCONFIG_MEMORY_FAILURE\fP オプションを有効にして作成された場合、 この上限がさらに 1 少ない値となる。
-.\"O There is an upper limit on the number of swap files that may be used,
-.\"O defined by the kernel constant
-.\"O .BR MAX_SWAPFILES .
-.\"O Before kernel 2.4.10,
-.\"O .B MAX_SWAPFILES
-.\"O has the value 8;
-.\"O since kernel 2.4.10, it has the value 32.
-.\"O Since kernel 2.6.18, the limit is decreased by 2 (thus: 30)
-.\"O if the kernel is built with the
-.\"O .B CONFIG_MIGRATION
-.\"O option
-.\"O (which reserves two swap table entries for the page migration features of
-.\"O .BR mbind (2)
-.\"O and
-.\"O .BR migrate_pages (2)).
-.\"O Since kernel 2.6.32, the limit is further decreased by 1
-.\"O if the kernel is built with the
-.\"O .B CONFIG_MEMORY_FAILURE
-.\"O option.
-使用できるスワップファイルの数には上限があり、その上限は
-カーネル定数
-.B MAX_SWAPFILES
-で定義される。
-.B MAX_SWAPFILES
-の値は、カーネル 2.4.10 より前では 8、
-カーネル 2.4.10 以降では 32 である。
-カーネル 2.6.18 以降では、カーネルが
-.B CONFIG_MIGRATION
-オプションを有効にして作成された場合、
-この上限が 2 少ない値 (つまり 30) となる
-(このカーネルでは、
-.BR mbind (2)
-と
-.BR migrate_pages (2)
-のページ・マイグレーション機能用にスワップ・テーブルのエントリーが
-二つ予約される)。
-カーネル 2.6.32 以降では、カーネルが
-.B CONFIG_MEMORY_FAILURE
-オプションを有効にして作成された場合、
-この上限がさらに 1 少ない値となる。
-.\"O .SH "SEE ALSO"
+.\" To be precise: 2.6.35.5
+スワップページの破棄は、カーネル 2.6.29 で導入され、その後カーネル 2.6.36 で
+\fBSWAP_FLAG_DISCARD\fP フラグが指定された場合にだけ実行されるようになったが、
+今でも、このフラグビットが指定されていない場合であっても、
+\fBswapon\fP が呼び出された際にスワップ領域全体の破棄が行われる。
.SH 関連項目
-.BR mkswap (8),
-.BR swapoff (8),
-.BR swapon (8)
+\fBmkswap\fP(8), \fBswapoff\fP(8), \fBswapon\fP(8)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。