All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/6] lapi: Add TEMP_FAILURE_RETRY definition
Date: Thu, 18 Oct 2018 13:24:28 +0200	[thread overview]
Message-ID: <20181018112433.9554-1-pvorel@suse.cz> (raw)

and use it in realtime to fix pi-tests.
This fixes build failure on libc missing it (e.g. musl, bionic):

test-skeleton.c:112:12: warning: implicit declaration of function ‘TEMP_FAILURE_RETRY’ [-Wimplicit-function-declaration]
  termpid = TEMP_FAILURE_RETRY(waitpid(pid, &status, 0));
            ^~~~~~~~~~~~~~~~~~
make[5]: *** [<builtin>: testpi-6] Error 1

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/lapi/unistd.h                          | 18 ++++++++++++++++++
 .../realtime/func/pi-tests/test-skeleton.c     |  1 +
 2 files changed, 19 insertions(+)
 create mode 100644 include/lapi/unistd.h

diff --git a/include/lapi/unistd.h b/include/lapi/unistd.h
new file mode 100644
index 000000000..7ddc60e9a
--- /dev/null
+++ b/include/lapi/unistd.h
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2017 Petr Vorel <pvorel@suse.cz>
+ */
+#ifndef LAPI_UNISTD_H__
+#define LAPI_UNISTD_H__
+
+/* glibc unistd.h */
+#ifndef TEMP_FAILURE_RETRY
+# define TEMP_FAILURE_RETRY(expression) \
+  (__extension__							      \
+    ({ long int __result;						      \
+       do __result = (long int) (expression);				      \
+       while (__result == -1L && errno == EINTR);			      \
+       __result; }))
+#endif
+
+#endif /* LAPI_UNISTD_H__ */
diff --git a/testcases/realtime/func/pi-tests/test-skeleton.c b/testcases/realtime/func/pi-tests/test-skeleton.c
index 326a8ab56..7ad4804c8 100644
--- a/testcases/realtime/func/pi-tests/test-skeleton.c
+++ b/testcases/realtime/func/pi-tests/test-skeleton.c
@@ -42,6 +42,7 @@
 #include <sys/wait.h>
 #include <time.h>
 #include <librttest.h>
+#include "lapi/unistd.h"
 
 void usage(void)
 {
-- 
2.19.1


             reply	other threads:[~2018-10-18 11:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 11:24 Petr Vorel [this message]
2018-10-18 11:24 ` [LTP] [PATCH 2/6] realtime: Fix pthread_mutexattr_{g, s}etrobust_np detection Petr Vorel
2018-10-18 11:24 ` [LTP] [PATCH 3/6] realtime/configure.ac: Remove unused check Petr Vorel
2018-10-18 11:24 ` [LTP] [PATCH 4/6] Use POSIX variants of pthread robust mutex functions Petr Vorel
2018-10-18 11:24 ` [LTP] [PATCH 5/6] kernel/pt_test: Add missing string.h header Petr Vorel
2018-10-18 11:24 ` [LTP] [PATCH 6/6] posix: Update README Petr Vorel
2018-10-19 12:53   ` Cyril Hrubis
2018-10-19 12:49 ` [LTP] [PATCH 1/6] lapi: Add TEMP_FAILURE_RETRY definition Cyril Hrubis
2018-10-19 14:57   ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181018112433.9554-1-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.