Various minor changes to make these compile on AIX5.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6257
}
if (pid == 0) {
+ alarm(10); /* if something breaks, don't spin forever */
signal(caughtsig, handler);
for(;;)
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;
sigfillset(&mask);
sigprocmask(SIG_BLOCK, &mask, NULL);
- *(volatile int *)1234 = 213;
+ *(volatile int *)12345 = 213;
return 0;
}
+
+/* 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;
}
void
-client ()
+client (void)
{
int s, fd1 = -1, fd2 = -1, size, count = 0, ret;
struct sockaddr_un addr;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <fcntl.h>
#ifdef HAVE_MQUEUE_H
#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;
return 0;
}
+
+#endif /* defined(_AIX) */
#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>
}
return 0;
}
+
+#endif /* defined(_AIX5) */
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,
static void thread_cleanup(void *arg)
{
- printf("cleaning up %p\n", arg);
+ printf("cleaning up 0x%lx\n", (long)arg);
return;
}
#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)
#include <string.h>
#include <sys/resource.h>
#include <unistd.h>
-#include <sys/syscall.h>
#include <dlfcn.h>
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);
}
void takedown_altstack(void* stack) {
+# if defined(_AIX)
+ stack_t ss;
+# else
struct sigaltstack ss;
+# endif
int result;
ss.ss_flags = SS_DISABLE;
int main( int argc, char **argv )
{
+ int ctr;
pid_t childpid;
pthread_t childthread;
void *res;
}
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");
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;
}
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;
-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)