From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by dpdk.org (Postfix) with ESMTP id D9A56C34A for ; Wed, 17 Jun 2015 06:17:14 +0200 (CEST) Received: by pacgb13 with SMTP id gb13so25850305pac.1 for ; Tue, 16 Jun 2015 21:17:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=nBTc6xn3bvMCXMaacFpo4FLoeWITdfm3nB8ADhvNv0I=; b=MSx+OmBodwOeZk415sVpJlxtZPFWVHFkCsMSM77U6Iq5UTZFy08BRNWyGbO40oEnLl 9qpxbgxQl3bCS1cAb4axBpWXxbqn5kcXncrXkTCuZR4ACJ+DVlD3yxjYXwo8+ycrVzzG ynN8WzCbEYRjuXKcqlAJ8vmogy5S5eBydRLwee7oBmJUgzZof1f5vVFfR8kxNhgRn8Em tIqoDObLhSnUxbi8QHcSAqPAR4v+SOr33LOCT4YSdYIy9dcH2jE6n+h71Q6GGzTuvCJA nKNLs3RuinxNJoncc/BV0nZEywCuSRSut4r/KWgCPWnwsftmOhSe2/6oe9DnRiPkhXaH Kqrw== X-Gm-Message-State: ALoCoQl49zuRnATHKDOsj//jP/6iOySRg8n8GdBwrkUdOzPH2B20IV7iP4Y/4iDNwnmXZLePn0sP X-Received: by 10.70.93.69 with SMTP id cs5mr6703969pdb.165.1434514634307; Tue, 16 Jun 2015 21:17:14 -0700 (PDT) Received: from [10.16.129.101] (napt.igel.co.jp. [219.106.231.132]) by mx.google.com with ESMTPSA id kh6sm2945366pbc.50.2015.06.16.21.17.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jun 2015 21:17:13 -0700 (PDT) Message-ID: <5580F4C7.30604@igel.co.jp> Date: Wed, 17 Jun 2015 13:17:11 +0900 From: Tetsuya Mukawa User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Huawei Xie , dev@dpdk.org References: <1433209800-29091-1-git-send-email-huawei.xie@intel.com> In-Reply-To: <1433209800-29091-1-git-send-email-huawei.xie@intel.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] vhost: provide vhost API to unregister vhost unix domain socket X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 04:17:15 -0000 On 2015/06/02 10:50, Huawei Xie wrote: > rte_vhost_driver_unregister will remove the listenfd from event list, and then close it. > > Signed-off-by: Huawei Xie > Signed-off-by: Peng Sun > --- > > +/** > + * Unregister the specified vhost server > + */ > +int > +rte_vhost_driver_unregister(const char *path) > +{ > + int i; > + int count; > + > + pthread_mutex_lock(&g_vhost_server.server_mutex); > + > + for (i = 0; i < g_vhost_server.vserver_cnt; i++) { > + if (!strcmp(g_vhost_server.server[i]->path, path)) { > + fdset_del(&g_vhost_server.fdset, > + g_vhost_server.server[i]->listenfd); > + > + close(g_vhost_server.server[i]->listenfd); > + free(g_vhost_server.server[i]->path); > + free(g_vhost_server.server[i]); > + > + unlink(path); > + > + count = --g_vhost_server.vserver_cnt; > + g_vhost_server.server[i] = > + g_vhost_server.server[count]; > + g_vhost_server.server[count] = > + NULL; > + pthread_mutex_unlock(&g_vhost_server.server_mutex); > + > + return 0; > + } > + } > + pthread_mutex_unlock(&g_vhost_server.server_mutex); > + > + return -1; > +} > + > Hi Xie, It seems vserver_cnt is incremented when socket is registered, and decremented when unregistered. And this value is used for index value of g_vhost_server.server[ ], when a new socket is registered. So I have a question about below case. Step1. socket0 is registered. Step2: scoekt1 is registered. Step3. socket0 is unregistered. Step4. socket2 is registered. After above steps, are socket1 and socket2 still registered? Thanks, Tetsuya