sys_socket_accept

Function sys_socket_accept 

Source
pub fn sys_socket_accept(tf: &mut Trapframe) -> usize
Expand description

System call: Accept an incoming connection

Accepts a connection from the socket’s backlog queue. This blocks if no connections are pending (in a real implementation, should return WouldBlock for non-blocking sockets).

§Arguments (via trapframe)

  • a0: Listening socket handle ID

§Returns

Handle ID of the accepted connection socket (> 0), or usize::MAX (-1) on error

§Errors

Returns usize::MAX (-1) if:

  • Invalid handle ID
  • Socket not in listening state
  • No pending connections (would block)
  • Failed to allocate handle for new socket