From nobody Tue May 7 01:20:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1637956361; cv=none; d=zohomail.com; s=zohoarc; b=GzAMVPxqEDQnQFNwIDoqHuDJteAQaQnG/+ncwk7DDfRpT5bWUhMwknnaI388G2golSA57hZPl9yrD3tSE5nwCAXj73KulDr2mHBth/pPUjJlmMi3Jv5mBTK+nDOs+cGxdHJRZnobfZ1Qezs8JugE+nrLP8ldOGBqRbfT64sRuNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637956361; 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=A5nRTSj0LoJBHcNnW7y39u23Nic455Cz37fj9soUTDw=; b=Xg/T6RwoTPm99dcs9xDvByAF5CxlSuIOnD1scdshNh802XiwDmdH+ZHMTfQ+/HZn7Zm0Gwlsaq/7duob2//KQQYtBuB95iAV/YHD8Mf+beE4sZsBCLcnAWd/SHqdA7ZbLoE+iV8xmRW+ew5NQYWR008G8kz5HQo3fl8d4ZLtpis= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1637956361407850.6106995055798; Fri, 26 Nov 2021 11:52:41 -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-77-Ys9OLF9vOI2plgT_edTniA-1; Fri, 26 Nov 2021 14:52:37 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D73E81CCB5; Fri, 26 Nov 2021 19:52:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 964815D9C0; Fri, 26 Nov 2021 19:52:31 +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 B2AC81809CB7; Fri, 26 Nov 2021 19:52:27 +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 1AQJqPxK013317 for ; Fri, 26 Nov 2021 14:52:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id D879C177C0; Fri, 26 Nov 2021 19:52:25 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.161]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA40C5C1CF for ; Fri, 26 Nov 2021 19:52:22 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 88E0118008E; Fri, 26 Nov 2021 20:52:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637956360; 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=A5nRTSj0LoJBHcNnW7y39u23Nic455Cz37fj9soUTDw=; b=CmL5o2U5hKZkhcgz8OmpFn3DoeMEUQO/6RZZLDZeTT3DzQlqpxzPj3Iwf+lAajz44Hp4ZX 7RWZXC7OA0lsUWnO6OBiWBB2acHmYxWQuS6EA01G92VaoAkVsBARQtq/kqWmWO64/TvbJF QUXMG1saGHQNsuu02zplQ7mQqmDjSSs= X-MC-Unique: Ys9OLF9vOI2plgT_edTniA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] virthreadpool: Copy job name Date: Fri, 26 Nov 2021 20:52:16 +0100 Message-Id: <607bfbca0dcad58c4f2725f44b0fad17fb558741.1637956256.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.79 on 10.5.11.14 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: 1637956362615100002 Content-Type: text/plain; charset="utf-8" Currently virThreadPoolNewFull relies on the caller to ensure the job name outlives the thread pool. Which basically enforces static strings. Let's drop this implicit requirement by making a copy of the job name. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/util/virthreadpool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c index 7bf4333885..426840e435 100644 --- a/src/util/virthreadpool.c +++ b/src/util/virthreadpool.c @@ -50,7 +50,7 @@ struct _virThreadPool { bool quit; =20 virThreadPoolJobFunc jobFunc; - const char *jobName; + char *jobName; void *jobOpaque; virThreadPoolJobList jobList; size_t jobQueueDepth; @@ -237,7 +237,7 @@ virThreadPoolNewFull(size_t minWorkers, pool->jobList.tail =3D pool->jobList.head =3D NULL; =20 pool->jobFunc =3D func; - pool->jobName =3D name; + pool->jobName =3D g_strdup(name); pool->jobOpaque =3D opaque; =20 if (identity) @@ -312,6 +312,7 @@ void virThreadPoolFree(virThreadPool *pool) if (pool->identity) g_object_unref(pool->identity); =20 + g_free(pool->jobName); g_free(pool->workers); virMutexUnlock(&pool->mutex); virMutexDestroy(&pool->mutex); --=20 2.34.0 From nobody Tue May 7 01:20:07 2024 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=1637956360; cv=none; d=zohomail.com; s=zohoarc; b=GFA6zCZgLxIl1oFeH2YJyuMarm+AFVZ0jKurKXVPyCEF32NwycY+cl57X6T/TxN23/8Uedtv82u7Byt9cX0tSGTJ0+qB87nXHvAMI3VgjhITHJCZ/f/yaTo95d461B5J+2WZzyV03Ug5uo/aCa+FIOAnhPKrvDLPrrfrhDgVtpU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637956360; 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=jAzLdCdsIH7tHn40A8s2OvaVnfUL+GU6SC3AeKMFOVs=; b=Y/NKNyoo5Zu3I3lI7mhC0G3QtYLmYgEQTmctdXC33ACxTFWpZVV73Tr1RfSDLUR6jTK/OIbeahRIRylSt2gm4K4qnCs0R30Z7NcFC0OJHBCfPHohwuZUoa8LwLgmXeVPItGfkcP0G+f/DI5uXuk6sOkjjWbmVkRSFxTuVsQh5uc= 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 1637956360556302.76212783160406; Fri, 26 Nov 2021 11:52:40 -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-16-J43uQf4eNJ2fKVkkWAM4tw-1; Fri, 26 Nov 2021 14:52:37 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D9002F20; Fri, 26 Nov 2021 19:52:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C55565C1CF; Fri, 26 Nov 2021 19:52:30 +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 939651809C8A; Fri, 26 Nov 2021 19:52:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AQJqQRu013337 for ; Fri, 26 Nov 2021 14:52:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 76CB460BF4; Fri, 26 Nov 2021 19:52:26 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.161]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F050160BF1 for ; Fri, 26 Nov 2021 19:52:22 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 8B29F18BB2F; Fri, 26 Nov 2021 20:52:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637956359; 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=jAzLdCdsIH7tHn40A8s2OvaVnfUL+GU6SC3AeKMFOVs=; b=cZZIo678fkDIo42bfO9/eiXjzDyYYA6HHC3toe0sxv8zpOFDGPsIKfePLmcPq+nB7Epn55 TGJaz2cDjOJ9ljqfQqXzYTkTJyTZP2a7hONEG3v/XmWBqdG5QFqhtxu7JxyJ/9w/k97/Tu k4LYut0dXmzyr7ISmepMzXJvJmdrS58= X-MC-Unique: J43uQf4eNJ2fKVkkWAM4tw-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] virnetserver: Format functions consistently Date: Fri, 26 Nov 2021 20:52:17 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.79 on 10.5.11.16 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: 1637956362625100003 Content-Type: text/plain; charset="utf-8" The file used a pretty inconsistent style for formatting function headers. Return types were both separate and on the same line as function names and functions were separated by one, two, and sometimes even three empty lines. Let's make it consistent by honoring our preferred coding style. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/rpc/virnetserver.c | 180 +++++++++++++++++++++++++---------------- 1 file changed, 112 insertions(+), 68 deletions(-) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index c7b4939398..f016f15f39 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -82,7 +82,8 @@ static void virNetServerUpdateServicesLocked(virNetServer= *srv, static inline size_t virNetServerTrackPendingAuthLocked(virNetServer *srv); static inline size_t virNetServerTrackCompletedAuthLocked(virNetServer *sr= v); =20 -static int virNetServerOnceInit(void) +static int +virNetServerOnceInit(void) { if (!VIR_CLASS_NEW(virNetServer, virClassForObjectLockable())) return -1; @@ -92,7 +93,9 @@ static int virNetServerOnceInit(void) =20 VIR_ONCE_GLOBAL_INIT(virNetServer); =20 -unsigned long long virNetServerNextClientID(virNetServer *srv) + +unsigned long long +virNetServerNextClientID(virNetServer *srv) { unsigned long long val; =20 @@ -103,10 +106,12 @@ unsigned long long virNetServerNextClientID(virNetSer= ver *srv) return val; } =20 -static int virNetServerProcessMsg(virNetServer *srv, - virNetServerClient *client, - virNetServerProgram *prog, - virNetMessage *msg) + +static int +virNetServerProcessMsg(virNetServer *srv, + virNetServerClient *client, + virNetServerProgram *prog, + virNetMessage *msg) { if (!prog) { /* Only send back an error for type =3D=3D CALL. Other @@ -141,7 +146,10 @@ static int virNetServerProcessMsg(virNetServer *srv, return 0; } =20 -static void virNetServerHandleJob(void *jobOpaque, void *opaque) + +static void +virNetServerHandleJob(void *jobOpaque, + void *opaque) { virNetServer *srv =3D opaque; virNetServerJob *job =3D jobOpaque; @@ -165,6 +173,7 @@ static void virNetServerHandleJob(void *jobOpaque, void= *opaque) VIR_FREE(job); } =20 + /** * virNetServerGetProgramLocked: * @srv: server (must be locked by the caller) @@ -186,6 +195,7 @@ virNetServerGetProgramLocked(virNetServer *srv, return NULL; } =20 + static void virNetServerDispatchNewMessage(virNetServerClient *client, virNetMessage *msg, @@ -289,8 +299,10 @@ virNetServerCheckLimits(virNetServer *srv) } } =20 -int virNetServerAddClient(virNetServer *srv, - virNetServerClient *client) + +int +virNetServerAddClient(virNetServer *srv, + virNetServerClient *client) { virObjectLock(srv); =20 @@ -323,9 +335,11 @@ int virNetServerAddClient(virNetServer *srv, return -1; } =20 -static int virNetServerDispatchNewClient(virNetServerService *svc, - virNetSocket *clientsock, - void *opaque) + +static int +virNetServerDispatchNewClient(virNetServerService *svc, + virNetSocket *clientsock, + void *opaque) { virNetServer *srv =3D opaque; virNetServerClient *client; @@ -352,19 +366,20 @@ static int virNetServerDispatchNewClient(virNetServer= Service *svc, } =20 =20 -virNetServer *virNetServerNew(const char *name, - unsigned long long next_client_id, - size_t min_workers, - size_t max_workers, - size_t priority_workers, - size_t max_clients, - size_t max_anonymous_clients, - int keepaliveInterval, - unsigned int keepaliveCount, - virNetServerClientPrivNew clientPrivNew, - virNetServerClientPrivPreExecRestart clien= tPrivPreExecRestart, - virFreeCallback clientPrivFree, - void *clientPrivOpaque) +virNetServer * +virNetServerNew(const char *name, + unsigned long long next_client_id, + size_t min_workers, + size_t max_workers, + size_t priority_workers, + size_t max_clients, + size_t max_anonymous_clients, + int keepaliveInterval, + unsigned int keepaliveCount, + virNetServerClientPrivNew clientPrivNew, + virNetServerClientPrivPreExecRestart clientPrivPreExecRest= art, + virFreeCallback clientPrivFree, + void *clientPrivOpaque) { virNetServer *srv; =20 @@ -401,13 +416,14 @@ virNetServer *virNetServerNew(const char *name, } =20 =20 -virNetServer *virNetServerNewPostExecRestart(virJSONValue *object, - const char *name, - virNetServerClientPrivNew c= lientPrivNew, - virNetServerClientPrivNewPo= stExecRestart clientPrivNewPostExecRestart, - virNetServerClientPrivPreEx= ecRestart clientPrivPreExecRestart, - virFreeCallback clientPrivF= ree, - void *clientPrivOpaque) +virNetServer * +virNetServerNewPostExecRestart(virJSONValue *object, + const char *name, + virNetServerClientPrivNew clientPrivNew, + virNetServerClientPrivNewPostExecRestart cl= ientPrivNewPostExecRestart, + virNetServerClientPrivPreExecRestart client= PrivPreExecRestart, + virFreeCallback clientPrivFree, + void *clientPrivOpaque) { virNetServer *srv =3D NULL; virJSONValue *clients; @@ -553,7 +569,8 @@ virNetServer *virNetServerNewPostExecRestart(virJSONVal= ue *object, } =20 =20 -virJSONValue *virNetServerPreExecRestart(virNetServer *srv) +virJSONValue * +virNetServerPreExecRestart(virNetServer *srv) { g_autoptr(virJSONValue) object =3D virJSONValueNewObject(); g_autoptr(virJSONValue) clients =3D virJSONValueNewArray(); @@ -621,9 +638,9 @@ virJSONValue *virNetServerPreExecRestart(virNetServer *= srv) } =20 =20 - -int virNetServerAddService(virNetServer *srv, - virNetServerService *svc) +int +virNetServerAddService(virNetServer *srv, + virNetServerService *svc) { virObjectLock(srv); =20 @@ -687,17 +704,18 @@ virNetServerAddServiceActivation(virNetServer *srv, } =20 =20 -int virNetServerAddServiceTCP(virNetServer *srv, - virSystemdActivation *act, - const char *actname, - const char *nodename, - const char *service, - int family, - int auth, - virNetTLSContext *tls, - bool readonly, - size_t max_queued_clients, - size_t nrequests_client_max) +int +virNetServerAddServiceTCP(virNetServer *srv, + virSystemdActivation *act, + const char *actname, + const char *nodename, + const char *service, + int family, + int auth, + virNetTLSContext *tls, + bool readonly, + size_t max_queued_clients, + size_t nrequests_client_max) { virNetServerService *svc =3D NULL; int ret; @@ -735,17 +753,18 @@ int virNetServerAddServiceTCP(virNetServer *srv, } =20 =20 -int virNetServerAddServiceUNIX(virNetServer *srv, - virSystemdActivation *act, - const char *actname, - const char *path, - mode_t mask, - gid_t grp, - int auth, - virNetTLSContext *tls, - bool readonly, - size_t max_queued_clients, - size_t nrequests_client_max) +int +virNetServerAddServiceUNIX(virNetServer *srv, + virSystemdActivation *act, + const char *actname, + const char *path, + mode_t mask, + gid_t grp, + int auth, + virNetTLSContext *tls, + bool readonly, + size_t max_queued_clients, + size_t nrequests_client_max) { virNetServerService *svc =3D NULL; int ret; @@ -783,8 +802,9 @@ int virNetServerAddServiceUNIX(virNetServer *srv, } =20 =20 -int virNetServerAddProgram(virNetServer *srv, - virNetServerProgram *prog) +int +virNetServerAddProgram(virNetServer *srv, + virNetServerProgram *prog) { virObjectLock(srv); =20 @@ -795,8 +815,10 @@ int virNetServerAddProgram(virNetServer *srv, return 0; } =20 -int virNetServerSetTLSContext(virNetServer *srv, - virNetTLSContext *tls) + +int +virNetServerSetTLSContext(virNetServer *srv, + virNetTLSContext *tls) { srv->tls =3D virObjectRef(tls); return 0; @@ -856,15 +878,18 @@ virNetServerUpdateServicesLocked(virNetServer *srv, } =20 =20 -void virNetServerUpdateServices(virNetServer *srv, - bool enabled) +void +virNetServerUpdateServices(virNetServer *srv, + bool enabled) { virObjectLock(srv); virNetServerUpdateServicesLocked(srv, enabled); virObjectUnlock(srv); } =20 -void virNetServerDispose(void *obj) + +void +virNetServerDispose(void *obj) { virNetServer *srv =3D obj; size_t i; @@ -886,7 +911,9 @@ void virNetServerDispose(void *obj) g_free(srv->clients); } =20 -void virNetServerClose(virNetServer *srv) + +void +virNetServerClose(virNetServer *srv) { size_t i; =20 @@ -906,18 +933,21 @@ void virNetServerClose(virNetServer *srv) virObjectUnlock(srv); } =20 + void virNetServerShutdownWait(virNetServer *srv) { virThreadPoolDrain(srv->workers); } =20 + static inline size_t virNetServerTrackPendingAuthLocked(virNetServer *srv) { return ++srv->nclients_unauth; } =20 + static inline size_t virNetServerTrackCompletedAuthLocked(virNetServer *srv) { @@ -937,6 +967,7 @@ virNetServerHasClients(virNetServer *srv) return ret; } =20 + void virNetServerProcessClients(virNetServer *srv) { @@ -974,12 +1005,14 @@ virNetServerProcessClients(virNetServer *srv) virObjectUnlock(srv); } =20 + const char * virNetServerGetName(virNetServer *srv) { return srv->name; } =20 + int virNetServerGetThreadPoolParameters(virNetServer *srv, size_t *minWorkers, @@ -1002,6 +1035,7 @@ virNetServerGetThreadPoolParameters(virNetServer *srv, return 0; } =20 + int virNetServerSetThreadPoolParameters(virNetServer *srv, long long int minWorkers, @@ -1018,6 +1052,7 @@ virNetServerSetThreadPoolParameters(virNetServer *srv, return ret; } =20 + size_t virNetServerGetMaxClients(virNetServer *srv) { @@ -1030,6 +1065,7 @@ virNetServerGetMaxClients(virNetServer *srv) return ret; } =20 + size_t virNetServerGetCurrentClients(virNetServer *srv) { @@ -1042,6 +1078,7 @@ virNetServerGetCurrentClients(virNetServer *srv) return ret; } =20 + size_t virNetServerGetMaxUnauthClients(virNetServer *srv) { @@ -1054,6 +1091,7 @@ virNetServerGetMaxUnauthClients(virNetServer *srv) return ret; } =20 + size_t virNetServerGetCurrentUnauthClients(virNetServer *srv) { @@ -1067,8 +1105,9 @@ virNetServerGetCurrentUnauthClients(virNetServer *srv) } =20 =20 -bool virNetServerNeedsAuth(virNetServer *srv, - int auth) +bool +virNetServerNeedsAuth(virNetServer *srv, + int auth) { bool ret =3D false; size_t i; @@ -1083,6 +1122,7 @@ bool virNetServerNeedsAuth(virNetServer *srv, return ret; } =20 + int virNetServerGetClients(virNetServer *srv, virNetServerClient ***clts) @@ -1105,6 +1145,7 @@ virNetServerGetClients(virNetServer *srv, return nclients; } =20 + virNetServerClient * virNetServerGetClient(virNetServer *srv, unsigned long long id) @@ -1128,6 +1169,7 @@ virNetServerGetClient(virNetServer *srv, return ret; } =20 + int virNetServerSetClientLimits(virNetServer *srv, long long int maxClients, @@ -1164,6 +1206,7 @@ virNetServerSetClientLimits(virNetServer *srv, return ret; } =20 + static virNetTLSContext * virNetServerGetTLSContext(virNetServer *srv) { @@ -1182,6 +1225,7 @@ virNetServerGetTLSContext(virNetServer *srv) return ctxt; } =20 + int virNetServerUpdateTlsFiles(virNetServer *srv) { --=20 2.34.0 From nobody Tue May 7 01:20:07 2024 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=1637956376; cv=none; d=zohomail.com; s=zohoarc; b=ln5D9CnWwneModS/yir0Rk6jB56hySz84bdBXB0Hn2JqxvC17Ir/nuDO0wPWeo/8XpRZ0VTjqS99+019fIYiau2mSU/Kj/ablOGmAbgbcteNKdOzF8kTxG+WLRcV6OhyG/pBm/dBtPJpuNNutHZ4u/ZLh619cmof330EZtjmVsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637956376; 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=fGGXI4tDBDd4UKpsrytlQBuRdnjObD1yNn4CIDjiSYE=; b=OTHqxdKAnFcL0A6nXUpPN5nvGj52nT5jBW03t4uOWg1rgj+4QmBicqqUIpOlW2A+bC/N3mSF1QpzZawQLL77e3M5boYGmSiCQOcR6O+wlhFlES/iL5NssWznT+ktCRpU08DI48b7GIqu+YsDhy65rYG8HF8KgMWA0SSyllz21y0= 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 1637956376136780.446466778973; Fri, 26 Nov 2021 11:52:56 -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-366-1cEUyrspNSKsq4v19ZgMqA-1; Fri, 26 Nov 2021 14:52:53 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92CC281CCB5; Fri, 26 Nov 2021 19:52:48 +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 774E4ADD6; Fri, 26 Nov 2021 19:52:48 +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 45C974A7CB; Fri, 26 Nov 2021 19:52:48 +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 1AQJqQRl013327 for ; Fri, 26 Nov 2021 14:52:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1551F5D9CA; Fri, 26 Nov 2021 19:52:26 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.161]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B68F65D9C0 for ; Fri, 26 Nov 2021 19:52:22 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 8D8F518BB30; Fri, 26 Nov 2021 20:52:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637956375; 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=fGGXI4tDBDd4UKpsrytlQBuRdnjObD1yNn4CIDjiSYE=; b=eEedGR+4xM2mJewZoIx03ZNc44rNIyXkXMagdU9Q9xt0CE8BdhtVUisQYNgx72sMuo5S/C TSaHu4S/ooHaShkLDmfIw9MsOTpNv8C84QSfd3gncPeNlUnhqhM34uUC95J4eLd+Ik0aIO oz1DSun7l/RIeMbWE2h8vTEzD539D2k= X-MC-Unique: 1cEUyrspNSKsq4v19ZgMqA-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] virnetserver: Use autoptr for virNetServer and virNetServerClient Date: Fri, 26 Nov 2021 20:52:18 +0100 Message-Id: <7e9b10c42cd70cd5a0d85a60942562996742c825.1637956256.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.79 on 10.5.11.14 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: 1637956376482100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/rpc/virnetserver.c | 64 +++++++++++++++--------------------- src/rpc/virnetserverclient.h | 2 ++ 2 files changed, 28 insertions(+), 38 deletions(-) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index f016f15f39..d0f248e7f5 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -342,7 +342,7 @@ virNetServerDispatchNewClient(virNetServerService *svc, void *opaque) { virNetServer *srv =3D opaque; - virNetServerClient *client; + g_autoptr(virNetServerClient) client =3D NULL; =20 if (!(client =3D virNetServerClientNew(virNetServerNextClientID(srv), clientsock, @@ -358,10 +358,8 @@ virNetServerDispatchNewClient(virNetServerService *svc, =20 if (virNetServerAddClient(srv, client) < 0) { virNetServerClientClose(client); - virObjectUnref(client); return -1; } - virObjectUnref(client); return 0; } =20 @@ -381,7 +379,7 @@ virNetServerNew(const char *name, virFreeCallback clientPrivFree, void *clientPrivOpaque) { - virNetServer *srv; + g_autoptr(virNetServer) srv =3D NULL; =20 if (virNetServerInitialize() < 0) return NULL; @@ -395,7 +393,7 @@ virNetServerNew(const char *name, "rpc-worker", NULL, srv))) - goto error; + return NULL; =20 srv->name =3D g_strdup(name); =20 @@ -409,10 +407,7 @@ virNetServerNew(const char *name, srv->clientPrivFree =3D clientPrivFree; srv->clientPrivOpaque =3D clientPrivOpaque; =20 - return srv; - error: - virObjectUnref(srv); - return NULL; + return g_steal_pointer(&srv); } =20 =20 @@ -425,7 +420,7 @@ virNetServerNewPostExecRestart(virJSONValue *object, virFreeCallback clientPrivFree, void *clientPrivOpaque) { - virNetServer *srv =3D NULL; + g_autoptr(virNetServer) srv =3D NULL; virJSONValue *clients; virJSONValue *services; size_t i; @@ -441,29 +436,29 @@ virNetServerNewPostExecRestart(virJSONValue *object, if (virJSONValueObjectGetNumberUint(object, "min_workers", &min_worker= s) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing min_workers data in JSON document")); - goto error; + return NULL; } if (virJSONValueObjectGetNumberUint(object, "max_workers", &max_worker= s) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing max_workers data in JSON document")); - goto error; + return NULL; } if (virJSONValueObjectGetNumberUint(object, "priority_workers", &prior= ity_workers) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing priority_workers data in JSON document")= ); - goto error; + return NULL; } if (virJSONValueObjectGetNumberUint(object, "max_clients", &max_client= s) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing max_clients data in JSON document")); - goto error; + return NULL; } if (virJSONValueObjectHasKey(object, "max_anonymous_clients")) { if (virJSONValueObjectGetNumberUint(object, "max_anonymous_clients= ", &max_anonymous_clients) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Malformed max_anonymous_clients data in JSON= document")); - goto error; + return NULL; } } else { max_anonymous_clients =3D max_clients; @@ -471,12 +466,12 @@ virNetServerNewPostExecRestart(virJSONValue *object, if (virJSONValueObjectGetNumberUint(object, "keepaliveInterval", &keep= aliveInterval) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing keepaliveInterval data in JSON document"= )); - goto error; + return NULL; } if (virJSONValueObjectGetNumberUint(object, "keepaliveCount", &keepali= veCount) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing keepaliveCount data in JSON document")); - goto error; + return NULL; } =20 if (virJSONValueObjectGetNumberUlong(object, "next_client_id", @@ -492,18 +487,18 @@ virNetServerNewPostExecRestart(virJSONValue *object, keepaliveInterval, keepaliveCount, clientPrivNew, clientPrivPreExecRestart, clientPrivFree, clientPrivOpaque))) - goto error; + return NULL; =20 if (!(services =3D virJSONValueObjectGet(object, "services"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing services data in JSON document")); - goto error; + return NULL; } =20 if (!virJSONValueIsArray(services)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Malformed services array")); - goto error; + return NULL; } =20 for (i =3D 0; i < virJSONValueArraySize(services); i++) { @@ -512,15 +507,15 @@ virNetServerNewPostExecRestart(virJSONValue *object, if (!child) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing service data in JSON document")); - goto error; + return NULL; } =20 if (!(service =3D virNetServerServiceNewPostExecRestart(child))) - goto error; + return NULL; =20 if (virNetServerAddService(srv, service) < 0) { virObjectUnref(service); - goto error; + return NULL; } } =20 @@ -528,22 +523,22 @@ virNetServerNewPostExecRestart(virJSONValue *object, if (!(clients =3D virJSONValueObjectGet(object, "clients"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing clients data in JSON document")); - goto error; + return NULL; } =20 if (!virJSONValueIsArray(clients)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Malformed clients array")); - goto error; + return NULL; } =20 for (i =3D 0; i < virJSONValueArraySize(clients); i++) { - virNetServerClient *client; + g_autoptr(virNetServerClient) client =3D NULL; virJSONValue *child =3D virJSONValueArrayGet(clients, i); if (!child) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing client data in JSON document")); - goto error; + return NULL; } =20 if (!(client =3D virNetServerClientNewPostExecRestart(srv, @@ -552,20 +547,13 @@ virNetServerNewPostExecRestart(virJSONValue *object, clientPrivPreE= xecRestart, clientPrivFree, clientPrivOpaq= ue))) - goto error; + return NULL; =20 - if (virNetServerAddClient(srv, client) < 0) { - virObjectUnref(client); - goto error; - } - virObjectUnref(client); + if (virNetServerAddClient(srv, client) < 0) + return NULL; } =20 - return srv; - - error: - virObjectUnref(srv); - return NULL; + return g_steal_pointer(&srv); } =20 =20 diff --git a/src/rpc/virnetserverclient.h b/src/rpc/virnetserverclient.h index a9d0afe95a..0d585eb2ce 100644 --- a/src/rpc/virnetserverclient.h +++ b/src/rpc/virnetserverclient.h @@ -28,8 +28,10 @@ #include "virjson.h" =20 typedef struct _virNetServer virNetServer; +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetServer, virObjectUnref); =20 typedef struct _virNetServerClient virNetServerClient; +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetServerClient, virObjectUnref); =20 /* This function owns the "msg" pointer it is passed and * must arrange for virNetMessageFree to be called on it --=20 2.34.0 From nobody Tue May 7 01:20:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1637956377; cv=none; d=zohomail.com; s=zohoarc; b=E7RS6TUAHqdfrx65F7go6YJIhZnqoYqQ/02GmYgqNpKeJ5VIvK/bylMJHiQJ/z3jDq279o9vFbXJ4CYNIktwqX1uftWwl/w/PfyD0d7vNlxYHSNRBEcg/0tvy4stGCMoo75KxL/fQwSoeczTSunRhOxZv7KNJiqKGkgkN+nE4Z8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637956377; 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=ptdRDFgOFQ8KzcxUyhGTej5tria+bz5h2kkZ78fBbsk=; b=ntPVhqkSwSWlNk8vIR2FnbBvOGqlCSdIiNiWDG6rlUj7UhCE3V27AIQDTW+XKZtOKWlsVWj4YtdcvPfFqz4jLQaw24rBM4JXbyDR5SBkl5McV2zEKaYRl1i/rxKleF3UCG66usrcE8I5l5RFrm3HiA5MpkzBDdQLtos7TwJeEh4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1637956377702777.665101623336; Fri, 26 Nov 2021 11:52:57 -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-283-HSAasDkoMzaB2lDYAE678w-1; Fri, 26 Nov 2021 14:52:53 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F5DA1853024; Fri, 26 Nov 2021 19:52:48 +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 7294960C4A; Fri, 26 Nov 2021 19:52:48 +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 41F9A4A7CA; Fri, 26 Nov 2021 19:52:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AQJqQsI013332 for ; Fri, 26 Nov 2021 14:52:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2800560C4A; Fri, 26 Nov 2021 19:52:26 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.161]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F054E60BF4 for ; Fri, 26 Nov 2021 19:52:22 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 8FD0D18BB76; Fri, 26 Nov 2021 20:52:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637956376; 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=ptdRDFgOFQ8KzcxUyhGTej5tria+bz5h2kkZ78fBbsk=; b=ZPp7G0h8hP023aFetx/kBxOk92RAko7aM0qs5CCNo6QQtkmNoYC7p2g9phYP/b1qYJ7jRl ktuPErD7CWfeiiGybF03Nacuzm5PVoQE/99IEgOVncDYp1l/wu624u1JhLpBbeYSoKMpvK 1DEC9MFnWxbayrGaI23lHZW+HcEoexQ= X-MC-Unique: HSAasDkoMzaB2lDYAE678w-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] virnetserver: Make pool job name less generic Date: Fri, 26 Nov 2021 20:52:19 +0100 Message-Id: <4b14c8ef0b6274e742f3f22dc48cc0cd58155f66.1637956256.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.79 on 10.5.11.12 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: 1637956378708100001 Content-Type: text/plain; charset="utf-8" The generic "rpc-worker" name becomes a name of the associated task, which may than appear in logs and bring some confusion. Let's add a server name to it so that one can easily see which daemon the task belongs to, which is especially useful for split daemons. And since the name would be too long, we can drop the "-worker" part and just keep it as "rpc-*" and "prio-rpc-*". Such confusing entries can, for example, be found in audit log when SELinux is complaining that "rpc-worker" was denied access to something. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/rpc/virnetserver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index d0f248e7f5..ad581a36dd 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -380,6 +380,7 @@ virNetServerNew(const char *name, void *clientPrivOpaque) { g_autoptr(virNetServer) srv =3D NULL; + g_autofree char *jobName =3D g_strdup_printf("rpc-%s", name); =20 if (virNetServerInitialize() < 0) return NULL; @@ -390,7 +391,7 @@ virNetServerNew(const char *name, if (!(srv->workers =3D virThreadPoolNewFull(min_workers, max_workers, priority_workers, virNetServerHandleJob, - "rpc-worker", + jobName, NULL, srv))) return NULL; --=20 2.34.0