Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 1 | #ifndef QEMU_CHAR_FE_H |
| 2 | #define QEMU_CHAR_FE_H |
| 3 | |
| 4 | #include "chardev/char.h" |
Markus Armbruster | db72581 | 2019-08-12 07:23:50 +0200 | [diff] [blame] | 5 | #include "qemu/main-loop.h" |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 6 | |
Philippe Mathieu-Daudé | 083b266 | 2019-12-18 18:20:09 +0100 | [diff] [blame] | 7 | typedef void IOEventHandler(void *opaque, QEMUChrEvent event); |
Anton Nefedov | 81517ba | 2017-07-06 15:08:49 +0300 | [diff] [blame] | 8 | typedef int BackendChangeHandler(void *opaque); |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 9 | |
Alex Bennée | 67b5595 | 2023-12-11 14:59:59 +0000 | [diff] [blame] | 10 | /** |
| 11 | * struct CharBackend - back end as seen by front end |
| 12 | * @fe_is_open: the front end is ready for IO |
| 13 | * |
| 14 | * The actual backend is Chardev |
| 15 | */ |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 16 | struct CharBackend { |
| 17 | Chardev *chr; |
| 18 | IOEventHandler *chr_event; |
| 19 | IOCanReadHandler *chr_can_read; |
| 20 | IOReadHandler *chr_read; |
Anton Nefedov | 81517ba | 2017-07-06 15:08:49 +0300 | [diff] [blame] | 21 | BackendChangeHandler *chr_be_change; |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 22 | void *opaque; |
| 23 | int tag; |
Alex Bennée | 67b5595 | 2023-12-11 14:59:59 +0000 | [diff] [blame] | 24 | bool fe_is_open; |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 25 | }; |
| 26 | |
| 27 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 28 | * qemu_chr_fe_init: |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 29 | * |
| 30 | * Initializes a front end for the given CharBackend and |
| 31 | * Chardev. Call qemu_chr_fe_deinit() to remove the association and |
| 32 | * release the driver. |
| 33 | * |
| 34 | * Returns: false on error. |
| 35 | */ |
| 36 | bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp); |
| 37 | |
| 38 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 39 | * qemu_chr_fe_deinit: |
Marc-André Lureau | 1ce2610 | 2017-01-27 00:49:13 +0400 | [diff] [blame] | 40 | * @b: a CharBackend |
| 41 | * @del: if true, delete the chardev backend |
| 42 | * |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 43 | * Dissociate the CharBackend from the Chardev. |
| 44 | * |
| 45 | * Safe to call without associated Chardev. |
| 46 | */ |
Marc-André Lureau | 1ce2610 | 2017-01-27 00:49:13 +0400 | [diff] [blame] | 47 | void qemu_chr_fe_deinit(CharBackend *b, bool del); |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 48 | |
| 49 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 50 | * qemu_chr_fe_get_driver: |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 51 | * |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 52 | * Returns: the driver associated with a CharBackend or NULL if no |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 53 | * associated Chardev. |
Anton Nefedov | 7c44a2a | 2017-07-06 15:08:51 +0300 | [diff] [blame] | 54 | * Note: avoid this function as the driver should never be accessed directly, |
| 55 | * especially by the frontends that support chardevice hotswap. |
| 56 | * Consider qemu_chr_fe_backend_connected() to check for driver existence |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 57 | */ |
| 58 | Chardev *qemu_chr_fe_get_driver(CharBackend *be); |
| 59 | |
| 60 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 61 | * qemu_chr_fe_backend_connected: |
Anton Nefedov | 7c44a2a | 2017-07-06 15:08:51 +0300 | [diff] [blame] | 62 | * |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 63 | * Returns: true if there is a chardevice associated with @be. |
Anton Nefedov | 7c44a2a | 2017-07-06 15:08:51 +0300 | [diff] [blame] | 64 | */ |
| 65 | bool qemu_chr_fe_backend_connected(CharBackend *be); |
| 66 | |
| 67 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 68 | * qemu_chr_fe_backend_open: |
Anton Nefedov | 3065070 | 2017-07-06 15:08:52 +0300 | [diff] [blame] | 69 | * |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 70 | * Returns: true if chardevice associated with @be is open. |
Anton Nefedov | 3065070 | 2017-07-06 15:08:52 +0300 | [diff] [blame] | 71 | */ |
| 72 | bool qemu_chr_fe_backend_open(CharBackend *be); |
| 73 | |
| 74 | /** |
Artem Pisarenko | 7a9657e | 2018-11-06 18:40:51 +0600 | [diff] [blame] | 75 | * qemu_chr_fe_set_handlers_full: |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 76 | * @b: a CharBackend |
| 77 | * @fd_can_read: callback to get the amount of data the frontend may |
| 78 | * receive |
| 79 | * @fd_read: callback to receive data from char |
| 80 | * @fd_event: event callback |
Anton Nefedov | 81517ba | 2017-07-06 15:08:49 +0300 | [diff] [blame] | 81 | * @be_change: backend change callback; passing NULL means hot backend change |
| 82 | * is not supported and will not be attempted |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 83 | * @opaque: an opaque pointer for the callbacks |
| 84 | * @context: a main loop context or NULL for the default |
Michael Tokarev | a1a62ce | 2023-07-14 14:33:02 +0300 | [diff] [blame] | 85 | * @set_open: whether to call qemu_chr_fe_set_open() implicitly when |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 86 | * any of the handler is non-NULL |
Artem Pisarenko | 7a9657e | 2018-11-06 18:40:51 +0600 | [diff] [blame] | 87 | * @sync_state: whether to issue event callback with updated state |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 88 | * |
| 89 | * Set the front end char handlers. The front end takes the focus if |
| 90 | * any of the handler is non-NULL. |
| 91 | * |
| 92 | * Without associated Chardev, nothing is changed. |
| 93 | */ |
Artem Pisarenko | 7a9657e | 2018-11-06 18:40:51 +0600 | [diff] [blame] | 94 | void qemu_chr_fe_set_handlers_full(CharBackend *b, |
| 95 | IOCanReadHandler *fd_can_read, |
| 96 | IOReadHandler *fd_read, |
| 97 | IOEventHandler *fd_event, |
| 98 | BackendChangeHandler *be_change, |
| 99 | void *opaque, |
| 100 | GMainContext *context, |
| 101 | bool set_open, |
| 102 | bool sync_state); |
| 103 | |
| 104 | /** |
| 105 | * qemu_chr_fe_set_handlers: |
| 106 | * |
| 107 | * Version of qemu_chr_fe_set_handlers_full() with sync_state = true. |
| 108 | */ |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 109 | void qemu_chr_fe_set_handlers(CharBackend *b, |
| 110 | IOCanReadHandler *fd_can_read, |
| 111 | IOReadHandler *fd_read, |
| 112 | IOEventHandler *fd_event, |
Anton Nefedov | 81517ba | 2017-07-06 15:08:49 +0300 | [diff] [blame] | 113 | BackendChangeHandler *be_change, |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 114 | void *opaque, |
| 115 | GMainContext *context, |
| 116 | bool set_open); |
| 117 | |
| 118 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 119 | * qemu_chr_fe_take_focus: |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 120 | * |
| 121 | * Take the focus (if the front end is muxed). |
| 122 | * |
| 123 | * Without associated Chardev, nothing is changed. |
| 124 | */ |
| 125 | void qemu_chr_fe_take_focus(CharBackend *b); |
| 126 | |
| 127 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 128 | * qemu_chr_fe_accept_input: |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 129 | * |
| 130 | * Notify that the frontend is ready to receive data |
| 131 | */ |
| 132 | void qemu_chr_fe_accept_input(CharBackend *be); |
| 133 | |
| 134 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 135 | * qemu_chr_fe_disconnect: |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 136 | * |
Julia Suvorova | 7351681 | 2018-08-13 12:34:02 +0300 | [diff] [blame] | 137 | * Close a fd accepted by character backend. |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 138 | * Without associated Chardev, do nothing. |
| 139 | */ |
| 140 | void qemu_chr_fe_disconnect(CharBackend *be); |
| 141 | |
| 142 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 143 | * qemu_chr_fe_wait_connected: |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 144 | * |
Michael Tokarev | a1a62ce | 2023-07-14 14:33:02 +0300 | [diff] [blame] | 145 | * Wait for character backend to be connected, return < 0 on error or |
Julia Suvorova | 7351681 | 2018-08-13 12:34:02 +0300 | [diff] [blame] | 146 | * if no associated Chardev. |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 147 | */ |
| 148 | int qemu_chr_fe_wait_connected(CharBackend *be, Error **errp); |
| 149 | |
| 150 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 151 | * qemu_chr_fe_set_echo: |
| 152 | * @echo: true to enable echo, false to disable echo |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 153 | * |
| 154 | * Ask the backend to override its normal echo setting. This only really |
| 155 | * applies to the stdio backend and is used by the QMP server such that you |
| 156 | * can see what you type if you try to type QMP commands. |
| 157 | * Without associated Chardev, do nothing. |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 158 | */ |
| 159 | void qemu_chr_fe_set_echo(CharBackend *be, bool echo); |
| 160 | |
| 161 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 162 | * qemu_chr_fe_set_open: |
Alex Bennée | 67b5595 | 2023-12-11 14:59:59 +0000 | [diff] [blame] | 163 | * @be: a CharBackend |
| 164 | * @is_open: the front end open status |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 165 | * |
Alex Bennée | 67b5595 | 2023-12-11 14:59:59 +0000 | [diff] [blame] | 166 | * This is an indication that the front end is ready (or not) to begin |
| 167 | * doing I/O. Without associated Chardev, do nothing. |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 168 | */ |
Alex Bennée | 67b5595 | 2023-12-11 14:59:59 +0000 | [diff] [blame] | 169 | void qemu_chr_fe_set_open(CharBackend *be, bool is_open); |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 170 | |
| 171 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 172 | * qemu_chr_fe_printf: |
| 173 | * @fmt: see #printf |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 174 | * |
| 175 | * Write to a character backend using a printf style interface. This |
| 176 | * function is thread-safe. It does nothing without associated |
| 177 | * Chardev. |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 178 | */ |
| 179 | void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...) |
Marc-André Lureau | 9edc631 | 2022-02-20 20:39:25 +0400 | [diff] [blame] | 180 | G_GNUC_PRINTF(2, 3); |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 181 | |
Marc-André Lureau | bf7b1ea | 2021-08-04 17:01:14 +0400 | [diff] [blame] | 182 | |
Philippe Mathieu-Daudé | b3a1090 | 2023-07-05 13:21:11 +0200 | [diff] [blame] | 183 | /** |
| 184 | * FEWatchFunc: a #GSourceFunc called when any conditions requested by |
| 185 | * qemu_chr_fe_add_watch() is satisfied. |
| 186 | * @do_not_use: depending on the underlying chardev, a GIOChannel or a |
| 187 | * QIOChannel. DO NOT USE! |
| 188 | * @cond: bitwise combination of conditions watched and satisfied |
| 189 | * before calling this callback. |
| 190 | * @data: user data passed at creation to qemu_chr_fe_add_watch(). Can |
| 191 | * be NULL. |
| 192 | * |
| 193 | * Returns: G_SOURCE_REMOVE if the GSource should be removed from the |
| 194 | * main loop, or G_SOURCE_CONTINUE to leave the GSource in |
| 195 | * the main loop. |
| 196 | */ |
Marc-André Lureau | bf7b1ea | 2021-08-04 17:01:14 +0400 | [diff] [blame] | 197 | typedef gboolean (*FEWatchFunc)(void *do_not_use, GIOCondition condition, void *data); |
| 198 | |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 199 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 200 | * qemu_chr_fe_add_watch: |
| 201 | * @cond: the condition to poll for |
| 202 | * @func: the function to call when the condition happens |
| 203 | * @user_data: the opaque pointer to pass to @func |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 204 | * |
| 205 | * If the backend is connected, create and add a #GSource that fires |
| 206 | * when the given condition (typically G_IO_OUT|G_IO_HUP or G_IO_HUP) |
| 207 | * is active; return the #GSource's tag. If it is disconnected, |
| 208 | * or without associated Chardev, return 0. |
| 209 | * |
Marc-André Lureau | 64c3f26 | 2019-02-06 18:43:26 +0100 | [diff] [blame] | 210 | * Note that you are responsible to update the front-end sources if |
| 211 | * you are switching the main context with qemu_chr_fe_set_handlers(). |
| 212 | * |
Marc-André Lureau | bf7b1ea | 2021-08-04 17:01:14 +0400 | [diff] [blame] | 213 | * Warning: DO NOT use the first callback argument (it may be either |
| 214 | * a GIOChannel or a QIOChannel, depending on the underlying chardev) |
| 215 | * |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 216 | * Returns: the source tag |
| 217 | */ |
| 218 | guint qemu_chr_fe_add_watch(CharBackend *be, GIOCondition cond, |
Marc-André Lureau | bf7b1ea | 2021-08-04 17:01:14 +0400 | [diff] [blame] | 219 | FEWatchFunc func, void *user_data); |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 220 | |
| 221 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 222 | * qemu_chr_fe_write: |
| 223 | * @buf: the data |
| 224 | * @len: the number of bytes to send |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 225 | * |
| 226 | * Write data to a character backend from the front end. This function |
| 227 | * will send data from the front end to the back end. This function |
| 228 | * is thread-safe. |
| 229 | * |
Julia Suvorova | 7351681 | 2018-08-13 12:34:02 +0300 | [diff] [blame] | 230 | * Returns: the number of bytes consumed (0 if no associated Chardev) |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 231 | */ |
| 232 | int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len); |
| 233 | |
| 234 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 235 | * qemu_chr_fe_write_all: |
| 236 | * @buf: the data |
| 237 | * @len: the number of bytes to send |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 238 | * |
| 239 | * Write data to a character backend from the front end. This function will |
| 240 | * send data from the front end to the back end. Unlike @qemu_chr_fe_write, |
| 241 | * this function will block if the back end cannot consume all of the data |
| 242 | * attempted to be written. This function is thread-safe. |
| 243 | * |
Julia Suvorova | 7351681 | 2018-08-13 12:34:02 +0300 | [diff] [blame] | 244 | * Returns: the number of bytes consumed (0 if no associated Chardev) |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 245 | */ |
| 246 | int qemu_chr_fe_write_all(CharBackend *be, const uint8_t *buf, int len); |
| 247 | |
| 248 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 249 | * qemu_chr_fe_read_all: |
| 250 | * @buf: the data buffer |
| 251 | * @len: the number of bytes to read |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 252 | * |
| 253 | * Read data to a buffer from the back end. |
| 254 | * |
Julia Suvorova | 7351681 | 2018-08-13 12:34:02 +0300 | [diff] [blame] | 255 | * Returns: the number of bytes read (0 if no associated Chardev) |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 256 | */ |
| 257 | int qemu_chr_fe_read_all(CharBackend *be, uint8_t *buf, int len); |
| 258 | |
| 259 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 260 | * qemu_chr_fe_ioctl: |
| 261 | * @cmd: see CHR_IOCTL_* |
| 262 | * @arg: the data associated with @cmd |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 263 | * |
| 264 | * Issue a device specific ioctl to a backend. This function is thread-safe. |
| 265 | * |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 266 | * Returns: if @cmd is not supported by the backend or there is no |
| 267 | * associated Chardev, -ENOTSUP, otherwise the return |
| 268 | * value depends on the semantics of @cmd |
| 269 | */ |
| 270 | int qemu_chr_fe_ioctl(CharBackend *be, int cmd, void *arg); |
| 271 | |
| 272 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 273 | * qemu_chr_fe_get_msgfd: |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 274 | * |
| 275 | * For backends capable of fd passing, return the latest file descriptor passed |
| 276 | * by a client. |
| 277 | * |
| 278 | * Returns: -1 if fd passing isn't supported or there is no pending file |
| 279 | * descriptor. If a file descriptor is returned, subsequent calls to |
| 280 | * this function will return -1 until a client sends a new file |
| 281 | * descriptor. |
| 282 | */ |
| 283 | int qemu_chr_fe_get_msgfd(CharBackend *be); |
| 284 | |
| 285 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 286 | * qemu_chr_fe_get_msgfds: |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 287 | * |
| 288 | * For backends capable of fd passing, return the number of file received |
| 289 | * descriptors and fills the fds array up to num elements |
| 290 | * |
| 291 | * Returns: -1 if fd passing isn't supported or there are no pending file |
| 292 | * descriptors. If file descriptors are returned, subsequent calls to |
| 293 | * this function will return -1 until a client sends a new set of file |
| 294 | * descriptors. |
| 295 | */ |
| 296 | int qemu_chr_fe_get_msgfds(CharBackend *be, int *fds, int num); |
| 297 | |
| 298 | /** |
Marc-André Lureau | 5662576 | 2018-08-24 16:22:47 +0200 | [diff] [blame] | 299 | * qemu_chr_fe_set_msgfds: |
Marc-André Lureau | 4d43a60 | 2017-01-26 18:26:44 +0400 | [diff] [blame] | 300 | * |
| 301 | * For backends capable of fd passing, set an array of fds to be passed with |
| 302 | * the next send operation. |
| 303 | * A subsequent call to this function before calling a write function will |
| 304 | * result in overwriting the fd array with the new value without being send. |
| 305 | * Upon writing the message the fd array is freed. |
| 306 | * |
| 307 | * Returns: -1 if fd passing isn't supported or no associated Chardev. |
| 308 | */ |
| 309 | int qemu_chr_fe_set_msgfds(CharBackend *be, int *fds, int num); |
| 310 | |
| 311 | #endif /* QEMU_CHAR_FE_H */ |