mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:27:34 +00:00
Add a "pwd" utility to userland.
It's implemented as a separate process. How cute is that. Tasks now have a current working directory. Spawned tasks inherit their parent task's working directory. Currently everyone just uses "/" as there's no way to chdir().
This commit is contained in:
parent
eb4074bb9d
commit
ec1d16b307
17 changed files with 87 additions and 14 deletions
|
@ -142,6 +142,9 @@ ssize_t FileHandle::get_dir_entries(byte* buffer, size_t size)
|
|||
return true;
|
||||
});
|
||||
|
||||
if (size < stream.offset())
|
||||
return -1;
|
||||
|
||||
memcpy(buffer, tempBuffer.pointer(), stream.offset());
|
||||
return stream.offset();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ public:
|
|||
|
||||
ByteBuffer readEntireFile();
|
||||
|
||||
String absolutePath() const;
|
||||
|
||||
#ifdef SERENITY
|
||||
int fd() const { return m_fd; }
|
||||
void setFD(int fd) { m_fd = fd; }
|
||||
|
|
|
@ -28,6 +28,11 @@ public:
|
|||
return m_fileSystemID == other.m_fileSystemID && m_index == other.m_index;
|
||||
}
|
||||
|
||||
bool operator!=(const InodeIdentifier& other) const
|
||||
{
|
||||
return m_fileSystemID != other.m_fileSystemID || m_index != other.m_index;
|
||||
}
|
||||
|
||||
InodeMetadata metadata() const;
|
||||
bool isRootInode() const;
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ private:
|
|||
friend class FileHandle;
|
||||
|
||||
void enumerateDirectoryInode(InodeIdentifier, Function<bool(const FileSystem::DirectoryEntry&)>);
|
||||
String absolutePath(InodeIdentifier);
|
||||
InodeIdentifier resolvePath(const String& path);
|
||||
InodeIdentifier resolveSymbolicLink(const String& basePath, InodeIdentifier symlinkInode);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue