Greatly improve /proc/PID/stack by tracing the ebp frame chain.

I also added a generator cache to FileHandle. This way, multiple
reads to a generated file (i.e in a synthfs) can transparently
handle multiple calls to read() without the contents changing
between calls.

The cache is discarded at EOF (or when the FileHandle is destroyed.)
This commit is contained in:
Andreas Kling 2018-10-27 00:14:24 +02:00
parent c928b06218
commit 2716a9e2d7
Notes: sideshowbarker 2024-07-19 18:37:57 +09:00
22 changed files with 210 additions and 116 deletions

View file

@ -268,7 +268,7 @@ Vector<unsigned> Ext2FileSystem::blockListForInode(const ext2_inode& e2inode) co
return list;
}
Unix::ssize_t Ext2FileSystem::readInodeBytes(InodeIdentifier inode, Unix::off_t offset, Unix::size_t count, byte* buffer) const
Unix::ssize_t Ext2FileSystem::readInodeBytes(InodeIdentifier inode, Unix::off_t offset, Unix::size_t count, byte* buffer, FileHandle*) const
{
ASSERT(offset >= 0);
ASSERT(inode.fileSystemID() == id());
@ -293,6 +293,7 @@ Unix::ssize_t Ext2FileSystem::readInodeBytes(InodeIdentifier inode, Unix::off_t
static const unsigned maxInlineSymlinkLength = 60;
if (isSymbolicLink(e2inode->i_mode) && e2inode->i_size < maxInlineSymlinkLength) {
Unix::ssize_t nread = min((Unix::off_t)e2inode->i_size - offset, static_cast<Unix::off_t>(count));
kprintf("nread = %d\n", nread);
memcpy(buffer, e2inode->i_block + offset, nread);
return nread;
}