aboutsummaryrefslogtreecommitdiff
path: root/man/man3/sendfd.3
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-03 06:40:20 +0000
committerrsc <devnull@localhost>2005-01-03 06:40:20 +0000
commit058b0118a52061ad57694c01fc8763b22b789c4d (patch)
tree6685f04dea5ed68edaa34998c976aed34c55fe94 /man/man3/sendfd.3
parent2600337aa704efbeba8201e88147a764b4fd2b90 (diff)
downloadplan9port-058b0118a52061ad57694c01fc8763b22b789c4d.tar.gz
plan9port-058b0118a52061ad57694c01fc8763b22b789c4d.tar.bz2
plan9port-058b0118a52061ad57694c01fc8763b22b789c4d.zip
Some man pages.
Diffstat (limited to 'man/man3/sendfd.3')
-rw-r--r--man/man3/sendfd.357
1 files changed, 57 insertions, 0 deletions
diff --git a/man/man3/sendfd.3 b/man/man3/sendfd.3
new file mode 100644
index 00000000..8090dfce
--- /dev/null
+++ b/man/man3/sendfd.3
@@ -0,0 +1,57 @@
+.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
+.IR pipe (3)
+is implemented with
+.IR socketpair (2)
+instead of
+.IR pipe (2),
+.I socket
+can be a file descriptor obtained from
+.IR 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 /usr/local/plan9/src/lib9/sendfd.c
+.SH SEE ALSO
+.IR socketpair (2),
+.I sendmsg
+in
+.IR send (2)