mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 04:58:15 +00:00
Kernel: Don't hog file descriptor table lock in sys$listen()
We don't need to hold the lock across the entire syscall. Once we've fetched the open file description we're interested in, we can let go.
This commit is contained in:
parent
bc4282c773
commit
85ceab1fec
1 changed files with 9 additions and 11 deletions
|
@ -67,8 +67,7 @@ ErrorOr<FlatPtr> Process::sys$listen(int sockfd, int backlog)
|
||||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
||||||
if (backlog < 0)
|
if (backlog < 0)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
return m_fds.with_exclusive([&](auto& fds) -> ErrorOr<FlatPtr> {
|
auto description = TRY(open_file_description(sockfd));
|
||||||
auto description = TRY(fds.open_file_description(sockfd));
|
|
||||||
if (!description->is_socket())
|
if (!description->is_socket())
|
||||||
return ENOTSOCK;
|
return ENOTSOCK;
|
||||||
auto& socket = *description->socket();
|
auto& socket = *description->socket();
|
||||||
|
@ -77,7 +76,6 @@ ErrorOr<FlatPtr> Process::sys$listen(int sockfd, int backlog)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
TRY(socket.listen(backlog));
|
TRY(socket.listen(backlog));
|
||||||
return 0;
|
return 0;
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<FlatPtr> Process::sys$accept4(Userspace<Syscall::SC_accept4_params const*> user_params)
|
ErrorOr<FlatPtr> Process::sys$accept4(Userspace<Syscall::SC_accept4_params const*> user_params)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue