Commit Graph

7923 Commits

Author SHA1 Message Date
Christopher Faylor c529909f45 * dcrt0.cc (do_exit): Only call sigproc_terminate from one location --
pinfo::exit.
* pinfo.cc (pinfo::exit): Move sigproc_terminate later so that signals can be
processed while waiting for hExeced child.
(pinfo::maybe_set_exit_code_from_windows): Set exit code from sigExeced if it
is non-zero.  Set exit_state to ES_EXEC_EXIT prior to waiting for captive
process exit code.
* exceptions.cc (sigExeced): New global variable.
(signal_exit): Remove noreturn attribute from declaration.
(signal_exit): Just terminate captive process and return if hExeced on the
theory that the exit will be subsequently handled in the main thread.
* sigproc.cc (sigproc_terminate): Eliminate test for ES_SIGPROCTERMINATE and
use ES_FINAL instead.
(sig_send): Use no_signals_available instead of duplicate test.
* winsup.h (ES_EXEC_EXIT): New enum.
(ES_SIGPROCTERMINATE): Delete.
2005-09-20 02:06:57 +00:00
Jeff Johnston cddfc170fd 2005-09-19 Jeff Johnston <jjohnstn@redhat.com>
* libc/sys/rtems/include/stdint.h: Moved to...
        * libc/include/stdint.h: ...here.
2005-09-19 22:02:23 +00:00
Christopher Faylor e60ec8bf96 white space changes to force new snapshot 2005-09-19 15:50:56 +00:00
Christopher Faylor 1bde6e09a6 * sigproc.cc (talktome): Take siginfo_t argument. Don't scan all pids trying
to find one that's talking to me.  Just use the pid from siginfo_t.
(wait_pid): Pass siginfo_t argument to talktome.
2005-09-19 14:15:06 +00:00
Danny Smith 64cf26a0e9 * include/winsock2.h (SO_EXCLUSIVEADDRUSE): Define.
Thanks to Gisle Vanem  <giva at bgnett dot no>
2005-09-19 10:32:51 +00:00
Danny Smith c1c5de21a9 * include/stdlib.h (strtof): Add prototype. Uglify
parameter names in inline definition.
	(wcstof): Likewise.
	(_Exit): Uglify	parameter names in inline definition.
	(llabs): Add prototype.
	(_set_error_mode): Add prototype and input defines.
2005-09-19 09:48:08 +00:00
Christopher Faylor 0d8efc429f * pipe.cc (fhandler_pipe::open): Use 'cfree' to free buffer since it is now
allocated by cmalloc.
2005-09-17 20:36:34 +00:00
Corinna Vinschen 5da8b1281b * net.cc (cygwin_inet_ntop): Change len argument to socklen_t to
follow SUSv3.
	* include/arpa/inet.h (inet_ntop): Ditto.
	* include/cygwin/in.h: Include cygwin/socket.h to get socklen_t.
