From nobody Sun Feb 8 16:50:27 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=1562861140; cv=none; d=zoho.com; s=zohoarc; b=Tb3t2bOdaTRjx+fHzMrCzWH19x1u/4j2nvWd45fpNV5UFT7H8AKgBj3LvDdCNZrssQJYLD9fTrWnOP2u9HVx292QRRp1P1tmD3kB+20D+TmnoCr0w2Jmtbn/rdXk7VoqaFETC01aeh1nnOiiTGc88NrIMk7B2dVxN3rPPh2E+8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562861140; 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:ARC-Authentication-Results; bh=MpRp57agdqPcDBgLdQuNMSPlVGGiibqexDHY1UDBcMk=; b=VrVfPhm6Zkst6x3fU0DAdI1KmSc7Ln7EdstFQ3I5GF4czROpreLQdH7iwUSswCYUk90dkhlrRu6Pv4BjQF/tdb5OPOTGJssSMkX6mSgs+c+gY/hn8T0Cj/2901pJusUQM2sOxWQxM8EmRPFDIc6N+qeK8z8O2y7xlF7L6+Pm8QE= 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 1562861140268700.3066691314609; Thu, 11 Jul 2019 09:05:40 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id B404E9D0F7; Thu, 11 Jul 2019 16:05:38 +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 8CE1219C7F; Thu, 11 Jul 2019 16:05:38 +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 4CDBC206D1; Thu, 11 Jul 2019 16:05:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6BG5NRY020329 for ; Thu, 11 Jul 2019 12:05:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 965EB5D9DC; Thu, 11 Jul 2019 16:05:23 +0000 (UTC) Received: from dhcp-17-95.lcy.redhat.com (unknown [10.42.17.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11E4F5D9CC; Thu, 11 Jul 2019 16:05:22 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 11 Jul 2019 17:04:51 +0100 Message-Id: <20190711160516.2130-5-berrange@redhat.com> In-Reply-To: <20190711160516.2130-1-berrange@redhat.com> References: <20190711160516.2130-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/29] 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 11 Jul 2019 16:05:39 +0000 (UTC) Prepare for reusing libvirtd source to create other daemons by making the socket names conditionally defined by the make rules. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/remote/Makefile.inc.am | 3 +++ src/remote/remote_daemon.c | 27 ++++++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/remote/Makefile.inc.am b/src/remote/Makefile.inc.am index 851ab903fd..b41f14222a 100644 --- a/src/remote/Makefile.inc.am +++ b/src/remote/Makefile.inc.am @@ -143,6 +143,9 @@ libvirtd_CFLAGS =3D \ -I$(srcdir)/access \ -I$(srcdir)/conf \ -I$(srcdir)/rpc \ + -DSOCK_NAME=3D"\"libvirt-sock\"" \ + -DSOCK_NAME_RO=3D"\"libvirt-sock-ro\"" \ + -DSOCK_NAME_ADMIN=3D"\"libvirt-admin-sock\"" \ $(NULL) =20 libvirtd_LDFLAGS =3D \ diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 574c50075f..8ab3c21ef8 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -220,19 +220,19 @@ 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/" SOCK_NAME, 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/" SOCK_NAME_RO, config->unix_s= ock_dir) < 0 || + virAsprintf(admsockfile, "%s/" SOCK_NAME_ADMIN, config->un= ix_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 (VIR_STRDUP(*sockfile, LOCALSTATEDIR "/run/libvirt/" SOCK_N= AME) < 0 || + VIR_STRDUP(*rosockfile, LOCALSTATEDIR "/run/libvirt/" SOCK= _NAME_RO) < 0 || + VIR_STRDUP(*admsockfile, LOCALSTATEDIR "/run/libvirt/" SOC= K_NAME_ADMIN) < 0) goto cleanup; } else { mode_t old_umask; @@ -247,8 +247,8 @@ 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/" SOCK_NAME, rundir) < 0 || + virAsprintf(admsockfile, "%s/" SOCK_NAME_ADMIN, rundir) < = 0) goto cleanup; } } @@ -910,14 +910,14 @@ daemonUsage(const char *argv0, bool privileged) " %s/run/libvirtd.pid\n" "\n"), LIBVIRTD_CONFIGURATION_FILE, - LIBVIRTD_PRIV_UNIX_SOCKET, - LIBVIRTD_PRIV_UNIX_SOCKET_RO, + LOCALSTATEDIR "/run/libvirt/" SOCK_NAME, + LOCALSTATEDIR "/run/libvirt/" SOCK_NAME_RO, LIBVIRT_CACERT, LIBVIRT_SERVERCERT, LIBVIRT_SERVERKEY, LOCALSTATEDIR); } else { - fprintf(stderr, "%s", + fprintf(stderr, _("\n" " Default paths:\n" "\n" @@ -925,7 +925,7 @@ daemonUsage(const char *argv0, bool privileged) " $XDG_CONFIG_HOME/libvirt/libvirtd.conf\n" "\n" " Sockets:\n" - " $XDG_RUNTIME_DIR/libvirt/libvirt-sock\n" + " $XDG_RUNTIME_DIR/libvirt/%s\n" "\n" " TLS:\n" " CA certificate: $HOME/.pki/libvirt/cacert.pem= \n" @@ -934,7 +934,8 @@ daemonUsage(const char *argv0, bool privileged) "\n" " PID file:\n" " $XDG_RUNTIME_DIR/libvirt/libvirtd.pid\n" - "\n")); + "\n"), + SOCK_NAME); } } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list