cppthread 1.1.16
C++ Thread Library
Functions
deswappify.cpp File Reference

Implementation of the deswappify function. More...

#include "cppthread/thread.h"
#include <snapdev/glob_to_list.h>
#include <snapdev/hexadecimal_string.h>
#include <fstream>
#include <sstream>
#include <snapdev/poison.h>
Include dependency graph for deswappify.cpp:

Go to the source code of this file.

Functions

int cppthread::deswappify (pid_t pid)
 Go through the swapped out sections of a process and deswappify them.
 

Detailed Description

It is possible to ask the kernel to reload part of the swapped out processes. This is done by loading that section of memory (with a simple read() call).

This is based on a perl script found on github:

https://gist.github.com/WGH-/91260f6d65db88be2c847053c49be5ae

Definition in file deswappify.cpp.

Function Documentation

◆ deswappify()

int cppthread::deswappify ( pid_t  pid)

This function reads the memory map of a process and searches for sections of memory that were swapped out and read them back in memory.

Todo:
Implement necessary check to make sure the data can be swapped back in without causing immediate issues.
Todo:
Actually write a function that reads all the blocks and save them in a list with a grand total for the size. Then we can make the decision of swapping that process back in or not.
Parameters
[in]pidThe process identifier.
Returns
0 if no error occurred, an errno otherwise

Definition at line 83 of file deswappify.cpp.

References cppthread::deswappify(), and cppthread::end().

Referenced by cppthread::deswappify().

Here is the call graph for this function:
Here is the caller graph for this function:

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.