2015-07-13 Corinna Vinschen * exceptions.cc (exception::handle): Reenable code only disabled for debug purposes. 2015-07-07 Corinna Vinschen x86_64 only: * cygtls.cc (san::leave): Restore _my_tls.andreas. * cygtls.h (class san): Add _clemente as in 32 bit case. Add ret and frame members. (san::san): Handle _my_tls.andreas as on 32 bit. Take parameter and write it to new member ret. Store current stack pointer in frame. (san::~san): New destructor to restore _my_tls.andreas. (__try): Use __l_except address as parameter to san::san. * dcrt0.cc (dll_crt0_0): Add myfault_altstack_handler as vectored continuation handler. * exception.h (myfault_altstack_handler): Declare. * exceptions.cc (myfault_altstack_handler): New function. Explain what it's good for. 2015-07-07 Corinna Vinschen * child_info.h (CURR_CHILD_INFO_MAGIC): Update. (child_info_fork::alloc_stack_hard_way): Drop declaration. * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Fold into child_info_fork::alloc_stack. (getstack): Remove. (child_info_fork::alloc_stack): Simplify check for application-provided stack in "hard way" code. Don't call getstack for each page, just reallocate stack immediately as required. 2015-07-07 Corinna Vinschen * fork.cc (frok::parent): Simplify code propagating stack setup to child process. Tweak comments. 2015-07-06 Yaakov Selkowitz * path.cc: Rework basename redefinition handling. Explain why. 2015-07-05 Corinna Vinschen * dcrt0.cc (CYGWIN_GUARD): Remove. (child_info_fork::alloc_stack_hard_way): Align stack commit to changes of thread stack setup in CygwinCreateThread. 2015-07-05 Corinna Vinschen * miscfuncs.cc (struct pthread_wrapper_arg): Add member guardsize. (pthread_wrapper): Set thread stack guarantee according to guardsize. Tweak assembler code so that $rax/$eax is not required by GCC to prepare the wrapper_arg value. (CygwinCreateThread): Fix deadzone handling. Drop setting a "POSIX" guardpage (aka page w/ PAGE_NOACCESS). Always use Windows guard pages instead. On post-XP systems (providing SetThreadStackGuarantee) always set up stack Windows like with reserved/commited areas and movable guard pages. Only on XP set up stack fully commited if the guardpage size is not the default system guardpage size. Fill out pthread_wrapper_arg::guardsize. Improve comments. * resource.cc: Implement RSTACK_LIMIT Linux-like. (DEFAULT_STACKSIZE): New macro. (DEFAULT_STACKGUARD): Ditto. (rlimit_stack_guard): New muto. (rlimit_stack): New global variable holding current RSTACK_LIMIT values. (__set_rlimit_stack): Set rlimit_stack under lock. (__get_rlimit_stack): Initialize rlimit_stack from executable header and return rlimit_stack values under lock. (get_rlimit_stack): Filtering function to return useful default stacksize from rlimit_stack.rlim_cur value. (getrlimit): Call __get_rlimit_stack in RLIMIT_STACK case. (setrlimit): Call __set_rlimit_stack in RLIMIT_STACK case. * thread.cc (pthread::create): Fetch default stacksize calling get_rlimit_stack. (pthread_attr::pthread_attr): Fetch default guardsize calling wincap.def_guard_page_size. (pthread_attr_getstacksize): Fetch default stacksize calling get_rlimit_stack. * thread.h (PTHREAD_DEFAULT_STACKSIZE): Remove. (PTHREAD_DEFAULT_GUARDSIZE): Remove. (get_rlimit_stack): Declare. 2015-07-05 Corinna Vinschen * fhandler_process.cc (heap_info::heap_info): Disable fetching heap info on 64 bit XP/2003. Explain why. * wincap.h (wincaps::has_broken_rtl_query_process_debug_information): New element. * wincap.cc: Implement above element throughout. 2015-07-04 Corinna Vinschen * autoload.cc (SetThreadStackGuarantee): Import. * cygtls.h (struct _cygtls): Replace thread_context with a ucontext_t called context. * exceptions.cc (exception::handle): Exit from process via signal_exit in case sig_send returns from handling a stack overflow SIGSEGV. Explain why. (dumpstack_overflow_wrapper): Thread wrapper to create a stackdump from another thread. (signal_exit): Fix argument list to reflect three-arg signal handler. In case we have to create a stackdump for a stack overflow condition, do so from a separate thread. Explain why. (sigpacket::process): Don't run signal_exit on alternate stack. (altstack_wrapper): Wrapper function to do stack correction when calling the signal handler on an alternate stack to handle a stack overflow. Make sure to have lots of comments. (_cygtls::call_signal_handler): Drop local context variable to reduce stack pressure. Use this->context instead. Change inline assembler to call altstack_wrapper. (_cygtls::signal_debugger): Accommodate aforementioned change to struct _cygtls. * tlsoffset.h: Regenerate. * tlsoffset64.h: Regenerate. * wincap.h (wincaps::def_guard_pages): New element. (wincaps::has_set_thread_stack_guarantee): Ditto. * wincap.cc: Implement above elements throughout. 2015-07-01 Corinna Vinschen * fork.cc (frok::parent): Set stacktop value based on requested stack pointer value in child. Explain why. 2015-06-30 Corinna Vinschen * signal.cc (sigaltstack): Add comment. 2015-06-27 Corinna Vinschen * exceptions.cc (_cygtls::call_signal_handler): Drop manipulating thread's ss_flags here. It's not safe against longjmp. * signal.cc (sigaltstack): Check if we're running on the alternate stack and set ss_flags returned in oss to SS_ONSTACK. 2015-06-26 Corinna Vinschen * include/cygwin/signal.h: Revert to define MINSIGSTKSZ and SIGSTKSZ here with bigger values to allow _cygtls to reside on signal stack, should it turn out to be required at one point. 2015-06-26 Corinna Vinschen * resource.cc (getrlimit): Fix values returned by RLIMIT_STACK. Explain why this had to be changed. 2015-06-23 Ken Brown * include/cygwin/signal.h (SIGEV_*): Add macros. 2015-06-22 Corinna Vinschen * exceptions.cc (_cygtls::call_signal_handler): Drop pushing a register on the original stack, it confuses GCC. Rearrange the assembler code so that $rax/$eax is not used by GCC to prepare an argument value. Use $rax/$eax without saving. Drop clearing $rbp/$epb. 2015-06-21 Corinna Vinschen * exceptions.cc (_cygtls::call_signal_handler): Drop subtracting 16 bytes from the alternate stack, it's not necessary. Safe all clobbered registers. Safe one on the orignal stack, the others on the alternate stack on both platforms. 2015-06-20 Corinna Vinschen * exceptions.cc (_cygtls::call_signal_handler): Implement alternate signal stack handling. * signal.cc (sigaltstack): Add fault handler. * include/cygwin/signal.h: Remove definitions of MINSIGSTKSZ and SIGSTKSZ here. 2015-06-19 Corinna Vinschen * common.din (sigaltstack): Export. * cygtls.cc (_cygtls::init_thread): Initialize altstack. * cygtls.h (__tlsstack_t): Rename from __stack_t to distinguish more clearly from stack_t. Accommodate throughout. (_cygtls): Add altstack member. * exceptions.cc (exception::handle): Set SIGSEGV handler to SIG_DFL if we encounter a stack overflow, and no alternate stack has been defined. * include/cygwin/signal.h (MINSIGSTKSZ): Define (SIGSTKSZ): Define. (SA_ONSTACK): Define. * signal.cc (sigaltstack): New function. * tlsoffset.h: Regenerate. * tlsoffset64.h: Ditto. 2015-06-19 Corinna Vinschen * exceptions.cc: Minor formatting fixes. 2015-06-18 Corinna Vinschen * Makefile.in (install-man): Exclude release subdir from search paths. 2015-06-17 Corinna Vinschen * net.cc (sethostname): New function. * common.din (sethostname): Export * include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2001. (CYGWIN_VERSION_DLL_MINOR): Set to 0. 2015-06-15 Corinna Vinschen * fhandler_socket.cc (LOCK_EVENTS): Don't enter critical section with invalid mutex handle since then socket has been closed. (UNLOCK_EVENTS): Close critical section. (fhandler_socket::evaluate_events): Handle calling connect on shutdown socket. (fhandler_socket::wait_for_events): Try for pthread_testcancel in case of WAIT_FAILED. Try to come up with a better errno in case we waited on an invalid handle. (fhandler_socket::release_events): Change wsock_mtx and wsock_evt to NULL under lock to avoid accessing invalid handle. 2015-06-15 Corinna Vinschen * net.cc (errmap): Handle more Winsock error codes. 2015-06-15 Corinna Vinschen * exceptions.cc (_cygtls::call_signal_handler): Disable enforcing SA_RESTART in non-main threads to allow returning with EINTR from system calls. 2015-06-11 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 5. 2015-06-08 Corinna Vinschen * pinfo.cc (_pinfo::cwd): Initialize s to avoid comiler warning. (_pinfo::cmdline): Ditto. 2015-06-08 Corinna Vinschen * pinfo.cc (_pinfo::root): Fake default root for native processes. (open_commune_proc_parms): New helper function to access process parameter block. (_pinfo::cwd): Fetch missing cwd for native processes from processes parameter block. (_pinfo::cmdline): Ditto for command line. 2015-06-08 Corinna Vinschen * pinfo.cc (_pinfo::commune_request): Don't try to send commune requests to non-Cygwin processes. 2015-06-08 Takashi Yano * fhandler_tty.cc (fhandler_pty_slave::write): Move causing of SIGHUP into fhandler_pty_master::close(). (fhandler_pty_slave::read): Ditto. (fhandler_pty_master::close): Ditto. 2015-06-08 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 4. 2015-06-02 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 3. 2015-05-28 Takashi Yano Corinna Vinschen * fhandler_tty.cc (fhandler_pty_common::close): Don't close output_mutex here. Move into callers. (fhandler_pty_master::close): Use NtQueryObject instead of PeekNamedPipe to detect closing the last master handle. 2015-05-27 Takashi Yano * net.cc: Define _NETIOAPI_H_ to accomodate newer w32api. 2015-05-03 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 2. 2015-04-30 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 1. 2015-04-30 Corinna Vinschen * security.cc (convert_samba_sd): Fix accidental dropping of all non-Unix User, non-Unix Group accounts. 2015-04-27 Corinna Vinschen * include/asm/types.h: Add __s64 and __u64 types. 2015-04-23 Corinna Vinschen * path.cc (path_conv::set_nt_native_path): New function. * path.h (path_conv::set_nt_native_path): Add prototype. * syscall.cc (try_to_bin): Handle moving files to the recycler accessed via a local virtual drive (subst). Fix a problem renaming the file to the unique replacement name on Samba. Align comment. 2015-04-22 Corinna Vinschen * fhandler_tty.cc (fhandler_pty_slave::fch_close_handles): Don't close handles not opened via fhandler_pty_slave::fch_open_handles. 2015-04-22 Takashi Yano * fhandler.h (class fhandler_base): Add virtual function get_io_handle_cyg() to get handle from which OPOST-processed output is read on PTY master. (class fhandler_pty_slave): Add variable output_handle_cyg to store a handle to which OPOST-processed output is written. Add two functions, i.e., set_output_handle_cyg() and get_output_handle_cyg(), regarding variable output_handle_cyg. Now, output_handle is used only by native windows program. The data before OPOST-processing is written to output_handle and OPOST-processing is applied in the master-side. For a cygwin process, OPOST-processing is applied in the slave-side, and the data after OPOST-processing is written to output_handle_cyg. (class fhandler_pty_master): Add two variables, i.e., io_handle_cyg and to_master_cyg, to store handles of a pipe through which OPOST-processed output passes. Add pty_master_fwd_thread and function pty_master_fwd_thread() for a thread which applies OPOST-processing and forwards data from io_handle to to_master_cyg. Add function get_io_handle_cyg() regarding variable io_handle_cyg. Now, the pipe between io_handle and to_master are used only by native windows program for applying OPOST-processing in the master-side. For a cygwin process, the pipe between io_handle_cyg and to_master_cyg is used for passing through the data which is applied OPOST-processing in the slave-side. * fhandler_tty.cc (struct pipe_reply): Add member to_master_cyg. (fhandler_pty_master::process_slave_output): Read slave output from io_handle_cyg rather than io_handle. (fhandler_pty_slave::fhandler_pty_salve): Initialize output_handle_cyg. (fhandler_pty_slave::open): Set output_handle_cyg by duplicating handle to_master_cyg on PTY master. (fhandler_pty_slave::close): Close handle output_handle_cyg. (fhandler_pty_slave::write): Write data to output_handle_cyg rather than output_handle. (fhandler_pty_slave::fch_close_handles): Close handle output_handle_cyg. (fhandler_pty_master::fhandler_pty_master): Initialize io_handle_cyg, to_master_cyg and master_fwd_thread. (fhandler_pty_master::cleanup): Clean up to_master_cyg as well. (fhandler_pty_master::close): Print to_master_cyg as well in debug message. Terminate master forwarding thread. Close handles to_master_cyg and io_handle_cyg. (fhandler_pty_master::ioctl): Use io_handle_cyg rather than to_master. (fhandler_pty_master::pty_master_thread): Add code for duplicating handle to_master_cyg. (fhandler_pty_master::pty_master_fwd_thread): New function for a thread to forward OPOST-processed data from io_handle to to_master_cyg. This thread applies OPOST-processing to the output of native windows program. (::pty_master_fwd_thread): Ditto. (fhandler_pty_master::setup): Create a new pipe to pass thruegh OPOST- processed output. Create new thread to forward data from io_handle to to_master_cyg. Set handle to_master_cyg to tty. Print io_handle_cyg as well in debug message. Close handles io_handle_cyg and to_master_cyg in case of error. (fhandler_pty_master::fixup_after_fork): Set handle to_master_cyg to tty. Copy handle to_master_cyg from arch->to_master_cyg. (fhandler_pty_master::fixup_after_exec): Clean up to_master_cyg. * select.cc: Check handle returned by get_io_handle_cyg() rather than get_handle(). * tty.h (class tty): Add variable _to_master_cyg to store a handle to which OPOST-processed data is written. Add two functions, to_master_cyg() and set_to_master_cyg(), regarding _to_master_cyg. 2015-04-22 Corinna Vinschen * path.cc (basename): Undefine basename before defining function to avoid type collision with prototype in string.h. 2015-04-21 Corinna Vinschen * include/libgen.h: Remove in favor of newlib version. 2015-04-17 Corinna Vinschen * uinfo.cc (pwdgrp::fetch_account_from_windows): Always revert SID subauth count after checking for known domain. 2015-04-17 Corinna Vinschen * pwdgrp.h: Add comment to explain below change. (struct pg_pwd): Convert sid member to BYTE array. (struct pg_grp): Ditto. * grp.cc (pwdgrp::parse_group): Accommodate above change. * passwd.cc (pwdgrp::parse_passwd): Ditto. 2015-04-12 Corinna Vinschen * shm.cc (shmget): Fetch segment size from server rather than using size argument to accommodate existing segments. Add comment to explain why. 2015-04-10 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2000. (CYGWIN_VERSION_DLL_MINOR): Set to 0. 2015-04-04 Jon TURNEY * exceptions.cc (call_signal_handler): Set mcontext.cr2 to the faulting address. 2015-04-02 Jon TURNEY * exceptions.cc (call_signal_handler): Only bother to construct the ucontext for signal handlers with SA_SIGINFO set. Set mcontext.oldmask. 2015-04-04 Jon TURNEY * exceptions.cc (call_signal_handler): Zero initialize context and set context flags, as RlCaptureContext doesn't. 2015-04-09 Corinna Vinschen * fhandler_dsp.cc (fhandler_dev_dsp::open): Call open_null. 2015-04-08 Corinna Vinschen * pwdgrp.h (sidfromuid): New inline function. (sidfromgid): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::fchown): Use sidfromuid. * quotactl.cc (quotactl): Use sidfromuid and sidfromgid. 2015-04-08 Corinna Vinschen * include/cyggwin/acl.h (struct __acl16): Move from here... * sec_acl.cc: ...to here. 2015-04-07 Corinna Vinschen * tty.h (class tty): Remove unused 32/64 bit interoperability considerations. 2015-04-07 Corinna Vinschen * tty.h (NTTYS): Raise to 128. * devices.in: Change pty, ptym, and cons expressions accordingly. * devices.cc: Regenerate. 2015-04-04 Jon TURNEY * Makefile.in : Remove setting -fomit-frame-pointer for compiling various files, it is already the default. Set -fno-omit-frame-pointer for exceptions.cc on x86. 2015-04-03 Takashi Yano * fhandler_tty.cc (fhandler_pty_slave::read): Change calculation of "readlen" not to use "bytes_in_pipe" value directly. 2015-04-02 Jon TURNEY * include/cygwin/signal.h (struct __mcontext): 16-byte align. * include/sys/ucontext.h (ucontext_t): Ditto. 2015-04-01 Corinna Vinschen * include/cygwin/types.h: Include sys/_stdint.h rather than stdint.h. * include/stdint.h: Drop in favor of newlib version. * include/inttypes.h: Ditto. 2015-04-01 Jon TURNEY * include/sys/ucontext.h : New header. * include/ucontext.h : Ditto. * exceptions.cc (call_signal_handler): Provide ucontext_t parameter to signal handler function. 2015-04-01 Jon TURNEY * external.cc (cygwin_internal): Add operation to retrieve a copy of the EXCEPTION_RECORD from a siginfo_t *. * include/sys/cygwin.h (cygwin_getinfo_types): Ditto. * exception.h (cygwin_exception): Add exception_record accessor. 2015-04-01 Jon TURNEY * include/cygwin/signal.h : Rename struct ucontext to struct __mcontext. Fix layout differences from the Win32 API CONTEXT type. Remove unused member _internal. Rename member which corresponds to ContextFlags. Add cr2 member. 2015-04-01 Corinna Vinschen * grp.cc (internal_getgroups): Handle negative domain index to avoid crashes. 2015-03-31 Renato Silva * net.cc (cygwin_gethostname): Fix buffer size error handling. 2015-03-31 Corinna Vinschen * uinfo.cc (pwdgrp::fetch_account_from_windows): Don't allow fully qualified Windows account names (domain\user or user@domain). 2015-03-31 Corinna Vinschen * localtime.cc (tzset_unlocked): Export as _tzset_unlocked. 2015-03-30 Yaakov Selkowitz * common.din (__gnu_basename): Export. * path.cc (__gnu_basename): New function. 2015-03-30 Corinna Vinschen * cygheap.h (cygheap_domain_info::add_domain): Add prototype. * uinfo.cc (cygheap_domain_info::add_domain): New method. (pwdgrp::fetch_account_from_windows): Try to add domain explicitely if it was not in the original list of trusted domains and go ahead rather than bailing out. Add comment to explain why. 2015-03-30 Corinna Vinschen * cygtls.h (struct _cygtls): Convert thread_context to type CONTEXT. * exceptions.cc (_cygtls::signal_debugger): Use sizeof (CONTEXT) for size of CONTEXT copied for GDB's digestion. * include/cygwin/signal.h: Add a preliminary comment. 2015-03-25 Corinna Vinschen * include/sys/termios.h: Add CMIN and CTIME. * fhandler_termios.cc (fhandler_termios::tcinit): Use CMIN and CTIME. 2015-03-25 Takashi Yano * tty.h (class tty_min): Remove variable "write_error" to which any errors are not currently set at anywhere. (class tty): Add variable "column" for handling ONOCR. * tty.cc (tty::init): Add initialization code for variable "column". * fhandler.h (class fhandler_pty_master): Remove variable "need_nl" which is not necessary any more. "need_nl" was needed by OPOST process in fhandler_pty_master::process_slave_output(). (class fhandler_pty_common): Add function process_opost_output() for handling post processing for OPOST in write process. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Count TIOCPKT control byte into length to be read in TIOCPKT mode. Move post processing for OPOST to write process. Remove code related to variable "write_error". Return with EIO error if slave is already closed. (fhandler_pty_master::fhandler_pty_master): Remove initialization code for variable "need_nl". (fhandler_pty_common::process_opost_output): Add this function for handling of OPOST in write process. Add code to avoid blocking in non-blocking mode when output is suspended by ^S. (fhandler_pty_slave::write): Call fhandler_pty_common:: process_opost_output() instead of WriteFile(). Remove code related to variable "write_error". (fhandler_pty_master::doecho): Call fhandler_pty_common:: process_opost_output() instead of WriteFile(). * select.cc (peek_pipe): Remove code related to variable "need_nl". 2015-03-24 Corinna Vinschen Per glibc BZ #15366: * inttypes.h: Drop __STDC_FORMAT_MACROS consideration. * stdint.h: Drop __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS consideration. 2015-03-23 Corinna Vinschen * include/cygwin/_types.h: Drop unused file. 2015-03-18 Corinna Vinschen * grp.cc (pwdgrp::parse_group): Call cygsid::getfromgr_passwd. * passwd.cc (pwdgrp::parse_passwd): Call cygsid::getfrompw_gecos. * pwdgrp.h (cygsid::getfrompw): Implement as inline method here, accessing pg_pwd's sid member directly. (cygsid::getfromgr): Implement as inline method here, accessing pg_grp's sid member directly. * sec_auth.cc (extract_nt_dom_user): Call cygsid::getfrompw_gecos. Explain why. * sec_helper.cc (cygsid::getfrompw): Drop implementation. (cygsid::getfromgr): Ditto. * security.h (cygsid::getfrompw_gecos): Implement former getfrompw inline here. (cygsid::getfromgr_passwd): Implement former getfromgr inline here. 2015-03-18 Corinna Vinschen * sec_auth.cc (get_server_groups): Drop unused passwd argument. Adjust calls throughout. (get_initgroups_sidlist): Ditto. (get_setgroups_sidlist): Ditto. (create_token): Ditto. (lsaauth): Ditto. * security.h (create_token): Adjust prototype to above change. (lsaauth): Ditto. (get_server_groups): Ditto. * grp.cc (get_groups): Adjust call to get_server_groups. * syscalls.cc (seteuid32): Adjust calls to lsaauth and create_token. 2015-03-17 Corinna Vinschen * grp.cc (internal_getgroups): Drop unused timeout parameter. * pwdgrp.h (internal_getgroups): Ditto in prototype. * uinfo.cc (internal_getlogin): Ditto in usage. 2015-03-17 Corinna Vinschen * spawn.cc (find_exec): Fix a name change in case of a symlink which can be opened as is. 2015-03-12 Jon TURNEY * exceptions.cc (stack_info): Add sigstackptr member. (walk): Unwind sigstackptr inside _sigbe and sigdelayed. * gendef (_sigdelayed_end): Add symbol to mark end of sigdelayed. 2015-03-13 Corinna Vinschen * include/cygwin/sys_time.h: Remove. Definitions moved to newlib's sys/time.h. 2015-03-13 Alexey Pavlov * net.cc (in6addr_any): Remove redundant braces. (in6addr_loopback): Ditto. 2015-03-12 Alexey Pavlov * include/cygwin/version.h: Fix typo. 2015-03-12 Corinna Vinschen * fhandler_socket.cc: Drop defining _BSDTYPES_DEFINED before including winsup.h. 2015-03-12 Takashi Yano * fhandler_tty.cc (fhandler_pty_master::close): Add code to make slave detect closure of master. Fix typo in error message. 2015-03-11 Corinna Vinschen * include/cygwin/types.h: Include 2015-03-11 Corinna Vinschen * autoload.cc (CreateEnvironmentBlock): Make loading non-fatal. 2015-03-11 Corinna Vinschen * autoload.cc (std_dll_init): Fix condition for breaking from DLL loading loop. 2015-03-10 Yaakov Selkowitz * include/stdint.h: Fix __x86_64__ conditional. 2015-03-05 Corinna Vinschen * tty.h (tty::set_master_ctl_closed): Rename from set_master_closed. (tty::is_master_closed): Drop method. * fhandler_tty.cc (fhandler_pty_slave::open): Remove code prematurely bailing out if master control thread is not running. (fhandler_pty_slave::read): Don't generate SIGHUP if master control thread is not running. (fhandler_pty_master::close): Rearrange code to avoid stopping master control thread twice in multi-threaded scenarios. 2015-03-05 Corinna Vinschen * fhandler.h (fhandler_base::get_echo_handle): New virtual method. (class fhandler_pty_master): Add echo_r and echo_w handles constituting read and write side of new echo pipe. * select.cc (peek_pipe): On pty masters, check additionally if input from the echo pipe is available. * fhandler_tty.cc (fhandler_pty_master::doecho): Drop output_mutex locking. Write output to echo pipe. (fhandler_pty_master::process_slave_output): Check if input is available in echo pipe and prefer to read from it, if so. (fhandler_pty_slave::write): Drop output_mutex locking. (fhandler_pty_master::fhandler_pty_master): Initialize echo pipe handles to NULL. (fhandler_pty_master::close): Close and NULL echo pipe handles. (fhandler_pty_master::setup): Create echo pipe, close in case of error. 2015-03-04 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 36. 2015-03-03 Corinna Vinschen * msg.cc: Throughout, drop raising SIGSYS if cygserver is not running. * sem.cc: Ditto. * shm.cc: Ditto. 2015-03-03 Corinna Vinschen * common.din (issetugid): Export. * glob.cc (issetugid): Drop macro. * sec_auth.cc (issetugid): New exported function. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. 2015-03-02 Corinna Vinschen * security.cc (get_attribute_from_acl): Don't spill Everyone permissions into group permissions if owner SID == group SID. (alloc_sd): Add parenthesis for clarity. 2015-02-28 Corinna Vinschen * uinfo.cc (pwdgrp::add_line): Return NULL if parsing a line failed. (pwdgrp::add_account_post_fetch): Check return value from add_line and return NULL if add_line returns NULL. 2015-02-27 Corinna Vinschen * security.cc (alloc_sd): For directories, mark inherited ACEs inheritable to better follow POSIX 1003.1e rules. 2015-02-27 Corinna Vinschen * sec_acl.cc (getacl): Add mask even if all group and secondary account permissions are 0. 2015-02-27 Corinna Vinschen * uinfo.cc (pwdgrp::fetch_account_from_windows): Drop redundant test for SidTypeUser. 2015-02-27 Corinna Vinschen * sec_acl.cc (setacl): Fix bug which leads to ACE duplication in case owner SID == group SID. (getacl): Reverse order of SID test against group or owner sid to prefer owner attributes over group attributes. Disable setting group permissions equivalent to owner permissions if owner == group. Add comment to explain why. Fix indentation. * security.cc (get_attribute_from_acl): Change type of local variables containing permission to mode_t. Apply deny mask to group if group SID == owner SID to avoid Everyone permissions to spill over into group permissions. Disable setting group permissions equivalent to owner permissions if owner == group. Add comment to explain why. * uinfo.cc (pwdgrp::fetch_account_from_windows): Allow user SID as group account if user is a "Microsoft Account". Explain why. Drop workaround enforcing primary group "Users" for "Microsoft Accounts". 2015-02-26 Corinna Vinschen * ldap.cc (cyg_ldap::wait): Call cygwait with cw_infinite timeout value and with cw_sig_restart instead of cw_sig_eintr. Drop useless _my_tls.call_signal_handler call. Return EIO if cygwait failed. 2015-02-26 Corinna Vinschen * posix_ipc.cc (ipc_mutex_lock): Revert unneeded call to signal handler. 2015-02-26 Corinna Vinschen * posix_ipc.cc (ipc_mutex_lock): Add bool parameter to influence if cygwait should be in EINTR or in restart mode. Call signal handler if in EINTR mode. (mq_getattr): Call ipc_mutex_lock in restart mode. (mq_setattr): Ditto. (mq_notify): Ditto. (_mq_send): Call ipc_mutex_lock in EINTR mode. (_mq_receive): Ditto. 2015-02-26 Corinna Vinschen * fhandler_termios.cc (fhandler_termios::line_edit): Fix condition for writing remaining bytes in readahead buffer in non-canonical mode. 2015-02-25 Corinna Vinschen * sec_acl.cc (setacl): Always grant default owner entry STANDARD_RIGHTS_ALL and FILE_WRITE_ATTRIBUTES access, too. 2015-02-25 Corinna Vinschen * fhandler_tape.cc (fhandler_dev_tape::_lock): Add cw_sig_restart to cygwait call. * thread.cc (pthread_mutex::lock): Ditto. (semaphore::_timedwait): Fix formatting. (semaphore::_wait): Ditto. * thread.h (fast_mutex::lock): Ditto. 2015-02-25 Corinna Vinschen * security.cc (alloc_sd): Don't apply temporary workaround for chmod to DEF_USER_OBJ, DEF_GROUP_OBJ, and DEF_OTHER_OBJ ACEs. 2015-02-25 Corinna Vinschen * fhandler_tty.cc (fhandler_pty_slave::read): Having no input is not an error condition for tcflush. 2015-02-25 Corinna Vinschen * security.cc (alloc_sd): Fix comment style. Remove code unused for years. 2015-02-25 Corinna Vinschen * security.cc (alloc_sd): Add temporary workaround which disallows any secondary user to have more permissions than the primary group in calls to chmod. Add comment to explain why. 2015-02-25 Corinna Vinschen * uinfo.cc (client_request_pwdgrp::client_request_pwdgrp): Add missing break in switch statement. 2015-02-24 Corinna Vinschen * ldap.h: Remove index macros. (class cyg_ldap): Remove members srch_msg and srch_entry. (cyg_ldap::get_string_attribute): Remove private method taking index argument. (cyg_ldap::get_num_attribute): Ditto. Add method taking attribute name. (cyg_ldap::get_primary_gid): Adjust to aforementioned change. (cyg_ldap::get_unix_uid): Ditto. (cyg_ldap::get_unix_gid): Ditto. * ldap.cc: Throughout, use msg and entry in place of srch_msg and srch_entry. (std_user_attr): Add sAMAccountName and objectSid. (group_attr): Ditto. (cyg_ldap::close): Drop handling of srch_msg and srch_entry. (cyg_ldap::get_string_attribute): Move earlier in file. (cyg_ldap::get_num_attribute): Ditto. (cyg_ldap::enumerate_ad_accounts): Add comments for clarity. Use group_attr or user_attr rather than sid_attr to fetch all desired attributes for an account right away. (cyg_ldap::next_account): Store found SID in last_fetched_sid to skip calls to fetch_ad_account from fetch_account_from_windows. (cyg_ldap::get_string_attribute): Remove method taking index argument. (cyg_ldap::get_num_attribute): Ditto. * pwdgrp.h (class pg_ent): Fix formatting. Add member dom. * passwd.cc (pg_ent::enumerate_ad): Store current flat domain name in dom. Construct fetch_acc_t argument from LDAP attributes and call fetch_account_from_windows with that. * userinfo.h (enum fetch_user_arg_type_t): Rename FULL_grp_arg to FULL_acc_arg. Change throughout. (struct fetch_acc_t): Rename from fetch_full_grp_t. Change throughout. (struct fetch_user_arg_t): Rename full_grp to full_acc. Change throughout. 2015-02-24 Corinna Vinschen * fhandler.h (class fhandler_base): Add was_nonblocking status flag. * fhandler.cc (fhandler_base::set_flags): Set was_nonblocking if the O_NONBLOCK flag has been specified. (fhandler_base_overlapped::close): Check for was_nonblocking instead of for is_nonblocking. Explain why. (fhandler_base::set_nonblocking): Set was_nonblocking if noblocking mode gets enabled. 2015-02-24 Ken Brown * include/sys/socket.h (sockatmark): Add prototype. 2015-02-23 Corinna Vinschen * userinfo.h (struct fetch_full_grp_t): Define only when building Cygwin itself. (struct fetch_user_arg_t): Ditto. 2015-02-23 Corinna Vinschen * autoload.cc (LsaLookupSids): Import. * cygserver_pwdgrp.h: Include userinfo.h. Drop workaround defining fetch_user_arg_type_t locally. * grp.cc (internal_getgrsid_cachedonly): New function. (internal_getgrfull): Ditto. (internal_getgroups): Rearrange function. Center around fetching all cached group info first, calling LsaLookupSids on all so far non-cached groups second. Pass all available info to new internal_getgrfull call. * pwdgrp.h: Include userinfo.h. Move definitions of fetch_user_arg_type_t and fetch_user_arg_t there. (pwdgrp::add_group_from_windows): Declare with getting full group info. Called from internal_getgrfull. * uinfo.cc (pwdgrp::add_group_from_windows): Define. (pwdgrp::fetch_account_from_line): Add default case. (pwdgrp::fetch_account_from_file): Ditto. (pwdgrp::fetch_account_from_windows): Handle FULL_grp_arg. (client_request_pwdgrp::client_request_pwdgrp): Add default case. * userinfo.h: New header. (enum fetch_user_arg_type_t): Add FULL_grp_arg. (struct fetch_full_grp_t): New datatype. 2015-02-23 Corinna Vinschen * grp.cc (internal_getgroups): Check for group attributes and Everyone sid before calling internal_getgrsid. 2015-02-23 Corinna Vinschen * cygwait.h (enum cw_wait_mask): Add cw_sig_restart. Add comments to explain the meaning of the possible values. * cygwait.cc (is_cw_sig_restart): Define. (is_cw_sig_handle): Check for cw_sig_restart as well. (cygwait): Restart always if cw_sig_restart is set. * thread.cc (pthread::join): Call cygwait with cw_sig_restart flag to avoid having to handle signals at all. 2015-02-23 Corinna Vinschen * cygwait.cc (cygwait): Move setting res to WAIT_SIGNALED to clarify when WAIT_SIGNALED is returned to the caller. 2015-02-23 Corinna Vinschen * winsup.h (SIGTOMASK): Add cast to sigset_t to avoid int overflow. 2015-02-20 Corinna Vinschen * grp.cc (internal_getgroups): Take additional timeout_ns parameter. Restrict fetching group account entries from user token groups by timeout_ns 100ns-intervals. Add preceding comment to explain why. * pwdgrp.h (internal_getgroups): Align prototype. * times.cc (GetTickCount_ns): New function. * uinfo.cc (internal_getlogin): Call internal_getgroups wih 300ms timeout. * winsup.h (GetTickCount_ns): Declare. 2015-02-19 Jon TURNEY * Makefile.in (sigfe.o): Use CFLAGS. 2015-02-19 Jon TURNEY * include/cygwin/stdlib.h (initstate, random, setstate, srandom): Check if __XSI_VISIBLE is set by sys/cdefs.h, rather than testing for _XOPEN_SOURCE directly, to work correctly when _GNU_SOURCE is set. 2015-02-19 Corinna Vinschen * sec_acl.cc (setacl): Always grant owner FILE_WRITE_ATTRIBUTES access. 2015-02-18 Corinna Vinschen * ldap.cc (struct cyg_ldap_search): Add scope member. (cyg_ldap::search_s): Add parameter scope. Use as LDAP search scope instead of fixed LDAP_SCOPE_SUBTREE scope. (ldap_search_thr): Call cyg_ldap::search_s with scope from argument. (cyg_ldap::search): Add parameter scope and fill in to cyg_ldap_search. (cyg_ldap::fetch_ad_account): Call search with LDAP_SCOPE_SUBTREE scope. (cyg_ldap::fetch_posix_offset_for_domain): Call search with LDAP_SCOPE_ONELEVEL scope. (cyg_ldap::fetch_unix_sid_from_ad): Call search with LDAP_SCOPE_SUBTREE scope. (cyg_ldap::fetch_unix_name_from_rfc2307): Ditto. * ldap.h (cyg_ldap::search): Align prototype to above change. (cyg_ldap::search_s): Ditto. 2015-02-18 Corinna Vinschen * ldap.cc: Macro-ize filter expressions. Use throughout to compute required filter buffer size if filter is a local buffer. 2015-02-17 Corinna Vinschen * ldap.cc (cyg_ldap::fetch_posix_offset_for_domain): Drop stray system_printf. 2015-02-17 Corinna Vinschen * ldap.h (class cyg_ldap): Rename rootdse to def_context. Change throughout. * ldap.cc (cyg_ldap::open): Fix debug output. (cyg_ldap::fetch_ad_account): Rename rdse to base. Restrict LDAP query to users and groups only. (cyg_ldap::enumerate_ad_accounts): Rearrange filter expression for user accounts. (SYSTEM_CONTAINER): New macro. (cyg_ldap::fetch_posix_offset_for_domain): Set base in LDAP search to the "System" container in the default naming context to restrict the search scope. (cyg_ldap::fetch_unix_sid_from_ad): Add objectCategory=Person to search filter for users. 2015-02-16 Corinna Vinschen * spawn.cc (find_exec): Extend preceeding comment to explain more detailed what's going on in this function. Overwrite potential symlink target with original path. 2015-02-15 Corinna Vinschen * i686.din (__mempcpy): Move symbol export from here... * common.din (__mempcpy): ... to here. 2015-02-14 Corinna Vinschen * path.h (path_conv): Make path_flags private. Rename known_suffix to suffix and make private. Rename normalized_path to posix_path and make privtae. Accommodate name changes throughout in path_conv methods. (path_conv::known_suffix): New method. Use throughout instead of accessing suffix directly. (path_conv::get_win32): Constify. (path_conv::get_posix): New method to read posix_path. Use throughout instead of accessing normalized_path directly. (path_conv::set_posix): Rename from set_normalized_path. Accommodate name change throughout. * spawn.cc (find_exec): Return POSIX path, not Win32 path. 2015-02-12 Corinna Vinschen * sec_acl.cc (setacl): Introduce bool array "invalid" to note the invalidation of incoming acl entries while iterating over them. 2015-02-12 Corinna Vinschen * cygheap.h (cygheap_pwdgrp::get_home): Add dnsdomain parameter to declaration in ldap-related method. (cygheap_pwdgrp::get_shell): Ditto. (cygheap_pwdgrp::get_gecos): Ditto. * ldap.cc (cyg_ldap::open): Use NO_ERROR instead of 0. (cyg_ldap::close): Reset last_fetched_sid. (cyg_ldap::fetch_ad_account): Return immediately if sid is the same as last_fetched_sid. Open LDAP connection from here. Move initialization of rdse after open call. Set last_fetched_sid if LDAP call was successful. * ldap.h (class cyg_ldap): Add member last_fetched_sid. (cyg_ldap::cyg_ldap): Initialize last_fetched_sid. (cyg_ldap::is_open): New inline method. * uinfo.cc (cygheap_pwdgrp::init): Drop initialization of db_home, db_shell and db_gecos with "cygwin desc", thus only using the fallback by default. (fetch_windows_home): Add parameter dnsdomain. Call cyg_ldap::fetch_ad_account if required. (fetch_from_path): Add parameter dnsdomain. Call fetch_windows_home accordingly. (cygheap_pwdgrp::get_home): Accomodate call to fetch_windows_home. Add dnsdomain parameter in ldap-related method. Call cyg_ldap::fetch_ad_account if required. (cygheap_pwdgrp::get_shell): Ditto. (cygheap_pwdgrp::get_gecos): Ditto. (pwdgrp::fetch_account_from_windows): Drop cyg_ldap::open call prior to cyg_ldap::fetch_ad_account call. Set is_current_user to true if we're handling the current user account. Make sure to perform the LDAP calls only for users, and only if required. 2015-02-11 Corinna Vinschen * flock.cc (fhandler_base::lock): Convert accidental system_printf to debug_printf in case of non-matching file modes. Clear up debug output. 2015-02-11 Corinna Vinschen * dlfcn.cc (check_path_access): Drop FE_NATIVE from find_exec call. (gfpod_helper): Drop equality sign from environment variable name in call to check_path_access. * exec.cc (execlp): Drop equality sign from environment variable name in call to find_exec. (execvp): Ditto. (execvpe): Ditto. * path.h (enum fe_types): Drop FE_NATIVE. (find_exec): Rename third paramter in declaration from search. Drop equality sign from default value. * spawn.cc (perhaps_suffix): Add PC_POSIX to path_conv::check call. (find_exec): Simplify function. Iterate over POSIX pathlist rather than Windows pathlist. Drop handling of FE_NATIVE flag. Always fill posix path of incoming path_conv buf, unless FE_NNF flag is given. (av::setup): Drop equality sign from environment variable name in call to find_exec. Call unshift with normalized_path. * winf.cc (av::unshift): Drop conv parameter and code converting Windows to POSIX path. * winf.h (av::unshift): Accommodate prototype. 2015-02-10 Corinna Vinschen * syscalls.cc (fhandler_base::stat_fixup): Generate unique inode number for /dev/tty under all circumstances. Add to comment. 2015-02-06 Corinna Vinschen * common.din: Export cabsl, cimagl, creall, finitel, hypotl, sqrtl. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. 2015-02-06 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 35. 2015-02-06 Corinna Vinschen * fhandler_proc.cc (format_proc_cpuinfo): Enable multi-core fields on Intel CPUs. 2015-02-04 Corinna Vinschen * common.din (wcstold): Export. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. 2015-02-03 Corinna Vinschen * mkvers.sh: Automate generating the copyright date in the version resource. * winver.rc: Ditto. 2015-01-28 Corinna Vinschen * Makefile.in (VERSION_OFILES): New variable containing object files with version information. Use throughout. (clean): Drop winver_stamp. (version.cc winver.o): Drop empty rule. (winver_stamp): Convert to rule targeting version.cc and winver.o directly. Drop touching winver_stamp. Fix typo. 2015-01-24 Corinna Vinschen * uname.cc (uname): Shorten "WOW64" to "WOW" to account for the new Windows 10 OS version "10.0" starting with preview build 9926. 2015-01-23 Pierre A. Humblet * net.cc (cygwin_inet_pton): Declare. (gethostby_specials): New function. (gethostby_helper): Change returned addrtype in 4-to-6 case. (gethostbyname2): Call gethostby_specials. 2015-01-22 Corinna Vinschen * fhandler.h (class fhandler_process): Add fd_type member. * fhandler_process.cc (process_tab): Fix indentation. (fhandler_process::exists): Rely on format_process_fd returning file type in fd_type. (struct process_fd_t): Add fd_type member. (fhandler_process::fill_filebuf): Allow format_process_fd to set this->fd_type member. (format_process_fd): Fix path evaluation to allow recognizing trailing path components. Fix check for file descriptor path component. Return virt_symlink in fd_type if no trailing path compenents exist, return virt_fsdir otherwise and copy full resulting path into destbuf. * path.cc (path_conv::check): If /proc/$PID/fd symlink has trailing path components, reparse resulting path as if it's the incoming path. Add comment to wail over the outdated and hackish check method, and to explain what we do here. 2015-01-21 Corinna Vinschen * uinfo.cc (pwdgrp::fetch_account_from_windows): Allow fetching gid, home, shell and gecos info from NT4 domain. 2015-01-21 Corinna Vinschen * sec_auth.cc (get_logon_server): Constify domain parameter. * security.h (get_logon_server): Same in prototype. 2015-01-20 Corinna Vinschen * common.din (sockatmark): Export. * net.cc (sockatmark): New function. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. 2015-01-19 Corinna Vinschen * cygserver_ipc.h (ipc_retval): Add default constructor. (class thread): struct->class. Add prototypes for new private methods dup_signal_arrived and close_signal_arrived. Implement constructor and destructor. 2015-01-16 Marco Atzeri Corinna Vinschen * gendef: Export _sigbe on 64 bit as well. * malloc_wrapper.cc (free): In malloc_printf, call caller_return_address instead of __builtin_return_address. (malloc): Ditto. (realloc): Ditto. (calloc): Ditto. * miscfuncs.cc (__caller_return_address): New function. * miscfuncs.h (caller_return_address): New macro calling __caller_return_address. (__caller_return_address): Add prototype. 2015-01-14 Corinna Vinschen * uinfo.cc (fetch_windows_home): Disable fetching from homeDrive or usri3_home_dir_drive. Add comment. 2015-01-14 Corinna Vinschen * environ.cc (renv_arr): Drop variables not usually in a Windows environment and all variables being uppercase anyway. But keep TMP and TEMP for paranoia. 2015-01-14 Corinna Vinschen * environ.cc (build_env): When merging the user's Windows environment, explicitely skip the variables needing conversion to avoid collisions. Extend comment to explain. 2015-01-13 Corinna Vinschen * uinfo.cc (pwdgrp::fetch_account_from_windows): Drop code from 2014-11-17, always prepending domain to NT SERVICE accounts when searching by name. Fix test expression to allow fully qualified names for NT SERVICE accounts. Extend comment to explain a bit. 2015-01-12 Pierre A. Humblet * minires-os-if.c (cygwin_query): Change questions into answers. 2015-01-08 Corinna Vinschen * cygheap.h (cygheap_pwdgrp::get_shell): Add sid to argument list. (cygheap_pwdgrp::get_gecos): Ditto. * uinfo.cc (fetch_windows_home): Accept cyg_ldap and PUSER_INFO_3 arguments, and fetch db home dir values right here. (fetch_from_path): Accept cyg_ldap, PUSER_INFO_3 pointers and sid arguments. Add '%H' format specifier to fetch Windows home dir in POSIX notation. (cygheap_pwdgrp::get_home): Accommodate changes to fetch_windows_home and fetch_from_path. (cygheap_pwdgrp::get_shell): Ditto. (cygheap_pwdgrp::get_gecos): Ditto. (pwdgrp::fetch_account_from_windows): Accommodate sid argument to cygheap_pwdgrp::get_shell and cygheap_pwdgrp::get_gecos. 2015-01-08 Corinna Vinschen * include/cygwin/socket.h (struct cmsghdr): Redefine cmsg_len as type size_t. Add comment to explain why. 2015-01-08 Corinna Vinschen * localtime.cc (__cygwin_gettzoffset): New function for access from newlib. (__cygwin_gettzname): Ditto. 2015-01-07 Corinna Vinschen * localtime.cc (tzload): Fix loading latest timezone offsets into tzinfo from zoneinfo files. Add comment to explain what we do. (tzparse): Add more comments to explain in case of loading timezone offset from other sources.