diff options
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -1774,6 +1774,30 @@ static void do_closefd(Monitor *mon, const char *fdname) fdname); } +int monitor_get_fd(Monitor *mon, const char *fdname) +{ + mon_fd_t *monfd; + + LIST_FOREACH(monfd, &mon->fds, next) { + int fd; + + if (strcmp(monfd->name, fdname) != 0) { + continue; + } + + fd = monfd->fd; + + /* caller takes ownership of fd */ + LIST_REMOVE(monfd, next); + qemu_free(monfd->name); + qemu_free(monfd); + + return fd; + } + + return -1; +} + static const mon_cmd_t mon_cmds[] = { #include "qemu-monitor.h" { NULL, NULL, }, |