mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 23:39:02 +00:00
Allow processes to go into a BeingInspected state (used by procfs.)
This ensures that the process won't get scheduled, and so inspecting it is safe and easy without blocking interrupts.
This commit is contained in:
parent
dfaa2b6b02
commit
52607aa086
Notes:
sideshowbarker
2024-07-19 18:34:47 +09:00
Author: https://github.com/awesomekling
Commit: 52607aa086
3 changed files with 37 additions and 19 deletions
|
@ -27,8 +27,9 @@ ProcFileSystem::~ProcFileSystem()
|
|||
{
|
||||
}
|
||||
|
||||
ByteBuffer procfs$pid_fds(const Process& process)
|
||||
ByteBuffer procfs$pid_fds(Process& process)
|
||||
{
|
||||
ProcessInspectionScope scope(process);
|
||||
char* buffer;
|
||||
auto stringImpl = StringImpl::createUninitialized(process.number_of_open_file_descriptors() * 80, buffer);
|
||||
memset(buffer, 0, stringImpl->length());
|
||||
|
@ -43,9 +44,9 @@ ByteBuffer procfs$pid_fds(const Process& process)
|
|||
return ByteBuffer::copy((byte*)buffer, ptr - buffer);
|
||||
}
|
||||
|
||||
ByteBuffer procfs$pid_vm(const Process& process)
|
||||
ByteBuffer procfs$pid_vm(Process& process)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
ProcessInspectionScope scope(process);
|
||||
char* buffer;
|
||||
auto stringImpl = StringImpl::createUninitialized(80 + process.regionCount() * 80 + 80 + process.subregionCount() * 80, buffer);
|
||||
memset(buffer, 0, stringImpl->length());
|
||||
|
@ -76,7 +77,7 @@ ByteBuffer procfs$pid_vm(const Process& process)
|
|||
|
||||
ByteBuffer procfs$pid_stack(Process& process)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
ProcessInspectionScope scope(process);
|
||||
OtherProcessPagingScope pagingScope(process);
|
||||
struct RecognizedSymbol {
|
||||
dword address;
|
||||
|
@ -108,11 +109,8 @@ ByteBuffer procfs$pid_stack(Process& process)
|
|||
|
||||
ByteBuffer procfs$pid_exe(Process& process)
|
||||
{
|
||||
InodeIdentifier inode;
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
inode = process.executableInode();
|
||||
}
|
||||
ProcessInspectionScope scope(process);
|
||||
auto inode = process.executableInode();
|
||||
return VirtualFileSystem::the().absolutePath(inode).toByteBuffer();
|
||||
}
|
||||
|
||||
|
@ -201,6 +199,7 @@ static const char* toString(Process::State state)
|
|||
case Process::BlockedSleep: return "Sleep";
|
||||
case Process::BlockedWait: return "Wait";
|
||||
case Process::BlockedRead: return "Read";
|
||||
case Process::BeingInspected: return "Inspect";
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
return nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue