(fhandler_tty_master::fixup_after_exec): Ditto.
* fhandler_tty.cc (fhandler_tty_master::init): Fix so that children do not
inherit master tty handles.
(fhandler_tty_master::fixup_after_fork): Remove, since it was never used.
(fhandler_tty_master::fixup_after_exec): Ditto.
* pinfo.cc (_pinfo::set_ctty): Increment open_fhs when ctty is set.
* cygheap.cc (cygheap_init): Ditto.
* syscalls.cc (setsid): *Always* call close on opened ctty since the archetype
is associated with the ctty and it counts as an opened handle.
* tty.cc (tty::common_init): Don't protect input/output mutex since it confuses
subsequent fork/execs when CYGWIN=tty.
+2003-12-26 Christopher Faylor <cgf@redhat.com>
+
+ * fhandler.h (fhandler_tty_master::fixup_after_fork): Remove
+ declaration.
+ (fhandler_tty_master::fixup_after_exec): Ditto.
+ * fhandler_tty.cc (fhandler_tty_master::init): Fix so that children do
+ not inherit master tty handles.
+ (fhandler_tty_master::fixup_after_fork): Remove, since it was never
+ used.
+ (fhandler_tty_master::fixup_after_exec): Ditto.
+ * pinfo.cc (_pinfo::set_ctty): Increment open_fhs when ctty is set.
+ * cygheap.cc (cygheap_init): Ditto.
+ * syscalls.cc (setsid): *Always* call close on opened ctty since the
+ archetype is associated with the ctty and it counts as an opened
+ handle.
+ * tty.cc (tty::common_init): Don't protect input/output mutex since it
+ confuses subsequent fork/execs when CYGWIN=tty.
+
2003-12-26 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (try_to_debug): Fix off-by-one problem when resetting
&& (set_process_privilege (SE_CREATE_GLOBAL_NAME, true) >= 0
|| GetLastError () == ERROR_NO_SUCH_PRIVILEGE)
? "Global\\" : "");
+ if (cygheap->ctty)
+ {
+ fhandler_console::open_fhs++;
+ debug_printf ("tty%d, open_fhs %d, arch usecount %d",
+ cygheap->ctty->get_ttyp ()->ntty,
+ fhandler_console::open_fhs, cygheap->ctty->usecount);
+ }
}
/* Copyright (C) 1997, 2000 DJ Delorie */
virtual int dup (fhandler_base *child);
- tty *get_ttyp () { return (tty *)tc; }
+ tty *get_ttyp () { return (tty *) tc; }
int close ();
void set_close_on_exec (int val);
int init ();
int init_console ();
void set_winsize (bool);
- void fixup_after_fork (HANDLE parent);
- void fixup_after_exec (HANDLE);
bool is_slow () {return 1;}
};
set_winsize (false);
inuse = get_ttyp ()->create_inuse (TTY_MASTER_ALIVE);
+ set_close_on_exec (true);
cygthread *h;
h = new cygthread (process_input, cygself, "ttyin");
}
}
-void
-fhandler_tty_master::fixup_after_fork (HANDLE child)
-{
- fhandler_pty_master::fixup_after_fork (child);
- console->fixup_after_fork (child);
-}
-
-void
-fhandler_tty_master::fixup_after_exec (HANDLE)
-{
- console->close ();
- init_console ();
-}
-
int
fhandler_tty_master::init_console ()
{
if (arch)
{
arch->usecount++;
- debug_printf ("arch usecount for tty%d is %d", tc->ntty, arch->usecount);
+ fhandler_console::open_fhs++;
+ debug_printf ("tty%d, open_fhs %d, arch usecount %d", tc->ntty,
+ fhandler_console::open_fhs, arch->usecount);
}
}
}
myself->pgid, myself->ctty, fhandler_console::open_fhs);
if (cygheap->ctty)
{
- if (cygheap->ctty->usecount == 1)
- cygheap->ctty->close ();
+ cygheap->ctty->close ();
cygheap->ctty = NULL;
}
return myself->sid;
return false;
}
- ProtectHandle1INH (ptym->output_mutex, output_mutex);
- ProtectHandle1INH (ptym->input_mutex, input_mutex);
+ // /* screws up tty master */ ProtectHandle1INH (ptym->output_mutex, output_mutex);
+ // /* screws up tty master */ ProtectHandle1INH (ptym->input_mutex, input_mutex);
winsize.ws_col = 80;
winsize.ws_row = 25;
class tty: public tty_min
{
HANDLE get_event (const char *fmt, BOOL manual_reset = FALSE)
- __attribute__ ((regparm (2)));
+ __attribute__ ((regparm (3)));
public:
HWND hwnd; /* Console window handle tty belongs to */