sendfd(2) - SerenityOS man pages


sendfd - send a file descriptor to a local socket peer


#include <sys/socket.h>

int sendfd(int sockfd, int fd);


Send an open file descriptor to a local socket peer connected via sockfd. This is a non-blocking call that will fail if there are too many file descriptors already waiting to be received by the peer.

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

Return value

If a file descriptor is successfully sent, sendfd() returns 0. Otherwise, -1 is returned and errno is set to indicate the error.



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

See also