handshake_req_submit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ handshake_req_submit(9) ✨

okay so this is a page from the Kernel API Manual β€” section 9, bestie, we're in kernel-internals territory πŸ’… β€” and honestly? it's giving "one function, a LOT of emotional weight." Stay with me.


πŸŽ€ NAME πŸŽ€

handshake_req_submit β€” literally just submit a handshake request. that's the whole vibe. 🫢


🌸 SYNOPSIS 🌸

int handshake_req_submit (struct socket *sock , struct handshake_req
*req , gfp_t flags );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • sock β€” the open socket where the handshake is gonna happen. it has to be open, okay? this is not a "make it work anyway" situation ✨
  • req β€” the handshake arguments πŸ’Œ like, the whole point of the call
  • flags β€” memory allocation flags. yes the gfp_t ones. no i will not elaborate, they're flags, they flag 🚩

πŸ’– DESCRIPTION πŸ’–

okay so here's the return-value tea, and ngl there is a LOT of it, so buckle up πŸ“

Return values:

  • 0 β€” Request queued πŸŽ‰
  • -EINVAL β€” Invalid argument πŸ™ˆ
  • -EBUSY β€” A handshake is already under way for this socket πŸ’€ (it's occupied, respectfully back off)
  • -ESRCH β€” No handshake agent is available 😭 (nobody's home)
  • -EAGAIN β€” Too many pending handshake requests 🫠 (the queue said "no more")
  • -ENOMEM β€” Failed to allocate memory πŸ˜΅β€πŸ’«
  • -EMSGSIZE β€” Failed to construct notification message πŸ“­
  • -EOPNOTSUPP β€” Handshake module not initialized ⚠️ (the module didn't even show up)

the way that a zero return value from handshake_req_submit means that exactly one subsequent completion callback is guaranteed β€” exactly one, bestie, not zero, not two, ONE πŸ‘‘ that's the contract, periodt.

and here's the flip side, because the negative path is lowkey the spicy part 🌢️:

A negative return value from handshake_req_submit guarantees that no completion callback will occur and that req is no longer owned by the caller. If cancellation wins the completion race after the request has been published, final destruction is deferred until socket teardown. πŸ’€ so like. don't touch req after a fail, it's not yours anymore, it's the kernel's problem now.

now the reference-counting bit, which is highkey the most important part and also the easiest to fumble 🧚:

The caller must hold a reference on sock->file for the duration of this call. Once the request is published to the accept side, a concurrent completion or cancellation may release the request's pin on sock->file; the caller's reference is what keeps sock->sk valid until handshake_req_submit returns.

read that again fr fr. your reference is the whole safety net. main character energy for your own sock->file pin 🫢


🌈 SEE ALSO 🌈


that's the whole page, bestie, you ate it πŸ’… mwah πŸ’–

signed, sealed, and shipped from ./net/handshake β€” dated October 2026, syntax handshake_req_submit(9), and yes it's still the Kernel API Manual ✨

πŸ“¦ where this page comes from