From nobody Mon Feb 9 00:30:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1644854315; cv=none; d=zohomail.com; s=zohoarc; b=ZKSCWNASvdswACzv94Q28iVLPS/sYnt983ff/r126l9dK+xO2FgPm4d/8Y0UqlCZrwxue9lDzKMkXR8STlFdJfMzmNK/mEAb9fscLWTPSLtC29/LhLxU5e8Cu7LH7hsurJUIuMai2t5oHK2dldukhj0/nX3ZD85VxzhtktwIlJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644854315; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kS2F2CIwHxkXYOLxRCN+qyyYDtHofWdlHtZtI+7RwbY=; b=UVqoOp7N5xIdEikPIHd3u5CNFa+8cdNFFoyrU9n30ev3xGChA1y6vX4Ot7LO9iSE3BawfqgzMlxORPmICG+UkWa5DiC3ck0QsGJEzYD7/KU7Qa2PuR2ZMcsh41A96LlGKfbrYrfaLoEzDZ9oCOZEjZs3LGWB49KlIybqxKatJ6M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1644854315081664.1467589782715; Mon, 14 Feb 2022 07:58:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-638-z2yrogNzP2u-9UvFDyQENA-1; Mon, 14 Feb 2022 10:58:32 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA7FB2F4C; Mon, 14 Feb 2022 15:58:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 677C627CAC; Mon, 14 Feb 2022 15:58:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3804B4A7C8; Mon, 14 Feb 2022 15:58:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21EFwIZ2021470 for ; Mon, 14 Feb 2022 10:58:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5926C108C7; Mon, 14 Feb 2022 15:58:18 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id B83362BCD8 for ; Mon, 14 Feb 2022 15:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644854314; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kS2F2CIwHxkXYOLxRCN+qyyYDtHofWdlHtZtI+7RwbY=; b=QkXT6MeibHbzybWkQy/gzxQRqeQBx55YWHXYF1u9F5cls6400/sAR4dHEHN4Zh7AT4j10V 8qMlkiU8G0eK7MAbXBZNKgPkFswYb18E8+JYWZHJY7/XJY5angsUDn6YYq7nRzEx3yKUAw HTqiFlgYynha9CeEcGY9AnJ//IveKj8= X-MC-Unique: z2yrogNzP2u-9UvFDyQENA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/6] qemuhotplugmock: Mock fd passing to qemu via 'SCM_RIGHTS' Date: Mon, 14 Feb 2022 16:58:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644854316950100002 Content-Type: text/plain; charset="utf-8" We don't want to be dealing with real FDs thus we mock 'qemuMonitorIOWriteWithFD' to do the same thing as when no FD is being passed. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 2 +- src/qemu/qemu_monitor_priv.h | 7 +++++++ tests/qemuhotplugmock.c | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f514998ba5..dc81e41783 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -288,7 +288,7 @@ qemuMonitorIOProcess(qemuMonitor *mon) /* Call this function while holding the monitor lock. */ -static int +int qemuMonitorIOWriteWithFD(qemuMonitor *mon, const char *data, size_t len, diff --git a/src/qemu/qemu_monitor_priv.h b/src/qemu/qemu_monitor_priv.h index 606aa79fbd..70f5f16e72 100644 --- a/src/qemu/qemu_monitor_priv.h +++ b/src/qemu/qemu_monitor_priv.h @@ -96,3 +96,10 @@ struct _qemuMonitor { void qemuMonitorResetCommandID(qemuMonitor *mon); + +int +qemuMonitorIOWriteWithFD(qemuMonitor *mon, + const char *data, + size_t len, + int fd) + G_GNUC_NO_INLINE; diff --git a/tests/qemuhotplugmock.c b/tests/qemuhotplugmock.c index e3f0715058..d618ff9d06 100644 --- a/tests/qemuhotplugmock.c +++ b/tests/qemuhotplugmock.c @@ -28,6 +28,9 @@ #include "virmock.h" #include +#define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW +#include "qemu/qemu_monitor_priv.h" + static bool (*real_virFileExists)(const char *path); static void @@ -107,3 +110,14 @@ qemuProcessPrepareHostBackendChardevHotplug(virDomainO= bj *vm, testQemuPrepareHostBac= kendChardevOne, vm); } + + +/* we don't really want to send fake FDs across the monitor */ +int +qemuMonitorIOWriteWithFD(qemuMonitor *mon, + const char *data, + size_t len, + int fd G_GNUC_UNUSED) +{ + return write(mon->fd, data, len); /* sc_avoid_write */ +} --=20 2.34.1