mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 19:35:06 +00:00
Lots of hacking to make a very simple "ls" utility.
I added a dead-simple malloc that only allows allocations < 4096 bytes. It just forwards the request to mmap() every time. I also added simplified versions of opendir() and readdir().
This commit is contained in:
parent
0c5bbac86e
commit
bca4b71bfa
19 changed files with 277 additions and 67 deletions
|
@ -230,6 +230,10 @@ Task::Task(String&& name, uid_t uid, gid_t gid)
|
|||
, m_state(Runnable)
|
||||
, m_ring(Ring3)
|
||||
{
|
||||
m_fileHandles.append(nullptr);
|
||||
m_fileHandles.append(nullptr);
|
||||
m_fileHandles.append(nullptr);
|
||||
|
||||
m_nextRegion = LinearAddress(0x600000);
|
||||
|
||||
memset(&m_tss, 0, sizeof(m_tss));
|
||||
|
@ -280,6 +284,10 @@ Task::Task(void (*e)(), const char* n, IPC::Handle h, RingLevel ring)
|
|||
, m_state(Runnable)
|
||||
, m_ring(ring)
|
||||
{
|
||||
m_fileHandles.append(nullptr);
|
||||
m_fileHandles.append(nullptr);
|
||||
m_fileHandles.append(nullptr);
|
||||
|
||||
m_nextRegion = LinearAddress(0x600000);
|
||||
|
||||
Region* codeRegion = nullptr;
|
||||
|
@ -643,6 +651,14 @@ FileHandle* Task::fileHandleIfExists(int fd)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ssize_t Task::sys$get_dir_entries(int fd, void* buffer, size_t size)
|
||||
{
|
||||
auto* handle = fileHandleIfExists(fd);
|
||||
if (!handle)
|
||||
return -1;
|
||||
return handle->get_dir_entries((byte*)buffer, size);
|
||||
}
|
||||
|
||||
int Task::sys$seek(int fd, int offset)
|
||||
{
|
||||
auto* handle = fileHandleIfExists(fd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue