1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

Add basic symlink support.

- sys$readlink + readlink()
- Add a /proc/PID/exe symlink to the process's executable.
- Print symlink contents in ls output.
- Some work on plumbing options into VFS::open().
This commit is contained in:
Andreas Kling 2018-10-28 14:11:51 +01:00
parent 1d4af51250
commit 97726862dd
20 changed files with 140 additions and 46 deletions

View file

@ -20,10 +20,9 @@ pid_t getpid()
return Syscall::invoke(Syscall::PosixGetpid);
}
int open(const char* path)
int open(const char* path, int options)
{
size_t length = strlen(path);
int rc = Syscall::invoke(Syscall::PosixOpen, (dword)path, (dword)length);
int rc = Syscall::invoke(Syscall::PosixOpen, (dword)path, (dword)options);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
@ -74,5 +73,11 @@ int gethostname(char* buffer, size_t size)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
ssize_t readlink(const char* path, char* buffer, size_t size)
{
int rc = Syscall::invoke(Syscall::PosixReadlink, (dword)path, (dword)buffer, (dword)size);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
}