swapon

SWAPON(2)                  Linux Programmer's Manual                 SWAPON(2)



åå
       swapon, swapoff - ãã¡ã¤ã«/ããã¤ã¹ã¸ã®ã¹ã¯ãã(swap)ãéå§/åæ¢ãã

æ¸å¼
       #include <unistd.h>
       #include <linux/swap.h>

       int swapon(const char *path, int swapflags);
       int swapoff(const char *path);

説æ
       swapon 㯠path ã§æå®ããããã¡ã¤ã«ããããã¯ã»ããã¤ã¹(block device)ã«
       ã¹ã¯ããé å(swap area)ãè¨å®ããã swapoff 㯠path ã§æå®ããããã¡ã¤ã«ããã‐
       ãã¯ã»ããã¤ã¹ã¸ã®ã¹ã¯ãããåæ¢ããã

       swapon 㯠swapflags å¼ãæ°ãåãã ãã swapflags ã« SWAP_FLAG_PREFER ããããè¨‐
       å®ãããå ´åã¯ãæ°ããã¹ã¯ããé åã¯ããã©ã«ããããé«ã
       åªå度(priority)ãæã¤ãåªå度ã¯ä»¥ä¸ã®ããã«ã³ã¼ãåããã¦ããã

           (prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK

       ãããã®é¢æ°ã¯ã¹ã¼ãã¼ã»ã¦ã¼ã¶ã¼ã®ã¿ä½¿ç¨ã§ããã

åªå度
       ããããã®ã¹ã¯ããé åã¯é«ã(high)ã¨ä½ã(low)ã®ã©ã¡ããã®
       åªå度ãæã¤ãããã©ã«ãã®åªå度ã¯ä½ãã
       ä½ãåªå度ã®é åã«ããã¦ãæ°ããé åã¯å¤ãé åããããã«ä½ã åªå度ãæã¤ã

       swapflags ãè¨å®ããããã®ã¯å¨ã¦ã¨é«ãåªå度ã¨ãªããããã©ã«ããããé«ãåªå度ãæã¤ã
       使ç¨è(caller)ã¯ãããã«è² ã§ãªãå¤ãæå®ã§ããã 大ããªæ°åã¯é«ãåªå度ãæå³ããã

       é«ãåªå度ã®é åããé ã«ã¹ã¯ããã»ãã¼ã¸(swap page)ã¨ãã¦ä½¿ç¨ãããã
       ããä½ãåªå度ã®é åã使ç¨ããåã«ããé«ãåªå度ã®
       é åã使ãåããããäºã¤ä»¥ä¸ã®é åãåãåªå度ãæã¡ã 使ããä¸‐
       ã§ä¸çªé«ãåªå度ã§ããã°ããããã®ãã¼ã¸ã¯é㧠ã©ã¦ã³ãã»ããã³(round
       robin)æ¹å¼ã§éåãããã

       Linux 1.3.6 ã«ããã¦ãã«ã¼ãã«ã¯é常ã¯ãããã®è¦åã«å¾ã£ã¦ããã ãããä¾å¤ãåå¨ãã¦ããã

è¿ãå¤
       æåããå ´åã¯ã¼ããè¿ããããã¨ã©ã¼ã®å ´å㯠-1 ãè¿ããã errno ãé©åã«è¨å®ãããã

ã¨ã©ã¼
       ãã path ãä¸é©åãªå ´åãä»ã®å¤ãã®ã¨ã©ã¼ãèµ·ããå¯è½æ§ãããã


       EPERM   ã¦ã¼ã¶ã¼ãã¹ã¼ãã¼ã»ã¦ã¼ã¶ã¼ã§ãªããã MAX_SWAPFILES (Linux 1.3.6
               ã§ã¯ 8 ã¨å®ç¾©ããã)以ä¸ã®ã¹ã¯ããã使ç¨ãã¦ããã

       EINVAL  path ãåå¨ããããé常ã®ãã¹ã§ããããã¯ã»ããã¤ã¹ã§ããªãå ´åã«è¿ãããã

       ENOENT  path ãåå¨ããªãå ´åã«è¿ãããã

       ENOMEM  ã¹ã¯ãããéå§ããã®ã«ååãªã¡ã¢ãªã¼ãåå¨ããªãå ´åã«è¿ãããã


æºæ
       ãããã®é¢æ°ã¯ Linux ç¹æã§ããã移æ¤ã¨æå³ããããã°ã©ã ã§ã¯ 使ç¨ãã¦ã¯ãããªãã
       äºçªç®ã® `swapflags` å¼ãæ°ã¯ Linux 1.3.2 ããå°å¥ãããã

注æ
       ãã¼ãã£ã·ã§ã³(partition)ããã¹ã¯ mkswap(8) ã«ãã£ã¦æºåããã¦ããªããã°ãªããªãã

é¢é£é ç®
       mkswap(8), swapon(8), swapoff(8)



Linux 1.3.6                      22 July 1995                        SWAPON(2)