2005-09-17 08:55:30 +00:00
Christopher Faylor b3ecdcf438 * environ.cc (build_env): Use "kilo"bytes not "mega"bytes. Return immediately
on error.
* spawn.cc (spawn_guts): Set return value to -1 on error from build_env.
2005-09-16 20:12:12 +00:00
Christopher Faylor e4d981b957 * environ.cc (build_env): Clear envblock and return NULL on attempt to use env
var > 32K.
* spawn.cc (spawn_guts): Set E2BIG if build_env detects an error.
2005-09-16 19:58:12 +00:00
Christopher Faylor 541ea31352 * environ.cc (environ_init): Protect with a 'myfault' in case
GetEnvironmentStrings misbehaves.
* environ.cc (environ_init): Add debugging output with value returned from
GetEnvironmentStrings.
2005-09-16 15:56:06 +00:00
Christopher Faylor 4dc2cfe588 * environ.cc (environ_init): Issue an error if GetEnvironmentStrings fails and
return.
2005-09-16 14:52:32 +00:00
Christopher Faylor 882dfbf776 * pinfo.h (EXITCODE_SET): Move out of range of Windows error.
(EXITCODE_NOSET): Ditto.
* sigproc.cc (no_signals_available): Remove check for hwait_sig.  Just rely on
my_sendsig.  Pass in an argument controlling when it is appropriate to test
EXITCODE_SET.
(proc_can_be_signalled): Remove checks for myself since this function is never
called in that context.
(sigproc_init): Pre-initialize my_sendsig to non-zero so that
proc_can_be_signalled will know that we expect to be signalable soon.
(sig_send): Change debugging output.
2005-09-16 03:16:17 +00:00
Christopher Faylor 150f3bd168 * sigproc.cc (no_signals_available): Return true if sending to self from the
signal thread.
(wait_sig): Correct so that WaitForSingleObject is called when hMainThread is
!= 0, rather than the reverse.
* cygheap.cc (cygheap_fixup_in_child): Clarify potential error message.
* fork.cc (fork_copy): Cosmetic change.
2005-09-16 01:47:09 +00:00
Christopher Faylor a3a9aac72d * sigproc.cc (wait_sig): Reorganize exit case so that ExitProcess is always
called, since that is the intent of sending a __SIGEXIT.  Wait forever for main
thread to go away since, presumably, the main thread told us it was going away.
2005-09-15 16:06:18 +00:00
Corinna Vinschen c4ec3e76b9 * cygwinenv.sgml (ntea): Add some wording to scare people away
from using this option.
2005-09-15 08:24:46 +00:00
Christopher Faylor fef80fce55 * spawn.cc (av::fixup): Avoid breaking out of the wrong "loop". 2005-09-15 00:31:42 +00:00
Christopher Faylor 59960f651d * hookapi.cc (hook_or_detect_cygwin): Simplify very slightly.
* spawn.cc (av::fixup): Guard against problems reading an executable which does
not match Microsoft's documentation about PE format.
2005-09-15 00:02:57 +00:00
Christopher Faylor ae37cc1218 * spawn.cc (av::error): Eliminate.
(av::av): Remove reference to error.
(av::replace0_maybe): Ditto.
(av::dup_maybe): Ditto.
(av::dup_all): Ditto.
(av::unshift): Ditto.
(spawn_guts): On a fault, return E2BIG only if ENOMEM has been set.  Otherwise
return EFAULT.
2005-09-14 23:03:44 +00:00
Christopher Faylor c9629cefe9 * cygtls.h (san): New structure.
(cygtls::andreas): New element.  Replaces _myfault and _myfault_errno.
(cygtls::fault_guarded): Use andreas.
(cygtls::return_from_fault): Ditto.
(cygtls::setup_fault): Add a parameter denoting where to store old fault
handler, if any and use it to "stack" faults.
(cygtls::reset_fault): Restore fault from parameter.
(myfault::sebastian): New variable.
(myfault::~myfault): Pass sebastian to reset_fault.
(myfault::myfault): Store old fault values in sebastian.
2005-09-14 21:26:15 +00:00
Christopher Faylor 1f48d233eb * heap.cc (heap_init): Revert 2005-09-11 patch as it seems to inexplicably
cause problems with emacs.
2005-09-14 18:30:21 +00:00
Christopher Faylor 3aca3cb636 Remove some more unneeded 'return;'s throughout. 2005-09-14 14:27:56 +00:00
Christopher Faylor 18ea7328a7 * sigproc.h: Protect declaration so that it only happens when
__INSIDE_CYGWIN__.
2005-09-14 14:08:00 +00:00
Christopher Faylor 62fe0eacda . 2005-09-14 14:02:17 +00:00
Christopher Faylor a611ae50d5 * exceptions.cc (sigtid): Remove declaration.
(handle_exceptions): Use _sig_tls rather than sigtid to determine if this is
the signal thread.
(set_signal_mask): Ditto for conditionalized CGF code.
* pinfo.cc (pinfo::exit): Exit the thread if we forcefully terminated the main
thread
* sigproc.cc (sigtid): Delete.
(_sig_tls): Define.
(sig_clear): Use _sig_tls rather than sigtid to determine if this is the signal
thread.
(sig_dispatch_pending): Ditto.
(wait_sig): Set _sig_tls here.
* dcrt0.cc (do_exit): Move sigproc_terminate call later since signal handling
was still needed for subsequent stuff.  Call sigproc_terminate with new
exit_state value.
* pinfo.cc (pinfo::exit): Call sigproc_terminate with new exit_state value.
* sigproc.cc (proc_terminate): Remove unnecessary (void) parameter.
(sigproc_terminate): Ditto.  Add new argument to accept exit state to be set.
(wait_sig): Reorganize __SIGEXIT handling.  Add more debugging output.
* winsup.h (sigproc_terminate): Declare with new exit_state argument.
(exit_states): Reorganize to reflect new exit ordering of sigproc_terminate.
2005-09-14 14:00:07 +00:00
Christopher Faylor 67483cb2cd * dcrt0.cc (do_exit): Rely on sigproc_terminate to set exit_state
appropriately.
* pinfo.cc (pinfo::exit): Always call sigproc_terminate here.  Rely on
sigproc_terminate to signal signal thread to handle eventual process exit.
* sigproc.cc (no_signals_available): Change criteria for determining if this
process can handle signals to itself.
(my_sendsig): New variable.  Copy of my sendsig handle.
(proc_can_be_signalled): Don't send signals if exit code is set.
(sigproc_terminate): Use and set exit_state appropriately to determine when to
do anything.  Send __SIGEXIT to self to control process exit.
(sig_send): Use my_sendsig for sending signals.  Don't call
proc_can_be_signalled for myself since the criteria is now different for
sending signals to myself.
(wait_sig): Copy myself->sendsig to my_sendsig for future use.  Exit signal
loop when __SIGEXIT is received.  Wait for main thread to exit and use its exit
status to actually exit process.
* sigproc.h (__SIGEXIT): New enum.
* dcrt0.cc (alloc_stack): Eliminate superfluous "return;".
* debug.cc (add_handle): Ditto.
* devices.in (device::parse): Ditto.
* dtable.cc (dtable::vfork_parent_restore): Ditto.
(dtable::vfork_child_fixup): Ditto.
* environ.cc (parse_options): Ditto.
* errno.cc (seterrno_from_win_error): Ditto.
* exceptions.cc (sig_handle_tty_stop): Ditto.
(set_signal_mask): Ditto.
* fhandler.cc (fhandler_base::read): Ditto.
(fhandler_base::operator delete): Ditto.
(fhandler_base::seekdir): Ditto.
(fhandler_base::rewinddir): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
(fhandler_console::fixup_after_exec): Ditto.
* sigproc.cc (sigproc_init): Ditto.
(sigproc_terminate): Ditto.

