Starting system memory dump operation by using the ioctl subroutine

You can start a system memory dump operation by using the input/output control (ioctl) subroutine.

Note: You must have root user authority to start a system memory dump by using the sysdumpstart command.

Before you use the ioctl subroutine calls, you must configure the device that stores the memory dump by using the sysdumpdev command. For secondary devices, you cannot use firmware-assisted system memory dump operations. For more information, see the sysdumpstart command.

The following example illustrates how to start a system memory dump operation by using the ioctl subroutine on a primary device:

#include <sys/dump.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
int main() {
        int fd;
        if((fd = open("/dev/sysdump",0)) < 0) {
                printf(" Opening the dump device failed \n");
                return -1;
        }
        int rt = ioctl(fd, DUMP_PRIMARY,DMP_SELECTIVE_MEM);
        if(rt == -1) {
                printf(" IOCTL failed with return value %d \n", errno);
        }
        return 0;
}