summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/unistd/clone.c7
-rw-r--r--test/unistd/clone_cruft.h20
-rw-r--r--test/unistd/errno.c3
3 files changed, 26 insertions, 4 deletions
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 <signal.h>
#include <sched.h>
#include <sys/wait.h>
+#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 <stdlib.h>
#include <errno.h>
#include <sched.h>
+#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",