From patchwork Mon Jun 20 05:36:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eyal Birger X-Patchwork-Id: 637808 X-Patchwork-Delegate: nbd@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rY0775Vp3z9ryk for ; Mon, 20 Jun 2016 15:40:03 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=EYeTLNlq; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bErtr-0005cl-LB; Mon, 20 Jun 2016 05:37:31 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bErtq-0005aA-CQ for lede-dev@lists.infradead.org; Mon, 20 Jun 2016 05:37:30 +0000 Received: by mail-wm0-x241.google.com with SMTP id a66so6079896wme.2 for ; Sun, 19 Jun 2016 22:37:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=n81IZ8kvRuRes64KULT5WWWXVWA0/C88/PnrtNqQ+/c=; b=EYeTLNlqdBgtQDHpSn5EuGJhGGAHhv9f/lfwDQ1AZ1X/YH6qlnEMleYxKv5yKUbggz bxKGVyFVnbkPI+DlA1G7O6mF5Hqc9aozMoQVMBcv3rl41/Jfq9d788ep0gXnW81S2Eos oJZ+E2Kh7F8ubDX6UFHTm6PG9ofiWc3sclkCMpAKPGYf6gOhXyyhLG8dibvpfPj9n22S ypWbq+GpTIvRKuxYUHtDlLTunfHOUYg5A+iuprlQNVfT1h5fu0Jlf1j0++hhseBmmKhp zh+VnZDxJa1Qpg5o8cL16TwJwxTR6T5ro3bRYiyxL6EfIE1WyFS9x/AS8ZcslzANVw1/ G8wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=n81IZ8kvRuRes64KULT5WWWXVWA0/C88/PnrtNqQ+/c=; b=gY6rK4qHn7idWGe7y9cLHE/ok4YcBIF4zumod1Io/c+TH+1LX4KkZn7UBoCw2QMvzU s8Pn1GHEiAIioY+BF19U3X8LQR1YlbbBZDarszDXIRpKDUg66fXt+ej/+ZpndqcWy7HD t9gEUBuScNRBocihj4zuDV6cy9sKgHlkmjfClOmPossMug+wJmsU1WQ8qSbXEq5D3E3a 3v5Q9gzFbLt5xiqLNdLwTg3Es/YCrr7lwPLDjU3mM7aupgjzvXbT6DAjejW1ouSVRe5h efef9RNFoQyHdczp+3ArxVuvlO6p+HBLSQD03HmWySvqX0Y9Eie2WQe8UnRQj9oaRRUq riOw== X-Gm-Message-State: ALyK8tKEXshW4gOxTJHW0uH1mXdkkFUhm6CXehrF3jVpQ9rH4bXk2bfnX0+fyg6426KXsg== X-Received: by 10.28.66.148 with SMTP id k20mr9833473wmi.55.1466401028332; Sun, 19 Jun 2016 22:37:08 -0700 (PDT) Received: from netad9sh4952.netanya.eu.thmulti.com ([94.188.248.67]) by smtp.gmail.com with ESMTPSA id f196sm6410228wmg.15.2016.06.19.22.37.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Jun 2016 22:37:07 -0700 (PDT) From: Eyal Birger To: openwrt-devel@lists.openwrt.org, lede-dev@lists.infradead.org Date: Mon, 20 Jun 2016 08:36:47 +0300 Message-Id: <1466401007-30322-1-git-send-email-eyal.birger@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160619_223730_605383_38E61414 X-CRM114-Status: GOOD ( 15.37 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:241 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (eyal.birger[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [LEDE-DEV] [PATCH] uloop: handle waker pipe write() return value X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eyal Birger MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Recent glibc warns if result of read() or write() is unused. Added a retry in case of EINTR, all other faults are silently discarded. Signed-off-by: Eyal Birger ----- - I was not able to reproduce the EINTR case, but it seems to be the right thing to do - Retrying on EAGAIN in this case would be weird as there is no one to read from the other end of the pipe. We could call waker_consume() directly but since the size of the message is just one byte, I think this would be dead code --- uloop.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/uloop.c b/uloop.c index e60fb09..fd315c0 100644 --- a/uloop.c +++ b/uloop.c @@ -386,7 +386,13 @@ static void uloop_handle_processes(void) static void uloop_signal_wake(void) { - write(waker_pipe, "w", 1); + do { + if (write(waker_pipe, "w", 1) < 0) { + if (errno == EINTR) + continue; + } + break; + } while (1); } static void uloop_handle_sigint(int signo)