]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge r6113:
authorJulian Seward <jseward@acm.org>
Tue, 17 Oct 2006 01:28:48 +0000 (01:28 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 17 Oct 2006 01:28:48 +0000 (01:28 +0000)
Various minor changes to make these compile on AIX5.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6257

13 files changed:
none/tests/async-sigs.c
none/tests/blockfault.c
none/tests/fdleak_cmsg.c
none/tests/mq.c
none/tests/mremap.c
none/tests/mremap2.c
none/tests/pth_atfork1.c
none/tests/pth_cancel1.c
none/tests/sigstackgrowth.c
none/tests/susphello.c
none/tests/threaded-fork.c
none/tests/threadederrno.c
none/tests/threadederrno.stdout.exp

index c20dac1a1f18d5b463730c96b828dd62089840b8..3e403f6d00322072e440ac48d32a19a2d3fb96fb 100644 (file)
@@ -72,6 +72,7 @@ static void test(int block, int caughtsig, int fatalsig)
        }
 
        if (pid == 0) {
+         alarm(10); /* if something breaks, don't spin forever */
                signal(caughtsig, handler);
 
                for(;;)
index f4e069d5a834e5af0a8b3be1f70087b60f76c8bc..3996437b8d590ea1d53e62dee38a22e9b2feb50b 100644 (file)
@@ -13,6 +13,10 @@ static void handler(int sig, siginfo_t *info, void *v)
    the default handler */
 int main()
 {
+#if defined(_AIX)
+  printf("this test hangs when run (even natively) on AIX\n");
+  return 0;
+#endif
        struct sigaction sa;
        sigset_t mask;
 
@@ -25,7 +29,7 @@ int main()
        sigfillset(&mask);
        sigprocmask(SIG_BLOCK, &mask, NULL);
 
-       *(volatile int *)1234 = 213;
+       *(volatile int *)12345 = 213;
 
        return 0;
 }
index 32c5d84f8044a0bd074471b238e95bc8f5c5d424..ecbd0eb59bda637eef656f6974814d5c9a94fe2a 100644 (file)
@@ -1,6 +1,26 @@
+
+/* On AIX 5.2, _LINUX_SOURCE_COMPAT needs to be defined when reading
+   sys/socket.h in order to make CMSG_SPACE and CMSG_LEN visible. */
+
+#if defined(_AIX)
+#define _LINUX_SOURCE_COMPAT 1
+#endif
+
+#include <sys/socket.h>
+
+#if defined(_AIX)
+#undef _LINUX_SOURCE_COMPAT
+#endif
+
+
+/* Needed for 'memset' on AIX 5.2 */
+#if defined(_AIX)
+# include <memory.h>
+#endif
+
+
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <sys/socket.h>
 #include <sys/un.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <errno.h>
 
+
 char filea[24];
 char fileb[24];
 char sock[24];
 
 void
-server ()
+server (void)
 {
    int s, fd1, fd2;
    struct sockaddr_un addr;
@@ -90,7 +111,7 @@ server ()
 }
 
 void
-client ()
+client (void)
 {
    int s, fd1 = -1, fd2 = -1, size, count = 0, ret;
    struct sockaddr_un addr;
index cd032c5fe789e1408fb7326b511d50e99d709bb7..cd111c951b56486223ba48232a264c40efc39539 100644 (file)
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <fcntl.h>
 
 #ifdef HAVE_MQUEUE_H
 
index a768836ac1042d88c53dbd8ba398cdf64ad49052..3a2d22a4a8c0fbab89a54e5a316dbbc082e7214f 100644 (file)
@@ -3,6 +3,16 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#if defined(_AIX)
+
+int main ( void )
+{
+  printf("This test is Linux-specific.\n");
+  return 0;
+}
+
+#else
+
 static char *mkmap(unsigned sz)
 {
        static char *map;
@@ -96,3 +106,5 @@ int main()
 
        return 0;
 }
+
+#endif /* defined(_AIX) */
index b664cbc92b17961afc35c9f1b90bbb4dc318a092..8bef8319447d320cd63b1306f50db804486379e9 100644 (file)
@@ -1,6 +1,17 @@
 #define _GNU_SOURCE
 
 #include <stdio.h>
+
+#if defined(_AIX)
+
+int main ( void )
+{
+  printf("This test is Linux-specific.\n");
+  return 0;
+}
+
+#else
+
 #include <sys/mman.h>
 #include <assert.h>
 #include <stdlib.h>
@@ -161,3 +172,5 @@ int main ( void )
   }
   return 0;
 }
+
+#endif /* defined(_AIX5) */
index b9305808c84d5aedde041316321da50ee04d9ed9..79ce177133e9bdb51b28169eddddf436152f5559 100644 (file)
    Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
-#include <error.h>
+#if !defined(_AIX)
+# include <error.h>
+#endif
 #include <stdlib.h>
 #include <pthread.h>
 #include <unistd.h>
 #include <sys/wait.h>
 #include <stdio.h>
 
