chiark / gitweb /
Refugees from Catacomb: low-level buffer primitives.
[mLib] / man / fdpass.3
CommitLineData
759ef658 1.\" -*-nroff-*-
2.TH fdpass 3 "28 November 2003" "Straylight/Edgeware" "mLib utilities library"
3.SH NAME
4fdpass \- file descriptor passing
5.\" @fdpass_send
6.\" @fdpass_recv
7.SH SYNOPSIS
8.nf
9.B "#include <mLib/fdpass.h>"
10
11.BI "ssize_t fdpass_send(int " sock ", int " fd ", const void *" p ", size_t " sz );
12.BI "ssize_t fdpass_recv(int " sock ", int *" fd ", void *" p ", size_t " sz );
13.fi
14.SH DESCRIPTION
15The function
16.B fdpass_send
17sends the file descriptor
18.I fd
19as ancillary data attached to the buffer pointed to by
20.I p
21of length
22.I sz
23over the Unix-domain socket
24.IR sock .
25It returns the amount of data sent, or \-1 on error. For more details,
26see
27.BR sendmsg (2)
28and
29.BR unix (7).
30.PP
31The function
32.B fdpass_recv
33receives at most
34.I sz
35bytes of data into the buffer pointed to by
36.IR p ,
37together with at most one file descriptor passed as ancillary data,
38which is written to the integer pointed to by
39.IR fd .
40Other file descriptors received are closed; any other ancillary messages
41are ignored. If no file descriptor is received,
42.BI * fd
43is set to \-1. The function returns the number of bytes read, or \-1 on
44error. For more details, see
45.BR recvmsg (2)
46and
47.BR unix (7).
48.SH "SEE ALSO"
49.BR recvmsg (2),
50.BR sendmsg (2),
51.BR mLib (3),
52.BR unix (7).
53.SH AUTHOR
54Mark Wooding, <mdw@nsict.org>