mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:57:36 +00:00
The syncd loop can just be a lambda.
This commit is contained in:
parent
503e32552c
commit
033a42b580
5 changed files with 10 additions and 18 deletions
|
@ -544,7 +544,7 @@ int Process::sys$get_arguments(int* argc, char*** argv)
|
||||||
return 0;
|
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);
|
auto* process = new Process(move(name), (uid_t)0, (gid_t)0, (pid_t)0, Ring0);
|
||||||
process->m_tss.eip = (dword)e;
|
process->m_tss.eip = (dword)e;
|
||||||
|
|
|
@ -35,7 +35,7 @@ struct SignalActionData {
|
||||||
class Process : public InlineLinkedListNode<Process> {
|
class Process : public InlineLinkedListNode<Process> {
|
||||||
friend class InlineLinkedListNode<Process>;
|
friend class InlineLinkedListNode<Process>;
|
||||||
public:
|
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);
|
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();
|
~Process();
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ void Scheduler::initialize()
|
||||||
memset(&s_redirection, 0, sizeof(s_redirection));
|
memset(&s_redirection, 0, sizeof(s_redirection));
|
||||||
s_redirection.selector = gdt_alloc_entry();
|
s_redirection.selector = gdt_alloc_entry();
|
||||||
initialize_redirection();
|
initialize_redirection();
|
||||||
s_colonel_process = Process::create_kernel_process(nullptr, "colonel");
|
s_colonel_process = Process::create_kernel_process("colonel", nullptr);
|
||||||
current = nullptr;
|
current = nullptr;
|
||||||
load_task_register(s_redirection.selector);
|
load_task_register(s_redirection.selector);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <VirtualFileSystem/Ext2FileSystem.h>
|
#include <VirtualFileSystem/Ext2FileSystem.h>
|
||||||
#include <VirtualFileSystem/VirtualFileSystem.h>
|
#include <VirtualFileSystem/VirtualFileSystem.h>
|
||||||
#include "MemoryManager.h"
|
#include "MemoryManager.h"
|
||||||
|
|
||||||
#include "ProcFileSystem.h"
|
#include "ProcFileSystem.h"
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
#include "VirtualConsole.h"
|
#include "VirtualConsole.h"
|
||||||
|
@ -53,15 +52,6 @@ static void spawn_stress()
|
||||||
}
|
}
|
||||||
#endif
|
#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() NORETURN;
|
||||||
static void init_stage2()
|
static void init_stage2()
|
||||||
{
|
{
|
||||||
|
@ -166,9 +156,13 @@ void init()
|
||||||
procfs->initialize();
|
procfs->initialize();
|
||||||
|
|
||||||
Process::initialize();
|
Process::initialize();
|
||||||
Process::create_kernel_process(init_stage2, "init_stage2");
|
Process::create_kernel_process("init_stage2", init_stage2);
|
||||||
|
Process::create_kernel_process("syncd", [] {
|
||||||
Process::create_kernel_process(syncd, "syncd");
|
for (;;) {
|
||||||
|
Syscall::sync();
|
||||||
|
sleep(10 * TICKS_PER_SECOND);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Scheduler::pick_next();
|
Scheduler::pick_next();
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include <AK/Vector.h>
|
|
||||||
#include <AK/AKString.h>
|
|
||||||
|
|
||||||
struct system_t
|
struct system_t
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue