set RFNOTEG when we can

This commit is contained in:
rsc 2006-06-04 16:06:49 +00:00
parent 14695b90ac
commit 17558fbe2d
3 changed files with 14 additions and 1 deletions

View file

@ -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

View file

@ -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);

View file

@ -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;