The syncd loop can just be a lambda.

This commit is contained in:
Andreas Kling 2018-12-24 23:10:48 +01:00
parent 503e32552c
commit 033a42b580
Notes: sideshowbarker 2024-07-19 16:07:25 +09:00
5 changed files with 10 additions and 18 deletions

View file

@ -544,7 +544,7 @@ int Process::sys$get_arguments(int* argc, char*** argv)
return 0;
}
Process* Process::create_kernel_process(void (*e)(), String&& name)
Process* Process::create_kernel_process(String&& name, void (*e)())
{
auto* process = new Process(move(name), (uid_t)0, (gid_t)0, (pid_t)0, Ring0);
process->m_tss.eip = (dword)e;

View file

@ -35,7 +35,7 @@ struct SignalActionData {
class Process : public InlineLinkedListNode<Process> {
friend class InlineLinkedListNode<Process>;
public:
static Process* create_kernel_process(void (*entry)(), String&& name);
static Process* create_kernel_process(String&& name, void (*entry)());
static Process* create_user_process(const String& path, uid_t, gid_t, pid_t ppid, int& error, Vector<String>&& arguments = Vector<String>(), Vector<String>&& environment = Vector<String>(), TTY* = nullptr);
~Process();

View file

@ -269,7 +269,7 @@ void Scheduler::initialize()
memset(&s_redirection, 0, sizeof(s_redirection));
s_redirection.selector = gdt_alloc_entry();
initialize_redirection();
s_colonel_process = Process::create_kernel_process(nullptr, "colonel");
s_colonel_process = Process::create_kernel_process("colonel", nullptr);
current = nullptr;
load_task_register(s_redirection.selector);
}

View file

@ -16,7 +16,6 @@
#include <VirtualFileSystem/Ext2FileSystem.h>
#include <VirtualFileSystem/VirtualFileSystem.h>
#include "MemoryManager.h"
#include "ProcFileSystem.h"
#include "RTC.h"
#include "VirtualConsole.h"
@ -53,15 +52,6 @@ static void spawn_stress()
}
#endif
static void syncd() NORETURN;
static void syncd()
{
for (;;) {
Syscall::sync();
sleep(10 * TICKS_PER_SECOND);
}
}
static void init_stage2() NORETURN;
static void init_stage2()
{
@ -166,9 +156,13 @@ void init()
procfs->initialize();
Process::initialize();
Process::create_kernel_process(init_stage2, "init_stage2");
Process::create_kernel_process(syncd, "syncd");
Process::create_kernel_process("init_stage2", init_stage2);
Process::create_kernel_process("syncd", [] {
for (;;) {
Syscall::sync();
sleep(10 * TICKS_PER_SECOND);
}
});
Scheduler::pick_next();

View file

@ -1,8 +1,6 @@
#pragma once
#include "types.h"
#include <AK/Vector.h>
#include <AK/AKString.h>
struct system_t
{