* devices.cc: Regenerate.
2005-09-13 17:08:54 +00:00
Christopher Faylor 00fb79f70e * sigproc.cc (wait_sig): Be more defensive about detecting when we're exiting. 2005-09-13 15:05:53 +00:00
Christopher Faylor 4e993dc7cc * cygthread.cc (cygthread::cygthread): Add more info to fatal error.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Temporarily remove
insertion of /dev into root directory.
* path.cc (path_conv::check): Ditto.
2005-09-12 21:19:07 +00:00
Christopher Faylor 6772e4c9e9 * heap.cc (heap_init): Allocate heap from top down as a hedge against
subsequent ERROR_INVALID_ADDRESS in forked processes when CTRL-C is pressed.
2005-09-12 03:55:16 +00:00
Christopher Faylor 70b4d870b5 . 2005-09-10 05:51:26 +00:00
Christopher Faylor 6336eba8f4 * heap.cc (heap_init): Be slightly more aggressive when trying to allocate
heap.  Change fatal error to avoid confusion with cygheap.
* spawn.cc (linebuf::finish): New function.
(linebuf::add): Cosmetic change.
(spawn_guts): Only avoid building windows command line if the program being
executed was actually mounted with -X.  Don't return E2BIG if we hit the 32K
size and we're executing a detected cygwin program.  Just silently truncate the
windows command line, instead.
2005-09-10 01:37:20 +00:00
Richard Earnshaw a751165daa * arm.h (SHT_ARM_PREEMPTMAP, SHT_ARM_ATTRIBUTES): New defines. 2005-09-09 13:06:21 +00:00
Christopher Faylor 270bbd4e24 * fhandler_serial.cc (fhandler_serial::tcgetattr): Just zero c_cflag here
rather than clearing CBAUD after the fact.
2005-09-09 03:00:34 +00:00
Christopher Faylor c0df672fa0 * fhandler_serial.cc (fhandler_serial::ioctl): Always return 0 for window size.
* termios.cc (tcgetattr): Clear out baud part of c_cflag since it is always
ignored.
2005-09-09 02:53:40 +00:00
Jeff Johnston b10ab72581 2005-09-08 Jeff Johnston <jjohnstn@redhat.com>
* Makefile.am: Add include files under bits sub-directory.
        * Makefile.in: Regenerated.
        * libc/sys/linux/argp/argp-fs-xinl.c: Set __OPTIMIZE__ to
        actual value of 1 to be compatible with newer glibc headers.
        * libc/sys/linux/sys/cdefs.h: Fix to be compatible with newer
        glibc headers.
        * libc/sys/linux/sys/dirent.h: Ditto.
        * libc/sys/linux/argp/argp-xinl.c: Ditto.
        * libc/sys/linux/dl/dl-runtime.c: Make sure fixup and
        profile_fixup routines are marked used so they won't be
        optimized away.
        * libc/sys/linux/dl/dl-cache.c: Don't use weak_extern macro
        to mark functions as weak.
        * libc/sys/linux/dl/dl-open.c: Ditto.
        * libc/sys/linux/iconv/gconv_open.c: Fix to obey new gcc4
        rules about lvalues.
        * libc/sys/linux/iconv/gconv_simple.c: Ditto.
        * libc/sys/linux/linuxthreads/bits/libc-lock.h: Don't use
        weak_extern macro to mark functions as weak.  Instead always
        use #pragma weak.
        * iconvdata/jis0208.h: Fix to work with gcc4.
        * libc/sys/linux/dl/dl-load.c: Ditto.
        * libc/sys/linux/dl/dl-reloc.c: Ditto.
        * libc/sys/linux/dl/do-rel.h: Ditto.
        * libc/sys/linux/dl/dynamic-link.h: Ditto.
        * libc/sys/linux/include/ltdl.h: Ditto.
        * libc/sys/linux/machine/i386/dl-machine.h: Ditto.
        * libc/sys/linux/machine/i386/weakalias.h: Ditto.
        * libc/sys/linux/net/ns_ntoa.c: Ditto.
        * libc/sys/linux/bits/initspin.h: New file.
        * libc/sys/linux/bits/libc-lock.h: Ditto.
        * libc/sys/linux/bits/pthreadtypes.h: Ditto.
        * libc/sys/linux/bits/typesizes.h: Ditto.
