2020-01-18 08:38:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 08:38:21 +00:00
|
|
|
*/
|
|
|
|
|
2020-08-05 18:48:28 +00:00
|
|
|
#include <LibCore/ArgsParser.h>
|
2020-01-02 12:37:02 +00:00
|
|
|
#include <serenity.h>
|
2019-12-29 12:16:53 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
2019-12-09 18:16:45 +00:00
|
|
|
{
|
2019-12-29 12:16:53 +00:00
|
|
|
int mode = 0;
|
2020-08-05 18:48:28 +00:00
|
|
|
|
|
|
|
bool purge_all_volatile = false;
|
|
|
|
bool purge_all_clean_inode = false;
|
|
|
|
|
|
|
|
Core::ArgsParser args_parser;
|
|
|
|
args_parser.add_option(purge_all_volatile, "Mode PURGE_ALL_VOLATILE", nullptr, 'v');
|
|
|
|
args_parser.add_option(purge_all_clean_inode, "Mode PURGE_ALL_CLEAN_INODE", nullptr, 'c');
|
|
|
|
args_parser.parse(argc, argv);
|
|
|
|
|
|
|
|
if (!purge_all_volatile && !purge_all_clean_inode)
|
|
|
|
purge_all_volatile = purge_all_clean_inode = true;
|
|
|
|
|
|
|
|
if (purge_all_volatile)
|
|
|
|
mode |= PURGE_ALL_VOLATILE;
|
|
|
|
if (purge_all_clean_inode)
|
|
|
|
mode |= PURGE_ALL_CLEAN_INODE;
|
|
|
|
|
2020-01-02 12:37:02 +00:00
|
|
|
int purged_page_count = purge(mode);
|
|
|
|
if (purged_page_count < 0) {
|
|
|
|
perror("purge");
|
|
|
|
return 1;
|
|
|
|
}
|
2019-12-09 18:16:45 +00:00
|
|
|
printf("Purged page count: %d\n", purged_page_count);
|
|
|
|
return 0;
|
|
|
|
}
|