From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 2D2106841 for ; Mon, 2 Apr 2018 06:19:56 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Apr 2018 21:19:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,393,1517904000"; d="scan'208";a="47190280" Received: from jguo15x-mobl3.ccr.corp.intel.com (HELO [10.67.68.69]) ([10.67.68.69]) by orsmga002.jf.intel.com with ESMTP; 01 Apr 2018 21:19:52 -0700 To: Stephen Hemminger References: <1522063256-3997-5-git-send-email-jia.guo@intel.com> <1522339205-27698-1-git-send-email-jia.guo@intel.com> <1522339205-27698-4-git-send-email-jia.guo@intel.com> <20180329100029.2cbd3c82@xeon-e3> Cc: bruce.richardson@intel.com, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, gaetan.rivet@6wind.com, jingjing.wu@intel.com, thomas@monjalon.net, motih@mellanox.com, harry.van.haaren@intel.com, jianfeng.tan@intel.com, jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org, helin.zhang@intel.com From: "Guo, Jia" Message-ID: <64aec0c7-b455-2a13-8d6b-c55ecb2eecdb@intel.com> Date: Mon, 2 Apr 2018 12:19:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20180329100029.2cbd3c82@xeon-e3> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH V17 3/4] eal/linux: uevent parse and process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 04:19:56 -0000 On 3/30/2018 1:00 AM, Stephen Hemminger wrote: > On Fri, 30 Mar 2018 00:00:04 +0800 > Jeff Guo wrote: > >> +dev_uev_monitor_create(int netlink_fd) >> +{ >> + struct sockaddr_nl addr; >> + int ret; >> + int size = 64 * 1024; >> + int nonblock = 1; >> + >> + memset(&addr, 0, sizeof(addr)); >> + addr.nl_family = AF_NETLINK; >> + addr.nl_pid = 0; >> + addr.nl_groups = 0xffffffff; >> + >> + if (bind(netlink_fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { >> + RTE_LOG(ERR, EAL, "Failed to bind socket for netlink fd.\n"); >> + goto err; >> + } >> + >> + setsockopt(netlink_fd, SOL_SOCKET, SO_PASSCRED, &size, sizeof(size)); >> + >> + ret = ioctl(netlink_fd, FIONBIO, &nonblock); >> + if (ret != 0) { >> + RTE_LOG(ERR, EAL, "ioctl(FIONBIO) failed.\n"); >> + goto err; >> + } >> + return 0; >> +err: > You should set close on exec for this fd (with fcntl). yes, but i have already set it when fd creation time by SOCK_CLOEXEC.