|
From: <sv...@va...> - 2006-10-01 17:09:46
|
Author: sewardj
Date: 2006-10-01 18:09:43 +0100 (Sun, 01 Oct 2006)
New Revision: 6113
Log:
Various minor changes to make these compile on AIX5.
Modified:
branches/AIX5/none/tests/async-sigs.c
branches/AIX5/none/tests/blockfault.c
branches/AIX5/none/tests/mq.c
branches/AIX5/none/tests/mremap.c
branches/AIX5/none/tests/mremap2.c
branches/AIX5/none/tests/pth_atfork1.c
branches/AIX5/none/tests/pth_cancel1.c
branches/AIX5/none/tests/sigstackgrowth.c
branches/AIX5/none/tests/susphello.c
branches/AIX5/none/tests/threaded-fork.c
branches/AIX5/none/tests/threadederrno.c
branches/AIX5/none/tests/threadederrno.stdout.exp
Modified: branches/AIX5/none/tests/async-sigs.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/async-sigs.c 2006-10-01 17:08:16 UTC (rev 61=
12)
+++ branches/AIX5/none/tests/async-sigs.c 2006-10-01 17:09:43 UTC (rev 61=
13)
@@ -72,6 +72,7 @@
}
=20
if (pid =3D=3D 0) {
+ alarm(10); /* if something breaks, don't spin forever */
signal(caughtsig, handler);
=20
for(;;)
Modified: branches/AIX5/none/tests/blockfault.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/blockfault.c 2006-10-01 17:08:16 UTC (rev 61=
12)
+++ branches/AIX5/none/tests/blockfault.c 2006-10-01 17:09:43 UTC (rev 61=
13)
@@ -13,6 +13,10 @@
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;
=20
@@ -25,7 +29,7 @@
sigfillset(&mask);
sigprocmask(SIG_BLOCK, &mask, NULL);
=20
- *(volatile int *)1234 =3D 213;
+ *(volatile int *)12345 =3D 213;
=20
return 0;
}
Modified: branches/AIX5/none/tests/mq.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/mq.c 2006-10-01 17:08:16 UTC (rev 6112)
+++ branches/AIX5/none/tests/mq.c 2006-10-01 17:09:43 UTC (rev 6113)
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <fcntl.h>
=20
#ifdef HAVE_MQUEUE_H
=20
Modified: branches/AIX5/none/tests/mremap.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/mremap.c 2006-10-01 17:08:16 UTC (rev 6112)
+++ branches/AIX5/none/tests/mremap.c 2006-10-01 17:09:43 UTC (rev 6113)
@@ -3,6 +3,16 @@
#include <stdio.h>
#include <stdlib.h>
=20
+#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 @@
=20
return 0;
}
+
+#endif /* defined(_AIX) */
Modified: branches/AIX5/none/tests/mremap2.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/mremap2.c 2006-10-01 17:08:16 UTC (rev 6112)
+++ branches/AIX5/none/tests/mremap2.c 2006-10-01 17:09:43 UTC (rev 6113)
@@ -1,6 +1,17 @@
#define _GNU_SOURCE
=20
#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 @@
}
return 0;
}
+
+#endif /* defined(_AIX5) */
Modified: branches/AIX5/none/tests/pth_atfork1.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/pth_atfork1.c 2006-10-01 17:08:16 UTC (rev 6=
112)
+++ branches/AIX5/none/tests/pth_atfork1.c 2006-10-01 17:09:43 UTC (rev 6=
113)
@@ -18,13 +18,28 @@
Boston, MA 02111-1307, USA. */
=20
#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>
=20
+#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 =3D 1,
Modified: branches/AIX5/none/tests/pth_cancel1.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/pth_cancel1.c 2006-10-01 17:08:16 UTC (rev 6=
112)
+++ branches/AIX5/none/tests/pth_cancel1.c 2006-10-01 17:09:43 UTC (rev 6=
113)
@@ -5,7 +5,7 @@
=20
static void thread_cleanup(void *arg)
{
- printf("cleaning up %p\n", arg);
+ printf("cleaning up 0x%lx\n", (long)arg);
=20
return;
}
Modified: branches/AIX5/none/tests/sigstackgrowth.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/sigstackgrowth.c 2006-10-01 17:08:16 UTC (re=
v 6112)
+++ branches/AIX5/none/tests/sigstackgrowth.c 2006-10-01 17:09:43 UTC (re=
v 6113)
@@ -4,6 +4,10 @@
#include <sys/types.h>
#include <unistd.h>
=20
+#if defined(_AIX) && !defined(SA_NOMASK)
+# define SA_NOMASK 0
+#endif
+
static char *deep;
=20
#define SIZE (4*1024*1024)
Modified: branches/AIX5/none/tests/susphello.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/susphello.c 2006-10-01 17:08:16 UTC (rev 611=
2)
+++ branches/AIX5/none/tests/susphello.c 2006-10-01 17:09:43 UTC (rev 611=
3)
@@ -18,7 +18,7 @@
#include <string.h>
#include <sys/resource.h>
#include <unistd.h>
-#include <sys/syscall.h>
+//#include <sys/syscall.h>
#include <dlfcn.h>
=20
=20
@@ -132,7 +132,12 @@
sa.sa_flags =3D SA_RESTART | SA_SIGINFO | SA_ONSTACK;
sa.sa_sigaction =3D 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) =3D=3D -1) {
perror("sigaction");
exit(1);
@@ -163,7 +168,11 @@
}
=20
void takedown_altstack(void* stack) {
+# if defined(_AIX)
+ stack_t ss;
+# else
struct sigaltstack ss;
+# endif
int result;
=20
ss.ss_flags =3D SS_DISABLE;
Modified: branches/AIX5/none/tests/threaded-fork.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/threaded-fork.c 2006-10-01 17:08:16 UTC (rev=
6112)
+++ branches/AIX5/none/tests/threaded-fork.c 2006-10-01 17:09:43 UTC (rev=
6113)
@@ -14,6 +14,7 @@
=20
int main( int argc, char **argv )
{
+ int ctr;
pid_t childpid;
pthread_t childthread;
void *res;
@@ -36,8 +37,15 @@
}
=20
pthread_join( childthread, &res );
- while(waitpid(childpid, &status, 0) !=3D childpid)
- ;
+ ctr =3D 0;
+ while(waitpid(childpid, &status, 0) !=3D childpid) {
+ sleep(1);
+ ctr++;
+ if (ctr >=3D 10) {
+ printf("FAILED - timeout waiting for child\n");
+ return 0;
+ }
+ }
=20
printf("PASS\n");
=20
Modified: branches/AIX5/none/tests/threadederrno.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/threadederrno.c 2006-10-01 17:08:16 UTC (rev=
6112)
+++ branches/AIX5/none/tests/threadederrno.c 2006-10-01 17:09:43 UTC (rev=
6113)
@@ -8,14 +8,14 @@
void* thr2 ( void* v )
{
FILE* f =3D fopen("bogus2", "r");
- printf("f =3D %p, errno =3D %d (%s)\n", f, errno, strerror(errno));
+ printf("f =3D %ld, errno =3D %d (%s)\n", (long)f, errno, strerror(er=
rno));
return NULL;
}
=20
void* thr3 ( void* v )
{
FILE* f =3D fopen("bogus3", "r");
- printf("f =3D %p, errno =3D %d (%s)\n", f, errno, strerror(errno));
+ printf("f =3D %ld, errno =3D %d (%s)\n", (long)f, errno, strerror(er=
rno));
return NULL;
}
=20
@@ -27,7 +27,7 @@
pthread_create(&tid2, NULL, &thr2, NULL);
pthread_create(&tid3, NULL, &thr3, NULL);
f =3D fopen("bogus", "r");
- printf("f =3D %p, errno =3D %d (%s)\n", f, errno, strerror(errno));
+ printf("f =3D %ld, errno =3D %d (%s)\n", (long)f, errno, strerror(er=
rno));
pthread_join(tid2, NULL);
pthread_join(tid3, NULL);
return 0;
Modified: branches/AIX5/none/tests/threadederrno.stdout.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/AIX5/none/tests/threadederrno.stdout.exp 2006-10-01 17:08:16=
UTC (rev 6112)
+++ branches/AIX5/none/tests/threadederrno.stdout.exp 2006-10-01 17:09:43=
UTC (rev 6113)
@@ -1,3 +1,3 @@
-f =3D (nil), errno =3D 2 (No such file or directory)
-f =3D (nil), errno =3D 2 (No such file or directory)
-f =3D (nil), errno =3D 2 (No such file or directory)
+f =3D 0, errno =3D 2 (No such file or directory)
+f =3D 0, errno =3D 2 (No such file or directory)
+f =3D 0, errno =3D 2 (No such file or directory)
|