Skip to contentSkip to conversation

syscalls/profil01: Fix build for libc without profil() support

PATCH New Petr Vorel 2 participants 2 messages Oct 2, 2017 – Oct 10, 2017

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH v2 1/1 syscalls/profil01: Fix build for libc without profil() support

uClibc and uClibc-ng (at least) have no profil() support atm.

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

---
 configure.ac                                | 2 ++
 testcases/kernel/syscalls/profil/profil01.c | 9 +++++++++
 2 files changed, 11 insertions(+)
configure.ac +2 -0
index 458a5b13f..465655e7b 100644
@@ -46,6 +46,8 @@ AC_CHECK_HEADERS([ \
     sys/prctl.h \
 ])
 
+AC_CHECK_FUNCS([profil])
+
 # Tools knobs
 
 # Expect
testcases/kernel/syscalls/profil/profil01.c +9 -0
index 2fc47aaf5..ff330d0b9 100644
@@ -28,6 +28,8 @@
 #include "test.h"
 #include "safe_macros.h"
 
+#if HAVE_PROFIL
+
 #define PROFIL_TIME 5
 
 /* Should be large enough to hold data for test_profil() .text,
@@ -37,6 +39,7 @@
 #define PROFIL_BUFLEN (32*1024)
 
 char *TCID = "profil01";
+
 int TST_TOTAL = 1;
 
 static volatile sig_atomic_t profil_done;
@@ -124,3 +127,9 @@ int main(int ac, char *av[])
 
 	tst_exit();
 }
+#else /* systems without profil() */
+int main(void)
+{
+        tst_brkm(TCONF, NULL, "system doesn't have profil() support");
+}
+#endif
Signature · 1 line
2.14.2
#1 lore raw

PATCH v2 1/1 syscalls/profil01: Fix build for libc without profil() support

Hi!
I've fixed the patch and pushed, thanks.

I've added #include "config.h" so that the test is actually enabled when configure finds that profil is implemented and also suffled the TCID before the #ifdef so that it's defined for the TCONF branch as well.

Signature · 2 lines
Cyril Hrubis
[email protected]