OSDN Git Service

* mount.cc (fs_info::update): Set has_buggy_reopen for Netapps as well.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / ChangeLog
index 0215311..f517537 100644 (file)
+2011-12-12  Corinna Vinschen  <vinschen@redhat.com>
+
+       * mount.cc (fs_info::update): Set has_buggy_reopen for Netapps as well.
+
+2011-12-12  Corinna Vinschen  <vinschen@redhat.com>
+           Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * dcrt0.cc (wow64_respawn): New static variable.
+       (wow64_started_from_native64): New function to check if a WOW64
+       process got started from a native 64 bit process.
+       (respawn_wow64_process): New function to respawn process.
+       (dll_crt0_0): When started from a native parent, check if parent
+       is a 64 bit process.  If so, return early.
+       (_dll_crt0): Respawn WOW64 process here if required.
+       * init.cc (respawn_wow64_process): Remove.
+       (dll_entry): Rename wow64_test_stack_marker to test_stack_marker.
+       Drop WOW64 test here.
+
+2011-12-11  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * pipe.cc (fhandler_pipe::create): Use debug_printf to print debugging
+       info since this isn't a "syscall".
+       (pipe_worker): New function created from _pipe().
+       (_pipe): Use pipe_worker to create a pipe.  Use standard syscall strace
+       reporting on exit.
+       (pipe): Ditto.
+       (pipe2): Ditto.
+
+2011-12-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * select.cc (select_stuff::wait): Very minor formatting fix.
+       (peek_windows): Report on HWND handle used in queries.
+       * select.h: Update copyright.
+       * sigproc.h (cygwait): Eliminate multi-argument variety since more
+       general implementation may cause odd problems in select.  Also force to
+       always be inline.
+
+2011-12-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.h (cygwait): Delete duplicate va_start and add matching
+       va_end.
+
+2011-12-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.h (cygwait): Tweak test for cancellable event to make it a
+       little more clear.
+
+2011-12-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * exceptions.cc (ctrl_c_handler): YA in a series or reversions.  Put
+       back _my_tls.remove along with a comment.
+       (sigpacket::process): Remove code which now causes a gdb deadlock.
+       * sigproc.cc (_cygtls::signal_exit): Signal debugger with signal number
+       earlier.
+
+2011-12-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * dllfixdbg: Work around annoying gdb warning about missing
+       .gnu_debuglink.
+
+2011-12-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       Rename cygWFMO to cygwait throughout and use the magic of polymorphism
+       to "wait for stuff".
+       * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use
+       simplified arg form of cygwait.
+       * fhandler_console.cc (fhandler_console::read): Ditto.
+       * fhandler_audio.cc (fhandler_dev_dsp::Audio_out::waitforspac): Ditto.
+       (fhandler_dev_dsp::Audio_in::waitfordata): Ditto.
+       * fhandler_fifo.cc (fhandler_fifo::wait): Ditto.
+       * fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
+       (fhandler_serial::raw_write): Ditto.
+       * select.cc (cygwin_select): Ditto.
+       * sigproc.h (cygwait): Rename from cygWFMO.  Define two argument and
+       single argument forms of this function.
+
+       * fhandler_tty.cc (fhandler_pty_slave::open): Use method to query if
+       tty is open.
+       (fhandler_pty_slave::read): Send SIGHUP when master is detected as
+       closed.
+       (fhandler_pty_common::close): Close input_available_event in callers
+       since master may need to signal it first.
+       (fhandler_pty_master::close): Lie and set input_available_event when
+       closing, then close input_available_event.
+       (fhandler_pty_slave::close): Close input_available_event explicitly
+       here.
+       * tty.h (tty::is_master_closed): Declare new method.
+
+2011-12-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.cc (signal_exit): Revert reversion of 2011-12-04 change
+       since, otherwise, you see hangs when the signal pipe is closed.
+
+2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * select.cc (cygwin_select): Fifth time is the charm.
+
+2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * select.cc (cygwin_select): Make sure that 0 is returned when sel.wait
+       times out.
+
+2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * include/sys/wait.h: Add in all c++ functions.
+
+2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * select.cc (select_stuff::wait): Temporarily disallow APCS.
+
+2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * include/sys/wait.h: Ensure that C++ functions are only used when
+       using C++.
+
+2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * select.cc (cygwin_select): Make sure that poll is called when
+       appropriate.
+
+2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * dll_init.cc (dll_dllcrt0): Don't try to initialize dll data if we're
+       dynamically loaded since fork() doesn't work in that scenario anyway.
+       (dll_dllcrt0_1): Don't accommodate dynamically loaded dlls.
+       * exceptions.cc (ctrl_c_handler): Don't lock the process; there's too
+       much risk of deadlock.
+       * sigproc.cc (_cygtls::remove_wq): Don't try to remove anything from
+       the waitq if there is obviously nothing there.
+       * strace.cc (strace::activate): Allow stracing dynamically loaded
+       cygwin1.dll.
+
+2011-12-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * fhandler_termios.cc (tty_min::kill_pgrp): Don't send __SIGSETPGRP
+       to ourselves since presumably we are already initialized.
+
+2011-12-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * select.cc (cygwin_select): Add common introducer and leaver debug
+       output.
+       (select_stuff::poll): Remove unneeded debugging.
+
+2011-12-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * exceptions.cc (ctrl_c_handler): Remove _my_tls.remove since it can
+       cause deadlocks during exec and will eventually be handled anyway.
+
+2011-12-07  Corinna Vinschen  <vinschen@redhat.com>
+
+       * spawn.cc (child_info_spawn::worker): Add CREATE_BREAKAWAY_FROM_JOB
+       to all spawned processes.  Explain why.
+
+2011-12-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * fhandler_fifo.cc (fhandler_fifo::wait): Fix stupid typo and actually
+       wait for the handle.
+
+2011-12-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.cc (close_my_readsig): New function.
+       (_cygtls::signal_exit): Close my_readsig via close_my_readsig(),
+       avoiding communication with the signal pipe.
+       (wait_sig): Close my_readsig via close_my_readsig().
+
+2011-12-05  Corinna Vinschen  <vinschen@redhat.com>
+
+       * mmap.cc (mlock): Replace LOCK_VM_IN_WSL with correct MAP_PROCESS.
+       (munlock): Ditto.
+       * ntdll.h: Rearrange to have all preprocessor definitions at the start
+       of the file.  Add comments to each definition block.
+       (MAP_PROCESS): Rename from LOCK_VM_IN_WSL.
+       (MAP_SYSTEM): Rename from LOCK_VM_IN_RAM.
+
+2011-12-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.h (cygWFMO): Don't assume that cancellable event is always
+       available.
+       * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::waitforspace): Use
+       cygWFMO instead of WaitForMultipleObjects.
+       (fhandler_dev_dsp::Audio_in::waitfordata): Ditto.
+       * fhandler_fifo.cc (fhandler_fifo::wait): Ditto.
+       * fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
+       (fhandler_serial::raw_write): Ditto.
+       * fhandler_tty.cc (fhandler_pty_slave::read): Ditto.
+       * select.cc (cygwin_select): Ditto for degenerate case.
+
+2011-12-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.h (cygWFMO): Move inside "INSIDE_CYGWIN" #ifdef.
+
+2011-12-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * exceptions.cc (exception::handle): Drop abbreviation for "exception"
+       since I never remember what it stands for.
+       (sig_handle_tty_stop): Remove obsolete call to reset_signal_arrived.
+       (_cygtls::call_signal_handler): Rework to grab signal information from
+       _main_tls if none is set for _my_tls.  Try harder to keep thread
+       locked.
+       (reset_signal_arrived): Delete.
+       * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use new
+       cygWFMO call to wait for an event + standard cygwin stuff.  Modify
+       debug output to acccomodate new function.
+       * fhandler_console.cc (fhandler_console::read): Replace
+       WaitForMultipleObjects with cygWFMO.
+       * fhandler_socket.cc (get_inet_addr): Add comment.
+       * gendef (_sigdelayed): Remove call to reset_signal_arrived.
+       * sigproc.cc (_cygtls::signal_exit): Don't close my_readsig here unless
+       we're in the signal thread.
+       (create_signal_arrived): Create signal_arrived as auto-reset so that only
+       one thread is woken when a signal arrives.
+       * sigproc.h (cygWFMO): New function.
+       (reset_signal_arrived): Delete declaration.
+
+2011-12-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * mmap.cc (mlock): Add standard syscall return value debugging output.
+       (munlock): Ditto.
+       (posix_madvise): Ditto.
+
+       * signal.cc: Remove obsolete sigcatchers stuff throughout.
+       (sigaction_worker): Add function name parameter and use it to show
+       standard syscall return value debugging output.  Also add fault
+       protection.
+       (sigaction): Accommodate extra argument to sigaction_worker.
+       (siginterrupt): Ditto.
+       * syscalls.cc (read): Remove obsolete sigcatchers stuff.
+       (readv): Ditto.
+
+2011-12-03  Corinna Vinschen  <vinschen@redhat.com>
+
+       * mmap.cc (mlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE.  Drop
+       outdated comment.  Call NtLockVirtualMemory with LOCK_VM_IN_WSL flag.
+       (munlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE.  Call
+       NtUnlockVirtualMemory with LOCK_VM_IN_WSL flag.
+
+2011-12-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       Throughout, remove extra space after function name from debugging
+       output.
+       Throughout, change syscalls to report on return values using new %R
+       format option.
+       * smallprint.cc (__small_vsprintf): Add parsing for %R to report on
+       return values and possible errno from syscalls.
+
+       * errno.cc (errmap): Add PRIVILEGE_NOT_HELD.
+
+       * fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread
+       use shorter name to reduce debuggging output.
+       * select.cc (start_thread_pipe): Ditto.
+       (start_thread_serial): Ditto.
+       (start_thread_socket): Ditto.
+       (start_thread_mailslot): Ditto.
+       * sigproc.cc (talktome): Ditto.
+
+2011-12-03  Corinna Vinschen  <vinschen@redhat.com>
+
+       * fhandler.cc (fhandler_base::open): Fix comment a bit more.
+
+2011-12-03  Corinna Vinschen  <vinschen@redhat.com>
+
+       * fhandler.cc (fhandler_base::open): Fix typos in comment.
+
+2011-12-02  Corinna Vinschen  <vinschen@redhat.com>
+
+       * path.cc (conv_path_list): Take cygwin_conv_path_t as third parameter.
+       Allow all types of CCP conversions.  Accommodate throughout.
+       (cygwin_conv_path): Use current ANSI or OEM codepage for WIN_A
+       conversions, depending on current file API codepage setting.
+       (cygwin_conv_path_list): Allow all CCP conversion types.
+       * include/sys/cygwin.h (CCP_CONVTYPE_MASK): Add to cygwin_conv_path_t
+       enum for convenience.
+
+2011-11-29  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.cc (get_proc_lock): Remove extra NULL check.  Return false on
+       failure.
+
+2011-11-29  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sync.cc: Fix comment.
+
+2011-11-29  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * dll_init.cc (dll_list::reserve_space): Use %p rather than %lx to show
+       reserved space.
+
+2011-11-29  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.cc (remove_proc): Don't terminate the currently executing
+       thread.
+
+2011-11-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * cygheap.cc (cygheap_fixup_in_child): Accommodate new HEAP_3*
+       classifications for cleanup-after-fork.
+       * cygheap_malloc.h (cygheap_types): Add HEAP_2_MAX, HEAP_3_FHANDLER.
+       * fhandler.h: Throughout, change clone to take a cmalloc id.
+       (fhandler_base::delete): Inline.
+       (fhandler_base_overlapped): Mark flush_async_io as a friend.
+       (fhandler_base_overlapped::asio_done): Declare new static member.
+       (fhandler_base_overlapped::asio_close_counter): Ditto.
+       (fhandler_base_overlapped::check_later): Declare new function.
+       (fhandler_base_overlapped::flush_all_async_io): Ditto.
+       * fhandler.cc (fhandler_base_overlapped::asio_done): Declare.
+       (fhandler_base_overlapped::asio_close_counter): Ditto.
+       (flush_async_io): Declare new thread function.
+       (fhandler_base_overlapped::flush_all_async_io): Declare new function.
+       (fhandler_base_overlapped::check_later): Ditto.
+       (fhandler_base_overlapped::close): Call check_later to close
+       nonblocking fd asynchronously.  Assume that this completed
+       successfully.
+       * select.cc (pipe_data_available): Don't consider data to be
+       "available" if fd still has unflushed I/O.
+       * syscalls.cc (close_all_files): Call
+       fhandler_base_overlapped::flush_all_async_io to make sure that all
+       nonblocking pipe I/O has completed.
+
+2011-11-28  Corinna Vinschen  <vinschen@redhat.com>
+
+       * external.cc (fillout_pinfo): Store program name as POSIX path in
+       ep.progname_long.
+
+2011-11-28  Corinna Vinschen  <vinschen@redhat.com>
+
+       * pinfo.cc (pinfo::exit): Call TerminateProcess to avoid potential
+       busy loop in ntdll.dll when calling ExitProcess. Only call ExitProcess
+       as a fallback.
+
+2011-11-27  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * init.cc (dll_entry): Revert previous change since it caused
+       inexplicable fork problems.
+
+2011-11-26  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * init.cc (dll_entry): Don't bother calling through thread removal
+       cleanup if we are exiting.
+
+2011-11-26  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * exceptions.cc (stackdump): Make global.
+       (signal_exit): Move to sigproc.cc.
+       * sigproc.cc (signal_exit): Move here.  Declare stackdump extern.  Set
+       my_sendsig to indicate that signals are no longer available.
+       (my_readsig): Make Static again.
+       (sig_send): Interpret ERROR_BROKEN_PIPE as ESRCH.  Remove special-case
+       EACCESS errno setting, just setting errno generally, even for "its_me"
+       case.
+
+2011-11-25  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * exceptions.cc (sigpacket::process): Move signal_exit processing
+       into...
+       (_cygtls::signal_exit): ...here.  Close my_readsig and comment on why.
+       * pinfo.cc (pinfo::exit): Move sigproc_terminate earlier.  Set exiting
+       flag in lock_process.
+       * sigproc.cc (my_readsig): Make global.
+       * sync.cc (muto::exiting_thread): Delete.
+       (muto::acquire): Delete #if 0'ed code.
+       * sync.h (muto::exiting_thread): Delete.
+       (set_exiting_thread): Ditto.
+       (lock_process::lock_process): Don't worry about setting the exiting
+       thread since it had no meaning.
+
+2011-11-24  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * cygthread.cc (cygthread::name): Default name to "main" if we are early
+       in the process of setting up the DLL and no name is known.
+       * dcrt0.cc (initial_env): Remove CYGWIN_SLEEP stuff.
+       (get_cygwin_startup_info): Activate strace here as appropriate.
+       (dll_crt0_0): Move get_cygwin_startup_info as early as possible to
+       avoid missing strace output.
+       * fork.cc (frok::child): Move debugging statement to point where ppid
+       will be set.
+       * pinfo.cc (pinfo::thisproc): Remove obsolete call to strace.hello.
+       Tweak debug output slightly.
+       * select.cc (select_stuff::wait): Allow APCS to be triggered while
+       waiting since we use them now.  Report when that happens.
+       * sigproc.cc (child_info::child_info): Use strace.active() rather than
+       strace.attached().
+       * spawn.cc (child_info_spawn::worker): Only write strace child pid
+       when we know it's a cygwin process.  Accommodate change to write_child
+       argument list.
+       * strace.cc (strace::hello): Delete.  Move functionality...
+       (strace::activate): ...to here.
+       (mypid): Just use raw GetCurrentProcessId () if myself isn't set.
+       (strace::write_childpid): Don't wait for subproc_ready.  Remove arg
+       which was required for it.
+       * include/sys/strace.h (strace::hello): Delete.
+       (strace::write_childpid): Delete first argument.
+
+2011-11-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * child_info.h (CURR_CHILD_INFO_MAGIC): Reset for previous changes.
+
+       * dcrt0.cc (get_cygwin_startup_info): Signal readiness when stracing
+       since strace::write_child relies on it.  Use strace.activate to notify
+       strace process, passing in arg indicating whether we're forked.
+       * sigproc.cc (wait_sig): Accommodate new strace::activate argument.
+       * spawn.cc (child_info_spawn::worker): Oops.  Previous suspended test
+       was actually correct.  Revert and document.
+       * strace.cc (strace::activate): Send additional flag indicating whether
+       this is an attempt to activate a forked process.
+       (strace::hello): Report on windows pid.
+       * include/sys/strace.h (strace::strace): Make a dummy.
+       (strace::activate): Modify declaration to accept an argument.
+       (strace::write_childpid): Set regparm.
+
+2011-11-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * pipe.cc (fhandler_pipe::create): Avoid derefencing a NULL pointer.
+
+       * child_info.h (child_info): Reorganize some elements so that the ones
+       which are initialized in a constructor are all together.
+       * sigproc.cc (child_info::child_info): Initialize values via the
+       constructor rather than as C statements and make sure that flags is set
+       to zero initially.
+
+       * spawn.cc (child_info_spawn::worker): Use iscygwin() test for
+       determining when to send strace info since it is more foolproof than
+       checking the suspend state.
+
+2011-11-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * fhandler.h (fhandler_pipe::create): Rename from the misnamed
+       "create_selectable".  Change return to DWORD.
+       (fhandler_pty_common::pipesize): New constant.
+       * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Reflect
+       create_selectable name change.
+       * miscfuncs.cc (CreatePipeOverlapped): Ditto.
+       * pipe.cc (fhandler_pipe::create): Ditto.
+       (fhandler_pipe::create): Rename from the misnamed "create_selectable".
+       Return DWORD.  Only set pipe size to default when it is passed in as
+       zero.
+       * fhandler_tty.cc (fhandler_pty_master::setup): Ditto.  Use
+       fhandler_pty_common::pipesize rather than a raw constant.
+       * tty.cc (tty::not_allocated): Ditto.
+
+       * sigproc.cc (sigproc_init): Use fhandler_pipe::create to create the
+       signal pipe to get a more appropriate message based pipe.
+
+2011-11-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.cc (remove_proc): Don't do busy loop when exiting since it
+       doesn't matter.
+
+2011-11-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.cc (remove_proc): Don't do busy loop when execing since
+       thread could have been terminated prior to setting flag.
+
+       * signal.cc (sigwaitinfo): Zero event before closing to signal other
+       threads that it is no longer available.
+
+2011-11-18  Corinna Vinschen  <corinna@vinschen.de>
+
+       * shared.cc (get_shared_parent_dir): Use global shared_parent_dir
+       instead of local dir variable and create handle not inheritable to
+       avoid accumulating stray handles in child processes.
+       (get_session_parent_dir): Ditto with session_parent_dir variable.
+
+2011-11-17  Corinna Vinschen  <corinna@vinschen.de>
+
+       * shared.cc (shared_info::create): Open global shared data section
+       non-inheritable to avoid accumulating stray handles in child processes.
+
+2011-11-15  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
+       (cygheap_exec_info::nchildren): Move from child_info_spawn.
+       (cygheap_exec_info::cchildren): Ditto.
+       (cygheap_exec_info::record_children): Declare new function.
+       (cygheap_exec_info::reattach_children): Ditto.
+       (cygheap_exec_info::alloc): Ditto.
+       (child_info_spawn::nchildren): Move to cygheap_exec_info.
+       (child_info_spawn::cchildren): Ditto.
+       * sigproc.cc (cygheap_exec_info::alloc): Define new function.
+       (child_info_spawn::cleanup): Accommodate move of children info to
+       cygheap_exec_info.
+       (cygheap_exec_info::record_children): Define new function.
+       (cygheap_exec_info::reattach_children): Ditto.
+       (child_info_spawn::record_children): Use
+       cygheap_exec_info function to accomplish this task.
+       (child_info_spawn::reattach_children): Ditto.
+       * spawn.cc (child_info_spawn::worker): Allocate moreinfo using
+       cygheap_exec_info::alloc.
+
+       * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Use abort for the
+       error to avoid a retry.
+
+2011-11-14  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * pinfo.cc (_pinfo::dup_proc_pipe): Fatalize a warning when debugging.
+
+2011-11-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       Remove erroneously checked-in debugging statements.
+       * cygheap.cc (cygheap_fixup_in_child): Here.
+       * debug.cc (delete_handle): Here.
+       * sigproc.cc (child_info_spawn::cleanup): Here.
+       * spawn.cc (child_info_spawn::worker): Here.
+
+2011-11-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       Throughout, change "sig %d" in strace output to "signal %d" for
+       consistency.
+       * assert.cc (__assert_func): Output assertion string to strace too.
+       * fork.cc (frok::parent): Report ASAP on forked pid in debugging output.
+       * pinfo.cc (pinfo::_pinfo_release): Define new function.
+       (pinfo::init): Use _pinfo_release() rather than release() to release
+       shared memory stuff.
+       (pinfo::wait): Shorten name of process waiting thread for more concise
+       debugging.
+       (pinfo::release): Use pinfo_release to release shared memory part of
+       struct.
+       * pinfo.h (pinfo::__pinfo_release): Declare.
+
+2011-11-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       Throughout use "have_execed" macro rather than "hExeced" global handle.
+       Throughout rename _PROC_* to _CH_*.
+       * child_info.h: Include "pinfo.h".
+       (child_info_types): Rename _PROC_* -> _CH_* to avoid confusion with
+       similarly named constants.
+       (_PROC_*): Delete unneeded aliases.
+       (PROC_*): Ditto.
+       (CURR_CHILD_INFO_MAGIC): Ditto.
+       (cchildren): Define using "pinfo_minimal".
+       (child_info::set_saw_ctrl_c): Move to
+       (child_info_spawn::set_saw_ctrl_c): Here.
+       (child_info_spawn::lock): New field.
+       (child_info_spawn::hExeced): Ditto.
+       (child_info_spawn::ev): Ditto.
+       (child_info_spawn::~child_info_spawn): Move to sigproc.cc.
+       (child_info_spawn::child_info_spawn): Ditto.
+       (child_info_spawn::cleanup): Declare new function.
+       (child_info_spawn::set_saw_ctrl_c): Move to this class.  Set flag only
+       when execed and return true when we have set the flag.
+       (child_info_spawn::child_info_spawn::signal_myself_exited): New function.
+       (child_info_spawn::wait_for_myself): Ditto.
+       (child_info_spawn::has_execed_cygwin): Ditto.
+       (child_info_spawn::has_execed): Ditto.  Replaces "hExeced" test.
+       (child_info_spawn::operator HANDLE&): New operator.
+       (child_info_spawn::worker): Define old "spawn_guts" as class member.
+       (ch_spawn): Declare.
+       (have_execed): Define.
+       (have_execed_cygwin): Ditto.
+       * cygheap.h: Update comment.
+       * dcrt0.cc (get_cygwin_startup_info): Use _CH_* enums.
+       (child_info_spawn::handle_spawn): Ditto.
+       (dll_crt0_0): Ditto.
+       (multiple_cygwin_problem): Ditto.
+       * exceptions.cc (chExeced): Delete obsolete declaration.
+       (ctrl_c_handler): Reference set_saw_ctrl_c via new ch_spawn global.
+       * globals.cc (hExeced): Delete.
+       * pinfo.cc (pinfo::thisproc): Refer to cygheap as ::cygheap for
+       consistency in handle naming when -DDEBUGGING.
+       (pinfo::init): Accommodate case where myself.h is known but h0 is
+       passed in.
+       (pinfo::pinfo): New constructor for setting up a pinfo passed in by
+       previous exec'or.
+       (pinfo::proc_waiter): Don't handle subprocess if we're in the process
+       of exiting due to an exec of a cygwin process.  Don't close
+       rd_proc_pipe here.  Close it when we actually are finished with the
+       process.  Use new ch_spawn.signal_myself_exited function to let exec
+       stub know that subprocess has exited.
+       (pinfo::wait): Clarify debugging output.
+       (pinfo::release): Use "close_h" to close all handles to avoid races.
+       (winpids::add): Assume that elements of the array do not need to be
+       zeroed and are properly initialized or suffer problems on
+       pinfo::release.  Don't close hProcess since release does that now.
+       * pinfo.h: Update comment.
+       (pinfo_minimal): Move some elements from pinfo here so that
+       child_info_spawn can use them.
+       (pinfo): Inherit from pinfo_minimal.
+       (pinfo::pinfo): Modify to accommodate new pinfo_minimal.
+       (pinfo::allow_remove): New function.
+       * sigproc.cc (proc_subproc): Use boolean values for true/false.
+       Implement PROC_EXEC_CLEANUP.
+       (proc_terminate): Set ppid = 1 since the procs list will only be
+       iterated when the process has not execed.  Don't do any cleanup here
+       since it is now handled in pinfo::release.
+       (sigproc_init): Initialize sync_proc_subproc earlier.
+       (child_info::child_info): Assume that all important fields are properly
+       initialized and avoid memset().
+       (child_info_spawn::child_info_spawn): Specifically test for execing and
+       then set up appropriate fields in the struct.
+       (child_info_spawn::cleanup): Define new function.
+       (child_info_spawn::record_children): Specifically test for being execed
+       here.  Fill in pinfo_minimal part of children array.
+       (child_info_spawn::reattach_children): Use constructor to duplicate
+       information for previous exec'or.  Add more debugging output.
+       (remove_proc): Force deletion of thread when exiting due to exec.  Rely
+       on pinfo::cleanup in release.
+       * sigproc.h (PROC_EXEC_CLEANUP): New enum.
+       (PROC_DETACHED_CHILD): Delete.
+       * spawn.cc (chExeced): Delete.
+       (child_info_spawn::worker): Rename from spawn_guts.  Use elements of
+       child_info_spawn throughout rather than ch.whatever.  Use ::cygheap to
+       refer to global rather than element of child_info.  Use
+       wait_for_myself() rather than waitpid().  Call
+       child_info_spawn::cleanup on function return.
+       (spawnve): Reflect movement of spawn_guts functionality into
+       child_info_spawn::worker.
+       * syscalls.cc (popen): Ditto.
+       * winsup.h (spawn_guts): Delete declaration.
+
+2011-11-08  Corinna Vinschen  <corinna@vinschen.de>
+
+       * posix.sgml (std-gnu): Add ptsname_r.
+
+2011-11-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * fhandler.h (__ptsname): New macro.
+       * dtable.cc (decode_tty): Use __ptsname to generate the slave pty name.
+       * fhandler_tty.cc (fhandler_pty_master::ptsname_r): Ditto.
+       * bsdlib.cc: Add needed includes for openpty() changes.
+       (openpty): Use __ptsname to generate the slave pty name.  Close slave
+       fd when aslave == NULL.
+
+2011-11-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * include/cygwin/stdlib.h: Update copyright.
+
+2011-11-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * cygwin.din (ptsname_r): Export.
+       * fhandler.cc (fhandler_base::ptsname_r): Define.
+       * fhandler.h (fhandler_base::ptsname): Delete.
+       (fhandler_base::ptsname_r): Declare.
+       (fhandler_pty_master::ptsname_r): Declare.
+       * fhandler_tty.cc (fhandler_pty_master::ptsname): Delete.
+       (fhandler_pty_master::ptsname_r): New reentrant function derived from
+       previous ptsname.
+       * syscalls.cc (ptsname_r): Implement new function with functionality
+       similar to Linux.
+       (ptsname): Use ptsname_r () to fill out buf.
+       * include/cygwin/stdlib.h (ptsname_r): Declare.
+       * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 255 to
+       reflect export of ptsname_r.
+
+       * pinfo.cc (pinfo::wait): Return bool rather than int.
+       * pinfo.h (info::wait): Ditto.
+       (pinfo::reattach): Define !defined(_SIGPROC_H) case for consistency.
+       * sigproc.cc (child_info_spawn::reattach_children): Use correct
+       dwProcessId rather than pid when duplicating handle.
+
+2011-11-07  Corinna Vinschen  <corinna@vinschen.de>
+
+       * fhandler.cc (CHUNK_SIZE): Drop NO_COPY.
+
+2011-11-07  Corinna Vinschen  <corinna@vinschen.de>
+
+       * syscalls.cc (check_dir_not_empty): Check surplus directory entries
+       by calling NtQueryAttributesFile.  Make STATUS_DIRECTORY_NOT_EMPTY
+       return value dependent on its status code.  Add long comment to explain.
+       (unlink_nt): Add comment to explain flaw in checking the sharing mode.
+       Set status to STATUS_SUCCESS instead of 0.  Add a retry loop to setting
+       the delete disposition and trying to move a directory to bin to
+       workaround rare cases of lingering, already deleted subdirectory
+       entries.  Add long comment to explain.
+       (rename): Set status to STATUS_SUCCESS instead of 0.
+
+2011-11-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * pinfo.cc (status_exit): Recognize STATUS_ILLEGAL_INSTRUCTION.
+       (child_info::proc_retry): Ditto.
+
+2011-11-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * pinfo.cc (status_exit): Return complete error code.  Handle
+       STATUS_ACCESS_VIOLATION correctly.
+       (pinfo::set_exit_code): Set self->exitcode directly from status_exit.
+
+2011-11-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * pinfo.h (pinfo::reattach): Only set destroy to false when
+       proc_subproc succeeds.  Return true for success.
+       * sigproc.cc (child_info_spawn::reattach_children): Try harder to clean
+       up on error by detecting reattach failures too.
+
+2011-11-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.cc (child_info_spawn::reattach_children): Clean up handle
+       when can't open parent process or suffer handle leak.
+
+2011-11-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.cc (child_info::sync): Report on exit code in strace output.
+       (child_info::proc_retry): Don't consider STATUS_ACCESS_VIOLATION as a
+       restartable event.
+
+2011-11-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.cc (child_info_spawn::reattach_children): Avoid issuing an
+       error when we can't duplicate from "parent" since it is probably ok if
+       children of the previous owner of the pid disappear.
+
+2011-11-03  Corinna Vinschen  <corinna@vinschen.de>
+
+       * fhandler.cc (off_current): Define local in fhandler_base::raw_write.
+       Drop erroneous NO_COPY, add _RDATA to make R/O.
+       (off_append): Ditto.
+       * globals.cc (_RDATA): Move definition from here...
+       * winsup.h: ...to here.
+
+2011-10-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * fhandler.h (fhandler_pipe::create_selectable): Remove optional
+       argument, take an options argument for CreateNamedPipe/CreateFile.
+       Change handle arguments to expect pointers.
+       (fhandler_fifo::fifo_state): Delete.
+       (fhandler_fifo::dummy_client): Ditto.
+       (fhandler_fifo::open_nonserver): Ditto.
+       (fhandler_fifo::wait_state): Ditto.
+       (fhandler_fifo::raw_write): Ditto.
+       (fhandler_fifo::read_ready): New field.
+       (fhandler_fifo::write_ready): Ditto.
+       (fhandler_fifo::wait): Modify argument.
+       (fhandler_fifo::fifo_name): Add a new argument.
+       (fhandler_fifo::fixup_after_fork): New function.
+       * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Remove
+       initialization of expunged elements.  Initialize new handles to NULL.
+       (fhandler_fifo::open_nonserver): Delete.
+       (fnevent): New macro for creating a named event.
+       (fnpipe): New macro for creating a unique named pipe name.
+       (create_pipe): New macro for simplification of named pipe creation.
+       (fhandler_fifo::fifo_name): Use new argument when creating a shared
+       name.
+       (fhandler_fifo::open): Rewrite.  Use events to synchronize.
+       (fhandler_fifo::wait): Rewrite to wait for new fifo events which are
+       supplied as a parameter.
+       (fhandler_fifo::raw_read): Rewrite to use handle mechanism to detect
+       client-side disconnect.
+       (fhandler_fifo::raw_write): Delete.
+       (fhandler_fifo::close): Remove accommodations for expunged fields.
+       Close event handles.
+       (fhandler_fifo::dup): Remove accommodations for expunged fields.
+       Duplicate event handles.
+       (fhandler_fifo::fixup_after_fork): New function.  Perform fixups on
+       event handles.
+       (fhandler_fifo::set_close_on_exec): Remove accommodations for expunged
+       fields.  Set inheritance for new handle fields.
+       * miscfuncs.cc (CreatePipeOverlapped): Accommodate changes in
+       fhandler_pipe::create_selectable.
+       * tty.cc (tty::not_allocated): Ditto.
+       * pipe.cc (fhandler_pipe::create): Ditto.
+       (fhandler_pipe::create_selectable): Accept an extra open_mode argument.
+       Pass arguments by reference and allow opening one end of the pipe at a
+       time.
+
+       * sys/strace.h (debug_only_printf): Define new macro which calls
+       debug_printf only when DEBUGGING is defined.
+
+2011-10-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * exceptions.cc (sigpacket::process): Avoid a potential deadlock when
+       exiting due to a signal.
+
+2011-10-28  Corinna Vinschen  <corinna@vinschen.de>
+
+       * cygwin.din (getgrouplist): Export.
+       * grp.cc (get_groups): New static function to run the core functionality
+       of initgroups and getgrouplist.
+       (initgroups32): Call get_groups and just create supplementary group
+       list in cygheap.  Rename name of first argument to "user".  Add an
+       assertion to test for a NULL user name.
+       (initgroups): Rename name of first argument to "user".
+       (getgrouplist): New function.
+       * posix.sgml (std-bsd): Add getgrouplist.
+       * include/cygwin/grp.h (getgrouplist): Declare.
+       * include/cygwin/version.h: Bump API minor number.
+
+2011-10-25  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * child_info.h (cchildren): New struct.
+       (child_info_spawn::nchildren): Rename from nprocs.
+       (child_info_spawn::children): Change type to cchildren for more
+       bookkeeping possibilities.
+       (child_info_spawn::child_info_spawn): Clear nchildren.
+       (child_info_spawn::record_children): Declare new function.
+       (child_info_spawn::reattach_children): Ditto.
+       * dcrt0.cc (child_info_spawn::handle_spawn): Call reattach_children to
+       gather list of processes we are potentially waiting for.
+       * pinfo.h (pinfo::pinfo): Make sure that rd_proc_pipe is always cleared.
+       (pinfo::reattach): New function.
+       * sigproc.cc: Move pinfo.h earlier so that it can be used in sigproc.h.
+       (get_proc_lock): Don't bother with a lock during DLL initialization.
+       (proc_subproc): Handle PROC_REATTACH_CHILD.
+       (proc_terminate): Orphan children only when we are not an execed
+       process or when the pid is about to be occupied by a non-cygwin
+       process.
+       (child_info_spawn::record_children): Define new function.
+       (child_info_spawn::reattach_children): Ditto.
+       * sigproc.h (procstuff): Define PROC_REATTACH_CHILD and renumber other
+       elements.
+       * spawn.cc (spawn_guts): Record any to-be-waited-for subprocesses if
+       about to exec a cygwin process.
+
+       * sigproc.cc (sig_send): Fix harmless transposition of fifth and six
+       arguments to DuplicateHandle().
+       (child_info::child_info): Ditto.
+
+       * globals.cc (hExeced): Make NO_COPY.
+
+2011-10-25  Corinna Vinschen  <corinna@vinschen.de>
+
+       * hookapi.cc (hook_or_detect_cygwin): Take additional handle
+       to a file mapping as parameter.  If this handle is not NULL,
+       create another file mapping for the IAT.
+       * spawn.cc (av::fixup): Only map the first 64K of an image and
+       keep the mapping handle to use as argument to hook_or_detect_cygwin.
+       * winsup.h (hook_or_detect_cygwin): Add mapping handle as default
+       parameter in declaration.
+
+2011-10-24  Corinna Vinschen  <corinna@vinschen.de>
+
+       * syscalls.cc (unlink_nt): Fix a bug which overwrites the NT status
+       value in case setting the delete disposition returns with
+       STATUS_DIRECTORY_NOT_EMPTY.
+
+2011-10-24  Corinna Vinschen  <corinna@vinschen.de>
+
+       * shared.cc (open_shared): Fix memory reservation of essential shared
+       memory regions.  Drop delta computations since delta is always 0 in
+       non-relocated case.  Add a comment.
+
+2011-10-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * fhandler_tty.cc (fhandler_pty_slave::read): Use consistent way for
+       testing ReadFile return.
+       * pipe.cc (fhandler_pipe::create_selectable): Open the write side of
+       the pipe in message-mode to force writing as "chunks".  Explain why.
+
+2011-10-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * path.cc (path_conv::get_nt_native_path): Avoid dereferencing path
+       when it is NULL.
+
+2011-10-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * dtable.cc (dtable::delete_archetype): Improve debugging output.
+       (dtable::init_std_file_from_handle): Close console handle early, before
+       initialization.  Build up openflags for passing to open_setup, just to
+       be safe.
+       (last_tty_dev): New variable.
+       (fh_last_tty_dev): New macro.
+       (fh_alloc): Try again to keep track of previously opened tty, this time
+       by just saving the device and using that to potentially open an
+       archetype.  Avoid setting the "/dev/tty" name if the creation of the
+       fhandler failed.
+       (build_fh_pc): Remove unused second argument.  Reorganize how and where
+       the name is set.  Set last_tty_dev as appropriate.  Avoid a NULL
+       dereference in a debug printf.
+       * dtable.h (build_fh_pc): Reflect removal of second parameter.
+       * fhandler.cc (fhandler_base::reset): Use new '<<' operator to copy pc
+       since it preserves any potentially previously set name.
+       (fhandler_base::set_name): Ditto.
+       * fhandler.h (fhandler_*::clone): Throughout use ccalloc to allocate
+       new fhandler, primarily to make sure that pc field is properly zeroed.
+       (fhandler_termios::last): Eliminate.
+       (fhandler_termios): Remove setting of last.
+       (fhandler_base::~fhandler_termios): Ditto.
+       * fhandler_console.cc (fhandler_console::open): Don't make decisions
+       about opening close-on-exec handles here since it makes no sense for
+       archetypes.
+       (fhandler_console::init): Assume that input handle has already been
+       opened.
+       * fhandler_termios.cc (fhandler_termios::last): Delete.
+       * path.h (path_conv::eq_worker): New function.  Move bulk of operator =
+       here.
+       (operator <<): New function.
+       (operator =): Use eq_worker to perform old functionality.
+
+       * child_info.h (NPROCS): Move here from sigproc.cc.
+       (child_info::nprocs): New field.  Not used yet.
+       (child_info::children):: Ditto.
+
+2011-10-21  Corinna Vinschen  <corinna@vinschen.de>
+
+       * fhandler_disk_file.cc (fhandler_disk_file::rmdir): Check invalid
+       success only on Samba shares.
+       * mount.cc (fs_info::update): Drop has_buggy_basic_info flag for
+       NcFsd.
+       * syscalls.cc (unlink_nt): Fix typo in comment.
+
+2011-10-21  Corinna Vinschen  <corinna@vinschen.de>
+
+       * globals.cc (ro_u_ncfsd): New R/O unicode string.
+       * mount.cc (fs_info::update): Check for "NcFsd" FS.  Set flags and
+       change comments accordingly.
+       (fs_names): Add entry for NcFsd FS.
+       * mount.h (enum fs_info_type): Add ncfsd.
+       (class fs_info): Add ncfsd flag and accessor methods.
+       * path.h (class path_conv): Add fs_is_ncfsd method.
+       * syscalls.cc (unlink_nt): Experimentally try delete-on-close on NcFsd
+       in STATUS_CANNOT_DELETE case.
+
+2011-10-20  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * fhandler.h (fhandler*::copyto): Free path_conv strings first.
+       * path.h (cfree_and_null): Rename and expand from cfree_maybe.
+       (path_conv &operator =): Call free_strings rather than freeing strings
+       directly.
+
+2011-10-20  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       Throughout change TTY_* to PTY_*, tty_* to pty_*, and ttym_* to ptmx_*.
+       * devices.cc: Regenerate.
+       * dtable.cc: (fh_alloc): Preserve /dev/tty name when that's what we
+       opened.
+       (build_fh_pc): Preserve any existing name.
+       * fhandler.cc (fhandler_base::open_with_arch): Ditto.
+       * fhandler_tty.cc (fhandler_pty_master::fhandler_pty_master): Force the
+       name to /dev/ptmx while preserving other pty master device information.
+       * path.h (cfree_maybe): New macro.
+       (path_conv::operator =): Free any allocated strings in target.
+       (path_conv::free_strings): Delete unused function.
+
+       * sigproc.cc (proc_terminate): Remove previous accommodation for execed
+       processes since it didn't have the desired effect.  Change comment to a
+       FIXME.
+
+       * spawn.cc (chExeced): Mark NO_COPY.
+       (exe_suffixes): Ditto.
+
+2011-10-20  Corinna Vinschen  <corinna@vinschen.de>
+
+       * syscalls.cc (try_to_bin): Improve debug output.
+       (check_dir_not_empty): Take additional path_conv argument.  Improve
+       debug output.  Change syscall_printf to debug_printf.
+       (unlink_nt): Improve debug output.  Change syscall_printf to
+       debug_printf.
+       (unlink): Change syscall_printf to debug_printf.
+
+       * cygthread.h: Fix copyright dates.
+
+2011-10-18  Corinna Vinschen  <corinna@vinschen.de>
+
+       * path.cc: Extend two comments.  Mention the name RtlpCurDirRef
+       for reference.
+
+2011-10-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * dcrt0.cc (dll_crt0_1): Copy argv before passing to main().
+
+2011-10-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * sigproc.cc (proc_terminate): Avoid setting ppid to 1 if we're execing.
+
+2011-10-15  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * cygerrno.h (__set_errno): Modify debugging output to make searching
+       strace logs easier.
+
+       Throughout, change /dev/tty* to /dev/pty*.
+       Throughout, add flags argument to fhandler_*::dup methods.
+       * devices.in: Rename (temporarily?) /dev/ttyN to /dev/ptyN.  Add
+       /dev/ptymN devices for pty masters.
+       * devices.cc: Regenerate.
+       * devices.h (MAX_CONSOLES): Set to max number supported by devices.in.
+       (fh_devices::FH_PTMX): Rename from FH_PTYM.
+       (device::operator int): Return by reference.
+       * dtable.cc (fh_alloc): Take pc as an argument rather than just the
+       device.  This makes debugging easier since more information is
+       available.  Actually implement handling for already-allocated pty
+       master devices.  Make different decisions when generating fhandler for
+       not-opened devices.  Add kludge to deal with opening /dev/tty.
+       (cnew_no_ctor): New macro.
+       (build_fh_pc): Make debugging output more verbose.  Use new clone()
+       fhandler interface to duplicate archetypes.  Reset last term opened.
+       (dtable::dup_worker): Use Use new clone() fhandler interface to
+       duplicate archetypes.  Pass flags to child dup handler.
+       (dtable::dup3): Set O_NOCTTY flag if newfd is not stdin/stdout/stderr.
+       * fhandler.cc (fhandler_base::reset): Rename from operator =() and
+       reduce functionality and sense of copy direction.
+       (fhandler_base::open_with_arch): Use published interface to query
+       io_handle().  Use new copyto() fhandler method to copy from/to found
+       archetype.
+       * fhandler.h: Throughout, delete size(), add copyout, clone, and
+       fhandler_* (void *) methods.
+       (fhandler_base::reset): Rename from operator =().
+       (fhandler_termios::is_dev_tty): Delete.
+       (fhandler_termios): change "protected" region to "private".
+       (fhandler_termios::is_dev_tty): Delete.
+       (fhandler_termios): Rearrange protected/public.
+       (fhandler_termios::fhandler_termios): Remember last fhandler_termios
+       "opened".
+       (fhandler_termios::~fhandler_termios): Forget last fhandler_termios
+       opened.
+       (ioctl): Rename from ioctl_termios.  Take a void * argument.  Reflect
+       argument change in pinfo::set_ctty.
+       (fhandler_console::dup): Declare new function.  Set ctty here if
+       appropriate.
+       (fhandler_pty_master::from_master): Privatize.
+       (fhandler_pty_master::to_master): Ditto.
+       (fhandler_pty_master::dwProcessId): Ditto.
+       (fhandler_pty_master::fhandler_pty_master): Add an `int' argument.
+       (fhandler_pty_master::open_setup): Declare new function.
+       (fhandler_pty_master::~fhandler_pty_master): Declare new method.
+       (fhandler_nodevice): Remove commented out function declaration.
+       * fhandler_console.cc: Use get_ttyp() instead of tc() throughout.
+       (fhandler_console::dup): Define new function to set controlling ctty on
+       dup, as appropriate.
+       (fhandler_console::ioctl): Reflect ioctl_termios name change.
+       (fhandler_console::setup): Rename from get_tty_stuff.
+       (fhandler_console::open_setup): Reflect argument change in
+       pinfo::set_ctty.
+       (fhandler_console::fhandler_console): Set _tc here.
+       * fhandler_termios.cc (handler_termios::ioctl): Rename.  Take a void *
+       arg like other ioctl functions.
+       * fhandler_tty.cc (fhandler_pty_slave::dup): Call myself->set_ctty to
+       potentially reset the controlling terminal.
+       (fhandler_pty_slave::ioctl): Reflect name/arg change for ioctl_termios.
+       (fhandler_pty_slave::fhandler_pty_slave): Take a "unit" argument.  Call
+       setup() here so that we will know the unit number of this fhandler as
+       soon as possible.  Set the unit as appropriate.
+       (handler_pty_master::open): Move most stuff to constructor and
+       open_setup.
+       (handler_pty_slave::open_setup): Reflect argument change in
+       pinfo::set_ctty.
+       (handler_pty_master::open_setup): Define new function.
+       (fhandler_pty_master::cleanup): Clear handles as a flag that the
+       destructor does not have to do "close" operations.
+       (fhandler_pty_master::close): Ditto.
+       (fhandler_pty_master::~fhandler_pty_master): Define new method.
+       (fhandler_pty_master::ioctl): Reflect name/arg change for
+       ioctl_termios.
+       (fhandler_pty_master::setup): Allocate tty here.  Rely on handles being
+       returned from allocated test rather than opening them here.  Avoid
+       setting _need_nl here since it is already zeroed in the constructor.
+       Set up device information with DEV_TTYM_MAJOR.
+       * path.h (path_conv &operator =): Take a const argument.
+       (path_conv::dup): Ditto.
+       (pathconv_arg::PC_OPEN): New enum.
+       (pathconv_arg::PC_CTTY): Ditto.
+       (path_types::PATH_CTTY): Ditto.
+       (path_types::PATH_OPEN): Ditto.
+       (path_conv::isopen): New method.
+       (path_conv::isctty_capable): Ditto.
+       * path.cc (path_conv::check): Set PATH_OPEN and PATH_CTTY as
+       appropriate.
+       * pipe.cc (fhandler_pipe::open): Use copyto to copy pipe handle.
+       * syscall.cc (open): Reinstate fd > 2 check to disallow resetting ctty
+       on non-std* handles.
+       * tty.cc (tty_list::allocate): Pass out handles for allocated tty.  use
+       `not_allocated' to find unallocated ttys.  Avoid keeping the lock since
+       the allocation of the tty should be sufficient to prevent multiple
+       access.
+       (tty::not_allocated): Clarify comment.  Rename.  Return handles when an
+       unused tty is found.  Simply test for existing tty.
+       (tty::exists): Rewrite to use `not_allocated'.
+       * tty.h (NTTYS): Reset down to actual number supported by devices.in.
+       (tty::not_allocated): Declare new function.
+       (tty_list::allocate): Pass out read/write tty handles.  Zero them when
+       not found.
+       * fhandler_proc.cc: Reflect name change from FH_PTYM -> FH_PTMX.
+       * pinfo.h (pinfo::set_ctty): Reduce/reorder arguments passed in.
+       * pinfo.cc (pinfo::set_ctty): Ditto.  Just use tc() built into the
+       passed-in fhandler_termios pointer.  Return true if ctty is assigned.
+       * syscalls.cc (open): Call build_fh_pc with PC_OPEN flag.  Set PC_CTTY
+       if appropriate.
+       (stat_worker): Remove is_dev_tty () stuff.
+
 2011-10-15  Corinna Vinschen  <corinna@vinschen.de>
 
        * fhandler_process.cc (dos_drive_mappings::fixup_if_match): Convert
        (fhandler_base::tcgetsid): New function.
        * fhandler.h ((fhandler_base::tcgetsid): Declare new function.
        (fhandler_base::is_dev_tty): Ditto.
+       (fhandler_termios): Rearrange protected/public.
+       (fhandler_termios::fhandler_termios): Remember last fhandler_termios
+       "opened".
+       (fhandler_termios::~fhandler_termios): Forget last fhandler_termios
+       opened.
        (fhandler_termios::opened_as_dev_tty): Declare new field.
        (fhandler_termios::is_dev_tty): Declare new function.
        (fhandler_termios::tcgetsid): Ditto.
        * pinfo.h (_pinfo::set_ctty): Change third parameter to
        fhandler_termios *.
 
-       * sigproc.cc (handle_sigsuspend): Don't special-case non-main threads.
+       * exceptions.cc (handle_sigsuspend): Don't special-case non-main threads.
 
 2011-04-15  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>