public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/1] syscalls/ustat: Fix build for libc without ustat() support
@ 2017-10-11 13:53 Petr Vorel
  2017-10-11 13:57 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Vorel @ 2017-10-11 13:53 UTC (permalink / raw)
  To: ltp

This applies at least for uClibc/uClibc-ng with disabled __UCLIBC_SV4_DEPRECATED__.

Patch taken from buildroot project (thanks!), adjusted it not to be
only uClibc/uClibc-ng specific.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reported-by: Erico Nunes <nunes.erico@gmail.com>
---
 configure.ac                              |  6 +++++-
 testcases/kernel/syscalls/ustat/ustat01.c | 17 +++++++++++++++--
 testcases/kernel/syscalls/ustat/ustat02.c | 18 +++++++++++++++---
 3 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 465655e7b..17a02050a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,9 +44,13 @@ AC_CHECK_HEADERS([ \
     sys/inotify.h \
     sys/fanotify.h \
     sys/prctl.h \
+    sys/ustat.h \
 ])
 
-AC_CHECK_FUNCS([profil])
+AC_CHECK_FUNCS([ \
+    profil \
+    ustat \
+])
 
 # Tools knobs
 
diff --git a/testcases/kernel/syscalls/ustat/ustat01.c b/testcases/kernel/syscalls/ustat/ustat01.c
index 494647bc2..31d7f86dc 100644
--- a/testcases/kernel/syscalls/ustat/ustat01.c
+++ b/testcases/kernel/syscalls/ustat/ustat01.c
@@ -21,15 +21,22 @@
 
 #include <unistd.h>
 #include <errno.h>
-#include <sys/ustat.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+
+#include "config.h"
 #include "test.h"
 #include "safe_macros.h"
 
+char *TCID = "ustat01";
+
+#ifdef HAVE_USTAT
+# ifdef HAVE_SYS_USTAT_H
+#  include <sys/ustat.h>
+# endif
+
 static void setup(void);
 
-char *TCID = "ustat01";
 int TST_TOTAL = 1;
 
 static dev_t dev_num;
@@ -79,3 +86,9 @@ static void setup(void)
 
 	dev_num = buf.st_dev;
 }
+#else
+int main(void)
+{
+	tst_brkm(TCONF, NULL, "system doesn't have ustat() support");
+}
+#endif
diff --git a/testcases/kernel/syscalls/ustat/ustat02.c b/testcases/kernel/syscalls/ustat/ustat02.c
index edada3107..fe644f9a9 100644
--- a/testcases/kernel/syscalls/ustat/ustat02.c
+++ b/testcases/kernel/syscalls/ustat/ustat02.c
@@ -22,16 +22,22 @@
 
 #include <unistd.h>
 #include <errno.h>
-#include <sys/ustat.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+
+#include "config.h"
 #include "test.h"
 #include "safe_macros.h"
 
-static void setup(void);
-
 char *TCID = "ustat02";
 
+#ifdef HAVE_USTAT
+# ifdef HAVE_SYS_USTAT_H
+#  include <sys/ustat.h>
+# endif
+
+static void setup(void);
+
 static dev_t invalid_dev = -1;
 static dev_t root_dev;
 struct ustat ubuf;
@@ -101,3 +107,9 @@ static void setup(void)
 
 	root_dev = buf.st_dev;
 }
+#else
+int main(void)
+{
+	tst_brkm(TCONF, NULL, "system doesn't have ustat() support");
+}
+#endif
-- 
2.14.2


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

* [LTP] [PATCH v2 1/1] syscalls/ustat: Fix build for libc without ustat() support
  2017-10-11 13:53 [LTP] [PATCH v2 1/1] syscalls/ustat: Fix build for libc without ustat() support Petr Vorel
@ 2017-10-11 13:57 ` Cyril Hrubis
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2017-10-11 13:57 UTC (permalink / raw)
  To: ltp

Hi!
Applied, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-11 13:53 [LTP] [PATCH v2 1/1] syscalls/ustat: Fix build for libc without ustat() support Petr Vorel
2017-10-11 13:57 ` Cyril Hrubis

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