mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Misc tweaks
This commit is contained in:
parent
9bc6157998
commit
d5426fcc88
Notes:
sideshowbarker
2024-07-19 09:56:23 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/d5426fcc888 Pull-request: https://github.com/SerenityOS/serenity/pull/1100
1 changed files with 4 additions and 9 deletions
|
@ -1722,8 +1722,6 @@ int Process::sys$access(const char* user_path, size_t path_length, int mode)
|
|||
int Process::sys$fcntl(int fd, int cmd, u32 arg)
|
||||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
(void)cmd;
|
||||
(void)arg;
|
||||
#ifdef DEBUG_IO
|
||||
dbgprintf("sys$fcntl: fd=%d, cmd=%d, arg=%u\n", fd, cmd, arg);
|
||||
#endif
|
||||
|
@ -1981,14 +1979,11 @@ int Process::sys$open(const Syscall::SC_open_params* user_params)
|
|||
|
||||
int Process::alloc_fd(int first_candidate_fd)
|
||||
{
|
||||
int fd = -EMFILE;
|
||||
for (int i = first_candidate_fd; i < (int)m_max_open_file_descriptors; ++i) {
|
||||
if (!m_fds[i]) {
|
||||
fd = i;
|
||||
break;
|
||||
}
|
||||
if (!m_fds[i])
|
||||
return i;
|
||||
}
|
||||
return fd;
|
||||
return -EMFILE;
|
||||
}
|
||||
|
||||
int Process::sys$pipe(int pipefd[2], int flags)
|
||||
|
@ -2497,7 +2492,7 @@ int Process::sys$dup(int old_fd)
|
|||
auto description = file_description(old_fd);
|
||||
if (!description)
|
||||
return -EBADF;
|
||||
int new_fd = alloc_fd(0);
|
||||
int new_fd = alloc_fd();
|
||||
if (new_fd < 0)
|
||||
return new_fd;
|
||||
m_fds[new_fd].set(*description);
|
||||
|
|
Loading…
Reference in a new issue