aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/dcrt0.cc
AgeCommit message (Collapse)AuthorFilesLines
2012-08-10This commit was manufactured by cvs2svn to create tag 'cygwin-cygwin-1_7_14-releasecvs2svn1-23/+14
1_7_14-release'. Sprout from cygwin-64bit-branch 2012-08-10 09:37:33 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'cygwin-64bit-' Cherrypick from master 2012-04-24 14:42:51 UTC Corinna Vinschen <corinna@vinschen.de> ' * new-features.sgml (ov-new1.7.14): New section. Add new console mouse': COPYING3 COPYING3.LIB ChangeLog MAINTAINERS compile config.rpath config.sub config/ChangeLog config/mh-darwin config/mh-interix config/mh-ppc-aix config/mt-alphaieee config/mt-sde config/picflag.m4 config/stdint.m4 config/tcl.m4 configure configure.ac include/ChangeLog include/dis-asm.h include/dwarf2.h include/elf/ChangeLog include/elf/avr.h include/elf/common.h include/elf/m68hc11.h include/elf/ppc.h include/elf/s390.h include/elf/sparc.h include/filenames.h include/gdb/ChangeLog include/gdb/callback.h include/gdb/signals.def include/gdb/signals.h include/mach-o/ChangeLog include/mach-o/codesign.h include/mach-o/external.h include/mach-o/loader.h include/mach-o/reloc.h include/mach-o/x86-64.h include/opcode/ChangeLog include/opcode/avr.h include/opcode/m68hc11.h include/opcode/mips.h include/opcode/ppc.h include/opcode/sparc.h include/plugin-api.h ltgcc.m4 ltoptions.m4 ltversion.m4 lt~obsolete.m4 newlib/ChangeLog newlib/doc/Makefile.am newlib/doc/Makefile.in newlib/libc/include/stdio.h newlib/libc/include/string.h newlib/libc/include/sys/signal.h newlib/libc/include/sys/stat.h newlib/libc/include/sys/time.h newlib/libc/include/sys/times.h newlib/libc/include/sys/types.h newlib/libc/include/sys/unistd.h newlib/libc/include/sys/wait.h newlib/libc/locale/lmessages.c newlib/libc/locale/lmonetary.c newlib/libc/locale/nl_langinfo.c newlib/libc/machine/cr16/sys/asm.h newlib/libc/machine/epiphany/Makefile.am newlib/libc/machine/epiphany/Makefile.in newlib/libc/machine/epiphany/aclocal.m4 newlib/libc/machine/epiphany/configure newlib/libc/machine/epiphany/configure.in newlib/libc/machine/epiphany/machine/stdlib.h newlib/libc/machine/epiphany/setjmp.S newlib/libc/machine/rl78/Makefile.am newlib/libc/machine/rl78/Makefile.in newlib/libc/machine/rl78/aclocal.m4 newlib/libc/machine/rl78/configure newlib/libc/machine/rl78/configure.in newlib/libc/machine/rl78/setjmp.S newlib/libc/posix/collate.c newlib/libc/posix/engine.c newlib/libc/posix/glob.c newlib/libc/posix/popen.c newlib/libc/posix/readdir.c newlib/libc/posix/regcomp.c newlib/libc/posix/telldir.c newlib/libc/posix/wordexp.c newlib/libc/reent/mkdirr.c newlib/libc/reent/renamer.c newlib/libc/search/hash.c newlib/libc/search/hash_bigkey.c newlib/libc/search/hash_page.c newlib/libc/search/hcreate_r.c newlib/libc/stdio/asiprintf.c newlib/libc/stdio/asprintf.c newlib/libc/stdio/clearerr.c newlib/libc/stdio/fclose.c newlib/libc/stdio/fdopen.c newlib/libc/stdio/feof.c newlib/libc/stdio/ferror.c newlib/libc/stdio/fflush.c newlib/libc/stdio/fgetc.c newlib/libc/stdio/fgets.c newlib/libc/stdio/fgetwc.c newlib/libc/stdio/fgetws.c newlib/libc/stdio/fileno.c newlib/libc/stdio/findfp.c newlib/libc/stdio/fmemopen.c newlib/libc/stdio/fopen.c newlib/libc/stdio/fopencookie.c newlib/libc/stdio/fpurge.c newlib/libc/stdio/fputc.c newlib/libc/stdio/fputs.c newlib/libc/stdio/fputwc.c newlib/libc/stdio/fputws.c newlib/libc/stdio/fread.c newlib/libc/stdio/freopen.c newlib/libc/stdio/fseek.c newlib/libc/stdio/ftell.c newlib/libc/stdio/funopen.c newlib/libc/stdio/fwide.c newlib/libc/stdio/fwrite.c newlib/libc/stdio/getc.c newlib/libc/stdio/getdelim.c newlib/libc/stdio/gets.c newlib/libc/stdio/local.h newlib/libc/stdio/mktemp.c newlib/libc/stdio/open_memstream.c newlib/libc/stdio/putc.c newlib/libc/stdio/setvbuf.c newlib/libc/stdio/ungetc.c newlib/libc/stdio/ungetwc.c newlib/libc/stdio/vasiprintf.c newlib/libc/stdio/vasprintf.c newlib/libc/stdio/vfprintf.c newlib/libc/stdio/vfscanf.c newlib/libc/stdio/vfwprintf.c newlib/libc/stdio/vfwscanf.c newlib/libc/stdio64/fdopen64.c newlib/libc/stdio64/fopen64.c newlib/libc/stdio64/freopen64.c newlib/libc/stdio64/fseeko64.c newlib/libc/stdio64/ftello64.c newlib/libc/stdlib/mbtowc_r.c newlib/libc/stdlib/mprec.h newlib/libc/stdlib/wctomb_r.c newlib/libc/string/Makefile.am newlib/libc/string/Makefile.in newlib/libc/string/strcasestr.c newlib/libc/sys/epiphany/Makefile.am newlib/libc/sys/epiphany/Makefile.in newlib/libc/sys/epiphany/aclocal.m4 newlib/libc/sys/epiphany/configure newlib/libc/sys/epiphany/configure.in newlib/libc/sys/epiphany/e_printf.c newlib/libc/sys/rtems/crt0.c newlib/libc/sys/rtems/machine/_types.h newlib/libc/sys/sysnecv850/crt0.S newlib/libc/time/strptime.c newlib/libm/common/sf_round.c newlib/libm/math/e_atan2.c newlib/libm/math/e_exp.c newlib/libm/math/e_pow.c newlib/libm/math/e_rem_pio2.c newlib/libm/math/ef_exp.c newlib/libm/math/ef_pow.c newlib/libm/math/er_lgamma.c newlib/libm/math/erf_lgamma.c newlib/testsuite/newlib.stdio/stdio.exp newlib/testsuite/newlib.stdio/swprintf.c newlib/testsuite/newlib.string/strcmp-1.c winsup/ChangeLog winsup/Makefile.common winsup/cygserver/ChangeLog winsup/cygserver/woutsup.h winsup/cygwin/ChangeLog winsup/cygwin/Makefile.in winsup/cygwin/advapi32.cc winsup/cygwin/child_info.h winsup/cygwin/configure.in winsup/cygwin/cygheap.cc winsup/cygwin/cygheap.h winsup/cygwin/cygserver_ipc.h winsup/cygwin/cygthread.cc winsup/cygwin/cygtls.cc winsup/cygwin/cygtls.h winsup/cygwin/cygwin.din winsup/cygwin/cygwin.sc winsup/cygwin/dcrt0.cc winsup/cygwin/devices.cc winsup/cygwin/devices.in winsup/cygwin/dll_init.cc winsup/cygwin/dtable.cc winsup/cygwin/dtable.h winsup/cygwin/environ.cc winsup/cygwin/exceptions.cc winsup/cygwin/external.cc winsup/cygwin/fenv.cc winsup/cygwin/fhandler.cc winsup/cygwin/fhandler.h winsup/cygwin/fhandler_clipboard.cc winsup/cygwin/fhandler_console.cc winsup/cygwin/fhandler_disk_file.cc winsup/cygwin/fhandler_dsp.cc winsup/cygwin/fhandler_fifo.cc winsup/cygwin/fhandler_mem.cc winsup/cygwin/fhandler_procnet.cc winsup/cygwin/fhandler_registry.cc winsup/cygwin/fhandler_serial.cc winsup/cygwin/fhandler_socket.cc winsup/cygwin/fhandler_tape.cc winsup/cygwin/fhandler_termios.cc winsup/cygwin/fhandler_tty.cc winsup/cygwin/fhandler_virtual.cc winsup/cygwin/fhandler_windows.cc winsup/cygwin/flock.cc winsup/cygwin/fork.cc winsup/cygwin/gendef winsup/cygwin/gentls_offsets winsup/cygwin/globals.cc winsup/cygwin/heap.cc winsup/cygwin/hookapi.cc winsup/cygwin/include/cygwin/if.h winsup/cygwin/include/cygwin/in.h winsup/cygwin/include/cygwin/socket.h winsup/cygwin/include/cygwin/version.h winsup/cygwin/include/elf.h winsup/cygwin/include/inttypes.h winsup/cygwin/include/mntent.h winsup/cygwin/include/netdb.h winsup/cygwin/include/stdint.h winsup/cygwin/include/sys/elf32.h winsup/cygwin/include/sys/elf64.h winsup/cygwin/include/sys/elf_common.h winsup/cygwin/include/sys/elf_generic.h winsup/cygwin/include/sys/wait.h winsup/cygwin/kernel32.cc winsup/cygwin/lib/_cygwin_crt0_common.cc winsup/cygwin/lib/crt0.h winsup/cygwin/libc/inet_addr.c winsup/cygwin/libc/inet_network.c winsup/cygwin/libc/minires-os-if.c winsup/cygwin/libc/minires.h winsup/cygwin/libc/rcmd.cc winsup/cygwin/miscfuncs.cc winsup/cygwin/miscfuncs.h winsup/cygwin/mkvers.sh winsup/cygwin/mount.cc winsup/cygwin/mount.h winsup/cygwin/net.cc winsup/cygwin/ntdll.h winsup/cygwin/passwd.cc winsup/cygwin/path.cc winsup/cygwin/path.h winsup/cygwin/pinfo.cc winsup/cygwin/pipe.cc winsup/cygwin/poll.cc winsup/cygwin/posix.sgml winsup/cygwin/posix_ipc.cc winsup/cygwin/pseudo-reloc.cc winsup/cygwin/regex/regcomp.c winsup/cygwin/registry.cc winsup/cygwin/release/1.7.10 winsup/cygwin/release/1.7.11 winsup/cygwin/release/1.7.12 winsup/cygwin/release/1.7.13 winsup/cygwin/release/1.7.14 winsup/cygwin/sched.cc winsup/cygwin/sec_helper.cc winsup/cygwin/security.cc winsup/cygwin/security.h winsup/cygwin/select.cc winsup/cygwin/select.h winsup/cygwin/shared.cc winsup/cygwin/signal.cc winsup/cygwin/sigproc.cc winsup/cygwin/sigproc.h winsup/cygwin/smallprint.cc winsup/cygwin/spawn.cc winsup/cygwin/strace.cc winsup/cygwin/strfuncs.cc winsup/cygwin/syscalls.cc winsup/cygwin/syslog.cc winsup/cygwin/thread.cc winsup/cygwin/thread.h winsup/cygwin/tlsoffsets.h winsup/cygwin/wait.cc winsup/cygwin/winbase.h winsup/cygwin/wincap.cc winsup/cygwin/wincap.h winsup/cygwin/winlean.h winsup/cygwin/winsup.h winsup/doc/ChangeLog winsup/doc/cygwinenv.sgml winsup/doc/faq-programming.xml winsup/doc/faq-using.xml winsup/doc/new-features.sgml winsup/doc/pathnames.sgml winsup/doc/setup-net.sgml winsup/doc/using.sgml winsup/lsaauth/ChangeLog winsup/lsaauth/Makefile.in winsup/lsaauth/cyglsa.c winsup/lsaauth/cyglsa64.dll winsup/lsaauth/make-64bit-version-with-mingw-w64.sh winsup/mingw/ChangeLog winsup/mingw/configure winsup/mingw/configure.in winsup/mingw/include/_mingw.h winsup/mingw/include/excpt.h winsup/mingw/include/inttypes.h winsup/mingw/include/limits.h winsup/mingw/include/process.h winsup/mingw/include/stdint.h winsup/mingw/include/stdio.h winsup/mingw/include/stdlib.h winsup/mingw/include/sys/param.h winsup/mingw/include/wchar.h winsup/mingw/mingwex/Makefile.in winsup/mingw/mingwex/gdtoa/gd_qnan.h winsup/mingw/mingwex/tsearch.c winsup/mingw/profile/Makefile.in winsup/utils/ChangeLog winsup/utils/Makefile.in winsup/utils/bloda.cc winsup/utils/cygcheck.cc winsup/utils/cygpath.cc winsup/utils/dump_setup.cc winsup/utils/dumper.cc winsup/utils/locale.cc winsup/utils/mkpasswd.c winsup/utils/ps.cc winsup/utils/regtool.cc winsup/utils/strace.cc winsup/w32api/ChangeLog winsup/w32api/include/setupapi.h winsup/w32api/include/winbase.h winsup/w32api/include/windows.h winsup/w32api/include/winnt.h winsup/w32api/include/winsock.h winsup/w32api/include/winsock2.h winsup/w32api/include/winuser.h winsup/w32api/include/winver.h winsup/w32api/include/wtsapi32.h winsup/w32api/lib/Makefile.in winsup/w32api/lib/kernel32.def winsup/w32api/lib/wtsapi32.def Delete: config/asmcfi.m4 config/math.m4 config/mmap.m4 config/weakref.m4 include/dwarf2.def include/elf/xgate.h include/gdb/gdb-index.h include/leb128.h include/opcode/xgate.h newlib/libc/string/memrchr.c winsup/cygwin/DevNotes winsup/cygwin/cygwait.cc winsup/cygwin/cygwait.h winsup/cygwin/include/machine/elf.h winsup/cygwin/include/sys/elf.h winsup/mingw/mingwex/membarrier.c winsup/w32api/include/sdkddkver.h winsup/w32api/include/shobjidl.h winsup/w32api/lib/shobjidl-uuid.c
2012-08-09* DevNotes: Add entry cgf-000014.Christopher Faylor1-2/+0
* cygheap.cc (tls_sentry): Move here, rename from 'sentry' in cygtls.cc (tls_sentry::lock): Ditto. (nthreads): Move from cygtls.cc (THREADLIST_CHUNK): Ditto. (cygheap_init): Call init_tls_list(). (init_cygheap::init_tls_list): Define new function. (init_cygheap::add_tls): Ditto. (init_cygheap::remove_tls): Ditto. (init_cygheap::find_tls): Ditto. Semi-resurrect from _cygtls::find_tls. * cygheap.h (init_cygheap::init_tls_list): Declare new function. (init_cygheap::add_tls): Ditto. (init_cygheap::remove_tls): Ditto. (init_cygheap::find_tls): Ditto. * cygtls.cc (sentry): Delete. (sentry::lock): Ditto. (nthreads): Ditto. (THREADLIST_CHUNK): Ditto. (_cygtls::init): Delete definition. (_cygtls::init_thread): Call cygheap->add_tls() to add thread to global list. (_cygtls::remove): cygheap->remove_tls() to remove thread from global list. * cygtls.h (_cygtls::init): Delete declaration. * dcrt0.cc (dll_crt0_0): Delete call to _cygtls::init(). * exceptions.cc (sigpacket::process): When no thread is specified, try to find one via cygheap->find_tls.
2012-07-29* fhandler_termios.cc (fhandler_termios::line_edit): Use special case '%0c'Christopher Faylor1-1/+0
handling to print non-printable characters using hex notation. * smallprint.cc (__small_vsprintf): Semi-reimplement printing of non-printable characters in hex but only when padding is specified. * dcrt0.cc (dll_crt0_0): Remove tty_list initialization. * shared.cc (memory_init): Initialize tty_list here. * path.cc (path_conv::check): Remove unneeded parentheses from if check.
2012-07-21* DevNotes: Add entry cgf-000013.Christopher Faylor1-5/+0
* cygserver_ipc.h (ipc_set_proc_info): Use _cygtls::ipc_set_proc_info to set per-thread signal arrived value. * cygthread.cc (cygthread::detach): Use per-thread signal_arrived via set_thread_waiting. * fork.cc (_cygtls::fixup_after_fork): Clear signal_arrived. (_cygtls::remove): Close any signal_arrived handle when thread exists. (_cygtls::find_tls): Remove unneeded function. * cygtls.h: Update copyright. (class _cygtls): Reorganize to help avoid rebuilding newlib when structure changes. (_cygtls::event): Delete. (_cygtls::threadkill): Ditto. (_cygtls::signal_waiting): Declare new bool. (_cygtls::find_tls): Delete declaration. (_cygtls::set_threadkill): Ditto. (_cygtls::reset_threadkill): Ditto. (_cygtls::set_signal_arrived): Declare new function. (class set_thread_waiting): Declare new class. * cygwait.cc (cw_nowait_storage): Define. (cygwait): Set per-thread signal_arrived via set_thread_waiting. Don't special-case _main_tls. * cygwait.h (cw_nowait): Define. (cw_infinite): Ditto. (cygwait): Redefine pathological wait-only case. * dcrt0.cc (dll_crt0_0): Remove call to now-defunct events_init(). (dll_crt0_1): Remove call to now-defunct create_signal_arrived(). * exceptions.cc: Reflect set_signal_mask() argument reordering throughout. Remove signal mask synchronization throughout. (events_init): Delete definition. (mask_sync): Delete now-unneeded mask synchronization. (set_signal_mask): Reverse order of arguments to "standard" to, from layout. Rename "newmask" argument to "setmask". Remove debugging. (sig_handle_tty_stop): Use cancelable_wait rather than WFMO. (_cygtls::interrupt_setup): Don't treat "threadkill" events specially. Conditionally set signal_arrived depending on whether the thread has created it or not. (sigpacket::process): Reorganize to reflect thread-specific sending of signals which is more in line with the way it was actually supposed to work. * fhandler_socket.cc (get_inet_addr): Use cancelable_wait rather than IsEventSignalled to avoid potential race. (fhandler_socket::wait_for_events): Set signal_arrived event using set_thread_waiting(). (fhandler_socket::close): Use cygwait for the case of just waiting 10 ms for a signal. * fhandler_tape.cc (fhandler_dev_tape::_lock): Use cancelable_wait rather than WFMO. Redo switch/case tests accordingly. * fhandler_termios.cc (fhandler_termios::bg_check): Use cygwait for case of just waiting 0 ms for a potential signal. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Use cancelable_wait rather than WFSO. * fhandler_windows.cc (fhandler_windows::read): Set per-thread signal_arrived via set_thread_waiting(). * flock.cc (lf_setlock): Ditto. * select.cc (pselect): Ditto. Set per-thread signal_arrived using set_thread_waiting(). * gendef: Don't special case handling of _cygtls::sig for threads. * gentls_offsets: Use #pragma once in tlsoffsets.h. * ntdll.h: Use #pragma once. * poll.cc: Reflect set_signal_mask() argument reordering. * posix_ipc.cc (ipc_mutex_lock): Use cancelable_wait rather than WFMO. (ipc_cond_timedwait): Set perl-thread signal arrived using set_thread_waiting(). * security.h: Use #pragma once. * signal.cc (abort): Reflect set_signal_mask() argument reordering. (clock_nanosleep): Ditto. Change call to cancelable_wait to properly specify handling of cancel and interrupt. (sigwaitinfo): Remove handling of per-thread event in favor of per-thread signal_arrived. Use cancelable_wait rather than WFSO. * sigproc.cc (signal_arrived): Delete definition. (create_signal_arrived): Ditto. * sigproc.h (signal_arrived): Delete declaration. (set_signal_mask): Avoid defining as a "C" function. Don't conditionally declare. (create_signal_arrived): Delete declaration. * syscalls.cc (rename): Use cygwait() rather than WFSO. * thread.h (fast_mutex::lock): Use cw_infinite rather than LARGE_NULL. * wait.cc (wait4): Ditto. * thread.cc (pthread_mutex::lock): Ditto. (pthread::join): Ditto. (semaphore::_wait): Ditto. (pthread_kill): Remove set_threadkill() accommodation. * tlsoffsets.h: Regenerate.
2012-07-04* dcrt0.cc (build_argv): Guard against NULL pointer dereference found by Clang.Christopher Faylor1-1/+2
2012-06-19Revert errneous checkin.Christopher Faylor1-0/+2
Check in actual change associated with ChangeLog.
2012-06-19* cygwait.cc (cancelable_wait): Mimic old cygwait behavior more closely wrtChristopher Faylor1-2/+0
handling of call_signal_handler. * cygwait.h (WAIT_CANCELED): Move here and redefine. (WAIT_SIGNALED): Ditto. * thread.h (WAIT_CANCELED): Delete. (WAIT_SIGNALED): Ditto.
2012-05-14* DevNotes: Add entry cgf-000007.Christopher Faylor1-3/+14
* 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.
2012-05-07* DevNotes: Add entry cgf-000003.Christopher Faylor1-3/+8
* 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'.
2012-03-20* dtable.cc (set_std_handle): Call SetStdHandle with NULL if fd is closed.Christopher Faylor1-7/+7
(dtable::release): "Close" standard handle if appropriate. * dcrt0.cc (dll_crt0_0): Fix minor switch formatting problem. * fork.cc (frok::parent): Make minor comment indentation change.
2012-03-20* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.Christopher Faylor1-0/+18
(child_info::rd_proc_pipe): Declare new field. (child_info::wr_proc_pipe): Ditto. (child_info::prefork): Declare new function, derived from previous pinfo version. * dcrt0.cc (child_info_fork::handle_fork): Close previous wr_proc_pipe when appropriate and assign new one from passed-in child_info block. (child_info_spawn::handle_spawn): Assign our wr_proc_pipe handle from passed-in child_info block. * fork.cc (child_info::prefork): Define new function. (frok::child): Clear rd_proc_pipe and wr_proc_pipe so they will not be closed by the child_info destructor. (frok::parent): Use child_info prefork handling, outside of retry loop. Set rd_proc_pipe in child's pinfo after successful CreateProcess. Eliminate postfork call. * globals.cc (my_wr_proc_pipe): Define/declare new variable. * pinfo.cc (pinfo::pending_rd_proc_pipe): Delete. (pinfo::pending_wr_proc_pipe): Ditto. (pinfo::prefork): Ditto. (pinfo::postfork): Ditto. (pinfo::postexec): Ditto. (pinfo::wait): Assume that rd_proc_pipe is set up correctly prior to call. (_pinfo::alert_parent): Replace "wr_proc_pipe" with "my_wr_proc_pipe". * pinfo.h (_pinfo::_wr_proc_pipe): Delete declaration. (_pinfo::set_rd_proc_pipe): Define new function. (pinfo::pending_rd_proc_pipe): Delete declaration. (pinfo::pending_wr_proc_pipe): Ditto. (pinfo::prefork): Ditto. (pinfo::postfork): Ditto. (pinfo::postexec): Ditto. (pinfo::wr_proc_pipe): Ditto. * sigproc.cc (child_info::child_info): Clear rd_proc_pipe and wr_proc_pipe. (child_info::cleanup): Close rd_proc_pipe and wr_proc_pipe if necessary. (child_info_fork::child_info_fork): Set forker_finished to NULL by default. (child_info_spawn::child_info_spawn): Use my_wr_proc_pipe rather than myself->wr_proc_pipe. (child_info::sync): Ditto. (child_info_spawn::cleanup): Call child_info::cleanup. * spawn.cc (child_info_spawn::worker): Remove call to myself.prefork(). Set wr_proc_pipe when execing or set up new rd_proc_pipe/wr_proc_pipe via child_info::prefork when spawning. Remove call to pinfo::postexec. Set rd_proc_pipe in child pinfo when spawning. Use my_wr_proc_pipe rather than myself->wr_proc_pipe. Remove call to postfork.
2012-03-05 * init.cc (dll_entry): Move wincap.init call back from here...Corinna Vinschen1-1/+2
* dcrt0.cc (dll_crt0_0): ...to here.
2012-01-27 * dcrt0.cc (is_dos_path): New macro to recognize drive letter and UNCCorinna Vinschen1-2/+10
DOS paths. (globify): Call is_dos_path instead of isdrive.
2011-12-21 * dcrt0.cc (_dll_crt0): Rephrase comments. Set $ebp to NULL, as inCorinna Vinschen1-5/+7
the pthread stack setup. * wow64.cc (wow64_revert_to_original_stack): Rephrase some comments. Return _tlsbase-16 rather than _main_tls-4 so as not to waste stack.
2011-12-19 * dcrt0.cc (dll_crt0_0): Check for wincap.wow64_has_secondary_stackCorinna Vinschen1-8/+10
rather than for wincap.is_wow64. Accommodate name change from wow64_has_64bit_parent to wow64_needs_stack_adjustment. Align comment. (_dll_crt0): Ditto. * wincap.h (wincaps::wow64_has_secondary_stack): New element. * wincap.cc: Implement above element throughout. (wincapc::init): Set wow64_has_secondary_stack to false on non-64 bit systems. * wow64.cc (wow64_needs_stack_adjustment): Rename (hopefully the last time) from wow64_has_64bit_parent. (wow64_eval_expected_main_stack): Fix comment to reflect real life. (wow64_test_for_64bit_parent): Fix comment. * wow64.h (wow64_needs_stack_adjustment): Accommodate new name.
2011-12-17Clean up whitespace.Christopher Faylor1-2/+2
2011-12-17 * dcrt0.cc (_dll_crt0): Fix formatting.Corinna Vinschen1-6/+3
2011-12-16 * dcrt0.cc (child_info_fork::alloc_stack): Correctly check if theCorinna Vinschen1-3/+5
parent stack fits into the child stack. Align comment. * wow64.cc (wow64_eval_expected_main_stack): New function to fetch expected addresses of main thread stack from PE/COFF image header values. (wow64_test_for_64bit_parent): Fix comment. Check current stack against real expected main thread stack addresses. (wow64_revert_to_original_stack): Fix and add comments. Check memory against real expected main thread stack addresses. Use orignal stack if reserved area is >= 256K.
2011-12-16 * Makefile.in (DLL_OFILES): Add wow64.o.Corinna Vinschen1-86/+52
* dcrt0.cc (CYGWIN_GUARD): Drop execute permission for stack, it's not used for stacks by the OS either. (child_info_fork::alloc_stack_hard_way): Ditto. (child_info_fork::alloc_stack): Don't alloc_stack_hard_way under WOW64 if forked from a 64 bit parent. Set child's StackBase to parent's StackBase. Add comments to explain why. (wow64_respawn): Move to wow64.cc. (wow64_started_from_native64): Move to wow64.cc. (respawn_wow64_process): Move to wow64.cc. (dll_crt0_0): Drop wow64_test_stack_marker and move stack test into wow64_test_for_64bit_parent function. Don't return early if WOW64 process has been started from native 64 bit process. (_dll_crt0): Implement moving stack for WOW64 processes started from native 64 bit process. * wow64.cc: New file. (wow64_has_64bit_parent): Rename from wow64_respawn. (wow64_test_for_64bit_parent): Rename from wow64_started_from_native64. Change comment. (wow64_revert_to_original_stack): New function. (wow64_respawn_process): Rename from respawn_wow64_process for symmetry. * wow64.h: New file.
2011-12-13* dcrt0.cc (init_windows_system_directory): Record system_wow64_directoryChristopher Faylor1-6/+17
information. * exceptions.cc (_cygtls::inside_kernel): Modernize comment. Consider executing a DLL from the Wow64 directory as being "in the kernel". (_cygtls::call_signal_handler): For now, only deal with main_tls signals if main_tls is known to be executing in the cygwin DLL. To more closely emulate linux, consider the operation to be restartable if not executing in the main thread. * globals.cc (windows_system_directory): Remove NO_COPY. (windows_system_directory_length): Ditto. (system_wow64_directory): New variable. (system_wow64_directory_length): Ditto. * select.cc (cygwin_select): Don't issue a EINTR on non-main threads since that seems to be what Linux does. Add missing break to signal case/switch. (select_stuff::wait): Don't issue a EINTR on non-main threads since that seems to be what Linux does. Remove now-unneeded accommodation for WAIT_IO_COMPLETION. Add a comment. * sigproc.h (cygwait): Ditto. Don't return if signal_received noticed and it's not the main thread. * signal.cc (sigprocmask): Add standard syscall debug stuff. * thread.cc (pthread_sigmask): Ditto.
2011-12-12 * dcrt0.cc (wow64_respawn): New static variable.Corinna Vinschen1-1/+85
(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-10Add ChangeLog entry for previous change and revert erroneously checked inChristopher Faylor1-83/+0
changes to dcrt0.cc and init.cc
2011-12-10Clarify entryChristopher Faylor1-0/+83
2011-11-24* cygthread.h (cygthread::name): Default name to "main" if we are early in theChristopher Faylor1-15/+7
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-24* child_info.h (CURR_CHILD_INFO_MAGIC): Reset for previous changes.Christopher Faylor1-2/+3
* 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-16* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.Christopher Faylor1-2/+1
(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-14Throughout use "have_execed" macro rather than "hExeced" global handle.Christopher Faylor1-10/+9
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-10-26* child_info.h (cchildren): New struct.Christopher Faylor1-0/+6
(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-17* dcrt0.cc (dll_crt0_1): Copy argv before passing to main().Christopher Faylor1-1/+12
2011-08-18* dcrt0.cc (dll_crt0_0): Remove unneeded __stdcall decoration.Christopher Faylor1-1/+1
* init.cc: Reflect change to dll_crt0_0 in declaration.
2011-07-30* cygthread.cc (cygthread::async_create): Define new function.Christopher Faylor1-2/+3
* 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.
2011-07-04 Throughout, open console handles with sharing for reading and writing.Corinna Vinschen1-6/+6
* dcrt0.cc (insert_file): Open file with full sharing allowed. * hookapi.cc (find_first_notloaded_dll): Ditto. * spawn.cc (av::fixup): Ditto.
2011-06-17 * dcrt0.cc (dll_crt0_1): Call strace.dll_info after call to pinfo_init.Corinna Vinschen1-0/+1
* strace.cc (strace::hello): Drop printing DLL information here since application info is not always available at this point. (strace::dll_info): New method to print DLL info. * include/sys/strace.h (strace::dll_info): Declare.
2011-06-14* cygheap.h (init_cygheap::ctty_on_hold): Remove conditionalized variable.Christopher Faylor1-6/+0
* dcrt0.cc (do_exit): Remove code which handled CYGWIN=tty style ttys. * devices.in: Remove "/dev/ttym". * dtable.cc: Rename tty to pty where appropriate throughout. (dtable::stdio_init): Use new t->is_console rather than using now-deleted hwnd element in tty structure. (dtable::init_std_file_from_handle): Remove code which handled CYGWIN=tty style ttys. (fh_alloc): Ditto. * fhandler.h: Rename tty to pty where appropriate. (fhandler_pty_common): Delete output_done_event, ioctl_request_event, ioctl_done_event. (fhandler_pty_master::setup): Delete argument. (fhandler_tty_master): Delete. (fhandler_union): Delete __tty_master. * fhandler_console.cc (use_tty): Delete. (fhandler_console::get_tty_stuff): Set is_console to true rather than calling sethwnd. (fhandler_console::send_winch_maybe): Remove CYGWIN=tty considerations. (fhandler_console::input_tcsetattr): Ditto. * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Use new t->is_console rather than using now-deleted hwnd element in tty structure. * fhandler_tty.cc: Rename tty to pty where appropriate throughout. (tty_master): Delete. (process_input): Ditto. (process_output): Ditto. (process_ioctl): Ditto. (fhandler_tty_master::*): Ditto. (fhandler_pty_master::process_slave_output): Remove CYGWIN=tty considerations. (fhandler_pty_slave::open): Ditto for *_done_event. (fhandler_pty_slave::write): Ditto. (fhandler_pty_slave::ioctl): Ditto. (fhandler_pty_slave::fch_open_handles): Ditto. (fhandler_pty_slave::fch_set_sd): Ditto. (fhandler_pty_slave::fch_close_handles): Ditto. (fhandler_pty_common::close): Ditto. (fhandler_pty_master::setup): Ditto. Remove now-unneeded ispty parameter. (fhandler_pty_master::open): Reflect argument removal for tty::allocate. * select.cc: Rename tty to pty where appropriate throughout. * sigproc.cc (proc_subproc): Remove CYGWIN=tty considerations. * tty.cc (ttyslot): Accommodate CYGWIN=tty removal. (tty_list::init_session): Ditto. (tty_list::attach): Ditto. (tty::create_master): Delete. (tty_list::terminate): Ditto. (tty_list::allocate): Delete "with_console" parameter. Remove CYGWIN=tty considerations. (tty::init): Set is_console = false. Use 'false' for was_opened since it is a boolean. * tty.h (*_{DONE,REQUEST}_EVENT): Delete. (tty_min::is_console): Declare new field which replaces hwnd. (tty_min::gethwnd): Delete. (tty_min::sethwnd): Ditto. (tty_list::allocate): Delete parameter. (tty_list::terminate): Delete declaration. * include/sys/cygwin.h (PID_USETTY): Redefine to PID_UNUSED1 and change comment to reflect its availability.
2011-06-09* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.Christopher Faylor1-30/+0
(child_info::old_title): Delete. (child_info::~child_info_spawn): Remove recording of old_title. * dcrt0.cc (title_buf): Delete. (child_info_spawn::handle_spawn): Remove recording of old_title. (dll_crt0_1): Get rid of all title handling. (do_exit): Ditto. * environ.cc (known): Delete strip_title and title. * fhandler_console.cc (fhandler_console::write): Remove recording of old_title. * globals.cc (exit_states): Remove ES_TITLE. (display_title): Delete. (strip_title_path): Delete. (old_title): Delete. * spawn.cc (spawn_guts): Remove old_title accommodation.
2011-06-06whitespace eliminationChristopher Faylor1-2/+2
2011-05-28* autoload.cc: Call _api_fatal in asm.Christopher Faylor1-5/+11
* child_info.h: Redefine CURR_CHILD_INFO_MAGIC. (child_info_fork::abort): Rename from handle_failure. Change arguments. * cygtls.h (_local_storage::ttybuf): New field. * dcrt0.cc (vapi_fatal): Split api_fatal. Add "in forked process" to message when appropriate. (api_fatal): Use vapi_fatal. * devices.h: Make multiple inclusion safe. (fh_devices): Add FH_CONS* stuff. Reorder slightly. (device): Eliminate anonymous union. Add more ways to access minor/major. (device::setunit): Accommodate no-longer-anonymous union. (device::is_fs): Ditto. (device::is_fs_special): Ditto. (device::major): New function. (device::minor): Ditto. (device::is_device): New function. (device::not_device): Ditto. (device::operator int): New operator. (device::operator fh_devices): Ditto. (device::operator bool): Ditto. (device::operator DWORD): Ditto. (device::operator =): Ditto. (isproc_dev): New function. (isprocsys_dev): Ditto. (iscons_dev): Ditto. (istty_slave_dev): Ditto. * devices.in: Add new "/dev/cons*" strings. Accommodate no-longer-anonymous union throughout. (BRACK): Use more precise method for initialization. * devices.cc: Regenerate. * dtable.cc (dtable::stdio_init): Use get_cttyp instead of get_tty. (dtable::find_archetype): Use new DWORD operator in device to test archetypes. (dtable::init_std_file_from_handle): Use different method to initialize 'dev'. Adapt to different ctty handling and accommodate /dev/cons*. (fh_alloc): Accommodate no-longer-anonymous union. Adapt to new /dev/cons*. (build_fh_pc): Make debugging output more useful. * exceptions.cc (ctrl_c_handler): Use get_cttyp instead of get_tty. * external.cc (fillout_pinfo): Accommodate new cons* stuff. * fhandler.cc (fhandler_base::read): Eliminate is_slow() test. * fhandler.h (fhandler_base::*): Adapt to changes in device.h. (fhandler_*::is_slow): Delete. ( fhandler_proc::get_proc_fhandler): Return fh_devices type. * fhandler_console.cc (open_shared_console): New function. (console_unit): New class. (console_unit::console_unit): New constructor. (enum_windows): New function. Declare as friend to console_unit. (fhandler_console::set_unit): New function. (fhandler_console::get_tty_stuff): Call set_unit to set the unit number and determine if initialization is needed. Eliminate flags parameter. (tty_list::get_cttyp): Rename (sorta) from get_tty. Return pointer to correct tty_min. (fhandler_console::open): Adapt to elimination of argument to get_tty_stuff. (fhandler_console::output_tcsetattr): Properly detect error condition. (fhandler_console::fixup_after_fork_exec): Adapt to get_tty_stuff() setting tc automatically. * fhandler_proc.cc: Use FH_BAD rather than 0 throughout where using fh_devices enum. (fhandler_proc::get_proc_fhandler): Return fh_devices. Adapt to devices.h changes. * fhandler_process.cc: Adapt to devices.h changes. Use FH_BAD rather than 0 throughout where using fh_devices enum. * fhandler_procnet.cc: Ditto. * fhandler_procsys.cc: Ditto. * fhandler_procsysvipc.cc: Ditto. * fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape): Ditto. * fhandler_termios.cc (handler_termios::bg_check): Use tc->ttyname() rather than assuming that we can construct a tty. * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Just return get_minor() of dev. (fhandler_pty_master::process_slave_output): Add slightly more debugging info. (fhandler_tty_slave::fhandler_tty_slave): Change name from ntty to unit. (fhandler_pty_master::open): Ditto. (fhandler_tty_slave::ioctl): Adapt to change which causes ctty to represent a complete device. (fhandler_tty_master::init_console): Add debugging for failure path. (fhandler_pty_master::setup): Use get_unit() to retrieve unit number rather than relying on raw ntty. (fhandler_pty_master::setup): Ditto. * fhandler_virtual.h (virt_tab_t): Redefine fhandler as fh_devices. * fork.cc: Remove obsolete vfork stuff. (frok::child): Don't assume that a ctty == 0 is valid. * mount.cc (mount_info::conv_to_win32_path): Adapt to device struct changes. (mount_info::conv_to_win32_path): Ditto. * path.cc (path_conv::check): Retrive major/minor numbers via a method rather than accessing them directly from device. Rely on dev operators to set/retrieve device information as required by device struct change. * path.h (isproc_dev): Move to devices.h. (isprocsys_dev): Ditto. (isvirtual_dev): Ditto. (path_conv:{isdevice,isfifo,isspecial,iscygdrive,issocket,get_devn,get_unitn}): Use device methods to access/manipulate devices. * pinfo.cc (pinfo::exit): Don't assume that ctty == 0 is valid. Use iscons_dev to determine if a device is a console. (_pinfo::_ctty): Use device::parse to generate tty/cons name. (_pinfo::set_ctty): Don't assume that ctty == 0 is valid. Remove redundant info from debugging. * shared.cc (offsets): Remove console offset. * shared_info.h (shared_locations): Ditto. * syscalls.cc (umask): Use device methods to manipulate device information. (ctermid): Use device::parse to generate term device name. * tlsoffsets.h: Regenerate. * tty.cc (ttyslot): Return minor number of ctty since ctty now represents a full device. (tty::create_master): Set ctty to a complete device. (tty_list::attach): Rework to detect new /dev/cons* stuff. (tty_list::terminate): Adapt to changes to ctty. (tty_list::init): Adapt to change to setntty - pass in device major number. (tty::exists): Use get_unit() to retrive tty unit number. (tty::open_mutex): Ditto. (tty::open_inuse): Ditto. (tty::create_inuse): Ditto. (tty::get_event): Ditto. (tty_min::ttyname): Define new function. * tty.h (tty_min::ntty): Redefine as fh_devices. (tty::exists): Use get_unit() to retrive tty unit number. (tty::open_mutex): Ditto. (tty::open_inuse): Ditto. (tty::create_inuse): Ditto. (tty::get_event): Ditto. (tty_min::ttyname): Declare new function. (tty::getntty): Declare as const. (tty_list::operator []): Assure that only minor part of argument is used. * dll_init.cc (dll_list::alloc): Detect mismatch of data segments early issuing an explicit error message if necessary. * heap.cc (heap_init): Adapt to changes from fork->handle_failure to fork->abort. * pinfo.h (EXITCODE_FORK_FAILED): New enum. (from Ryan Johnson) * sigproc.cc (child_info_fork::abort): Rename from handle_failure. Change arguments to allow passing in a printf-like message. * winsup.h (api_fatal): Delete macro definition. (api_fatal): Redefine from __api_fatal. (vapi_fatal): Declare new function. * include/sys/strace.h (strace_vprintf): Define new macro. * ntdll.h (_SYSTEM_INFORMATION_CLASS): Add SystemHandleInformation.
2011-05-20 * child_info.h (CURR_CHILD_INFO_MAGIC): Update.Corinna Vinschen1-44/+28
(class child_info_fork): Remove stacksize, add stackaddr and guardsize members. * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Partial rewrite to regenerate the stack exactly as in the parent. (child_info_fork::alloc_stack): Set stackaddr to 0, rather than stacksize. (dll_crt0_1): Check for stackaddr before changing the stack addresses in the TEB. * fork.cc (frok::child): Check for stackaddr here. (frok::parent): Set ch.stackaddr and ch.guardsize if not called from the main thread. * init.cc (dll_entry): Replace pointer to NT_TIB with pointer to TEB. Fix incorrectly changed address test before removing _my_tls. Set StackLimit to NULL on Windows 2000. Explain why. * miscfuncs.cc (struct thread_wrapper_arg): Store stackbase rather than stacksize, store commitaddr, remove guardsize. Store all pointers as char * for easier address arithmetic. (thread_wrapper): Rewrite to remove OS stack before calling thread function. Add lots of comments to explain what we do. (CygwinCreateThread): Reserve our own stack in case we got no application stack. Add comments. * ntdll.h (struct _TEB): Extend defintion up to DeallocationStack member. * thread.cc (pthread_attr::pthread_attr): Use "(size_t) -1" rather then 0xffffffff. * wincap.h (wincaps::has_stack_size_param_is_a_reservation): New element. * wincap.cc: Implement above element throughout.
2011-05-16 * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Check if theCorinna Vinschen1-0/+9
requested stack is application-provided within the user heap or an mmapped region. If so, just use it. Add comment to explain why. * miscfuncs.cc (thread_wrapper): If an application-provided stack has been given, implement cygtls area at the stackbase. Fix comment. * mmap.cc (is_mmapped_region): New function. * winsup.h (is_mmapped_region): Declare.
2011-05-05 * dcrt0.cc (dll_crt0_1): Reset locale to "C" even when dynamicallyCorinna Vinschen1-1/+4
loaded.
2011-04-28 * advapi32.cc (InitializeAcl): Remove.Corinna Vinschen1-1/+1
(AddAce): Remove. (FindFirstFreeAce): Remove. (GetAce): Remove. (InitializeSecurityDescriptor): Remove. (OpenProcessToken): Remove. * dcrt0.cc: Replace above functions throughout with their ntdll.dll equivalent. * fhandler_tty.cc: Ditto. * flock.cc: Ditto. * pinfo.cc: Ditto. Drop unnecessary error handling. * sec_acl.cc: Ditto. * sec_auth.cc: Ditto. * sec_helper.cc: Ditto. * security.cc: Ditto.
2011-04-02 * autoload.cc (GetExtendedTcpTable): Remove.Corinna Vinschen1-53/+0
(GetTcpTable): Remove. (CharNextExA): Remove. (FindWindowA): Remove. (ShowWindowAsync): Remove. * dcrt0.cc (disable_dep): Remove unused function. (dll_crt0_0): Drop comment babbling about TS & DEP. * fhandler_socket.cc (address_in_use): Remove unused function. * wincap.cc: Throughout, drop ts_has_dep_problem from wincaps. (wincapc::init): Drop code setting ts_has_dep_problem flag. * wincap.h (struct wincaps): Drop ts_has_dep_problem flags and method.
2011-03-17 * crt0.c (mainCRTStartup): Move call to _feinitialise from here...Corinna Vinschen1-0/+4
* dcrt0.cc (_dll_crt0): ...to here.
2011-02-22 * dcrt0.cc: Fix copyright dates.Corinna Vinschen1-2/+1
* winsup.h: Ditto. * syscalls.cc (_read): Move EXPORT_ALIAS to its rightful place.
2011-02-18* dcrt0.cc (dll_crt0_1): Add a CYGHEAP_DEBUG conditional for debugging whichChristopher Faylor1-2/+11
allocates a lot of space at startup.
2010-12-26cygwin:Christopher Faylor1-0/+2
* cygwin.din: Export program_invocation_name and program_invocation_short_name. * dcrt0.cc: Set program_invocation*name to correct values, based on argv[0]. * globals.cc (program_invocation_name): Define. (program_invocation_short_name): Ditto newlib: * libc/include/sys/errno.h (program_invocation_name): Declare. (program_invocation_short_name): Ditto.
2010-10-24* dcrt0.cc (do_exit): Don't set thread termination until all fds have beenChristopher Faylor1-7/+7
closed since an fd may rely on a thread. * fhandler_tty.cc: Reformat comment. (fhandler_pty_master::pty_master_thread): Refuse ERROR_PIPE_CONNECTED state as an error. * globals.cc (exit_states): Reorder ES_THREADTERM. * path.cc (find_fast_cwd_pointers): Remove excessively wordy DEBUGGING output.
2010-10-02* dcrt0.cc (dll_crt0_0): Move _main_tls initialization here.Christopher Faylor1-2/+6
(__dll_crt0): Only initialize _main_tls if it changes. * fhandler_console.cc (fhandler_console::write): Fix debugging output.
2010-09-26* dcrt0.cc (__main): Force signal synchronization.Christopher Faylor1-2/+0
2010-09-19* wincap.h (wincaps::has_buggy_thread_startup): Declare.Christopher Faylor1-14/+13
(wincapc::has_buggy_thread_startup): Ditto. * wincap.cc::wincap_*): Accommodate has_buggy_thread_startup. (wincapc::init): Explicitly turn off has_buggy_thread_startup if not WOW64. * cygthread.h (cygthread::thread_handle): Declare/define new method. * dcrt0.cc (_dll_crt0): Don't call __sinit here. (dll_crt0_0): Don't call sigproc_init during initialization if wincap.has_buggy_thread_startup(). (dll_crt0_1): Defer sigproc_init to here when wincap.has_buggy_thread_startup(). Call __sinit after we've determined that we're not forking. (__main): Rework comments. Add potential future reminder.