2020-04-08 10:13:49 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-08 10:13:49 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
2021-06-22 12:40:16 -03:00
|
|
|
#include <Kernel/Sections.h>
|
2023-02-24 14:45:37 -03:00
|
|
|
#include <Kernel/Tasks/Process.h>
|
2020-04-08 10:13:49 -03:00
|
|
|
#include <Kernel/Tasks/SyncTask.h>
|
|
|
|
|
#include <Kernel/Time/TimeManagement.h>
|
|
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
|
2021-06-09 04:52:56 -03:00
|
|
|
UNMAP_AFTER_INIT void SyncTask::spawn()
|
2020-04-08 10:13:49 -03:00
|
|
|
{
|
2023-07-17 12:34:19 -03:00
|
|
|
MUST(Process::create_kernel_process("VFS Sync Task"sv, [] {
|
2022-06-05 01:44:48 -03:00
|
|
|
dbgln("VFS SyncTask is running");
|
2023-06-27 10:19:39 -03:00
|
|
|
while (!Process::current().is_dying()) {
|
2021-07-10 19:26:17 -03:00
|
|
|
VirtualFileSystem::sync();
|
2023-03-13 12:30:34 -03:00
|
|
|
(void)Thread::current()->sleep(Duration::from_seconds(1));
|
2020-04-08 10:13:49 -03:00
|
|
|
}
|
2023-06-27 10:19:39 -03:00
|
|
|
Process::current().sys$exit(0);
|
|
|
|
|
VERIFY_NOT_REACHED();
|
2023-04-02 14:25:36 -03:00
|
|
|
}));
|
2020-04-08 10:13:49 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|