mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 13:43:45 +03:00
3fd4997fc2
Instead, use the FixedCharBuffer class to ensure we always use a static buffer storage for these names. This ensures that if a Process or a Thread were created, there's a guarantee that setting a new name will never fail, as only copying of strings should be done to that static storage. The limits which are set are 32 characters for processes' names and 64 characters for thread names - this is because threads' names could be more verbose than processes' names.
29 lines
721 B
C++
29 lines
721 B
C++
/*
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
|
#include <Kernel/Sections.h>
|
|
#include <Kernel/Tasks/Process.h>
|
|
#include <Kernel/Tasks/SyncTask.h>
|
|
#include <Kernel/Time/TimeManagement.h>
|
|
|
|
namespace Kernel {
|
|
|
|
UNMAP_AFTER_INIT void SyncTask::spawn()
|
|
{
|
|
MUST(Process::create_kernel_process("VFS Sync Task"sv, [] {
|
|
dbgln("VFS SyncTask is running");
|
|
while (!Process::current().is_dying()) {
|
|
VirtualFileSystem::sync();
|
|
(void)Thread::current()->sleep(Duration::from_seconds(1));
|
|
}
|
|
Process::current().sys$exit(0);
|
|
VERIFY_NOT_REACHED();
|
|
}));
|
|
}
|
|
|
|
}
|