---
name: "io_passfd"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/io_passfd"
---

# io\_passfd(3)

pass a file descriptor over a Unix Domain socket

## NAME

io\_passfd - pass a file descriptor over a Unix Domain socket

## SYNTAX

**#include \<libowfat/io.h\>**

int **io\_passfd**(int64 sock,int64 fd);

## DESCRIPTION

io\_passfd transfers the file descriptor *fd* over the Unix Domain socket *sock*.  This works much like [dup(2)](/dup/2.md), only that the copy of the descriptor appears not in this process but at the other end of the Unix Domain socket (which therefore must be a process on the same system).

The peer can then use [io\_receivefd(3)](/io_receivefd/3.md) to receive the file descriptor.

Note that the passed descriptor stays open in the sending process.

## RETURN VALUE

io\_passfd returns 0 on success, -1 on error (setting errno accordingly).

## SEE ALSO

[io\_receivefd(3)](/io_receivefd/3.md)
