syscalls/ustat: Fix build for libc without ustat() support
PATCH v2 1/1 syscalls/ustat: Fix build for libc without ustat() support
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 <[email protected]>
Reported-by Erico Nunes <[email protected]>
--- configure.ac | 6 +++++- testcases/kernel/syscalls/ustat/ustat01.c | 17 +++++++++++++++-- testcases/kernel/syscalls/ustat/ustat02.c | 18 +++++++++++++++--- 3 files changed, 35 insertions(+), 6 deletions(-)
configure.ac +5 -1
@@ -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
testcases/kernel/syscalls/ustat/ustat01.c +15 -2
@@ -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
testcases/kernel/syscalls/ustat/ustat02.c +15 -3
@@ -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
Signature · 1 line
2.14.2
PATCH v2 1/1 syscalls/ustat: Fix build for libc without ustat() support
Hi!
Applied, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]