mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 00:38:48 +00:00
Kernel: Have the open() syscall take an explicit path length parameter.
Instead of computing the path length inside the syscall handler, let the caller do that work. This allows us to implement to new variants of open() and creat(), called open_with_path_length() and creat_with_path_length(). These are suitable for use with e.g StringView.
This commit is contained in:
parent
fc4022d173
commit
c110cf193d
Notes:
sideshowbarker
2024-07-19 13:21:47 +09:00
Author: https://github.com/awesomekling
Commit: c110cf193d
9 changed files with 40 additions and 9 deletions
|
@ -1127,12 +1127,18 @@ int Process::number_of_open_file_descriptors() const
|
|||
return count;
|
||||
}
|
||||
|
||||
int Process::sys$open(const char* path, int options, mode_t mode)
|
||||
int Process::sys$open(const Syscall::SC_open_params* params)
|
||||
{
|
||||
if (!validate_read_typed(params))
|
||||
return -EFAULT;
|
||||
auto* path = params->path;
|
||||
auto path_length = params->path_length;
|
||||
auto options = params->options;
|
||||
auto mode = params->mode;
|
||||
#ifdef DEBUG_IO
|
||||
dbgprintf("%s(%u) sys$open(\"%s\")\n", name().characters(), pid(), path);
|
||||
#endif
|
||||
if (!validate_read_str(path))
|
||||
if (!validate_read(path, path_length))
|
||||
return -EFAULT;
|
||||
int fd = alloc_fd();
|
||||
if (fd < 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue