chiark / gitweb /
Missing argument in sel_addtimer docs.
[mLib] / fdpass.h
CommitLineData
759ef658 1/* -*-c-*-
2 *
8656dc50 3 * $Id: fdpass.h,v 1.2 2004/04/08 01:36:11 mdw Exp $
759ef658 4 *
5 * File descriptor passing
6 *
7 * (c) 2003 Straylight/Edgeware
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of the mLib utilities library.
13 *
14 * mLib is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Library General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * mLib is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Library General Public License for more details.
23 *
24 * You should have received a copy of the GNU Library General Public
25 * License along with mLib; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 * MA 02111-1307, USA.
28 */
29
759ef658 30#ifndef MLIB_FDPASS_H
31#define MLIB_FDPASS_H
32
33#ifdef __cplusplus
34 extern "C" {
35#endif
36
37/*----- Header files ------------------------------------------------------*/
38
39#include <sys/types.h>
40#include <unistd.h>
41
42/*----- Functions provided ------------------------------------------------*/
43
44/* --- @fdpass_send@ --- *
45 *
46 * Arguments: @int sock@ = socket to send over
47 * @int fd@ = file descriptor to send
48 * @const void *p@ = pointer to data to send
49 * @size_t sz@ = size of buffer to send
50 *
51 * Returns: On error, @-1@, otherwise number of bytes transferred from
52 * @p@.
53 *
54 * Use: Sends a copy of file descriptor @fd@ to the other end of
55 * @sock@.
56 */
57
58extern ssize_t fdpass_send(int /*sock*/, int /*fd*/,
59 const void */*p*/, size_t /*sz*/);
60
61/* --- @fdpass_recv@ --- *
62 *
63 * Arguments: @int sock@ = socket to send over
64 * @int *fd@ = where to put received descriptor
65 * @void *p@ = pointer to where to put data
66 * @size_t sz@ = size of buffer
67 *
68 * Returns: On error, @-1@, otherwise number of bytes transferred.
69 *
70 * Use: Receives a file descriptor. If the call succeeds, and there
71 * was a file descriptor, then @fd@ won't be @-1@ on exit;
72 * otherwise it will. At most one descriptor will be collected.
73 */
74
75extern ssize_t fdpass_recv(int /*sock*/, int */*fd*/,
76 void */*p*/, size_t /*sz*/);
77
78/*----- That's all, folks -------------------------------------------------*/
79
80#ifdef __cplusplus
81 }
82#endif
83
84#endif