2005-09-08 22:45:53 +00:00
Jeff Johnston 7b786e4861 2005-09-08 Eric Blake <ebb9@byu.net>
* libc/argz/argz_insert.c (argz_insert): Don't die with EINVAL when
	before is NULL.
2005-09-08 21:07:43 +00:00
Jeff Johnston 32b09d754f 2005-09-08 Brian Dessent <brian@dessent.net>
* sf_lrint.c (lrintf): Mask 'i0' correctly when extracting
        mantissa.
        * s_lrint.c: Ditto.
2005-09-08 21:03:54 +00:00
Corinna Vinschen bd84404b0f * exceptions.cc (ctrl_c_handler): Disable any special CTRL_LOGOFF_EVENT
handling and add longish comment about the reasons.
2005-09-08 14:58:15 +00:00
Dimitri Papadopoulos f4613fcd1d * include/reason.h [_WIN32_WINNT >= 0x0501]
(SHTDN_REASON_*): New file.
	* include/objbase.h: Avoid double header guard.
2005-09-08 13:55:46 +00:00
Andreas Schwab b9984de10d Remove extraneous line. 2005-09-08 10:08:34 +00:00
Corinna Vinschen b17b7644d5 * regtool.cc: Extend copyright-years.
(print_version): Ditto.
	(cmd_list): Don't depend on terminating '\0' being present on
	string-values.
	(cmd_get): Don't attempt to read more than present, but keep
	extra space for terminating '\0'. Really output REG_BINARY.
	Don't leak memory.
	(cmd_set): Include trailing '\0' in string's length.
