* cygthread.cc (cygthread::terminate_thread): In debugging output, use name of

thread being terminated rather than thread doing terminating.
* fhandler.h (fhandler_pty_master::slave): Delete.
(fhandler_pty_master::get_unit): Ditto.
(fhandler_pty_master::setup): Change argument declaration to accommodate new
usage.
* fhandler_tty.cc (fhandler_tty_master::init): Remove obsolete slave
assignment.  Pass argument to setup indicating that this is a tty.
(fhandler_tty_slave::open): Use dev() method rather than referencing pc.dev
directly.
(fhandler_pty_master::open): Don't create archetype based on ptym device
number.  Set device number to use DEV_TTYM_MAJOR and tty number.  Pass argument
to setup indicating that this is a pty.
(fhandler_pty_master::setup): Change single argument to a flag indicating
whether we're creating a pty and use appropriately.  Calculate 't' variable
here rather than in caller.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Use dev() method rather than
referencing pc.dev directly.
This commit is contained in:
Christopher Faylor 2006-06-03 21:44:01 +00:00
parent 71d59a926f
commit c76ca04746
5 changed files with 35 additions and 25 deletions

View File

@ -1,3 +1,26 @@
2006-06-03 Christopher Faylor <cgf@timesys.com>
* cygthread.cc (cygthread::terminate_thread): In debugging output, use
name of thread being terminated rather than thread doing terminating.
* fhandler.h (fhandler_pty_master::slave): Delete.
(fhandler_pty_master::get_unit): Ditto.
(fhandler_pty_master::setup): Change argument declaration to
accommodate new usage.
* fhandler_tty.cc (fhandler_tty_master::init): Remove obsolete slave
assignment. Pass argument to setup indicating that this is a tty.
(fhandler_tty_slave::open): Use dev() method rather than referencing
pc.dev directly.
(fhandler_pty_master::open): Don't create archetype based on ptym
device number. Set device number to use DEV_TTYM_MAJOR and tty number.
Pass argument to setup indicating that this is a pty.
(fhandler_pty_master::setup): Change single argument to a flag
indicating whether we're creating a pty and use appropriately.
Calculate 't' variable here rather than in caller.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Use dev() method rather
than referencing pc.dev directly.
2006-06-03 Christopher Faylor <cgf@timesys.com> 2006-06-03 Christopher Faylor <cgf@timesys.com>
* dcrt0.cc (dll_crt0_0): Call tty_list::init_session here. * dcrt0.cc (dll_crt0_0): Call tty_list::init_session here.

View File

