diff options
author | Andreas Kling <kling@serenityos.org> | 2020-04-09 13:31:05 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-09 13:31:05 +0200 |
commit | f25d2f5518f3249787bef789fec86d3e333454a6 (patch) | |
tree | 09acd94ff74b44243118fc6a79788029d90144ca /Kernel | |
parent | 520c4254c9408507a70735a592c66a8de33cb1f0 (diff) | |
download | serenity-f25d2f5518f3249787bef789fec86d3e333454a6.zip |
Kernel: Move NetworkTask startup into NetworkTask::spawn()
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Net/NetworkTask.cpp | 9 | ||||
-rw-r--r-- | Kernel/Net/NetworkTask.h | 7 | ||||
-rw-r--r-- | Kernel/init.cpp | 6 |
3 files changed, 15 insertions, 7 deletions
diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index 62108e7b68..6db201365b 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -32,6 +32,7 @@ #include <Kernel/Net/IPv4.h> #include <Kernel/Net/IPv4Socket.h> #include <Kernel/Net/LoopbackAdapter.h> +#include <Kernel/Net/NetworkTask.h> #include <Kernel/Net/Routing.h> #include <Kernel/Net/TCP.h> #include <Kernel/Net/TCPSocket.h> @@ -56,6 +57,14 @@ static void handle_icmp(const EthernetFrameHeader&, const IPv4Packet&); static void handle_udp(const IPv4Packet&); static void handle_tcp(const IPv4Packet&); +[[noreturn]] static void NetworkTask_main(); + +void NetworkTask::spawn() +{ + Thread* thread = nullptr; + Process::create_kernel_process(thread, "NetworkTask", NetworkTask_main); +} + void NetworkTask_main() { WaitQueue packet_wait_queue; diff --git a/Kernel/Net/NetworkTask.h b/Kernel/Net/NetworkTask.h index c126fae314..9ed727afe8 100644 --- a/Kernel/Net/NetworkTask.h +++ b/Kernel/Net/NetworkTask.h @@ -27,7 +27,8 @@ #pragma once namespace Kernel { - -void NetworkTask_main(); - +class NetworkTask { +public: + static void spawn(); +}; } diff --git a/Kernel/init.cpp b/Kernel/init.cpp index cb2fd15248..e29f2f3aa5 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -318,10 +318,8 @@ void init_stage2() } thread->set_priority(THREAD_PRIORITY_HIGH); } - { - Thread* thread = nullptr; - Process::create_kernel_process(thread, "NetworkTask", NetworkTask_main); - } + + NetworkTask::spawn(); Process::current->sys$exit(0); ASSERT_NOT_REACHED(); |