From c429bf3057c87dd9545fc2d824b5930c52f7dfb8 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 4 Feb 2006 01:20:54 +0000 Subject: import files from glibc for an ia64/static port --- test/unistd/clone.c | 7 ++++--- test/unistd/clone_cruft.h | 20 ++++++++++++++++++++ test/unistd/errno.c | 3 ++- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 test/unistd/clone_cruft.h (limited to 'test') diff --git a/test/unistd/clone.c b/test/unistd/clone.c index 6d9aa6873..cbbdbb8fc 100644 --- a/test/unistd/clone.c +++ b/test/unistd/clone.c @@ -28,6 +28,7 @@ #include #include #include +#include "clone_cruft.h" #define GOT1 (1 << 1) #define GOT2 (1 << 2) @@ -56,15 +57,15 @@ int main(void) signal(SIGCHLD, child_handler); - if ((clone1 = clone(clone_main, clone1_stack, 0, (void*)11)) == -1) { + if ((clone1 = do_clone(clone_main, clone1_stack, 0, (void*)11)) == -1) { perror("Clone 1 failed"); exit(-1); } - if ((clone2 = clone(clone_main, clone2_stack, 0, (void*)22)) == -1) { + if ((clone2 = do_clone(clone_main, clone2_stack, 0, (void*)22)) == -1) { perror("Clone 2 failed"); exit(-2); } - if ((clone3 = clone(clone_main, clone3_stack, 0, (void*)33)) == -1) { + if ((clone3 = do_clone(clone_main, clone3_stack, 0, (void*)33)) == -1) { perror("Clone 3 failed"); exit(-3); } diff --git a/test/unistd/clone_cruft.h b/test/unistd/clone_cruft.h new file mode 100644 index 000000000..dacc1b2bf --- /dev/null +++ b/test/unistd/clone_cruft.h @@ -0,0 +1,20 @@ +/* because people like to make things difficult */ + +#undef do_clone + +#if defined __ia64__ + +# define do_clone(fn, stack, flags, arg) \ + __clone2(fn, stack, sizeof(stack), flags, arg, NULL, NULL, NULL) + +#elif defined __hppa__ + +# define do_clone(fn, stack, flags, arg) \ + clone(fn, stack, flags, arg) + +#else + +# define do_clone(fn, stack, flags, arg) \ + clone(fn, stack+sizeof(stack), flags, arg) + +#endif diff --git a/test/unistd/errno.c b/test/unistd/errno.c index cb082b890..c77f58aa2 100644 --- a/test/unistd/errno.c +++ b/test/unistd/errno.c @@ -4,6 +4,7 @@ #include #include #include +#include "clone_cruft.h" int child_fn(void *arg) { @@ -15,7 +16,7 @@ int main(void) { int r_clone, ret_errno; - r_clone = clone(child_fn, NULL, (int) NULL, NULL); + r_clone = do_clone(child_fn, NULL, (int) NULL, NULL); ret_errno = errno; if (ret_errno != EINVAL || r_clone != -1) { fprintf(stderr, "clone: res=%d (wanted -1) errno=%d (wanted %d)\n", -- cgit v1.2.3