mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 14:25:08 +00:00
Kernel: Implement fchdir syscall
The fchdir() function is equivalent to chdir() except that the directory that is to be the new current working directory is specified by a file descriptor.
This commit is contained in:
parent
26e81ad574
commit
7d85fc00e4
6 changed files with 24 additions and 0 deletions
|
@ -1202,6 +1202,19 @@ int Process::sys$chdir(const char* path)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$fchdir(int fd)
|
||||
{
|
||||
auto* description = file_description(fd);
|
||||
if (!description)
|
||||
return -EBADF;
|
||||
|
||||
if (!description->is_directory())
|
||||
return -ENOTDIR;
|
||||
|
||||
m_cwd = description->custody();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$getcwd(char* buffer, ssize_t size)
|
||||
{
|
||||
if (size < 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue