From 1204c515fe00335920c5707cc136e9562fd7cf38 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 28 Sep 2005 19:02:53 +0000 Subject: * fhandler.h (class fhandler_dev_raw): Delete current_position and eof_detected status flag. Delete is_eom and is_eof methods. Move drive_size, bytes_per_sector, eom_detected status flag, as well as the methods read_file, write_file, raw_read and raw_write to ... (class fhandler_dev_floppy): ... here. Remove is_eom and is_eof methods. Add dup method. * fhandler_floppy.cc (IS_EOM): New macro. (fhandler_dev_floppy::is_eom): Remove. (fhandler_dev_floppy::is_eof): Remove. (fhandler_dev_floppy::fhandler_dev_floppy): Initialize status flags. (fhandler_dev_floppy::get_drive_info): Only call EX functions on systems supporting them and stop suffering strange delays. (fhandler_dev_floppy::read_file): Move here, drop setting current_position. (fhandler_dev_floppy::write_file): Move here, drop setting current_position. (fhandler_dev_floppy::open): Rearrange comment. (fhandler_dev_floppy::dup): New method. (fhandler_dev_floppy::get_current_position): New inline method. Use instead of former current_position were appropriate. (fhandler_dev_floppy::raw_read): Move here. Drop EOF handling. (fhandler_dev_floppy::raw_write): Move here. Drop EOF handling. (fhandler_dev_floppy::lseek): Remove useless conditions. Convert sector_aligned_offset to LARGE_INTEGER to improve SetFilePointer call. (fhandler_dev_floppy::ioctl): Move blocksize check in RDSETBLK case to here. * fhandler_raw.cc (fhandler_dev_raw::is_eom): Remove. (fhandler_dev_raw::is_eof): Remove. (fhandler_dev_raw::write_file): Remove. (fhandler_dev_raw::read_file): Remove. (fhandler_dev_raw::raw_read): Remove. (fhandler_dev_raw::raw_write): Remove. (fhandler_dev_raw::dup): Drop copying removed members. (fhandler_dev_raw::ioctl): Drop blocksize testing. * wincap.h: Implement has_disk_ex_ioctls throughout. * wincap.cc: Ditto. (wincap_vista): Preliminary wincaps for Windows Vista/Longhorn. (wincapc::init): Add Vista/Longhorn handling. --- winsup/cygwin/fhandler_tty.cc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'winsup/cygwin/fhandler_tty.cc') diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 5016c5a4f..2c7f1e8cd 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -915,9 +915,12 @@ fhandler_tty_slave::read (void *ptr, size_t& len) } int -fhandler_tty_slave::dup (fhandler_base *child) +fhandler_tty_slave::dup (fhandler_base *child, HANDLE from_proc) { fhandler_tty_slave *arch = (fhandler_tty_slave *) archetype; + if (!arch) /* Might happen on descriptor passing */ + return !((fhandler_tty_slave *) child)->open (get_flags (), 0); + *(fhandler_tty_slave *) child = *arch; child->usecount = 0; arch->usecount++; @@ -928,7 +931,7 @@ fhandler_tty_slave::dup (fhandler_base *child) } int -fhandler_tty_common::dup (fhandler_base *child) +fhandler_tty_common::dup (fhandler_base *child, HANDLE from_proc) { fhandler_tty_slave *fts = (fhandler_tty_slave *) child; int errind; @@ -941,7 +944,7 @@ fhandler_tty_common::dup (fhandler_base *child) if (output_done_event == NULL) fts->output_done_event = NULL; - else if (!DuplicateHandle (hMainProc, output_done_event, hMainProc, + else if (!DuplicateHandle (from_proc, output_done_event, hMainProc, &fts->output_done_event, 0, 1, DUPLICATE_SAME_ACCESS)) { @@ -950,7 +953,7 @@ fhandler_tty_common::dup (fhandler_base *child) } if (ioctl_request_event == NULL) fts->ioctl_request_event = NULL; - else if (!DuplicateHandle (hMainProc, ioctl_request_event, hMainProc, + else if (!DuplicateHandle (from_proc, ioctl_request_event, hMainProc, &fts->ioctl_request_event, 0, 1, DUPLICATE_SAME_ACCESS)) { @@ -959,35 +962,35 @@ fhandler_tty_common::dup (fhandler_base *child) } if (ioctl_done_event == NULL) fts->ioctl_done_event = NULL; - else if (!DuplicateHandle (hMainProc, ioctl_done_event, hMainProc, + else if (!DuplicateHandle (from_proc, ioctl_done_event, hMainProc, &fts->ioctl_done_event, 0, 1, DUPLICATE_SAME_ACCESS)) { errind = 3; goto err; } - if (!DuplicateHandle (hMainProc, input_available_event, hMainProc, + if (!DuplicateHandle (from_proc, input_available_event, hMainProc, &fts->input_available_event, 0, 1, DUPLICATE_SAME_ACCESS)) { errind = 4; goto err; } - if (!DuplicateHandle (hMainProc, output_mutex, hMainProc, + if (!DuplicateHandle (from_proc, output_mutex, hMainProc, &fts->output_mutex, 0, 1, DUPLICATE_SAME_ACCESS)) { errind = 5; goto err; } - if (!DuplicateHandle (hMainProc, input_mutex, hMainProc, + if (!DuplicateHandle (from_proc, input_mutex, hMainProc, &fts->input_mutex, 0, 1, DUPLICATE_SAME_ACCESS)) { errind = 6; goto err; } - if (!DuplicateHandle (hMainProc, get_handle (), hMainProc, + if (!DuplicateHandle (from_proc, get_handle (), hMainProc, &nh, 0, 1, DUPLICATE_SAME_ACCESS)) { @@ -996,7 +999,7 @@ fhandler_tty_common::dup (fhandler_base *child) } fts->set_io_handle (nh); - if (!DuplicateHandle (hMainProc, get_output_handle (), hMainProc, + if (!DuplicateHandle (from_proc, get_output_handle (), hMainProc, &nh, 0, 1, DUPLICATE_SAME_ACCESS)) { @@ -1007,7 +1010,7 @@ fhandler_tty_common::dup (fhandler_base *child) if (inuse == NULL) fts->inuse = NULL; - else if (!DuplicateHandle (hMainProc, inuse, hMainProc, + else if (!DuplicateHandle (from_proc, inuse, hMainProc, &fts->inuse, 0, 1, DUPLICATE_SAME_ACCESS)) { -- cgit v1.2.3