Hi,
On 9/10/2013 7:29 AM, Rich Felker wrote:
On Thu, Aug 29, 2013 at 03:02:22PM +0200, Filippo ARCIDIACONO wrote:
Hi,
Building ltp testsuite it fails when try to build signal_test_04.c with the
the following error:

In file included from signal_test_04.c:85:0:
/usr/include/sys/wait.h:116:22: error: unknown type name '__WAIT_STATUS'
In file included from signal_test_04.c:85:0:
/usr/include/sys/wait.h:169:23: error: unknown type name '__WAIT_STATUS'
/usr/include/sys/wait.h:175:38: error: unknown type name '__WAIT_STATUS'
signal_test_04.c: In function 'main':
signal_test_04.c:203:2: warning: implicit declaration of function
'wait' [-W
signal_test_04.c:205:2: warning: implicit declaration of function 'WIFSIGNAL
signal_test_04.c:206:3: warning: implicit declaration of function 'WTERMSIG'
make[4]: *** [signal_test_04] Error 1

I try to explain what happening.
When stdlib.h is included by the test to get the needed stuff it
isn't included
because  it has been silently included, by bits/sched.h, in the
inclusion chain of stdio.h.
Follow the header included by the test:

#include <stdio.h>
#include <string.h>
#ifdef _LINUX_
#define __USE_XOPEN
#endif
#include <unistd.h>
#include <stdlib.h>
#include <sys/signal.h>
#include <sys/wait.h>
#include <errno.h>
This code is utter nonsense. __USE_XOPEN is an _internal_ glibc/uClibc
macro defined by features.h. Any program defining this macro itself is
plain wrong. Moreover, if fixing it to use the correct feature test
macro (_XOPEN_SOURCE), all feature test macros must be defined
_before_ any system headers are included. You can't include some
system headers, then define some feature test macros, then include
more headers.
Ok. Thanks for clarification.
I though the ltp test was wrong, but I was mislead compiling the same code using glibc the test compile fine and I wondered if it could be fixed using __need_malloc_and_calloc macro. I'll post a patch in ltp mailing list to fix this test using _XOPEN_SOURCE macro as you suggest.
something like:

diff --git a/testcases/kernel/ipc/ipc_stress/signal_test_04.c b/testcases/kernel
index f4d7e68..4d4010e 100644
--- a/testcases/kernel/ipc/ipc_stress/signal_test_04.c
+++ b/testcases/kernel/ipc/ipc_stress/signal_test_04.c
@@ -74,11 +74,9 @@
 | |
 +---------------------------------------------------------------------*/

+#define _XOPEN_SOURCE 500
 #include <stdio.h>
 #include <string.h>
-#ifdef _LINUX_
-#define __USE_XOPEN
-#endif
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/signal.h>



Rich

Filippo

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to