2005-09-08 09:24:41 +00:00
Christopher Faylor 70d0243ce9 * hookapi.cc (rvadelta): Change argument to DWORD to eliminate a compiler
warning.
* path.h (path_conv::set_cygexec): New function.
* spawn.cc (av::iscygwin): Eliminate.
(av::av): Don't initialize iscygwin.
(spawn_guts): Just use real_path.iscygexec for all tests.
(av::fixup): Short circuit test if .exe extension and known cygexec.  Set
cygexec flag appropriately if we find that program uses cygwin1.dll.
2005-09-08 00:57:12 +00:00
Christopher Faylor 31fcc87ed9 add missing ChangeLog entry. 2005-09-07 16:01:06 +00:00
Christopher Faylor 41ff9d8c7d * dcrt0.cc (initial_env): Don't attempt stracing if dynamically loaded.
(dll_crt0_0): Move console initialization earlier.
* init.cc (dll_entry): Move console initialization here.
* exceptions.cc (init_console_handler): Fully remove any old console handler.
* spawn.cc (spawn_guts): Don't fill out windows argv if we've deduced that this
is a cygwin-using program.
(av::fixup): Always check executables to see if they are using cygwin1.dll.
Don't consider .com files to be scripts.
* hookapi.cc (rvadelta): New function.
(PEHeaderFromHModule): Simplify slightly.
(hook_or_detect_cygwin): Use passed in name argument for "HMODULE" rather than
incorrectly reading current program.  Calculate delta needed to read image data
and file names if this isn't a real "HMODULE".
2005-09-07 03:10:17 +00:00
Ben Elliston e92fdf0163 Import from Autoconf sources:
2005-09-06  Paul Eggert  <eggert@cs.ucla.edu>
	* move-if-change: Don't output "$2 is unchanged"; suggested by Ben
	Elliston.  Handle weird characters correctly.
2005-09-07 00:42:19 +00:00
Corinna Vinschen 75833f08cd * thread.h: Revert patch from 2005-09-05.
* thread.cc (pthread_mutex::can_be_unlocked): Return true also if
	mutex is owned by MUTEX_OWNER_ANONYMOUS.
2005-09-06 19:22:54 +00:00
Chao-ying Fu 5843726e51 * mips.h (OP_SH_MT_U, OP_MASK_MT_U, OP_SH_MT_H, OP_MASK_MT_H,
OP_SH_MTACC_T, OP_MASK_MTACC_T, OP_SH_MTACC_D, OP_MASK_MTACC_D): New
define.
Document !, $, *, &, g, +t, +T operand formats for MT instructions.
(INSN_ASE_MASK): Update to include INSN_MT.
(INSN_MT): New define for MT ASE.
2005-09-06 18:42:58 +00:00
Christopher Faylor a743e3b940 * cygheap.cc (cygheap_init): Eliminate debugging #if.
* fork.cc (fork_parent): Don't issue errors if "somebody" has set the
PID_EXITED flag on a child.  Don't close process handle if it has potentially
already been closed.
* pinfo.cc (winpids::add): Eliminate PID_ALLPIDS handling which was obsoleted
by previous changes.
* spawn.cc (av::fixup): Do win16 detection for .com files.  Make sure that
buffer has been unmapped in all cases.
2005-09-05 17:30:04 +00:00
Corinna Vinschen bf58ec35b4 * thread.h (pthread_mutex::get_pthread_self): Remove.
(pthread_mutex::lock): Use ::pthread_self as self parameter.
	(pthread_mutex::trylock): Ditto.
	(pthread_mutex::unlock): Ditto.
	(pthread_mutex::destroy): Ditto.
2005-09-05 15:17:03 +00:00
Christopher Faylor be7d909395 Grr. REVERT erroneous checkin. AGAIN. 2005-09-02 17:35:22 +00:00