2 * QEMU I/O channels watch helper APIs
4 * Copyright (c) 2015 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef QIO_CHANNEL_WATCH_H
22 #define QIO_CHANNEL_WATCH_H
24 #include "io/channel.h"
27 * This module provides helper functions that will be needed by
28 * the various QIOChannel implementations, for creating watches
29 * on file descriptors / sockets
33 * qio_channel_create_fd_watch:
34 * @ioc: the channel object
35 * @fd: the file descriptor
36 * @condition: the I/O condition
38 * Create a new main loop source that is able to
39 * monitor the file descriptor @fd for the
40 * I/O conditions in @condition. This is able
41 * monitor block devices, character devices,
42 * pipes but not plain files or, on Win32, sockets.
44 * Returns: the new main loop source
46 GSource
*qio_channel_create_fd_watch(QIOChannel
*ioc
,
48 GIOCondition condition
);
51 * qio_channel_create_socket_watch:
52 * @ioc: the channel object
53 * @fd: the file descriptor
54 * @condition: the I/O condition
56 * Create a new main loop source that is able to
57 * monitor the file descriptor @fd for the
58 * I/O conditions in @condition. This is equivalent
59 * to qio_channel_create_fd_watch on POSIX systems
62 * Returns: the new main loop source
64 GSource
*qio_channel_create_socket_watch(QIOChannel
*ioc
,
66 GIOCondition condition
);
69 * qio_channel_create_fd_pair_watch:
70 * @ioc: the channel object
71 * @fdread: the file descriptor for reading
72 * @fdwrite: the file descriptor for writing
73 * @condition: the I/O condition
75 * Create a new main loop source that is able to
76 * monitor the pair of file descriptors @fdread
77 * and @fdwrite for the I/O conditions in @condition.
78 * This is intended for monitoring unidirectional
79 * file descriptors such as pipes, where a pair
80 * of descriptors is required for bidirectional
83 * Returns: the new main loop source
85 GSource
*qio_channel_create_fd_pair_watch(QIOChannel
*ioc
,
88 GIOCondition condition
);
90 #endif /* QIO_CHANNEL_WATCH_H */