2020-04-08 15:13:49 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-08 15:13:49 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
|
|
|
|
#include <Kernel/Process.h>
|
2021-06-22 17:40:16 +02:00
|
|
|
#include <Kernel/Sections.h>
|
2020-04-08 15:13:49 +02:00
|
|
|
#include <Kernel/Tasks/SyncTask.h>
|
|
|
|
|
#include <Kernel/Time/TimeManagement.h>
|
|
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
|
2021-06-09 00:52:56 -07:00
|
|
|
UNMAP_AFTER_INIT void SyncTask::spawn()
|
2020-04-08 15:13:49 +02:00
|
|
|
{
|
2022-08-19 20:53:40 +02:00
|
|
|
LockRefPtr<Thread> syncd_thread;
|
2022-07-11 17:32:29 +00:00
|
|
|
(void)Process::create_kernel_process(syncd_thread, KString::must_create("VFS Sync Task"sv), [] {
|
2022-06-04 21:44:48 -07:00
|
|
|
dbgln("VFS SyncTask is running");
|
2020-04-08 15:13:49 +02:00
|
|
|
for (;;) {
|
2021-07-11 00:26:17 +02:00
|
|
|
VirtualFileSystem::sync();
|
2021-02-27 23:56:16 +01:00
|
|
|
(void)Thread::current()->sleep(Time::from_seconds(1));
|
2020-04-08 15:13:49 +02:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|