All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/6] lapi: Add TEMP_FAILURE_RETRY definition
@ 2018-10-18 11:24 Petr Vorel
  2018-10-18 11:24 ` [LTP] [PATCH 2/6] realtime: Fix pthread_mutexattr_{g, s}etrobust_np detection Petr Vorel
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Petr Vorel @ 2018-10-18 11:24 UTC (permalink / raw)
  To: ltp

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-10-19 14:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 11:24 [LTP] [PATCH 1/6] lapi: Add TEMP_FAILURE_RETRY definition Petr Vorel
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

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.