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