public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [RFC] [PATCH] lib: Fix undefined reference to `mq_open' build failures
@ 2017-03-29 16:50 Cyril Hrubis
  2017-04-05  9:34 ` Richard Palethorpe
  2017-04-06  7:45 ` Cyril Hrubis
  0 siblings, 2 replies; 8+ messages in thread
From: Cyril Hrubis @ 2017-03-29 16:50 UTC (permalink / raw)
  To: ltp

It appears that since the addition of the tst_safe_posix_ipc.c to the
test library random testcases (mostly ltp-aiodio seems to be triggering
the issue) started to fail on linking with missing reference to mq_open.

The problem is that -lrt is needed for mq_open() so this commit adds a
weak stub symbol that is used as fallback when we are compiling without
-lrt.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 lib/tst_safe_posix_ipc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/tst_safe_posix_ipc.c b/lib/tst_safe_posix_ipc.c
index 7142a25..4c617c8 100644
--- a/lib/tst_safe_posix_ipc.c
+++ b/lib/tst_safe_posix_ipc.c
@@ -22,6 +22,13 @@
 #include "tst_test.h"
 #include "tst_safe_posix_ipc.h"
 
+mqd_t __attribute__((weak)) mq_open(const char *name __attribute__((unused)),
+				    int oflag __attribute__((unused)), ...)
+{
+	tst_brk(TBROK, "mq_open() stub called!");
+	return 0;
+}
+
 int safe_mq_open(const char *file, const int lineno, const char *pathname,
 	int oflags, ...)
 {
-- 
2.10.2


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

end of thread, other threads:[~2017-04-10 11:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-29 16:50 [LTP] [RFC] [PATCH] lib: Fix undefined reference to `mq_open' build failures Cyril Hrubis
2017-04-05  9:34 ` Richard Palethorpe
2017-04-05 10:03   ` Jan Stancek
2017-04-05 17:29   ` Cyril Hrubis
2017-04-06  7:45 ` Cyril Hrubis
2017-04-07 15:52   ` Cyril Hrubis
2017-04-10  7:41     ` Jan Stancek
2017-04-10 11:33       ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox