mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-27 15:04:33 +00:00
Add process cwd
This commit is contained in:
parent
dd232a3721
commit
7d939c001b
@ -212,6 +212,7 @@ namespace Execute
|
||||
/* ------------------------------------------------------------------------------------------------------------------------------ */
|
||||
|
||||
PCB *Process = TaskManager->CreateProcess(TaskManager->GetCurrentProcess(), BaseName, TaskTrustLevel::User, ElfFile);
|
||||
Process->SetWorkingDirectory(vfs->GetNodeFromPath(Path)->Parent);
|
||||
Memory::Virtual pV = Memory::Virtual(Process->PageTable);
|
||||
for (size_t i = 0; i < TO_PAGES(ExFileSize); i++)
|
||||
pV.Remap((void *)((uintptr_t)ElfFile + (i * PAGE_SIZE)), (void *)((uintptr_t)ElfFile + (i * PAGE_SIZE)), Memory::PTFlag::RW | Memory::PTFlag::US);
|
||||
|
@ -250,7 +250,7 @@ static int sys_ipc(SyscallsFrame *Frame, enum IPCCommand Command, enum IPCType T
|
||||
static uint64_t sys_file_open(SyscallsFrame *Frame, const char *Path, uint64_t Flags)
|
||||
{
|
||||
debug("(Path: %s, Flags: %#lx)", Path, Flags);
|
||||
VirtualFileSystem::File KPObj = vfs->Open(Path);
|
||||
VirtualFileSystem::File KPObj = vfs->Open(Path, TaskManager->GetCurrentProcess()->CurrentWorkingDirectory);
|
||||
if (!KPObj.IsOK())
|
||||
{
|
||||
debug("Failed to open file %s (%d)", Path, KPObj.Status);
|
||||
@ -307,13 +307,13 @@ static uint64_t sys_file_seek(SyscallsFrame *Frame, void *KernelPrivate, uint64_
|
||||
if (KernelPrivate == nullptr)
|
||||
return 0;
|
||||
|
||||
debug("(KernelPrivate: %#lx, Offset: %#lx, Whence: %#lx)", KernelPrivate, Offset, Whence);
|
||||
debug("(KernelPrivate: %#lx, Offset: %#lx, Whence: %d)", KernelPrivate, Offset, Whence);
|
||||
VirtualFileSystem::File *KPObj = (VirtualFileSystem::File *)KernelPrivate;
|
||||
|
||||
if (KPObj->node->Operator->Seek == nullptr)
|
||||
return SYSCALL_INTERNAL_ERROR;
|
||||
|
||||
return KPObj->node->Operator->Seek(KPObj->node, Offset, Whence);
|
||||
return KPObj->node->Operator->Seek(KPObj->node, Offset, (uint8_t)Whence);
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
|
@ -190,8 +190,16 @@ namespace Tasking
|
||||
InterProcessCommunication::IPC *IPC;
|
||||
Memory::PageTable *PageTable;
|
||||
SymbolResolver::Symbols *ELFSymbolTable;
|
||||
VirtualFileSystem::Node *CurrentWorkingDirectory;
|
||||
VirtualFileSystem::Node *ProcessDirectory;
|
||||
VirtualFileSystem::Node *memDirectory;
|
||||
|
||||
void SetWorkingDirectory(VirtualFileSystem::Node *node)
|
||||
{
|
||||
CriticalSection cs;
|
||||
trace("Setting working directory of process %s to %#lx (%s)", Name, node, node->Name);
|
||||
CurrentWorkingDirectory = node;
|
||||
}
|
||||
};
|
||||
|
||||
/** @brief Token Trust Level */
|
||||
|
Loading…
x
Reference in New Issue
Block a user