Page MenuHomeFreeBSD

sockets: provide solisten_clone(), solisten_enqueue()
ClosedPublic

Authored by glebius on Aug 7 2022, 7:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 21, 8:41 PM
Unknown Object (File)
Feb 21 2024, 6:18 PM
Unknown Object (File)
Feb 21 2024, 6:18 PM
Unknown Object (File)
Feb 21 2024, 6:14 PM
Unknown Object (File)
Feb 21 2024, 6:14 PM
Unknown Object (File)
Feb 21 2024, 6:13 PM
Unknown Object (File)
Feb 21 2024, 7:48 AM
Unknown Object (File)
Dec 29 2023, 1:02 PM
Subscribers

Details

Summary

as alternative KPI to sonewconn(). The latter has three stages:

  • check the listening socket queue limits
  • allocate a new socket
  • call into protocol attach method
  • link the new socket into the listen queue of the listening socket

The attach method, originally designed for a creation of socket by the
socket(2) syscall has slightly different semantics than attach of a socket
cloned by listener. Make it possible for protocols to call into the
first stage, then perform a different attach, and then call into the
final stage. The first stage, that checks limits and clones a socket
is called solisten_clone(), and the function that enqueues the socket
is solisten_enqueue().

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tuexen added inline comments.
sys/kern/uipc_socket.c
712–716

Should this be "solisten_clone: instead of "sonewconn:?

719–720

Should this be "solisten_clone: instead of "sonewconn:?

sys/sys/socketvar.h
477

Should there be variable names for consistency?

480

Should there be a variable name for consistency?

glebius added inline comments.
sys/kern/uipc_socket.c
719–720

This was done intentionally. The sonewconn log message is known to sysadmins since previous century, has multiple references in the Internet discussions. It is what happens when a web server is too slow to accept connections. Also, we have a test that looks for exactly for this particular message.

sys/sys/socketvar.h
480

Should there be a variable name for consistency?

I'm not sure. I personally prefer to get rid of them, usually in a creeping way - when editing the code. Not sure this matches project policy, though. My rationale is that we can have freedom to rename variables in the implementation without touching headers. Also shortens declarations. And style(9) has nothing on this topic.

tuexen added inline comments.
sys/kern/uipc_socket.c
719–720

Maybe add a short comment stating that it is done intentionally. If not, someone might think it is a copy and past error and fixes it.

This revision is now accepted and ready to land.Aug 8 2022, 9:56 PM
glebius marked an inline comment as done.

Shorten argument list for solisten_enqueue(). No functional changes.

This revision now requires review to proceed.Aug 8 2022, 9:57 PM
glebius added inline comments.
sys/kern/uipc_socket.c
719–720

Yep, that's a good idea!

glebius marked an inline comment as done.

Add comment on why do we start log message with "sonewconn:".

This revision is now accepted and ready to land.Aug 9 2022, 1:32 PM