+#if defined(_AIX)
+#include <string.h>  /* strerror */
+static void error (int status, int errnum, char* msg)
+{
+   fprintf(stderr, "%s%s%s\n",
+           msg,
+           errnum ? ": " : "",
+           errnum ? strerror(errnum) : "");
+   if (errnum)
+      exit(errnum);
+}
+#endif
+
 enum
 {
   PREPARE_BIT = 1,
index 11eef5201a51a72931622d5d226ca93a5b93af28..f48e075ecdc6678b7eded260e2c292c9bc25ef2e 100644 (file)
@@ -5,7 +5,7 @@
 
 static void thread_cleanup(void *arg)
 {
-  printf("cleaning up %p\n", arg);
+  printf("cleaning up 0x%lx\n", (long)arg);
 
   return;
 }
index d525dca455f8920612d4c30399d75b0376d90051..3b40896bc0198cf8266289d3024475a047c279c6 100644 (file)
@@ -4,6 +4,10 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+#if defined(_AIX) && !defined(SA_NOMASK)
+# define SA_NOMASK 0
+#endif
+
 static char *deep;
 
 #define SIZE   (4*1024*1024)
index 179dd947ee2f9cc2dc84903f7d5e3c3c81ded763..58d3c19b517395a7d2662cba4351d17cbe740003 100644 (file)
@@ -18,7 +18,6 @@
 #include <string.h>
 #include <sys/resource.h>
 #include <unistd.h>
-#include <sys/syscall.h>
 #include <dlfcn.h>
 
 
@@ -132,7 +131,12 @@ initSignalling(void)
    sa.sa_flags = SA_RESTART | SA_SIGINFO | SA_ONSTACK;
    sa.sa_sigaction = ptiSrSigHandler;
    sigfillset(&sa.sa_mask);
+
+#  if !defined(_AIX)
+   /* jrs 20060615: is this important?  I don't know. */
    sigdelset(&sa.sa_mask, (__SIGRTMIN+1));
+#  endif
+
    if (sigaction(srSignal, &sa, 0) == -1) {
       perror("sigaction");
       exit(1);
@@ -163,7 +167,11 @@ void* setup_altstack(void) {
 }
 
 void takedown_altstack(void* stack) {
+#  if defined(_AIX)
+   stack_t ss;
+#  else
    struct sigaltstack ss;
+#  endif
    int result;
    
    ss.ss_flags = SS_DISABLE;
index cf71b6956e71e2827f6efb50eaacd8ca2a2f5032..82c4c1d8f3eae1553f6ca09a55863264ebdb42a4 100644 (file)
@@ -14,6 +14,7 @@ static void *threadmain( void *dummy )
 
 int main( int argc, char **argv )
 {
+        int ctr;
        pid_t childpid;
        pthread_t childthread;
        void *res;
@@ -36,8 +37,15 @@ int main( int argc, char **argv )
        }
 
        pthread_join( childthread, &res );
-       while(waitpid(childpid, &status, 0) != childpid)
-               ;
+       ctr = 0;
+       while(waitpid(childpid, &status, 0) != childpid) {
+               sleep(1);
+               ctr++;
+               if (ctr >= 10) {
+                 printf("FAILED - timeout waiting for child\n");
+                 return 0;
+               }
+       }
 
        printf("PASS\n");
 
index 3cad5fbfda11eab1b8f943e29fc40a72de4c392a..9d9b0fffa834590e840504bd6f6b15d89ca936b2 100644 (file)
@@ -8,14 +8,14 @@
 void* thr2 ( void* v )
 {
   FILE* f = fopen("bogus2", "r");
-  printf("f  = %p, errno  = %d (%s)\n", f, errno, strerror(errno));
+  printf("f  = %ld, errno  = %d (%s)\n", (long)f, errno, strerror(errno));
   return NULL;
 }
 
 void* thr3 ( void* v )
 {
   FILE* f = fopen("bogus3", "r");
-  printf("f  = %p, errno  = %d (%s)\n", f, errno, strerror(errno));
+  printf("f  = %ld, errno  = %d (%s)\n", (long)f, errno, strerror(errno));
   return NULL;
 }
 
@@ -27,7 +27,7 @@ int main ( void )
   pthread_create(&tid2, NULL, &thr2, NULL);
   pthread_create(&tid3, NULL, &thr3, NULL);
   f = fopen("bogus", "r");
-  printf("f  = %p, errno  = %d (%s)\n", f, errno, strerror(errno));
+  printf("f  = %ld, errno  = %d (%s)\n", (long)f, errno, strerror(errno));
   pthread_join(tid2, NULL);
   pthread_join(tid3, NULL);
   return 0;
index 671ad2af5e608d5c804abe732212bdb31dbea0ed..32e76740291b0c552f511b040808dc437172030a 100644 (file)
@@ -1,3 +1,3 @@
-f  = (nil), errno  = 2 (No such file or directory)
-f  = (nil), errno  = 2 (No such file or directory)
-f  = (nil), errno  = 2 (No such file or directory)
+f  = 0, errno  = 2 (No such file or directory)
+f  = 0, errno  = 2 (No such file or directory)
+f  = 0, errno  = 2 (No such file or directory)