3 * File descriptor passing
5 * (c) 2003 Straylight/Edgeware
8 /*----- Licensing notice --------------------------------------------------*
10 * This file is part of the mLib utilities library.
12 * mLib is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Library General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
17 * mLib is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public
23 * License along with mLib; if not, write to the Free
24 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
35 /*----- Header files ------------------------------------------------------*/
37 #include <sys/types.h>
40 /*----- Functions provided ------------------------------------------------*/
42 /* --- @fdpass_send@ --- *
44 * Arguments: @int sock@ = socket to send over
45 * @int fd@ = file descriptor to send
46 * @const void *p@ = pointer to data to send
47 * @size_t sz@ = size of buffer to send
49 * Returns: On error, @-1@, otherwise number of bytes transferred from
52 * Use: Sends a copy of file descriptor @fd@ to the other end of
56 extern ssize_t fdpass_send(int /*sock*/, int /*fd*/,
57 const void */*p*/, size_t /*sz*/);
59 /* --- @fdpass_recv@ --- *
61 * Arguments: @int sock@ = socket to send over
62 * @int *fd@ = where to put received descriptor
63 * @void *p@ = pointer to where to put data
64 * @size_t sz@ = size of buffer
66 * Returns: On error, @-1@, otherwise number of bytes transferred.
68 * Use: Receives a file descriptor. If the call succeeds, and there
69 * was a file descriptor, then @fd@ won't be @-1@ on exit;
70 * otherwise it will. At most one descriptor will be collected.
73 extern ssize_t fdpass_recv(int /*sock*/, int */*fd*/,
74 void */*p*/, size_t /*sz*/);
76 /*----- That's all, folks -------------------------------------------------*/