sys_swapon  [mm/swapfile.c]


Sets the swap area to a file or block device.

Arguments

eax 87
ebx Pointer to a null-terminated string specifying the pathname of the file or block device.
ecx Flags. If ecx has SWAP_FLAG_PREFER bit turned on, the new swap area will have a higher priority than default. Otherwise if SWAP_FLAG_PREFER bit is not turned on, ecx has no meaning.

The priority is encoded within ecx as: (priority shl SWAP_FLAG_PRIO_SHIFT) and SWAP_FLAG_PRIO_MASK

Each swap area has a priority, either high or low. The default priority is low. Within the low-priority areas, newer areas are even lower priority than older areas.

All priorities set with ecx are high-priority, higher than default. They may have any non-negative value chosen by the caller. Higher numbers mean higher priority.

Swap pages are allocated from areas in priority order, highest priority first. For areas with different priorities, a higher-priority area is exhausted before using a lower-priority area. If two or more areas have the same priority, and it is the highest priority available, pages are allocated on a round-robin basis between them.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EINVAL The file pointed by ebx exists, but refers neither to a regular file nor to a block device.
-or-
The indicated path does not contain a valid swap signature.
-ENFILE The system limit on the total number of open files has been reached.
-ENOENT The file pointed by ebx does not exist.
-ENOMEM The system has insufficient memory to start swapping.
-EPERM The caller does not have the CAP_SYS_ADMIN capability, or all MAX_SWAPFILES are in use.
-EBUSY The file pointed by ebx is already being used as a swap area.

Remarks

n/a

Compatibility

n/a