From patchwork Fri Apr 1 09:40:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 64835 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp606560lbc; Fri, 1 Apr 2016 01:40:46 -0700 (PDT) X-Received: by 10.140.252.197 with SMTP id x188mr24439282qhc.81.1459500046567; Fri, 01 Apr 2016 01:40:46 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g8si11175950qgf.54.2016.04.01.01.40.46; Fri, 01 Apr 2016 01:40:46 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id E748A61B40; Fri, 1 Apr 2016 08:40:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B460F61967; Fri, 1 Apr 2016 08:40:42 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 715A761A52; Fri, 1 Apr 2016 08:40:40 +0000 (UTC) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by lists.linaro.org (Postfix) with ESMTPS id 7551E61957 for ; Fri, 1 Apr 2016 08:40:39 +0000 (UTC) Received: by mail-lb0-f177.google.com with SMTP id vo2so67691456lbb.1 for ; Fri, 01 Apr 2016 01:40:39 -0700 (PDT) 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=KLZ0xfehRNGlDKCjMSQ/9OVEosZgPkAHG6qeS1r8/Y8=; b=JtE7AXqaJVSZKG0SgGXVtgjs+Sy9fMqQXak9X6uYLj3UXG1Hd6R5wJPr9jNYyO5J9x 4Lte6AcGVDEComOJgqn8rmEGnL8WG5UqTPEQDTaHkUuEGzXgdrYlT6J3292cHzG25oCd r9hPQqnUlFv1ZFHBB8nIfHCAYdQS4pbWcfOcHLF9c2I4CoNpqf8PWcautIT9XMIbo8Xn 3QxGNgVT48eJhMVS+DcmMBjRtwaPRDyJCc+0YdPIqNFV8QFB6uyv/VsDoCPRhqh1/g0O UI11OL6xnHYAImGRrWRxMlRxLI006YCmolVo2TAfevZ9VgyZw7SGxymwOAVabgLwdX4k CMJw== X-Gm-Message-State: AD7BkJJHYuqg4atahyv1bv33FqDM6FTAVMO+CpDbxwXT7Ohoi4muPlKjwJSw1Fa10wEktkgfu7o= X-Received: by 10.112.140.41 with SMTP id rd9mr2102019lbb.138.1459500037863; Fri, 01 Apr 2016 01:40:37 -0700 (PDT) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id xf10sm1992823lbb.23.2016.04.01.01.40.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Apr 2016 01:40:37 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, bill.fischofer@linaro.org Date: Fri, 1 Apr 2016 11:40:04 +0200 Message-Id: <1459503604-4622-1-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.1.4 X-Topics: patch Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [PATCHv3] linux-generic: test: shmem: atomic check+open fifo X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Fixes: https://bugs.linaro.org/show_bug.cgi?id=2146 (CID 159395) The open system call is directely used to check the presence of the fifo and open it at the same time. Signed-off-by: Christophe Milard --- since v2: bug URL added (Anders) since v1: changed loop to avoid open() line duplication (Maxim) platform/linux-generic/test/shmem/shmem_linux.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/test/shmem/shmem_linux.c b/platform/linux-generic/test/shmem/shmem_linux.c index 12266cc..0f15c9e 100644 --- a/platform/linux-generic/test/shmem/shmem_linux.c +++ b/platform/linux-generic/test/shmem/shmem_linux.c @@ -115,12 +115,14 @@ int main(int argc __attribute__((unused)), char *argv[]) * Just die if time expire as there is no fifo to communicate * through... */ sprintf(fifo_name, FIFO_NAME_FMT, odp_app); - while (access(fifo_name, W_OK) != 0) { + for (;;) { + fifo_fd = open(fifo_name, O_WRONLY); + if (fifo_fd >= 0) + break; sleep(1); - if (nb_sec++ == 30) + if (nb_sec++ == 30) exit(1); } - fifo_fd = open(fifo_name, O_WRONLY); printf("pipe found\n"); /* the linux named pipe has now been found, meaning that the