summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--defs.h3
-rw-r--r--process.c56
-rw-r--r--syscall.c8
3 files changed, 17 insertions, 50 deletions
diff --git a/defs.h b/defs.h
index a869929..144feb5 100644
--- a/defs.h
+++ b/defs.h
@@ -528,9 +528,6 @@ extern const char *sprint_open_modes(mode_t);
extern int is_restart_error(struct tcb *);
extern int change_syscall(struct tcb *, int);
-#ifdef LINUX
-extern int internal_clone(struct tcb *);
-#endif
extern int internal_fork(struct tcb *);
extern int internal_exec(struct tcb *);
extern int internal_wait(struct tcb *, int);
diff --git a/process.c b/process.c
index ee8a7bc..997e536 100644
--- a/process.c
+++ b/process.c
@@ -896,13 +896,10 @@ setarg(tcp, argnum)
}
#endif
-#if defined SYS_clone || defined SYS_clone2
+#ifdef LINUX
int
-internal_clone(tcp)
-struct tcb *tcp;
+internal_fork(struct tcb *tcp)
{
- struct tcb *tcpchild;
- int pid;
if (entering(tcp)) {
if (!followfork)
return 0;
@@ -910,11 +907,15 @@ struct tcb *tcp;
if (setbpt(tcp) < 0)
return 0;
} else {
- int bpt = tcp->flags & TCB_BPTSET;
+ struct tcb *tcpchild;
+ int pid;
+ int bpt;
if (!(tcp->flags & TCB_FOLLOWFORK))
return 0;
+ bpt = tcp->flags & TCB_BPTSET;
+
if (syserror(tcp)) {
if (bpt)
clearbpt(tcp);
@@ -936,7 +937,7 @@ struct tcb *tcp;
pid, tcp->pid);
}
else
-#endif
+#endif /* CLONE_PTRACE */
{
fork_tcb(tcp);
tcpchild = alloctcb(pid);
@@ -952,7 +953,7 @@ struct tcb *tcp;
droptcb(tcpchild);
return 0;
}
-#endif
+#endif /* !CLONE_PTRACE */
if (bpt)
clearbpt(tcp);
@@ -1020,21 +1021,17 @@ Process %u resumed (parent %d ready)\n",
++tcp->nclone_detached;
}
}
-#endif
+#endif /* TCB_CLONE_THREAD */
}
return 0;
}
-#endif
+
+#else /* !LINUX */
int
internal_fork(tcp)
struct tcb *tcp;
{
-#ifdef LINUX
- /* We do special magic with clone for any clone or fork. */
- return internal_clone(tcp);
-#else
-
struct tcb *tcpchild;
int pid;
int dont_follow = 0;
@@ -1067,32 +1064,6 @@ struct tcb *tcp;
pid = tcp->u_rval;
fork_tcb(tcp);
tcpchild = alloctcb(pid);
-#ifdef LINUX
-#ifdef HPPA
- /* The child must have run before it can be attached. */
- /* This must be a bug in the parisc kernel, but I havn't
- * identified it yet. Seems to be an issue associated
- * with attaching to a process (which sends it a signal)
- * before that process has ever been scheduled. When
- * debugging, I started seeing crashes in
- * arch/parisc/kernel/signal.c:do_signal(), apparently
- * caused by r8 getting corrupt over the dequeue_signal()
- * call. Didn't make much sense though...
- */
- {
- struct timeval tv;
- tv.tv_sec = 0;
- tv.tv_usec = 10000;
- select(0, NULL, NULL, NULL, &tv);
- }
-#endif
- if (ptrace(PTRACE_ATTACH, pid, (char *) 1, 0) < 0) {
- perror("PTRACE_ATTACH");
- fprintf(stderr, "Too late?\n");
- droptcb(tcpchild);
- return 0;
- }
-#endif /* LINUX */
#ifdef SUNOS4
#ifdef oldway
/* The child must have run before it can be attached. */
@@ -1138,9 +1109,10 @@ struct tcb *tcp;
fprintf(stderr, "Process %d attached\n", pid);
}
return 0;
-#endif
}
+#endif /* !LINUX */
+
#endif /* !USE_PROCFS */
#if defined(SUNOS4) || defined(LINUX) || defined(FREEBSD)
diff --git a/syscall.c b/syscall.c
index 3f551cd..16cbdcd 100644
--- a/syscall.c
+++ b/syscall.c
@@ -679,17 +679,15 @@ internal_syscall(struct tcb *tcp)
#if defined(FREEBSD) || defined(LINUX) || defined(SUNOS4)
|| sys_vfork == func
#endif
+#ifdef LINUX
+ || sys_clone == func
+#endif
#if UNIXWARE > 2
|| sys_rfork == func
#endif
)
return internal_fork(tcp);
-#if defined(LINUX) && (defined SYS_clone || defined SYS_clone2)
- if (sys_clone == func)
- return internal_clone(tcp);
-#endif
-
if ( sys_execve == func
#if defined(SPARC) || defined(SPARC64) || defined(SUNOS4)
|| sys_execv == func