aboutsummaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-02 19:05:41 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-13 15:46:09 +0400
commit4bf21c7f748bee42b6f4692f8c37a11d1033b2d1 (patch)
tree2020afbc1d980f53767c061e01e23ee98e722c83 /monitor
parentf02b2c19174e3b5e0823e55cfb50d1b3153a485e (diff)
downloadqemu-4bf21c7f748bee42b6f4692f8c37a11d1033b2d1.zip
qemu-4bf21c7f748bee42b6f4692f8c37a11d1033b2d1.tar.gz
qemu-4bf21c7f748bee42b6f4692f8c37a11d1033b2d1.tar.bz2
monitor: restrict command getfd to POSIX hosts
Currently, the function will simply fail if ancillary fds are not provided, for ex on unsupported platforms. This changes the failure from: {"error": {"class": "GenericError", "desc": "No file descriptor supplied via SCM_RIGHTS"}} to: {"error": {"class": "CommandNotFound", "desc": "The command getfd has not been found"}} Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'monitor')
-rw-r--r--monitor/fds.c2
-rw-r--r--monitor/hmp-cmds.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/monitor/fds.c b/monitor/fds.c
index 9ed4197..d86c2c6 100644
--- a/monitor/fds.c
+++ b/monitor/fds.c
@@ -98,6 +98,7 @@ static bool monitor_add_fd(Monitor *mon, int fd, const char *fdname, Error **err
return true;
}
+#ifdef CONFIG_POSIX
void qmp_getfd(const char *fdname, Error **errp)
{
Monitor *cur_mon = monitor_cur();
@@ -111,6 +112,7 @@ void qmp_getfd(const char *fdname, Error **errp)
monitor_add_fd(cur_mon, fd, fdname, errp);
}
+#endif
void qmp_closefd(const char *fdname, Error **errp)
{
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 34bd8c6..6c559b4 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -192,6 +192,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, err);
}
+#ifdef CONFIG_POSIX
void hmp_getfd(Monitor *mon, const QDict *qdict)
{
const char *fdname = qdict_get_str(qdict, "fdname");
@@ -200,6 +201,7 @@ void hmp_getfd(Monitor *mon, const QDict *qdict)
qmp_getfd(fdname, &err);
hmp_handle_error(mon, err);
}
+#endif
void hmp_closefd(Monitor *mon, const QDict *qdict)
{