Onload User Guide (UG1586)

Document ID
Release Date
1.2 English


Move the file descriptor to the current stack. The target stack can be specified with onload_set_stackname(),then use onload_move_fd() to put the socket into the target stack.

A socket can exist only in a single stack. Moving a socket to a different stack does not create a copy of the socket in originator and target stacks. Limited to TCP closed or accepted sockets only.


int onload_move_fd (int fd)

Formal Parameters

fd - the file descriptor to be moved to the current stack.

Return Value

0 on success

non-zero otherwise.


  • Useful to move fds obtained by accept() to a different Onload stack from the listening socket.
  • Cannot be used on actively opened connections, although it is possible to use onload_set_stackname() before calling connect() to achieve the same result.
  • The socket must have empty send and retransmit queues (send not called on this socket)
  • The socket must have a simple receive queue (no loss, reordering, etc)
  • The fd is not yet in an epoll set.
  • The onload_move_fd function should not be used if SO_TIMESTAMPING is set to a non-zero value for the originating socket.
  • Should not be used simultaneously with other I/O multiplex actions such as poll(), select(), recv() etc on the file descriptor.
  • This function is not async-safe and should never be called from any process function handling signals.
  • This function cannot be used to hand sockets over to the kernel. It is not possible to use onload_set_stackname (ONLOAD_DONT_ACCELERATE) and then onload_move_fd().
Note: The onload_move_fd function does not check whether a destination stack has either RX or TX timestamping enabled.