mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:58:12 +00:00
Kernel: Don't hog file descriptor table lock in sys$bind()
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
85ceab1fec
commit
e103c5fe2d
1 changed files with 7 additions and 9 deletions
|
@ -51,15 +51,13 @@ ErrorOr<FlatPtr> Process::sys$socket(int domain, int type, int protocol)
|
|||
ErrorOr<FlatPtr> Process::sys$bind(int sockfd, Userspace<sockaddr const*> address, socklen_t address_length)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
||||
return m_fds.with_exclusive([&](auto& fds) -> ErrorOr<FlatPtr> {
|
||||
auto description = TRY(fds.open_file_description(sockfd));
|
||||
if (!description->is_socket())
|
||||
return ENOTSOCK;
|
||||
auto& socket = *description->socket();
|
||||
REQUIRE_PROMISE_FOR_SOCKET_DOMAIN(socket.domain());
|
||||
TRY(socket.bind(address, address_length));
|
||||
return 0;
|
||||
});
|
||||
auto description = TRY(open_file_description(sockfd));
|
||||
if (!description->is_socket())
|
||||
return ENOTSOCK;
|
||||
auto& socket = *description->socket();
|
||||
REQUIRE_PROMISE_FOR_SOCKET_DOMAIN(socket.domain());
|
||||
TRY(socket.bind(address, address_length));
|
||||
return 0;
|
||||
}
|
||||
|
||||
ErrorOr<FlatPtr> Process::sys$listen(int sockfd, int backlog)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue