swapon(2) System Calls Manual swapon(2) swapon, swapoff - / / (libc -lc) #include int swapon(const char *path, int swapflags); int swapoff(const char *path); swapon() path. swapoff() path. SWAP_FLAG_PREFER swapon() swapflags . swapflags : (prio << SWAP_FLAG_PRIO_SHIFT) & SWAP_FLAG_PRIO_MASK SWAP_FLAG_DISCARD swapon() swapflags . ( .) . ( CAP_SYS_ADMIN). . . . swapflags . . . . . . 1.3.6 . . -1 errno . EBUSY ( swapon()) path . EINVAL path EINVAL (swapon()) tmpfs(5). EINVAL ( 3.4) (swapon()) swapflags. EINVAL (swapoff()) path . ENFILE . ENOENT path . ENOMEM . EPERM CAP_SYS_ADMIN. . . swapflags 1.3.2. mkswap(8). MAX_SWAPFILES. 2.4.10 MAX_SWAPFILES 8 2.4.10 32. 2.6.18 2 ( 30) 5.19 3 (: 29) CONFIG_MIGRATION ( mbind(2) migrate_pages(2)). 2.6.32 1 CONFIG_MEMORY_FAILURE. 5.14 4 CONFIG_DEVICE_PRIVATE. 5.19 1 CONFIG_PTE_MARKER. 2.6.29 SWAP_FLAG_DISCARD 2.6.36 swapon() . mkswap(8), swapoff(8), swapon(8) 3 . . : . 6.18 8 2026 swapon(2)