Move wait.h to 'src/common/'
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 6 Apr 2021 20:45:50 +0000 (16:45 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 13 Apr 2021 18:22:59 +0000 (14:22 -0400)
It defines a generic macro that is only currently used in
liblttng-ust-ctl.

Change-Id: I9ed217176cf261f4fc410ba1655d0e9c0bf9ff07
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/common/Makefile.am
src/common/wait.h [new file with mode: 0644]
src/lib/lttng-ust-ctl/ustctl.c
src/lib/lttng-ust/Makefile.am
src/lib/lttng-ust/wait.h [deleted file]

index 6e155f7dca3848991b74e5c97a555b86a2044a71..177ef070dcbacdb8e4c5a4c596d2ef32c54a081c 100644 (file)
@@ -16,7 +16,8 @@ noinst_HEADERS = \
        macros.h \
        patient.h \
        procname.h \
-       safe-snprintf.h
+       safe-snprintf.h \
+       wait.h
 
 noinst_HEADERS += \
        compat/dlfcn.h \
diff --git a/src/common/wait.h b/src/common/wait.h
new file mode 100644 (file)
index 0000000..0af1f10
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#ifndef _UST_WAIT_H
+#define _UST_WAIT_H
+
+#include <poll.h>
+
+/*
+ * Wait until "cond" gets true or timeout (in ms).
+ */
+#define wait_cond_interruptible_timeout(_cond, _timeout)       \
+       ({                                                      \
+               int __ret = 0, __pollret;                       \
+               int __timeout = _timeout;                       \
+                                                               \
+               for (;;) {                                      \
+                       if (_cond)                              \
+                               break;                          \
+                       if (__timeout <= 0) {                   \
+                               __ret = -ETIMEDOUT;             \
+                               break;                          \
+                       }                                       \
+                       __pollret = poll(NULL, 0, 10);  /* wait 10ms */ \
+                       if (__pollret < 0) {                    \
+                               __ret = -errno;                 \
+                               break;                          \
+                       }                                       \
+                       __timeout -= 10;                        \
+               }                                               \
+               __ret;                                          \
+       })
+
+
+#endif /* _UST_WAIT_H */
index 076c92f8ee065da1fb0bd3950522b6f81dbdaa85..e4434bc075b08a3c8c7ad160594b781b60cbb0e3 100644 (file)
@@ -25,7 +25,7 @@
 #include "common/ringbuffer/backend.h"
 #include "common/ringbuffer/frontend.h"
 #include "lib/lttng-ust/ust-events-internal.h"
-#include "lib/lttng-ust/wait.h"
+#include "common/wait.h"
 #include "lib/lttng-ust/lttng-rb-clients.h"
 #include "lib/lttng-ust/clock.h"
 #include "lib/lttng-ust/getenv.h"
index bca09ad8ccdf2c3a540efeccb7285412ca5fb6c8..df0ae8d09bda29cbac6875168a34df9f1bebe61f 100644 (file)
@@ -80,7 +80,6 @@ liblttng_ust_runtime_la_SOURCES = \
        tracepoint-internal.h \
        ust-events-internal.h \
        clock.h \
-       wait.h \
        jhash.h \
        lttng-ust-uuid.h \
        error.h \
diff --git a/src/lib/lttng-ust/wait.h b/src/lib/lttng-ust/wait.h
deleted file mode 100644 (file)
index 0af1f10..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- */
-
-#ifndef _UST_WAIT_H
-#define _UST_WAIT_H
-
-#include <poll.h>
-
-/*
- * Wait until "cond" gets true or timeout (in ms).
- */
-#define wait_cond_interruptible_timeout(_cond, _timeout)       \
-       ({                                                      \
-               int __ret = 0, __pollret;                       \
-               int __timeout = _timeout;                       \
-                                                               \
-               for (;;) {                                      \
-                       if (_cond)                              \
-                               break;                          \
-                       if (__timeout <= 0) {                   \
-                               __ret = -ETIMEDOUT;             \
-                               break;                          \
-                       }                                       \
-                       __pollret = poll(NULL, 0, 10);  /* wait 10ms */ \
-                       if (__pollret < 0) {                    \
-                               __ret = -errno;                 \
-                               break;                          \
-                       }                                       \
-                       __timeout -= 10;                        \
-               }                                               \
-               __ret;                                          \
-       })
-
-
-#endif /* _UST_WAIT_H */
This page took 0.028248 seconds and 4 git commands to generate.