From: Julian Seward Date: Tue, 17 Oct 2006 01:28:48 +0000 (+0000) Subject: Merge r6113: X-Git-Tag: svn/VALGRIND_3_3_0~619 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=422a82fec7ba8fdf355bdb787b7fc5cc84ce993f;p=thirdparty%2Fvalgrind.git Merge r6113: Various minor changes to make these compile on AIX5. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6257 --- diff --git a/none/tests/async-sigs.c b/none/tests/async-sigs.c index c20dac1a1f..3e403f6d00 100644 --- a/none/tests/async-sigs.c +++ b/none/tests/async-sigs.c @@ -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(;;) diff --git a/none/tests/blockfault.c b/none/tests/blockfault.c index f4e069d5a8..3996437b8d 100644 --- a/none/tests/blockfault.c +++ b/none/tests/blockfault.c @@ -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; } diff --git a/none/tests/fdleak_cmsg.c b/none/tests/fdleak_cmsg.c index 32c5d84f80..ecbd0eb59b 100644 --- a/none/tests/fdleak_cmsg.c +++ b/none/tests/fdleak_cmsg.c @@ -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 + +#if defined(_AIX) +#undef _LINUX_SOURCE_COMPAT +#endif + + +/* Needed for 'memset' on AIX 5.2 */ +#if defined(_AIX) +# include +#endif + + #include #include -#include #include #include #include @@ -8,12 +28,13 @@ #include #include + 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; diff --git a/none/tests/mq.c b/none/tests/mq.c index cd032c5fe7..cd111c951b 100644 --- a/none/tests/mq.c +++ b/none/tests/mq.c @@ -3,6 +3,7 @@ #include #include #include +#include #ifdef HAVE_MQUEUE_H diff --git a/none/tests/mremap.c b/none/tests/mremap.c index a768836ac1..3a2d22a4a8 100644 --- a/none/tests/mremap.c +++ b/none/tests/mremap.c @@ -3,6 +3,16 @@ #include #include +#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) */ diff --git a/none/tests/mremap2.c b/none/tests/mremap2.c index b664cbc92b..8bef831944 100644 --- a/none/tests/mremap2.c +++ b/none/tests/mremap2.c @@ -1,6 +1,17 @@ #define _GNU_SOURCE #include + +#if defined(_AIX) + +int main ( void ) +{ + printf("This test is Linux-specific.\n"); + return 0; +} + +#else + #include #include #include @@ -161,3 +172,5 @@ int main ( void ) } return 0; } + +#endif /* defined(_AIX5) */ diff --git a/none/tests/pth_atfork1.c b/none/tests/pth_atfork1.c index b9305808c8..79ce177133 100644 --- a/none/tests/pth_atfork1.c +++ b/none/tests/pth_atfork1.c @@ -18,13 +18,28 @@ Boston, MA 02111-1307, USA. */ #include -#include +#if !defined(_AIX) +# include +#endif #include #include #include #include #include +#if defined(_AIX) +#include /* 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, diff --git a/none/tests/pth_cancel1.c b/none/tests/pth_cancel1.c index 11eef5201a..f48e075ecd 100644 --- a/none/tests/pth_cancel1.c +++ b/none/tests/pth_cancel1.c @@ -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; } diff --git a/none/tests/sigstackgrowth.c b/none/tests/sigstackgrowth.c index d525dca455..3b40896bc0 100644 --- a/none/tests/sigstackgrowth.c +++ b/none/tests/sigstackgrowth.c @@ -4,6 +4,10 @@ #include #include +#if defined(_AIX) && !defined(SA_NOMASK) +# define SA_NOMASK 0 +#endif + static char *deep; #define SIZE (4*1024*1024) diff --git a/none/tests/susphello.c b/none/tests/susphello.c index 179dd947ee..58d3c19b51 100644 --- a/none/tests/susphello.c +++ b/none/tests/susphello.c @@ -18,7 +18,6 @@ #include #include #include -#include #include @@ -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; diff --git a/none/tests/threaded-fork.c b/none/tests/threaded-fork.c index cf71b6956e..82c4c1d8f3 100644 --- a/none/tests/threaded-fork.c +++ b/none/tests/threaded-fork.c @@ -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"); diff --git a/none/tests/threadederrno.c b/none/tests/threadederrno.c index 3cad5fbfda..9d9b0fffa8 100644 --- a/none/tests/threadederrno.c +++ b/none/tests/threadederrno.c @@ -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; diff --git a/none/tests/threadederrno.stdout.exp b/none/tests/threadederrno.stdout.exp index 671ad2af5e..32e7674029 100644 --- a/none/tests/threadederrno.stdout.exp +++ b/none/tests/threadederrno.stdout.exp @@ -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)