plan9port/man/man3/sendfd.3
Russ Cox 977b25a76a tmac: introduce real manual reference macro instead of overloading IR
The overloading of IR emits magic \X'...' sequences that turn into HTML manual links.
But not all such IR invocations should be manual links;
those had to be written to avoid the IR macro before.
Worse, the \X'...' ending the IR causes troff to emit only a single space after a period.

Defining a new IM macro for manual references fixes both problems.

Fixes #441.
2020-08-13 23:43:43 -04:00

57 lines
1,014 B
Groff

.TH SENDFD 3
.SH NAME
sendfd, recvfd \- pass file descriptors along Unix domain sockets
.SH SYNOPSIS
.B
#include <u.h>
.PP
.B
#include <libc.h>
.PP
.B
int sendfd(int socket, int fd)
.PP
.B
int recvfd(int socket)
.SH DESCRIPTION
.I Recvfd
and
.I sendfd
can be used to pass an open file descriptor over
a Unix domain socket from one process to another.
Since
.IM pipe (3)
is implemented with
.IM socketpair (2)
instead of
.IM pipe (2) ,
.I socket
can be a file descriptor obtained from
.IM pipe (3) .
.PP
.I Sendfd
sends the file descriptor
.I fd
along the socket to a process calling
.I recvfd
on the other end.
.PP
It is assumed that the two sides have coordinated
and agreed to transfer a file descriptor already, so
that the
.I sendfd
is met with a
.I recvfd
instead of an ordinary
.IR read .
.PP
The file descriptor number may change on its way
between processes, but the kernel structure it represents
will not.
.SH SOURCE
.B \*9/src/lib9/sendfd.c
.SH SEE ALSO
.IM socketpair (2) ,
.I sendmsg
in
.IM send (2)