From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3m6vbT2P3U3Xxs2auknoqNACBbG77xgi4LCvrYPLB0Y=; b=oV72EhVTSxmCm1HqMkj6RQJgg/tdzlSYeR0dMll3P2b/nxpzHrjZYo1nnGzQq1Pee5 Wcw5AyJrlsLSBaiYYCvylh0j5EUluWPshD8dPyBIxvtJDoz21lPbNOHuidKIPlZz5No7 IMOIdABYwyEM87Cbq3iK5lr4DWiuuxb4d1HibjOv/8xedXu1c7C03B+9Ya4CDPUqihix QXlp6Sm1f33uxcRX9eXX6Sn1BavPDxKrK69WeHERk3eSCVa0WyTLUOyRUVi8mM2m85bL A7hvW2skl3vg2Mp1vHzi81zl2ncCsH0ZdHTAdq1CblF4cbab2lbon55JO2d9Wcz8VG1U J/Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3m6vbT2P3U3Xxs2auknoqNACBbG77xgi4LCvrYPLB0Y=; b=MADIO+C9n7TMUCXTvYKFIaOiPvHFD6+OBLMwHr/+s/NLddaxKb4QoOUFFZQ734AuV9 Y6s4P6oIQfIZqyWsgBdPPzxSvmhTWAy6Pn6lV82hCHC3f+y/MKtR1KvIyfFXxilxd4bK mHBXLapCAYu4A/eNLeae5iBUkkfikaaqaeDaz/TinepS+rR8rIkSGtVCe1b1vl6tk6Gy b7mM3c3WG81vLOp8vJXIo7qur5mvQZ14JnWxzhj/5e3/ZgkVKu789fhCW3PTba7NHr7y Sjv+OwMRqOBozslqKeomvPTai27irgK5KNQxWpq9PmsesONq9nrSL5hytD3KI8UliyKY Wvmg== X-Gm-Message-State: AElRT7FLbaOpUTGu/V/qyFt1zsJ1l29c+IBeqEwUGJ8AKtEeV27cdASF ko9rRC+FiQCS7ux93SWfnCIpCtlR8/A= X-Google-Smtp-Source: AIpwx49abKIhoyG9iNnTbQTyaNn7XUCZNHQ4QWMct4DMaWqeLn+G97DxD+so322Sfh7Ch40Nueovtg== X-Received: by 10.99.127.92 with SMTP id p28mr6161533pgn.305.1522342836514; Thu, 29 Mar 2018 10:00:36 -0700 (PDT) Received: from xeon-e3 (204-195-71-95.wavecable.com. [204.195.71.95]) by smtp.gmail.com with ESMTPSA id i127sm14888840pfc.136.2018.03.29.10.00.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Mar 2018 10:00:36 -0700 (PDT) Date: Thu, 29 Mar 2018 10:00:29 -0700 From: Stephen Hemminger To: Jeff Guo 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 Message-ID: <20180329100029.2cbd3c82@xeon-e3> In-Reply-To: <1522339205-27698-4-git-send-email-jia.guo@intel.com> 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 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: Thu, 29 Mar 2018 17:00:37 -0000 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).