Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel/Net: Implement SO_SNDBUF and SO_RCVBUF for getsockopt #25012

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

logkos
Copy link
Contributor

@logkos logkos commented Sep 11, 2024

These options are generally used for QoS tuning by Apache, NGINX, MySQL etc. (insert anything that scales here)

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Sep 11, 2024
Kernel/Net/LocalSocket.cpp Outdated Show resolved Hide resolved
Kernel/Net/LocalSocket.cpp Outdated Show resolved Hide resolved
if (size < sizeof(size_t))
return EINVAL;
buffer_size = m_for_server.ptr()->space_for_writing();
TRY(copy_to_user(static_ptr_cast<int*>(value), bit_cast<int*>(&buffer_size)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, the pointer cast is utterly wrong and the type is size_t. This bit_cast is wrong and will be UB on big-endian systems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what cast should be used here? pointer cast seems to be used on everywhere else

Kernel/Net/LocalSocket.cpp Show resolved Hide resolved
Kernel/Net/LocalSocket.cpp Outdated Show resolved Hide resolved
@logkos logkos force-pushed the socket branch 5 times, most recently from 3485f89 to 11384da Compare September 13, 2024 16:28
@BuggieBot
Copy link
Member

Hello!

One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

@logkos logkos force-pushed the socket branch 3 times, most recently from ff3107b to 84dabd3 Compare September 13, 2024 20:00
@logkos logkos changed the title Kernel/Net: Implement SO_SNDBUF and SO_RCVBUF for getsockopt Kernel/Net: Implement SO_SNDBUF and SO_RCVBUF for getsockopt Sep 14, 2024
@logkos logkos force-pushed the socket branch 2 times, most recently from 4372ed2 to 9fa49ec Compare September 14, 2024 11:38
These options are used for QoS and return buffer length as response.
We currently don't support setting the buffer size.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 pr-needs-review PR needs review from a maintainer or community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants