Merge r6109:

Various minor changes to make these compile on AIX5.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6254
This commit is contained in:
Julian Seward 2006-10-17 01:26:12 +00:00
parent 9284a14f28
commit a48daec904
16 changed files with 84 additions and 26 deletions

View File

@ -1,7 +1,7 @@
int main ( void )
{
#if defined(__powerpc64__)
#if defined(__powerpc64__) || defined(_AIX)
/* on ppc64-linux, a function pointer points to a function
descriptor, not to the function's entry point. Hence to get
uniform behaviour on all supported targets - a jump to 0xE000000

View File

@ -24,7 +24,9 @@ int main(void)
/* Install own SIGSEGV handler */
sigsegv_new.sa_handler = SIGSEGV_handler;
sigsegv_new.sa_flags = 0;
#if !defined(_AIX)
sigsegv_new.sa_restorer = NULL;
#endif
res = sigemptyset( &sigsegv_new.sa_mask );
assert(res == 0);
@ -33,8 +35,8 @@ int main(void)
if (__builtin_setjmp(myjmpbuf) == 0) {
// Jump to zero; will cause seg fault
#if defined(__powerpc64__)
unsigned long long int fake_fndescr[3];
#if defined(__powerpc64__) || defined(_AIX)
unsigned long int fake_fndescr[3];
fake_fndescr[0] = 0;
fake_fndescr[1] = 0;
fake_fndescr[2] = 0;

View File

@ -1,6 +1,8 @@
#include <assert.h>
#include <stdio.h>
#include <sys/syscall.h>
#if !defined(_AIX)
# include <sys/syscall.h>
#endif
#include <sys/types.h>
#include <unistd.h>
@ -27,7 +29,9 @@ int main(void)
vals[8] = EOL;
for (i = 0; EOL != vals[i]; i++) {
# if !defined(_AIX)
res = (void*)syscall(__NR_brk, vals[i]);
# endif
}
assert( 0 == brk(orig_ds) ); // libc brk()

View File

@ -11,10 +11,10 @@ int main(void)
int l;
static int ls;
if (gs == 0xDEADBEEF) printf("1!\n");
if (g == 0xDEADBEEF) printf("2!\n");
if (ls == 0xDEADBEEF) printf("3!\n");
if (l == 0xDEADBEEF) printf("4!\n"); // complains
if (gs == 0xCAFEBABE) printf("1!\n");
if (g == 0xCAFEBABE) printf("2!\n");
if (ls == 0xCAFEBABE) printf("3!\n");
if (l == 0xCAFEBABE) printf("4!\n"); // complains
return 0;
}

View File

@ -9,23 +9,23 @@ int main ( void )
char* p;
p = malloc(0);
printf("malloc(0) = %p\n", p);
printf("malloc(0) = 0x%lx\n", (unsigned long)p);
free(p);
p = malloc(-1);
printf("malloc(-1) = %p\n", p);
printf("malloc(-1) = 0x%lx\n", (unsigned long)p);
free(p);
p = calloc(0,1);
printf("calloc(0,1) = %p\n", p);
printf("calloc(0,1) = 0x%lx\n", (unsigned long)p);
free(p);
p = calloc(0,-1);
printf("calloc(0,-1) = %p\n", p);
printf("calloc(0,-1) = 0x%lx\n", (unsigned long)p);
free(p);
p = calloc(-1,-1);
printf("calloc(-1,-1) = %p\n", p);
printf("calloc(-1,-1) = 0x%lx\n", (unsigned long)p);
free(p);
return 0;

View File

@ -1,5 +1,5 @@
malloc(0) = 0x........
malloc(-1) = (nil)
malloc(-1) = 0x........
calloc(0,1) = 0x........
calloc(0,-1) = (nil)
calloc(-1,-1) = (nil)
calloc(0,-1) = 0x........
calloc(-1,-1) = 0x........

View File

@ -7,6 +7,8 @@ int main(void)
{
// Since our allocations are in multiples of 8, 99 will round up to 104.
int* x = malloc(99);
# if !defined(_AIX)
assert(104 == malloc_usable_size(x));
# endif
return 0;
}

View File

@ -4,7 +4,7 @@ int main ()
{
int x;
printf ("x = %d\n", x==0xDEADBEEF ? 99 : 88);
printf ("x = %d\n", x==0xCAFEBABE ? 99 : 88);
return 0;
}

View File

@ -25,7 +25,11 @@ int main ( void )
int* p;
int res;
assert(sizeof(long int) == sizeof(void*));
# if defined(_AIX)
printf("AIX 5.2 knows about neither memalign() nor posix_memalign().\n");
# else
p = memalign(0, 100); assert(0 == (long)p % 8);
p = memalign(1, 100); assert(0 == (long)p % 8);
p = memalign(2, 100); assert(0 == (long)p % 8);
@ -45,7 +49,7 @@ int main ( void )
p = memalign(4096, 100); assert(0 == (long)p % 4096);
p = memalign(4097, 100); assert(0 == (long)p % 8192);
#define PM(a,b,c) posix_memalign((void**)a, b, c)
# define PM(a,b,c) posix_memalign((void**)a, b, c)
res = PM(&p, -1,100); assert(EINVAL == res);
res = PM(&p, 0, 100); assert(0 == res && 0 == (long)p % 8);
@ -64,6 +68,8 @@ int main ( void )
res = PM(&p, 4096, 100); assert(0 == res &&
0 == (long)p % 4096);
res = PM(&p, 4097, 100); assert(EINVAL == res);
# endif
return 0;
}

