qobject atomics osdep: Make a few macros more hygienic
[qemu/kevin.git] / include / io / channel-command.h
blob98934e6d9eec20d8c2fbeea1c659c75156bed9a3
1 /*
2 * QEMU I/O channels external command driver
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.1 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_COMMAND_H
22 #define QIO_CHANNEL_COMMAND_H
24 #include "io/channel.h"
25 #include "qom/object.h"
27 #define TYPE_QIO_CHANNEL_COMMAND "qio-channel-command"
28 OBJECT_DECLARE_SIMPLE_TYPE(QIOChannelCommand, QIO_CHANNEL_COMMAND)
32 /**
33 * QIOChannelCommand:
35 * The QIOChannelCommand class provides a channel implementation
36 * that can transport data with an externally running command
37 * via its stdio streams.
40 struct QIOChannelCommand {
41 QIOChannel parent;
42 int writefd;
43 int readfd;
44 GPid pid;
45 #ifdef WIN32
46 bool blocking;
47 #endif
51 /**
52 * qio_channel_command_new_spawn:
53 * @argv: the NULL terminated list of command arguments
54 * @flags: the I/O mode, one of O_RDONLY, O_WRONLY, O_RDWR
55 * @errp: pointer to a NULL-initialized error object
57 * Create a channel for performing I/O with the
58 * command to be spawned with arguments @argv.
60 * Returns: the command channel object, or NULL on error
62 QIOChannelCommand *
63 qio_channel_command_new_spawn(const char *const argv[],
64 int flags,
65 Error **errp);
68 #endif /* QIO_CHANNEL_COMMAND_H */