sys_socketpair

Function sys_socketpair 

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

System call: Create a connected socket pair

Creates two connected local sockets for IPC. This is more efficient than bind/connect for simple bidirectional communication.

§Arguments (via trapframe)

  • a0: Pointer to array[2] for storing handle IDs

§Returns

0 on success, usize::MAX (-1) on error. On success, the handle IDs are written to the array pointed to by a0.

§Errors

Returns usize::MAX (-1) if:

  • Invalid array pointer
  • Failed to create socket pair
  • Failed to allocate handles