1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +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:
Andreas Kling 2018-10-24 14:28:22 +02:00
parent eb4074bb9d
commit ec1d16b307
17 changed files with 87 additions and 14 deletions

View file

@ -16,8 +16,8 @@ class Zone;
class Task : public InlineLinkedListNode<Task> {
friend class InlineLinkedListNode<Task>;
public:
static Task* create(const String& path, uid_t, gid_t);
Task(String&& name, uid_t, gid_t);
static Task* create(const String& path, uid_t, gid_t, pid_t parentPID);
Task(String&& name, uid_t, gid_t, pid_t parentPID);
static Vector<Task*> allTasks();
@ -103,6 +103,7 @@ public:
void* sys$mmap(void*, size_t size);
int sys$munmap(void*, size_t size);
int sys$get_dir_entries(int fd, void*, size_t);
int sys$getcwd(char*, size_t);
struct
{
@ -157,6 +158,8 @@ private:
dword m_timesScheduled { 0 };
pid_t m_waitee { -1 };
String m_cwd;
struct Region {
Region(LinearAddress, size_t, RetainPtr<Zone>&&, String&&);
~Region();
@ -174,6 +177,8 @@ private:
// FIXME: Implement some kind of ASLR?
LinearAddress m_nextRegion;
pid_t m_parentPID { 0 };
};
extern void task_init();