recvfd(2) - SerenityOS man pages


recvfd - receive a file descriptor from a local socket peer


#include <sys/socket.h>

int recvfd(int sockfd, int options);


Receive an open file descriptor from a local socket peer connected via sockfd. This is a non-blocking call that will fail if there is no file descriptor waiting in the socket's queue.

File descriptors are sent out-of-band and do not affect the regular data streams.

The options argument accepts a bitmask of the following flags:

Return value

If a file descriptor is successfully received, it is returned as a non-negative integer. Otherwise, -1 is returned and errno is set to indicate the error.



recvfd() was first introduced in Plan 9 from User Space.

See also