From nobody Sun Feb 8 16:49:53 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1564420319; cv=none; d=zoho.com; s=zohoarc; b=HnWvDZZqJ2XPQR515OZ/6vABfSQMJrmgpwkK5mqQPk4Xdc0S/ETWiT9B3oK7EZIogYxy/SJW/vdxqsqhLrwcT5SIAEcTwod9QaUS3JU6BKffUvISRLLMxE5rHuHZbDHxapW9n/AGAyaa99Gq2ytkkuwGuELa+yohdbebpNOS+JA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564420319; h=Content-Type:Content-Transfer-Encoding:Cc: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:ARC-Authentication-Results; bh=aEZJpo9qq/QBJrZ45UOtWsXIVFeGXmpY//xfpC2dgiw=; b=LHTDFg9YaoyBZiecKDhqFzzRTQ7BYhTtTtkiiBzyZ+nOzW6bEDmF0StobgnAgqQMvZyIxnkY6QV+GVwPD0VdOCc+PDZsK7e1IiOaybDMpVRrmEN5vx9EL5e0S1eZZp734hZezHQVITHH7LeNn8ek/L0KzBXSysQCxdWCSdZhw14= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1564420319465947.1813358349467; Mon, 29 Jul 2019 10:11:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F14072D6A0F; Mon, 29 Jul 2019 17:11:57 +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 C8DB460BF3; Mon, 29 Jul 2019 17:11:57 +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 8893D1972D; Mon, 29 Jul 2019 17:11:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6THBiOE027212 for ; Mon, 29 Jul 2019 13:11:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id A9D6E5C21A; Mon, 29 Jul 2019 17:11:44 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-51.ams2.redhat.com [10.36.112.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CFCB5C1A1; Mon, 29 Jul 2019 17:11:43 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Mon, 29 Jul 2019 18:10:49 +0100 Message-Id: <20190729171130.25484-8-berrange@redhat.com> In-Reply-To: <20190729171130.25484-1-berrange@redhat.com> References: <20190729171130.25484-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH v3 07/48] remote: conditionalize socket names in libvirtd daemon 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 29 Jul 2019 17:11:58 +0000 (UTC) Prepare for reusing libvirtd source to create other daemons by making the socket names conditionally defined by the make rules. Reviewed-by: Andrea Bolognani Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Christophe de Dinechin --- src/remote/Makefile.inc.am | 1 + src/remote/remote_daemon.c | 34 +++++++++++++++++++++------------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am index 0400dabad9..ced940d3c1 100644 --- a/src/remote/Makefile.inc.am +++ b/src/remote/Makefile.inc.am @@ -146,6 +146,7 @@ libvirtd_CFLAGS =3D \ -I$(srcdir)/access \ -I$(srcdir)/conf \ -I$(srcdir)/rpc \ + -DSOCK_PREFIX=3D"\"libvirt\"" \ $(NULL) =20 libvirtd_LDFLAGS =3D \ diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 69385af1c4..f9d923b357 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -221,19 +221,25 @@ daemonUnixSocketPaths(struct daemonConfig *config, char *rundir =3D NULL; =20 if (config->unix_sock_dir) { - if (virAsprintf(sockfile, "%s/libvirt-sock", config->unix_sock_dir= ) < 0) + if (virAsprintf(sockfile, "%s/%s-sock", + SOCK_PREFIX, config->unix_sock_dir) < 0) goto cleanup; =20 if (privileged) { - if (virAsprintf(rosockfile, "%s/libvirt-sock-ro", config->unix= _sock_dir) < 0 || - virAsprintf(admsockfile, "%s/libvirt-admin-sock", config->= unix_sock_dir) < 0) + if (virAsprintf(rosockfile, "%s/%s-sock-ro", + SOCK_PREFIX, config->unix_sock_dir) < 0 || + virAsprintf(admsockfile, "%s/%s-admin-sock", + SOCK_PREFIX, config->unix_sock_dir) < 0) goto cleanup; } } else { if (privileged) { - if (VIR_STRDUP(*sockfile, LOCALSTATEDIR "/run/libvirt/libvirt-= sock") < 0 || - VIR_STRDUP(*rosockfile, LOCALSTATEDIR "/run/libvirt/libvir= t-sock-ro") < 0 || - VIR_STRDUP(*admsockfile, LOCALSTATEDIR "/run/libvirt/libvi= rt-admin-sock") < 0) + if (virAsprintf(sockfile, "%s/run/libvirt/%s-sock", + LOCALSTATEDIR, SOCK_PREFIX) < 0 || + virAsprintf(sockfile, "%s/run/libvirt/%s-sock-ro", + LOCALSTATEDIR, SOCK_PREFIX) < 0 || + virAsprintf(sockfile, "%s/run/libvirt/%s-admin-sock", + LOCALSTATEDIR, SOCK_PREFIX) < 0) goto cleanup; } else { mode_t old_umask; @@ -248,8 +254,10 @@ daemonUnixSocketPaths(struct daemonConfig *config, } umask(old_umask); =20 - if (virAsprintf(sockfile, "%s/libvirt-sock", rundir) < 0 || - virAsprintf(admsockfile, "%s/libvirt-admin-sock", rundir) = < 0) + if (virAsprintf(sockfile, "%s/%s-sock", + rundir, SOCK_PREFIX) < 0 || + virAsprintf(admsockfile, "%s/%s-admin-sock", + rundir, SOCK_PREFIX) < 0) goto cleanup; } } @@ -902,12 +910,12 @@ daemonUsage(const char *argv0, bool privileged) fprintf(stderr, "\n"); =20 fprintf(stderr, " %s:\n", _("Sockets")); - fprintf(stderr, " %s\n", - privileged ? LOCALSTATEDIR "/run/libvirt/libvirt-sock" : - "$XDG_RUNTIME_DIR/libvirt/libvirt-sock"); + fprintf(stderr, " %s/libvirt/%s-sock\n", + privileged ? LOCALSTATEDIR "/run" : "$XDG_RUNTIME_DIR", + SOCK_PREFIX); if (privileged) - fprintf(stderr, " %s\n", - LOCALSTATEDIR "/run/libvirt/libvirt-sock-ro"); + fprintf(stderr, " %s/run/libvirt/%s-sock-ro\n", + LOCALSTATEDIR, SOCK_PREFIX); fprintf(stderr, "\n"); =20 fprintf(stderr, " %s:\n", _("TLS")); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list