From c1146045298c1bbd3c808fc8a4f5244a9dbaa9e4 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 31 Jul 2011 12:37:52 +0000 Subject: [PATCH] * fhandler.h (class fhandler_dev_mem): Remove dup method declaration. * fhandler_clipboard.cc (fhandler_dev_clipboard::dup): Accommodate the fact that the entire fhandler gets copied over to the child in operator =. * fhandler_floppy.cc (fhandler_dev_floppy::dup): Ditto. * fhandler_raw.cc (fhandler_dev_raw::dup): Ditto. * fhandler_serial.cc (fhandler_serial::dup): Ditto. * fhandler_socket.cc (fhandler_socket::dup): Ditto. * fhandler_virtual.cc (fhandler_virtual::dup): Ditto. * fhandler_mem.cc (fhandler_dev_mem::dup): Ditto. Remove entirely. --- winsup/cygwin/ChangeLog | 13 +++++++++++++ winsup/cygwin/fhandler.h | 1 - winsup/cygwin/fhandler_clipboard.cc | 5 ----- winsup/cygwin/fhandler_floppy.cc | 15 ++------------- winsup/cygwin/fhandler_mem.cc | 15 --------------- winsup/cygwin/fhandler_raw.cc | 1 - winsup/cygwin/fhandler_serial.cc | 2 -- winsup/cygwin/fhandler_socket.cc | 23 +++-------------------- winsup/cygwin/fhandler_virtual.cc | 3 --- 9 files changed, 18 insertions(+), 60 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 75cb0dd83..cc62bc20c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,16 @@ +2011-07-31 Corinna Vinschen + + * fhandler.h (class fhandler_dev_mem): Remove dup method declaration. + * fhandler_clipboard.cc (fhandler_dev_clipboard::dup): Accommodate the + fact that the entire fhandler gets copied over to the child in + operator =. + * fhandler_floppy.cc (fhandler_dev_floppy::dup): Ditto. + * fhandler_raw.cc (fhandler_dev_raw::dup): Ditto. + * fhandler_serial.cc (fhandler_serial::dup): Ditto. + * fhandler_socket.cc (fhandler_socket::dup): Ditto. + * fhandler_virtual.cc (fhandler_virtual::dup): Ditto. + * fhandler_mem.cc (fhandler_dev_mem::dup): Ditto. Remove entirely. + 2011-07-30 Christopher Faylor * cygthread.cc (cygthread::async_create): Define new function. diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 3da41b747..b8c3f20bb 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1317,7 +1317,6 @@ class fhandler_dev_mem: public fhandler_base void __stdcall read (void *ptr, size_t& len) __attribute__ ((regparm (3))); _off64_t lseek (_off64_t offset, int whence); int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2))); - int dup (fhandler_base *child); HANDLE mmap (caddr_t *addr, size_t len, int prot, int flags, _off64_t off); int munmap (HANDLE h, caddr_t addr, size_t len); diff --git a/winsup/cygwin/fhandler_clipboard.cc b/winsup/cygwin/fhandler_clipboard.cc index b0684c2c7..5defe6a3c 100644 --- a/winsup/cygwin/fhandler_clipboard.cc +++ b/winsup/cygwin/fhandler_clipboard.cc @@ -50,11 +50,6 @@ fhandler_dev_clipboard::dup (fhandler_base * child) if (!fhc->open (get_flags (), 0)) system_printf ("error opening clipboard, %E"); - - fhc->membuffer = membuffer; - fhc->pos = pos; - fhc->msize = msize; - return 0; } diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc index bd5bf95e6..bfa9bcb77 100644 --- a/winsup/cygwin/fhandler_floppy.cc +++ b/winsup/cygwin/fhandler_floppy.cc @@ -407,21 +407,10 @@ fhandler_dev_floppy::close () int fhandler_dev_floppy::dup (fhandler_base *child) { - fhandler_dev_floppy *fhc = (fhandler_dev_floppy *) child; - int ret = fhandler_dev_raw::dup (child); - if (!ret) - { - fhc->drive_size = drive_size; - fhc->bytes_per_sector = bytes_per_sector; - if (partitions) - { - InterlockedIncrement (&partitions->refcnt); - fhc->partitions = partitions; - } - fhc->eom_detected (eom_detected ()); - } + if (!ret && partitions) + InterlockedIncrement (&partitions->refcnt); return ret; } diff --git a/winsup/cygwin/fhandler_mem.cc b/winsup/cygwin/fhandler_mem.cc index b172cc576..c38e89c0f 100644 --- a/winsup/cygwin/fhandler_mem.cc +++ b/winsup/cygwin/fhandler_mem.cc @@ -263,18 +263,3 @@ fhandler_dev_mem::fstat (struct __stat64 *buf) return 0; } - -int -fhandler_dev_mem::dup (fhandler_base *child) -{ - int ret = fhandler_base::dup (child); - - if (! ret) - { - fhandler_dev_mem *fhc = (fhandler_dev_mem *) child; - - fhc->mem_size = mem_size; - fhc->pos = pos; - } - return ret; -} diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index 4fe5c92b0..3c67e0a43 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -89,7 +89,6 @@ fhandler_dev_raw::dup (fhandler_base *child) { fhandler_dev_raw *fhc = (fhandler_dev_raw *) child; - fhc->devbufsiz = devbufsiz; if (devbufsiz > 1L) fhc->devbuf = new char [devbufsiz]; fhc->devbufstart = 0; diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc index 65a1c4556..b8b5c2158 100644 --- a/winsup/cygwin/fhandler_serial.cc +++ b/winsup/cygwin/fhandler_serial.cc @@ -1176,7 +1176,5 @@ fhandler_serial::dup (fhandler_base *child) { fhandler_serial *fhc = (fhandler_serial *) child; fhc->overlapped_setup (); - fhc->vmin_ = vmin_; - fhc->vtime_ = vtime_; return fhandler_base::dup (child); } diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 500ee5069..bcb720fb2 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -770,28 +770,11 @@ fhandler_socket::dup (fhandler_base *child) NtClose (fhs->wsock_mtx); return -1; } - fhs->wsock_events = wsock_events; - - fhs->rmem (rmem ()); - fhs->wmem (wmem ()); - fhs->addr_family = addr_family; - fhs->set_socket_type (get_socket_type ()); if (get_addr_family () == AF_LOCAL) { fhs->set_sun_path (get_sun_path ()); fhs->set_peer_sun_path (get_peer_sun_path ()); - if (get_socket_type () == SOCK_STREAM) - { - fhs->sec_pid = sec_pid; - fhs->sec_uid = sec_uid; - fhs->sec_gid = sec_gid; - fhs->sec_peer_pid = sec_peer_pid; - fhs->sec_peer_uid = sec_peer_uid; - fhs->sec_peer_gid = sec_peer_gid; - } } - fhs->connect_state (connect_state ()); - if (!need_fixup_before ()) { int ret = fhandler_base::dup (child); @@ -806,14 +789,14 @@ fhandler_socket::dup (fhandler_base *child) cygheap->user.deimpersonate (); fhs->init_fixup_before (); fhs->set_io_handle (get_io_handle ()); - if (!fhs->fixup_before_fork_exec (GetCurrentProcessId ())) + int ret = fhs->fixup_before_fork_exec (GetCurrentProcessId ()); + cygheap->user.reimpersonate (); + if (!ret) { - cygheap->user.reimpersonate (); fhs->fixup_after_fork (GetCurrentProcess ()); if (fhs->get_io_handle() != (HANDLE) INVALID_SOCKET) return 0; } - cygheap->user.reimpersonate (); cygheap->fdtab.dec_need_fixup_before (); NtClose (fhs->wsock_evt); NtClose (fhs->wsock_mtx); diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc index 1c4e71008..f767d5dbd 100644 --- a/winsup/cygwin/fhandler_virtual.cc +++ b/winsup/cygwin/fhandler_virtual.cc @@ -160,10 +160,7 @@ fhandler_virtual::dup (fhandler_base * child) { fhandler_virtual *fhproc_child = (fhandler_virtual *) child; fhproc_child->filebuf = (char *) cmalloc_abort (HEAP_BUF, filesize); - fhproc_child->filesize = filesize; - fhproc_child->position = position; memcpy (fhproc_child->filebuf, filebuf, filesize); - fhproc_child->set_flags (get_flags ()); } return ret; } -- 2.43.5