View File

@ -9,6 +9,10 @@
#include <fcntl.h>
#include <unistd.h>
#if !defined(MAP_NORESERVE)
# define MAP_NORESERVE 0
#endif
int main()
{
char **volatile ptrs;

View File

@ -1,7 +1,9 @@
#include <signal.h>
#include <stdio.h>
#include <sys/syscall.h>
#if !defined(_AIX)
# include <sys/syscall.h>
#endif
#include <unistd.h>
// Reg test for bug #93328: we were using too-big sigset types, and thus
@ -11,7 +13,7 @@ int main(void)
{
int x[6], *s, *os, i;
#if defined(__NR_sigprocmask) && !defined(__powerpc64__)
#if defined(__NR_sigprocmask) && !defined(__powerpc64__) && !defined(_AIX)
x[0] = 0x11111111;
x[1] = 0x89abcdef;

View File

@ -10,10 +10,16 @@
// This test is checking the libc context calls (setcontext, etc.) and
// checks that Valgrind notices their stack changes properly.
struct ucontext ctx1, ctx2, oldc;
#if defined(_AIX)
typedef ucontext_t mycontext;
#else /* linux */
typedef struct ucontext mycontext;
#endif
mycontext ctx1, ctx2, oldc;
int count;
void hello(struct ucontext *newc)
void hello(mycontext *newc)
{
printf("hello, world: %d\n", count);
if (count++ == 2)
@ -21,7 +27,7 @@ void hello(struct ucontext *newc)
setcontext(newc);
}
int init_context(struct ucontext *uc)
int init_context(mycontext *uc)
{
void *stack;
int ret;

View File

@ -1,8 +1,18 @@
#define _XOPEN_SOURCE 600
#define _BSD_SOURCE
#include <sched.h>
#include <stdio.h>
#if defined(_AIX)
int main(int argc, char **argv)
{
printf("this test is linux-specific\n");
return 0;
}
#else
#include <sched.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
@ -53,3 +63,5 @@ int main(int argc, char **argv)
exit( 0 );
}
#endif /* !defined(_AIX) */

View File

@ -463,6 +463,7 @@ test_strchr (void)
}
}
#if !defined(_AIX)
static void
test_strchrnul (void)
{
@ -496,7 +497,9 @@ test_strchrnul (void)
}
}
}
#endif /* !defined(_AIX) */
#if !defined(_AIX)
static void
test_rawmemchr (void)
{
@ -523,6 +526,7 @@ test_rawmemchr (void)
}
}
}
#endif /* !defined(_AIX) */
static void
test_index (void)
@ -570,6 +574,7 @@ test_strrchr (void)
}
}
#if !defined(_AIX)
static void
test_memrchr (void)
{
@ -615,6 +620,7 @@ test_memrchr (void)
}
}
}
#endif /* !defined(_AIX) */
static void
test_rindex (void)
@ -890,6 +896,7 @@ test_strsep (void)
equal(one+4, "c", 50);
{
# if !defined(_AIX)
char text[] = "This,is,a,test";
char *list = strdupa (text);
equal (strsep (&list, ","), "This", 51);
@ -897,6 +904,7 @@ test_strsep (void)
equal (strsep (&list, ","), "a", 53);
equal (strsep (&list, ","), "test", 54);
check (strsep (&list, ",") == NULL, 55);
# endif
}
cp = strcpy(one, "a,b, c,, ,d,");
@ -1049,6 +1057,7 @@ test_memcpy (void)
}
}
#if !defined(_AIX)
static void
test_mempcpy (void)
{
@ -1085,6 +1094,7 @@ test_mempcpy (void)
equal (two, "hi there", 12 + (i * 6));
}
}
#endif /* !defined(_AIX) */
static void
test_memmove (void)
@ -1390,11 +1400,15 @@ main (void)
/* strchr. */
test_strchr ();
# if !defined(_AIX)
/* strchrnul. */
test_strchrnul ();
# endif
# if !defined(_AIX)
/* rawmemchr. */
test_rawmemchr ();
# endif
/* index - just like strchr. */
test_index ();
@ -1402,8 +1416,10 @@ main (void)
/* strrchr. */
test_strrchr ();
# if !defined(_AIX)
/* memrchr. */
test_memrchr ();
# endif
/* rindex - just like strrchr. */
test_rindex ();
@ -1441,8 +1457,10 @@ main (void)
/* memmove - must work on overlap. */
test_memmove ();
# if !defined(_AIX)
/* mempcpy */
test_mempcpy ();
# endif
/* memccpy. */
test_memccpy ();
@ -1479,7 +1497,7 @@ main (void)
else
{
status = EXIT_FAILURE;
printf("%Zd errors.\n", errors);
printf("%d errors.\n", (int)errors);
}
return status;

View File

@ -1,6 +1,7 @@
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include "valgrind.h"
/* As wrap4.c, but also throw in various calls to another redirected

View File

@ -1,6 +1,7 @@
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include "valgrind.h"
/* This is the same as wrap5.c, except that the recursion depth is 16.