@ -289,7 +289,7 @@ bool
cygthread::terminate_thread () cygthread::terminate_thread ()
{ {
bool terminated = true; bool terminated = true;
debug_printf ("thread '%s', id %p, inuse %d, stack_ptr %p", name (), id, inuse, stack_ptr); debug_printf ("thread '%s', id %p, inuse %d, stack_ptr %p", __name, id, inuse, stack_ptr);
while (inuse && !stack_ptr) while (inuse && !stack_ptr)
low_priority_sleep (0); low_priority_sleep (0);

View File

@ -993,8 +993,6 @@ class fhandler_tty_slave: public fhandler_tty_common
class fhandler_pty_master: public fhandler_tty_common class fhandler_pty_master: public fhandler_tty_common
{ {
int pktmode; // non-zero if pty in a packet mode. int pktmode; // non-zero if pty in a packet mode.
protected:
device slave; // device type of slave
public: public:
int need_nl; // Next read should start with \n int need_nl; // Next read should start with \n
DWORD dwProcessId; // Owner of master handles DWORD dwProcessId; // Owner of master handles
@ -1019,8 +1017,7 @@ public:
HANDLE from_master, to_master; HANDLE from_master, to_master;
bool hit_eof (); bool hit_eof ();
int get_unit () const { return slave.minor; } bool setup (bool);
bool setup (tty&);
int dup (fhandler_base *); int dup (fhandler_base *);
void fixup_after_fork (HANDLE parent); void fixup_after_fork (HANDLE parent);
void fixup_after_exec (); void fixup_after_exec ();

View File

@ -945,7 +945,7 @@ fhandler_dev_dsp::fhandler_dev_dsp ():
int int
fhandler_dev_dsp::open (int flags, mode_t mode) fhandler_dev_dsp::open (int flags, mode_t mode)
{ {
if (cygheap->fdtab.find_archetype (pc.dev)) if (cygheap->fdtab.find_archetype (dev ()))
{ {
set_errno (EBUSY); set_errno (EBUSY);
return 0; return 0;

View File

@ -62,7 +62,6 @@ fhandler_tty_master::set_winsize (bool sendSIGWINCH)
int int
fhandler_tty_master::init () fhandler_tty_master::init ()
{ {
slave = dev ();
termios_printf ("Creating master for tty%d", get_unit ()); termios_printf ("Creating master for tty%d", get_unit ());
if (init_console ()) if (init_console ())
@ -75,7 +74,7 @@ fhandler_tty_master::init ()
memset (&ti, 0, sizeof (ti)); memset (&ti, 0, sizeof (ti));
console->tcsetattr (0, &ti); console->tcsetattr (0, &ti);
if (!setup (*cygwin_shared->tty[get_unit ()])) if (!setup (false))
return 1; return 1;
set_winsize (false); set_winsize (false);
@ -458,7 +457,7 @@ int
fhandler_tty_slave::open (int flags, mode_t) fhandler_tty_slave::open (int flags, mode_t)
{ {
if (get_device () == FH_TTY) if (get_device () == FH_TTY)
pc.dev.tty_to_real_device (); dev().tty_to_real_device ();
fhandler_tty_slave *arch = (fhandler_tty_slave *) cygheap->fdtab.find_archetype (pc.dev); fhandler_tty_slave *arch = (fhandler_tty_slave *) cygheap->fdtab.find_archetype (pc.dev);
if (arch) if (arch)
{ {
@ -1084,23 +1083,13 @@ fhandler_pty_master::fhandler_pty_master ()
int int
fhandler_pty_master::open (int flags, mode_t) fhandler_pty_master::open (int flags, mode_t)
{ {
fhandler_pty_master *arch = (fhandler_tty_master *) cygheap->fdtab.find_archetype (pc.dev);
if (arch)
{
*this = *(fhandler_pty_master *) arch;
termios_printf ("copied fhandler_pty_master archetype");
set_flags ((flags & ~O_TEXT) | O_BINARY);
goto out;
}
int ntty; int ntty;
ntty = cygwin_shared->tty.allocate (false); ntty = cygwin_shared->tty.allocate (false);
if (ntty < 0) if (ntty < 0)
return 0; return 0;
slave = *ttys_dev; dev().devn = FHDEV (DEV_TTYM_MAJOR, ntty);
slave.setunit (ntty); if (!setup (true))
if (!setup (*cygwin_shared->tty[ntty]))
{ {
lock_ttys::release (); lock_ttys::release ();
return 0; return 0;
@ -1110,13 +1099,12 @@ fhandler_pty_master::open (int flags, mode_t)
set_open_status (); set_open_status ();
// //
// FIXME: Do this better someday // FIXME: Do this better someday
arch = (fhandler_tty_master *) cmalloc (HEAP_ARCHETYPES, sizeof (*this)); fhandler_pty_master *arch = (fhandler_tty_master *) cmalloc (HEAP_ARCHETYPES, sizeof (*this));
*((fhandler_pty_master **) cygheap->fdtab.add_archetype ()) = arch; *((fhandler_pty_master **) cygheap->fdtab.add_archetype ()) = arch;
archetype = arch; archetype = arch;
*arch = *this; *arch = *this;
arch->dwProcessId = GetCurrentProcessId (); arch->dwProcessId = GetCurrentProcessId ();
out:
usecount = 0; usecount = 0;
arch->usecount++; arch->usecount++;
char buf[sizeof ("opened pty master for ttyNNNNNNNNNNN")]; char buf[sizeof ("opened pty master for ttyNNNNNNNNNNN")];
@ -1338,8 +1326,10 @@ fhandler_tty_master::init_console ()
} while (0) } while (0)
bool bool
fhandler_pty_master::setup (tty& t) fhandler_pty_master::setup (bool ispty)
{ {
tty& t = *cygwin_shared->tty[get_unit ()];
tcinit (&t, true); /* Set termios information. Force initialization. */ tcinit (&t, true); /* Set termios information. Force initialization. */
const char *errstr = NULL; const char *errstr = NULL;
@ -1380,7 +1370,7 @@ fhandler_pty_master::setup (tty& t)
/* Create synchronisation events */ /* Create synchronisation events */
if (get_major () == DEV_TTYM_MAJOR) if (!ispty)
{ {
if (!(output_done_event = t.get_event (errstr = OUTPUT_DONE_EVENT))) if (!(output_done_event = t.get_event (errstr = OUTPUT_DONE_EVENT)))
goto err; goto err;