Kernel/Tasks: Allow Kernel processes to be shut down

Since we never check a kernel process's state like a userland process,
it's possible for a kernel process to ignore the fact that someone is
trying to kill it, and continue running. This is not desireable if we
want to properly shutdown all processes, including Kernel ones.
This commit is contained in:
kleines Filmröllchen 2023-06-27 15:19:39 +02:00 committed by Jelle Raaijmakers
commit 021fb3ea05
Notes: sideshowbarker 2024-07-17 02:42:21 +09:00
7 changed files with 22 additions and 9 deletions

View file

@ -96,7 +96,7 @@ void NetworkTask_main(void*)
auto buffer = (u8*)buffer_region->vaddr().get();
UnixDateTime packet_timestamp;
for (;;) {
while (!Process::current().is_dying()) {
flush_delayed_tcp_acks();
retransmit_tcp_packets();
size_t packet_size = dequeue_packet(buffer, buffer_size, packet_timestamp);
@ -127,6 +127,8 @@ void NetworkTask_main(void*)
dbgln_if(ETHERNET_DEBUG, "NetworkTask: Unknown ethernet type {:#04x}", eth.ether_type());
}
}
Process::current().sys$exit(0);
VERIFY_NOT_REACHED();
}
void handle_arp(EthernetFrameHeader const& eth, size_t frame_size)