- Type definitions defined in header files included from sys/signalfd.h
  and type definitions defined in sys/signalfd.h are conflicted.

- s/SIGNALFD_REFIX/SIGNALFD_PREFIX/
- if HAVE_SIGNALFD is not defined, use stub.
- if HAVE_LINUX_TYPES_H is defined, use our own implemention to call signalfd 
syscall.


Signed-of-by: Masatake YAMATO<[EMAIL PROTECTED]>


diff --git a/testcases/kernel/syscalls/modify_ldt/run-modify_ldt01.sh 
b/testcases/kernel/syscalls/modify_ldt/run-modify_ldt01.sh
index 083e9ab..112e258 100644
--- a/m4/ltp-signalfd.m4
+++ b/m4/ltp-signalfd.m4
@@ -58,12 +58,13 @@ dnl
 dnl
 AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_HEADER],
 [dnl
+AC_CHECK_HEADERS(sys/signalfd.h)
 AC_CHECK_HEADERS_ONCE([linux/types.h])
-AC_CHECK_HEADERS(sys/signalfd.h linux/signalfd.h signalfd.h,[dnl
+AC_CHECK_HEADERS(linux/signalfd.h signalfd.h,[dnl
 LTP_SYSCALL_SIGNALFD_HEADER=yes],[],[dnl
 #ifdef HAVE_LINUX_TYPES_H
 #include <linux/types.h>
-#endif)
+#endif
 ]dnl
 )dnl
 ]dnl
@@ -77,12 +78,12 @@ AC_DEFUN([_LTP_CHECK_SYSCALL_SIGNALFD_FIELD_PREFIX],
 [dnl
 AC_CHECK_MEMBERS([struct signalfd_siginfo.ssi_signo, struct 
signalfd_siginfo.signo],[dnl
 LTP_SYSCALL_SIGNALFD_FIELD_PREFIX=given],[],[dnl
-#ifdef HAVE_LINUX_TYPES_H
-#include <linux/types.h>
-#endif
 #if defined HAVE_SYS_SIGNALFD_H
 #include <sys/signalfd.h>
 #elif defined HAVE_LINUX_SIGNALFD_H
+#ifdef HAVE_LINUX_TYPES_H
+#include <linux/types.h>
+#endif
 #include <linux/signalfd.h>
 #elif defined HAVE_SIGNALFD_H
 #include <signalfd.h>
diff --git a/testcases/kernel/syscalls/signalfd/signalfd01.c 
b/testcases/kernel/syscalls/signalfd/signalfd01.c
index 204794e..5558fe8 100644
--- a/testcases/kernel/syscalls/signalfd/signalfd01.c
+++ b/testcases/kernel/syscalls/signalfd/signalfd01.c
@@ -42,7 +42,6 @@
 
 #include <errno.h>
 #include <signal.h>
-#include <sys/types.h>
 #include <unistd.h>
 #include <fcntl.h>
 
@@ -50,44 +49,50 @@ TCID_DEFINE(signalfd01);
 int TST_TOTAL = 1;
 extern int Tst_count;
 
-#ifdef HAVE_LINUX_TYPES_H
-#include <linux/types.h>
-#endif
+
+#ifndef HAVE_SIGNALFD
+#define  USE_STUB
+#endif 
 
 #if defined HAVE_SYS_SIGNALFD_H
 #include <sys/signalfd.h>
 #elif defined HAVE_LINUX_SIGNALFD_H
+# if defined HAVE_LINUX_TYPES_H
+# include <linux/types.h>
+# endif
 #include <linux/signalfd.h>
+#define USE_OWNIMPL
 #elif defined HAVE_SIGNALFD_H
 #include <signalfd.h>
 #else
 #define  USE_STUB
 #endif
 
-#if defined HAVE_SIGNALFD_SIGINFO_SSI_SIGNO
+#if defined HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO
 # define SIGNALFD_PREFIX(FIELD) ssi_##FIELD
-#elif defined HAVE_SIGNALFD_SIGINFO_SIGNO
+#elif defined HAVE_STRUCT_SIGNALFD_SIGINFO_SIGNO
 # define SIGNALFD_PREFIX(FIELD) FIELD
 #else
-# define  USE_STUB
+# define USE_STUB
 #endif
 
+
+
 #ifdef USE_STUB
 int main(int argc, char **argv)
 {
        tst_resm(TCONF, "System doesn't support execution of the test");
        return 0;
 }
-#else
 
-#ifndef HAVE_SIGNALFD
+#elif USE_OWNIMPL
 #include "linux_syscall_numbers.h"
 int signalfd(int fd, const sigset_t * mask, int flags)
 {
        /* Taken from GLIBC. */
        return (syscall(__NR_signalfd, fd, mask, _NSIG / 8));
 }
-#endif
+#else
 
 void cleanup(void);
 void setup(void);
@@ -174,7 +179,7 @@ int do_test1(int ntst, int sig)
                goto out;
        } else {
                tst_resm(TFAIL, "got unexpected signal: signal=%d : %s",
-                        fdsi.SIGNALFD_REFIX(signo),
+                        fdsi.SIGNALFD_PREFIX(signo),
                         strsignal(fdsi.SIGNALFD_PREFIX(signo)));
                sfd_for_next = -1;
                close(sfd);
[EMAIL PROTECTED] ltp-git]$ 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to