[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

swapon Subroutine


Activates paging or swapping to a designated block device.


Standard C Library (libc.a)


#include <sys/vminfo.h>

int swapon ( PathName)
char *PathName;


The swapon subroutine makes the designated block device available to the system for allocation for paging and swapping.

The specified block device must be a logical volume on a disk device. The paging space size is determined from the current size of the logical volume.


PathName Specifies the full path name of the block device.

Error Codes

If an error occurs, the errno global variable is set to indicate the error:

EINTR Signal was received during processing of a request.
EINVAL Invalid argument (size of device is invalid).
ENOENT The PathName file does not exist.
ENOMEM The maximum number of paging space devices (16) are already defined, or no memory is available.
ENOTBLK Block device required.
ENOTDIR A component of the PathName prefix is not a directory.
ENXIO No such device address.

Other errors are from calls to the device driver's open subroutine or ioctl subroutine.

Related Information

The swapoff subroutine,swapqry subroutine.

The swapoff command, swapon command.

The Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]