field.
(class lockf_t): Add lf_ver field.
(lockf_t::lockf_t): Initialize lf_ver to 0.
(class inode_t): Change i_wait to i_cnt. Change comment to explain
change in usage.
(inode_t:use): Rename from wait. Make private.
(inode_t::unuse): Rename from unwait. Make private.
(inode_t::inuse): Rename from waiting. Make private.
(inode_t::notused): New public method to set use count to 0.
(inode_t::unlock_and_remove): New method to unlock node and to delete
it if it's unused in current process.
(fhandler_base::del_my_locks): Drop global list lock. Drop variable
no_locks_left. Simpify unlocking and removing node by just calling
unlock_and_remove.
(fixup_lockf_after_exec): Call notused method for each node.
(inode_t::get): Call use method. Lock node only if outside of list
lock.
(inode_t::get_all_locks_list): Accommodate additional lf_ver field
when creating lockf_t structure from object name.
(lockf_t::create_lock_obj_attr): Accommodate additional lf_ver field
when creating object name from lockf_t structure. Handle
STATUS_OBJECT_NAME_COLLISION gracefully in F_POSIX case as well.
Change comment accordingly. Increment lf_ver field rather than high
byte of lf_wid field. Simplify comment.
(fhandler_disk_file::lock): Always call unlock_and_remove rather than
just UNLOCK on node.
(lf_setlock): Move ret definition where it's used. Drop unneeded
tests for obj being not NULL. Only check for deadlock condition if the
lock we're trying to establish is a POSIX lock. Revamp object
collecting and wait code to cover all cases. Don't return with EDEADLK
if blocking process can't be opened for synchronization in F_POSIX case,
rather just wait like in F_FLOCK case. Change system_printf to
debug_printf in that case. Only run WaitForMultipleObjects with high
priority. Close obj and process handles prior to locking node.
(fhandler_base::close): Move call to del_my_locks from here...
* fhandler_disk_file.cc (fhandler_disk_file::open): ...to here.
* flock.cc (struct lockfattr_t): New type.
(lockf_t::close_lock_obj): New method, use throughout.
(lockf_t::create_lock_obj_attr): New method.
(lockf_t::create_lock_obj): Use create_lock_obj_attr method. Handle
STATUS_OBJECT_NAME_COLLISION in F_FLOCK case gracefully. Add lengthy
comments to explain why and how.
(lockf_t::open_lock_obj): Use create_lock_obj_attr method.
(lockf_t::del_lock_obj): Call NtSetEvent rather than SetEvent for
symmetry.
(fhandler_disk_file::lock): Define n only where it's used. Call
need_fork_fixup only if call was successful. Handle EINTR and
ECANCELED return values from lf_setlock.
(lf_setlock): Drop WAIT_UNLOCKED and WAIT_PROC_EXITED. Don't wait
for event object handle count to become <= 1 in F_LOCK case.
Simplify WFMO return value handling. Don't handle signal and cancel
events here; just return with appropriate error code instead.
(lf_getblock): Ignore locks for which the handle can't be opened.
Use IsEventSignalled.
* ntdll.h (STATUS_INVALID_INFO_CLASS): Undef if defined elsewhere to
make sure the definition is casted to NTSTATUS.
(STATUS_INVALID_HANDLE): Define and ditto.
(STATUS_OBJECT_NAME_COLLISION): Define.
(NtSetEvent): Declare.
FILE_OVERWITE/FILE_OVERWRITE_IF. Set file size to 0 explicitely if
regular, existing file has been opened for writing with O_TRUNC flag
set. Explain why.
sigprocmask to copy parent thread signal mask into new parent_sigmask
member.
(pthread::thread_init_wrapper): Copy _my_tls.sigmask from new
parent_sigmask member.
* thread.h (class pthread): Drop parent_tls. Add parent_sigmask.
DEV_SOUND_MAJOR. Use throughout.
* fhandler_proc.cc (proc_tab): Add /proc/devices and /proc/misc
virtual files.
(format_proc_devices): New function.
(format_proc_misc): New function.
* environ.cc (conv_start_chars): Move to shared cygwin region and initialize at
compile time.
(match_first_char): New generic function for querying conv_start_chars.
(posify_maybe): Rename from posify.
(environ_init): Remove conv_envvars initialization. Don't check
conv_start_chars, just allow posify_maybe to make the decision.
* fhandler_console.cc (__vt100_conv): Fix formatting. Mark as const.
* dlfcn.cc: Throughout mark exported symbols as extern "C".
(dlopen): Unignore flags argument. Define ret to NULL. Fix typo in
comment. Support Glibc flags RTLD_NOLOAD and RTLD_NODELETE.
* include/dlfcn.h: Clean up comments.
(RTLD_NODELETE): Define.
(RTLD_NOLOAD): Define.
(RTLD_DEEPBIND): Define.
(ReadPipeOverlapped): Ditto.
(WritePipeOverlapped): Ditto.
* miscfuncs.h: Declare new functions.
* pinfo.cc (commune_process): Call WritePipeOverlapped instead of
WriteFile. Set timeout to 1 sec.
(_pinfo::commune_request): Call ReadPipeOverlapped instead of ReadFile.
Set timeout to 0.5 secs.
* sigproc.cc (sig_send): Create pipe using CreatePipeOverlapped.
(fhandler_proc::closedir): Declare.
* fhandler_proc.cc (fhandler_proc::opendir): New method. Fetch list
of active processes here once to avoid potential duplicates.
(fhandler_proc::closedir): New method.
pidlist, even if pid is a Cygwin PID.
(winpids::enum_processes): Fetch Cygwin processes from listing of
shared cygwin object dir in the native NT namespace. Only if winpid
is true, fetch Windows processes using an additional call to
NtQuerySystemInformation.
even for zombies.
(get_mem_values): Fix loop fetching working set list to avoid out of
memory conditions. Return all mem values set to 0 for zombies.
* ntdll.h (STATUS_PROCESS_IS_TERMINATING): Define.
size from the LoaderFlags field in the PE/COFF header.
(heap_init): Call eval_initial_heap_size rather than
cygwin_shared->heap_chunk_size to fetch the initial heap size.
* shared.cc (shared_info::heap_chunk_size): Remove.
* shared_info.h (class shared_info): Drop heap_chunk member.
(CURR_SHARED_MAGIC): Update.
* ntea.cc (read_ea): Return correct ENOTSUP rather than EOPNOTSUPP.
Handle STATUS_INVALID_DEVICE_REQUEST and STATUS_NOT_FOUND. Explain
why. Convert conditional to switch statement.
(write_ea): Return correct ENOTSUP rather than EOPNOTSUPP. Handle
STATUS_INVALID_DEVICE_REQUEST. Convert conditional to switch statement.
* posix.sgml (std-notimpl): Move clock_nanosleep from here...
(std-susv4): ... to here.
(std-notes): Note limitations of clock_nanosleep.
* signal.cc (clock_nanosleep): Renamed from nanosleep, adding clock_id
and flags arguments and changing return values throughout.
Improve checks for illegal rqtp values. Add support for
CLOCK_MONOTONIC and TIMER_ABSTIME.
(nanosleep): Rewrite in terms of clock_nanosleep.
(sleep): Ditto.
(usleep): Ditto.
* thread.cc: Mark clock_nanosleep in list of cancellation points.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* cygthread.h (cygthread::create): Use correct regparm.
(cygthread::standalone): Delete from class and from all constructors.
(cygthread::cygthread): Use three only arguments for detached threads, and
start the thread via QueueUserAPC/async_create.
* dcrt0.cc (dll_crt0_0): Remove handling for wincap.has_buggy_thread_startup.
(dll_crt0_1): Ditto.
* wincap.cc: Ditto throughout.
* wincap.h: Ditto.
* fhandler_socket.cc (fhandler_socket::sendmsg): Add missing call to
get_inet_addr to convert AF_LOCAL to AF_INET sockets.
* net.cc (cygwin_socket): Workaround UDP Winsock problem. Add comment
to explain why.
* select.cc: Include winsock2.h rather than winsock.h.
using PeekConsoleInput and return only key down events in buf.
* fhandler_tty.cc (fhandler_pty_slave::ioctl): Always return EINVAL
if PeekNamedPipe fails.
(fhandler_pty_master::ioctl): Ditto.