aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-12-28 07:10:39 +0000
committerChristopher Faylor <me@cgf.cx>2002-12-28 07:10:39 +0000
commita735a91b983fc9093b9146d889291f69bb5cf32b (patch)
tree73ca927aaec044dc7d148a760d6eb7b65183266d
parent0234386f30330b61c21e3bcf5c5d74561fd501db (diff)
downloadnewlib-unlabeled-1.83.4.zip
newlib-unlabeled-1.83.4.tar.gz
newlib-unlabeled-1.83.4.tar.bz2
Introduce device class to cygwin throughout. Rename FH_DISK to FH_FSgithub/unlabeled-1.83.4unlabeled-1.83.4
throughout. * dcrt0.cc (dll_crt0_1): Initialize device globals via device::init. * dtable.cc (dtable::init_std_file_from_handle): Use device numbers rather than names when they are known. Should speed up process startup slightly. (dtable::build_fhandler_from_name): Pass path_conv device to build_fhandler. (dtable::build_fhandler): Accept device argument rather than separate device/unit arguments. (dtable::build_fhandler): Ditto. Separate switch statement by devices which take units and those which don't. Build unix/win32 names from device if required. (dtable::dup_worker): Reflect changes to build_fhandler arguments. * dtable.h (dtable::build_fhandler): Ditto. * fhandler.cc (fhandler_base::set_name): Eliminate unit argument. Use get_unit to derive unit. * fhandler.h: Separate FH device defines into devices.h include. Define is_slow as appropriate for each fhandler_class. (fhandler_base::dev): New element. (fhandler_base::fhandler_base): Eliminate unit argument. (fhandler_base::get_device): Return device number. (fhandler_base::get_major): Return device major number. (fhandler_base::get_minor): Return device minor number. (fhandler_base::get_unit): Ditto. (fhandler_base::get_native_name): Return device format field. (fhandler_fifo): New class. (select_stuff::device_specific): Remove array. (select_stuff::device_specific_pipe): New class element. (select_stuff::device_specific_socket): New class element. (select_stuff::device_specific_serial): New class element. (select_stuff::select_stuff): Initialize new elements. * fhandler_disk_file.cc (fhandler_cygdrive::fhandler_cygdrive): Remove unit initialization. * fhandler_tty.cc (fhandler_tty_master::init_console): Use "console_dev" global to initialize captive console used by tty master. * mmap.cc (mmap_record::devtype_): Remove. (mmap_record::dev): New. (mmap_record::mmap_record): Use dev. (mmap_record::get_device): Implement via dev. * net.cc (fdsock): Use socket_dev global to initialize socket fhandler. * path.cc (path_conv::check): Accommodate new path_conv::dev element. (get_devn): Eliminate. (get_raw_device_number): Ditto. (get_device_number): Ditto. (win32_device_name): Accept dev argument. Use it. Use device::parse to derive potential device name. (mount_info::conv_to_win32_path): Accept dev argument. Use it. * path.h (path_conv::devn): Eliminate. (path_conv::unit): Ditto. (path_conv::dev): Declare. (path_conv::path_conv): Don't initialize deleted members. (path_conv::is_device): Implement via dev element. (path_conv::get_devn): Ditto. (path_conv::get_unitn): Ditto. * pipe.cc (make_pipe): Use pipe[rw]_dev in fhandler construction. * select.cc: Use new device_specific_* select class elements * shared_info.h (CURR_MOUNT_MAGIC): Update. (mount_info::conv_to_win32_path): Reflect new arguments. * syscalls.cc (fstat64): Just use get_device() without interpretation for st_dev element. (stat_worker): Ditto. * tty.cc (create_tty_master): Use ttym_dev in fhandler constructor. (tty::common_init): Check for tty major device number rather than FH_TTYM.
-rw-r--r--winsup/cygwin/select.cc28
1 files changed, 14 insertions, 14 deletions
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index d8d8999..442b8b8 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -555,9 +555,9 @@ out:
static int
start_thread_pipe (select_record *me, select_stuff *stuff)
{
- if (stuff->device_specific[FHDEVN (FH_PIPE)])
+ if (stuff->device_specific_pipe)
{
- me->h = *((pipeinf *) stuff->device_specific[FHDEVN (FH_PIPE)])->thread;
+ me->h = *((pipeinf *) stuff->device_specific_pipe)->thread;
return 1;
}
pipeinf *pi = new pipeinf;
@@ -567,20 +567,20 @@ start_thread_pipe (select_record *me, select_stuff *stuff)
me->h = *pi->thread;
if (!me->h)
return 0;
- stuff->device_specific[FHDEVN (FH_PIPE)] = (void *) pi;
+ stuff->device_specific_pipe = (void *) pi;
return 1;
}
static void
pipe_cleanup (select_record *, select_stuff *stuff)
{
- pipeinf *pi = (pipeinf *) stuff->device_specific[FHDEVN (FH_PIPE)];
+ pipeinf *pi = (pipeinf *) stuff->device_specific_pipe;
if (pi && pi->thread)
{
pi->stop_thread_pipe = true;
pi->thread->detach ();
delete pi;
- stuff->device_specific[FHDEVN (FH_PIPE)] = NULL;
+ stuff->device_specific_pipe = NULL;
}
}
@@ -982,9 +982,9 @@ thread_serial (void *arg)
static int
start_thread_serial (select_record *me, select_stuff *stuff)
{
- if (stuff->device_specific[FHDEVN (FH_SERIAL)])
+ if (stuff->device_specific_serial)
{
- me->h = *((serialinf *) stuff->device_specific[FHDEVN (FH_SERIAL)])->thread;
+ me->h = *((serialinf *) stuff->device_specific_serial)->thread;
return 1;
}
serialinf *si = new serialinf;
@@ -992,20 +992,20 @@ start_thread_serial (select_record *me, select_stuff *stuff)
si->stop_thread_serial = FALSE;
si->thread = new cygthread (thread_serial, (LPVOID) si, "select_serial");
me->h = *si->thread;
- stuff->device_specific[FHDEVN (FH_SERIAL)] = (void *) si;
+ stuff->device_specific_serial = (void *) si;
return 1;
}
static void
serial_cleanup (select_record *, select_stuff *stuff)
{
- serialinf *si = (serialinf *) stuff->device_specific[FHDEVN (FH_SERIAL)];
+ serialinf *si = (serialinf *) stuff->device_specific_serial;
if (si && si->thread)
{
si->stop_thread_serial = true;
si->thread->detach ();
delete si;
- stuff->device_specific[FHDEVN (FH_SERIAL)] = NULL;
+ stuff->device_specific_serial = NULL;
}
}
@@ -1253,7 +1253,7 @@ start_thread_socket (select_record *me, select_stuff *stuff)
{
socketinf *si;
- if ((si = (socketinf *) stuff->device_specific[FHDEVN (FH_SOCKET)]))
+ if ((si = (socketinf *) stuff->device_specific_socket))
{
me->h = *si->thread;
return 1;
@@ -1321,7 +1321,7 @@ start_thread_socket (select_record *me, select_stuff *stuff)
select_printf ("exitsock %p", si->exitsock);
WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->readfds);
WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->exceptfds);
- stuff->device_specific[FHDEVN (FH_SOCKET)] = (void *) si;
+ stuff->device_specific_socket = (void *) si;
si->start = &stuff->start;
select_printf ("stuff_start %p", &stuff->start);
si->thread = new cygthread (thread_socket, (LPVOID) si, "select_socket");
@@ -1337,7 +1337,7 @@ err:
void
socket_cleanup (select_record *, select_stuff *stuff)
{
- socketinf *si = (socketinf *) stuff->device_specific[FHDEVN (FH_SOCKET)];
+ socketinf *si = (socketinf *) stuff->device_specific_socket;
select_printf ("si %p si->thread %p", si, si ? si->thread : NULL);
if (si && si->thread)
{
@@ -1365,7 +1365,7 @@ socket_cleanup (select_record *, select_stuff *stuff)
si->thread->detach ();
shutdown (si->exitsock, SD_BOTH);
closesocket (si->exitsock);
- stuff->device_specific[FHDEVN (FH_SOCKET)] = NULL;
+ stuff->device_specific_socket = NULL;
delete si;
}
select_printf ("returning");