why -fomit-frame-pointer doesn't work right for passwd.o and path.o. Add
-static to link command line for cygwin0.dll.
* fhandler_disk_file.cc (fhandler_disk_file::facl): Reorganize slightly to
silence compiler warning when compiling with -fstack-check.
* net.cc (inet_ntop6): Initialize structure members to silence compiler warning
when compiling with -fstack-check.
* pseudo-reloc.cc (_pei386_runtime_relocator): Make this a C function. Detect
NULL u.
* winsup.h (_pei386_runtime_relocator): Declare this as extern "C".
* lib/_cygwin_crt0_common.cc (_pei386_runtime_relocator): Call with NULL
argument.
* signal.cc (sigaction_worker): Eliminate last argument. Let callers report
their own strace info. Regparmize.
(sigaction): Reflect sigaction_worker changes.
(siginterrupt): Ditto.
* exceptions.cc: Update copyright.
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.
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.
* 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.
rather than recvmsg.
(fhandler_socket::writev): Call send_internal directly, rather than
sendmsg.
* net.cc (cygwin_recv): Call fhandler_socket::recvfrom directly, rather
than cygwin_recvfrom.
(cygwin_send): Call fhandler_socket::sendto directly, rather than
cygwin_sendto.
(fhandler_socket::bind): Change comment to explain setting the
SO_EXCLUSIVEADDRUSE socket option. Remove code which checks for
address in use.
* net.cc (cygwin_setsockopt): Never set SO_REUSEADDR option. Improve
comment to compensate for the deleted comment in fhandler_socket::bind.
* wincap.cc: Throughout, drop has_enhanced_socket_security from wincaps.
* wincap.h (struct wincaps): Drop has_enhanced_socket_security flags
and method.
* net.cc (get_flags): Set IFF_NOARP flag for PPP and SLIP devices.
(get_xp_ifs): Unify IFF_BROADCAST setting. Drop calling SendARP to
set IFF_NOARP flag.
condition. Fix comment about availability. Move remaining comment to
the right spot. Drop has_ip_helper_lib condition.
* net.cc (cygwin_setsockopt): Drop has_disabled_user_tos_setting
condition. Fix comment.
(get_2k_ifs): Fix comment.
(get_nt_ifs): Remove.
(getifaddrs): Drop call to get_nt_ifs.
(get_ifconf): Ditto.
* wincap.cc: Throughout, drop has_ip_helper_lib,
has_disabled_user_tos_setting, and has_exclusiveaddruse settings from
wincaps.
(wincap_unknown): Remove.
(wincap_nt4): Remove.
(wincap_minimal): New macro, set to wincap_nt4sp4 for now.
(wincapc::init): Drop test for pre-SP4 NT4. Just imply at least NT SP4.
Replace references to wincap_unknown with references to wincap_minimal.
* wincap.h (struct wincaps): Drop has_ip_helper_lib,
has_disabled_user_tos_setting, and has_exclusiveaddruse flags and
methods.
(struct dll_info): Convert name to WCHAR.
(std_dll_init): Load DLLs with full path to windows system directory.
Add hint to Microsoft security advisory.
* dcrt0.cc (init_windows_system_directory): New function.
(dll_crt0_0): Call init_windows_system_directory first.
* exceptions.cc (windows_system_directory): Move to globals.cc.
(windows_system_directory_length): Ditto.
(events_init): Drop code fetching windows_system_directory.
* globals.cc (windows_system_directory): New global variable.
(windows_system_directory_length): Ditto.
* net.cc (load_ipv6_funcs): Use windows_system_directory rather than
GetSystemDirectoryW.
* netdb.cc (open_system_file): Ditto. Simplify debug output.
* miscfuncs.cc (yield): Rename from low_priority_sleep. Remove all of the
logic which called Sleep() and just use SwitchToThread.
* miscfuncs.h (yield): Rename from low_priority_sleep.
(SLEEP_0_STAY_LOW): Delete unused define.
* shared.cc (memory_init): Move heap_init() call directly after shared memory
initialization to more closely mimic long-standing program flow.
* tty.cc (tty_list::terminate): Replace call to low_priority_sleep with Sleep.
* fhandler.h (fhandler_socket::accept4): Rename from accept. Take
additional flag parameter.
* fhandler_socket.cc (fhandler_socket::accept4): Ditto. Handle
SOCK_NONBLOCK and SOCK_CLOEXEC flags.
* net.cc (cygwin_socket): Handle SOCK_NONBLOCK and SOCK_CLOEXEC flags
in type. Check for invalid flag values.
(socketpair): Ditto.
(cygwin_accept): Accommodate renaming of fhandler_socket::accept
function to accept4.
(accept4): New function.
* posix.sgml: Mention accept4 as GNU extensions.
* include/cygwin/socket.h (SOCK_NONBLOCK): Define.
(SOCK_CLOEXEC): Define.
(_SOCK_FLAG_MASK): Define when building Cygwin.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* include/sys/socket.h (accept4): Declare.
socket handle value to debug output.
(fhandler_socket::fixup_after_fork): Ditto. Make new socket handle
OVERLAPPED, just as if it has been created with socket().
* net.cc (fdsock): Close duplicated socket and explain why. Disable
the entire WSADuplicateSocket test for now and explain why.
* autoload.cc (WSADuplicateSocketW): Define.
(WSASocketW): Define.
* dtable.cc (dtable::release): Call dec_need_fixup_before if necessary.
(dtable::fixup_before_fork): New function.
(dtable::fixup_before_exec): New function.
* dtable.h (class dtable): Add member cnt_need_fixup_before. Add
declarations for above new functions.
(dtable::dec_need_fixup_before): New inline method.
(dtable::inc_need_fixup_before): New inline method.
(dtable::need_fixup_before): New inline method.
* fhandler.h (fhandler_base::fixup_before_fork_exec): New virtual
method.
(fhandler_base::need_fixup_before): New virtual method.
(class fhandler_socket): Add member prot_info_ptr.
(fhandler_socket::init_fixup_before): Declare.
(fhandler_socket::need_fixup_before): New inline method.
(fhandler_socket::fixup_before_fork_exec): Declare.
(fhandler_socket::fixup_after_exec): Declare.
* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
prot_info_ptr to NULL.
(fhandler_socket::~fhandler_socket): Free prot_info_ptr conditionally.
(fhandler_socket::init_fixup_before): New method.
(fhandler_socket::fixup_before_fork_exec): Ditto.
(fhandler_socket::fixup_after_fork): Use WSASocketW to duplicate
socket if necessary.
(fhandler_socket::fixup_after_exec): New method.
(fhandler_socket::dup): Use fixup_before_fork_exec/fixup_after_fork
to duplicate socket if necessary.
* fork.cc (frok::parent): Start child suspended if some fhandler
needs fixup before fork. If so, call dtable::fixup_before_fork after
CreateProcess and resume child.
* net.cc (fdsock): Try to find out if socket needs fixup before and
initialize socket accordingly. Add HUGE comment to explain what happens
and why.
* spawn.cc (spawn_guts): Start child suspended if some fhandler needs
fixup before exec. If so, call dtable::fixup_before_exec after
CreateProcess.
AF_LOCAL sockets.
(fhandler_socket::getpeername): Ditto.
* net.cc (socketpair): Don't set sun_path and peer_sun_path to
make sure getsockname and getpeername return the correct values
for AF_LOCAL sockets.
(fhandler_socket::set_peer_sun_path): New method.
(fhandler_socket::get_peer_sun_path): New method.
* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
peer_sun_path to NULL.
(fhandler_socket::~fhandler_socket): Free peer_sun_path if necessary.
(fhandler_socket::dup): Duplicate peer_sun_path.
(fhandler_socket::accept): Ditto. Return fake unbound peer content
and len in case of AF_LOCAL sockets.
(fhandler_socket::getsockname): Always use local sockaddr_storage to
store socket address and copy over to incoming address. Handle every
namelen correctly per POSIX.
(fhandler_socket::getpeername): Ditto. Add code path to return
correct value for AF_LOCAL sockets.
(fhandler_socket::set_peer_sun_path): New method.
* net.cc (socketpair): Set peer_sun_path to empty string, just like
sun_path.
the length exceeds it.
* net.cc (fdsock): Use 65535 as window size, just like the comment says or we
run into problems with DuplicateHandle.
* path.cc (patch_conv::check): Use set_path to set invalid filename.
* path.h (path_conv::path_conv): Ditto.
to store and retrieve the SO_RCVBUF and SO_SNDBUF sizes.
* fhandler_socket.cc (fhandler_socket::dup): Duplicate new members.
(fhandler_socket::send_internal): Check for SO_SNDBUF size and
restrict send to 1 byte less per KB 823764. Leave loop immediately
if WSASendMsg has been used.
* net.cc (fdsock): Change comment again. Set buffer sizes to 65536.
Store values in fhandler_socket.
(cygwin_setsockopt): Store SO_RCVBUF and SO_SNDBUF sizes in
fhandler_socket.
(cygwin_sendto): Drop call to sig_dispatch_pending.
(cygwin_recvfrom): Ditto.
(cygwin_recvmsg): Ditto.
(cygwin_sendmsg): Ditto.
value.
(get_ipv4fromreg_ipcnt): New static function to fetch number of
configured IPv4 addresses for a given NIC from registry.
(get_ipv4fromreg): New static function to fetch configured IPv4
addresses for a given NIC from registry.
(get_friendlyname): New static function to generate friendly name.
(get_hwaddr): New static function to copy hardware address.
(get_xp_ifs): Restructure slightly. Add code to generate IPv4 entries
entries for interfaces which are disconnected.