From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH V17 3/4] eal/linux: uevent parse and process Date: Thu, 29 Mar 2018 10:00:29 -0700 Message-ID: <20180329100029.2cbd3c82@xeon-e3> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 To: Jeff Guo Return-path: Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by dpdk.org (Postfix) with ESMTP id 5EC162B82 for ; Thu, 29 Mar 2018 19:00:37 +0200 (CEST) Received: by mail-pg0-f65.google.com with SMTP id b9so3442714pgf.6 for ; Thu, 29 Mar 2018 10:00:37 -0700 (PDT) In-Reply-To: <1522339205-27698-4-git-send-email-jia.guo@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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).