aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libthread/Linux-sparc64-asm.s3
-rw-r--r--src/libthread/exec.c3
-rw-r--r--src/libthread/threadimpl.h9
3 files changed, 14 insertions, 1 deletions
diff --git a/src/libthread/Linux-sparc64-asm.s b/src/libthread/Linux-sparc64-asm.s
index c371266f..422a1b24 100644
--- a/src/libthread/Linux-sparc64-asm.s
+++ b/src/libthread/Linux-sparc64-asm.s
@@ -1,3 +1,6 @@
+! Actually sparc32 assembly.
+! Debian's sparc64 port is a 32-bit user space.
+
.section ".text", #alloc, #execinstr
.align 8
.skip 16
diff --git a/src/libthread/exec.c b/src/libthread/exec.c
index a6d536ec..3c71e4b1 100644
--- a/src/libthread/exec.c
+++ b/src/libthread/exec.c
@@ -76,10 +76,11 @@ _threadspawn(int fd[3], char *cmd, char *argv[])
return -1;
case 0:
/* can't RFNOTEG - will lose tty */
- /* rfork(RFNOTEG); */
dup2(fd[0], 0);
dup2(fd[1], 1);
dup2(fd[2], 2);
+ if(!isatty(0) && !isatty(1) && !isatty(2))
+ rfork(RFNOTEG);
for(i=3; i<100; i++)
if(i != p[1])
close(i);
diff --git a/src/libthread/threadimpl.h b/src/libthread/threadimpl.h
index 12b8a998..bc0667f7 100644
--- a/src/libthread/threadimpl.h
+++ b/src/libthread/threadimpl.h
@@ -46,6 +46,14 @@ extern void makecontext(ucontext_t*, void(*)(), int, ...);
extern pid_t rfork_thread(int, void*, int(*)(void*), void*);
#endif
+#if defined(__sun__)
+# define mcontext libthread_mcontext
+# define mcontext_t libthread_mcontext_t
+# define ucontext libthread_ucontext
+# define ucontext_t libthread_ucontext_t
+# include "sparc-ucontext.h"
+#endif
+
#if defined(__arm__)
int getmcontext(mcontext_t*);
void setmcontext(const mcontext_t*);
@@ -53,6 +61,7 @@ void setmcontext(const mcontext_t*);
#define getcontext(u) getmcontext(&(u)->uc_mcontext)
#endif
+
typedef struct Context Context;
typedef struct Execjob Execjob;
typedef struct Proc Proc;