mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 19:25:07 +00:00
Kernel: And some more KResult/KResultOr<T> porting work.
This commit is contained in:
parent
028afabf6b
commit
e56fe71dbc
7 changed files with 56 additions and 51 deletions
|
@ -1391,18 +1391,19 @@ int Process::sys$getcwd(char* buffer, ssize_t size)
|
|||
return -EINVAL;
|
||||
if (!validate_write(buffer, size))
|
||||
return -EFAULT;
|
||||
auto path = VFS::the().absolute_path(cwd_inode());
|
||||
if (path.is_null())
|
||||
return -EINVAL;
|
||||
auto path_or_error = VFS::the().absolute_path(cwd_inode());
|
||||
if (path_or_error.is_error())
|
||||
return path_or_error.error();
|
||||
auto path = path_or_error.value();
|
||||
if (size < path.length() + 1)
|
||||
return -ERANGE;
|
||||
strcpy(buffer, path.characters());
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t Process::number_of_open_file_descriptors() const
|
||||
int Process::number_of_open_file_descriptors() const
|
||||
{
|
||||
size_t count = 0;
|
||||
int count = 0;
|
||||
for (auto& descriptor : m_fds) {
|
||||
if (descriptor)
|
||||
++count;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue