From patchwork Tue Mar 29 17:30:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 64607 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2117765lbc; Tue, 29 Mar 2016 09:31:53 -0700 (PDT) X-Received: by 10.55.71.135 with SMTP id u129mr4002416qka.26.1459269112880; Tue, 29 Mar 2016 09:31:52 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g6si26297055qkb.57.2016.03.29.09.31.52; Tue, 29 Mar 2016 09:31:52 -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 325F161838; Tue, 29 Mar 2016 16:31:52 +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 E559E6183C; Tue, 29 Mar 2016 16:31:47 +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 D607A6183C; Tue, 29 Mar 2016 16:31:41 +0000 (UTC) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by lists.linaro.org (Postfix) with ESMTPS id E552E61831 for ; Tue, 29 Mar 2016 16:31:39 +0000 (UTC) Received: by mail-lf0-f53.google.com with SMTP id g124so13872532lfg.0 for ; Tue, 29 Mar 2016 09:31: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=td6TKN+dcV5US/SB7Jnx1i3hnEIzMQuMDGFT9G4XcgU=; b=PnFBGTV8hQu0y6imDWQ7ZImicAJhzeKIEglz6+FFH7lUcbqq4h3Ts7t1FyILUzfEH7 Fyvp9rBNWi/D9WyipHP9twsIw3oPHtrG2Y8rvwaBq49Upd9Ue2xxYreVE9RSLGi/uL0/ bURR59KszyenPB5C7CTtMUIxDGE4w0eLRaISIT+wv1SqMi5e+WAIkypvGzGFuNWhUx+9 0MOcN0uJYxLHrrM6v0hg58BSKctHLwNSo/F+c9D/xrnIOHqczw7VIURRSbqdQjCQYOdn yAVVhytvZy6Irjd1eag2t7abYn+0iK0iRJC202Aq111QWbjcEFOIXYVx8quruRo2riAk L0Hg== X-Gm-Message-State: AD7BkJL6yGhrNOc03zXcXKzMl+fIWZTWsl5JMPWstYP4fvXeJzUQg1Fp9lxshr3tTpLZ20jBqPI= X-Received: by 10.25.135.198 with SMTP id j189mr1619536lfd.84.1459269098857; Tue, 29 Mar 2016 09:31:38 -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 rd3sm5423504lbb.2.2016.03.29.09.31.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Mar 2016 09:31:38 -0700 (PDT) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, bill.fischofer@linaro.org Date: Tue, 29 Mar 2016 19:30:58 +0200 Message-Id: <1459272658-22667-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] [PATCH] 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" Fix for bug 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 --- platform/linux-generic/test/shmem/shmem_linux.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/linux-generic/test/shmem/shmem_linux.c b/platform/linux-generic/test/shmem/shmem_linux.c index 12266cc..be39e8a 100644 --- a/platform/linux-generic/test/shmem/shmem_linux.c +++ b/platform/linux-generic/test/shmem/shmem_linux.c @@ -115,12 +115,13 @@ 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) { + fifo_fd = open(fifo_name, O_WRONLY); + while (fifo_fd < 0) { sleep(1); if (nb_sec++ == 30) exit(1); + fifo_fd = open(fifo_name, O_WRONLY); } - fifo_fd = open(fifo_name, O_WRONLY); printf("pipe found\n"); /* the linux named pipe has now been found, meaning that the