* fhandler.h (fhandler_base::refcnt): Delete.
(fhandler_base::inc_refcnt): New function.
(fhandler_base::dec_refcnt): New function.
* cygheap.h (cygheap_fdnew::~cygheap_fdnew): Accommodate split of refcnt to
inc_refcnt/dec_refcnt.
(cygheap_fdget::cygheap_fdget): Ditto.
(cygheap_fdget::~cygheap_fdget::cygheap_fdget): Ditto.
* dtable.cc (dtable::release): Ditto.
(cygwin_attach_handle_to_fd): Ditto.
(dtable::init_std_file_from_handle): Ditto.
(dtable::dup3): On success, return with fdtab locked.
* dtable.h (dtable): Add dup_finish as a friend.
* syscalls.cc (dup_finish): Define new function. Increment refcnt while fdtab
is locked.
(dup2): Use common dup_finish() to perform dup operation.
(dup3): Ditto.
* mount.cc (fs_info::update): Recognize ReFS.
* mount.h (enum fs_info_type): Add refs.
(class fs_info): Add refs flag and accessor methods.
* ntdll.h (RtlAddAccessAllowedAceEx): Declare.
(RtlAddAccessDeniedAceEx): Declare.
* path.h (path_conv::fs_is_refs): Define.
* sec_helper.cc (_recycler_sd): New function to create security
descriptors suitable for the recycler bin starting with Vista.
* security.cc (add_access_allowed_ace): Use RtlAddAccessAllowedAceEx
and drop code to set AceFlags explicitely.
(add_access_denied_ace): Use RtlAddAccessDeniedAceEx and drop code to
set AceFlags explicitely.
* security.h (_recycler_sd): Declare.
(recycler_sd): Define.
* syscalls.cc (desktop_ini): Change formatting.
(desktop_ini_ext): Define third line of recycler desktop.ini file
since Vista,
(try_to_bin): Handle ReFS just like NTFS. Write Vista and later
Recycler in all uppercase, just like shell32 does when recreating it.
Fix comments to include ReFS. Don't implicitely reuse object
attributes from earlier NtOpenFile call, rather recreate it for safety.
Use recycler_sd call when creating security descriptor for Recycler
dirs and files on Vista and later. Write third line of desktop.ini
when on Vista and later.
* select.cc (set_handle_or_return_if_not_open): Remove unneeded final backslash
from definition.
(cygwin_select): Reorganize to incorporate outer retry loop. Move remaining
time recalculation here for retry case. Use select_stuff::wait_states for loop
control.
(select_stuff::cleanup): Avoid unneeded initialization.
(select_stuff::wait): Modify definition to return select_stuff::wait_states.
Eliminate is_cancelable. Don't element 1 of an array if it is a cancel handle.
Remove loop. Rely on being called from enclosing loop in cygwin_select.
Remove time recalculation when restarting. Try harder to always return from
the bottom.
* select.h (select_stuff::wait_state): New enum.
(select_stuff::wait): Modify declaration to return select_stuff::wait_states.
mapped memory. Shorten static library name buffer to MAX_PATH. Use
strlcpy to copy library name to buffer. Only Unmap "map" if it has been
Mapped before.
* pinfo.cc (status_exit): Drop unneeded declaration of
find_first_notloaded_dll in favor of the declaration in winsup.h.
newlib doesn't install cleanup handlers. Explain the problem.
(class __cygwin_lock_handler): New class.
(__cygwin_lock_cleanup): New function.
(__cygwin_lock_lock): Push __cygwin_lock_cleanup thread cleanup
handler.
(__cygwin_lock_trylock): Ditto.
(__cygwin_lock_unlock): Pop thread cleanup handler.
(pthread::pop_cleanup_handler): Temporarily allow cleanup function to
destroy cleanup handler so we can pop in another function than we
pushed in.
to PTHREAD_CANCEL_DISABLE from here...
(pthread::pop_all_cleanup_handlers): ...to here, otherwise any explicit
call to pthread_cleanup_pop disables cancellation for this thread.
* devices.cc: Regenerate.
* dtable.cc (fh_alloc): Don't forget FH_KMEM.
* fhandler_mem.cc (fhandler_dev_mem::open): Set errno to EACCES rather
than ENOENT on systems not granting access to physical memory from
user space.
* child_info.h (child_info_spawn::parent_winpid): Declare new field.
(child_info_spawn::get_parent_handle): Declare new function.
* dcrt0.cc (child_info_spawn::get_parent_handle): Define new function.
(child_info_spawn::handle_spawn): Recreate parent handle if possible when
dynamically loaded. Don't mess with parent handle if it's NULL.
* spawn.cc (child_info_spawn::worker): Set parent_winpid appropriately.
* fhandler.h (PIPE_ADD_PID): Redefine to something we actually DON'T use.
* pipe.cc (fhandler_pipe::create): Avoid clearing all open_mode bits when
checking for PIPE_ADD_PID. Properly keep track of len so that passed in name
is not overwritten.
* pinfo.cc (pinfo::init): Reuse shared memory if the state is marked with
PID_REAPED.
* spawn.cc (child_info_spawn::worker): Don't duplicate myself_pinfo into
non-cygwin child.
* fork.cc (frok::parent): Improve error output.
* cygheap.h (init_cygheap::pid_handle): Delete.
* dcrt0.cc (child_info_spawn::handle_spawn): Keep parent open if we have
execed.
* pinfo.cc (pinfo::thisproc): Remove pid_handle manipulations.
(pinfo::init): Don't consider a reaped process to be available.
* spawn.cc (child_info_spawn::worker): Remove pid_handle manipulations. Make
wr_proc_pipe and parent noninheritable when starting a program which doesn't
use the Cygwin DLL. Conditionally reset wr_proc_pipe to inheritable if
CreateProcess fails. Inject wr_proc_pipe handle into non-Cygwin process.
Consider a non-cygwin process to be 'synced'.
* fhandler_tty.cc (bytes_available): Revert to previous Oct-2011 behavior where
a dummy buffer is used to determine how many bytes will be read.
(fhandler_pty_master::ioctl): Correct coercion in assignment.
systems. Change comment acordingly.
* wincap.h (wincaps::has_gaa_largeaddress_bug): New element.
* wincap.cc: Implement above element throughout.
(wincap_8): New globale wincaps to support Windows 8.
(wincapc::init): Take Windows 8 into account. Set new
has_gaa_largeaddress_bug member to false on 32 bit systems.
* sigproc.cc (proc_terminate): Don't set parent pid of child to 1 if we've
execed since the execed process is still considered the parent.
* child_info.h: Bump copyright.
* pipe.cc (fhandler_pipe::create): Don't indiscriminately add process id to
every pipe since some pipe names (fifo, tty) don't need it.
* sigproc.cc (sigproc_init): Pass PIPE_ADD_PID to fhandler_pipe::create to
ensure that pid is always part of sigwait pipe name.
* globals.cc (pipe_byte): Declare.
* pipe.cc (fhandler_pipe::create): Use current process id in pipe name rather
than pid for simple name collision avoidance. Do this only once to avoid extra
overhead when a busy pipe is found. Honor pipe_byte to create non-message
pipes if set.
* sigproc.cc (sigproc_init): Use a specific name for the signal pipe.