fork() stub and QoL improvements

This commit is contained in:
Alex
2023-05-03 06:37:39 +03:00
parent 6e6d22403c
commit 61aea6aa8d
25 changed files with 426 additions and 185 deletions

View File

@ -24,6 +24,20 @@
namespace InterProcessCommunication
{
void IPC::Fork(IPC *Parent)
{
std::vector<IPCHandle *> ParentHandles = Parent->GetHandles();
foreach (auto Hnd in ParentHandles)
{
debug("Forking IPC with ID %d", Hnd->ID);
IPCHandle *NewHnd = (IPCHandle *)mem->RequestPages(TO_PAGES(sizeof(IPCHandle) + 1));
memcpy(NewHnd, Hnd, sizeof(IPCHandle));
NewHnd->Node = vfs->Create(Hnd->Node->Name, VirtualFileSystem::NodeFlags::FILE, IPCNode);
Handles.push_back(NewHnd);
}
}
IPCHandle *IPC::Create(IPCType Type, char UniqueToken[16])
{
SmartLock(this->IPCLock);