* 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.
* 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.
* environ.cc (environ_init): Protect with a 'myfault' in case
GetEnvironmentStrings misbehaves.
* environ.cc (environ_init): Add debugging output with value returned from
GetEnvironmentStrings.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
Jeff Johnston [Thu, 8 Sep 2005 22:45:53 +0000 (22:45 +0000)]
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.
* 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.
* 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.
* 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".
Ben Elliston [Wed, 7 Sep 2005 00:42:19 +0000 (00:42 +0000)]
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.
* 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.
Jeff Johnston [Wed, 31 Aug 2005 20:39:43 +0000 (20:39 +0000)]
2005-08-31 Paul Brook <paul@codesourcery.com>
* configure.host: Set have_crt0 to no for Arm targts when not
providing syscalls. Set sys_dir=arm unconditionally.
Default have_crt0 based on sys_dir.
* configure.in: Use have_crt0.
* libc/configure.in: Ditto.
* libc/sys/configure.in: Ditto.
* configure: Regenerate.
* libc/configure: Regenerate.
* libc/sys/configure: Regenerate.
* libc/sys/arm/Makefile.am (lib_a_SOURCES): Add aeabi_atexit.c.
Only build other files when providing syscalls.
* libc/sys/arm/Makefile.in: Regenerate.
* libc/sys/arm/aeabi_atexit.c: New file.
* cygtls.h (__ljfault): Declare.
(_cygtls::return_from_fault): Use __ljfault.
* exceptions.cc (set_signal_mask): Revert previous checkin.
* gendef (__sjfault): Split out into a separate function which doesn't bother
with any special signal locking. routines.
(_ljfault): Return from a __sjfault without bothering with signals.
2005-08-26 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
* Makefile.in: Remove extra anchor to make NN4 happy.
* faq.xml: Link to cygwin.com/license.html
* faq-resources.xml: Link instead of duplicating info.
* faq-using.xml: Split out services and network shares FAQ.
* faq-what.xml: Link to cygwin.com/license.html
Corinna Vinschen [Fri, 26 Aug 2005 15:11:06 +0000 (15:11 +0000)]
* path.cc (normalize_posix_path): Keep two leading slashes
intact throughout.
(normalize_win32_path): Revert to only checking for slash.
(realpath): Convert drive letters to cygdrive paths before
doing anything else.
* shared_info.h (mount_info::cygdrive_posix_path): Make public.
Corinna Vinschen [Thu, 25 Aug 2005 21:18:26 +0000 (21:18 +0000)]
* path.cc (realpath): Drop call to mount_info::conv_to_posix_path
in favor of calling path_conv with PC_POSIX flag. Align error
handling closer to POSIX. As on Linux, return user space allocated
memory if second parameter is NULL.
Corinna Vinschen [Thu, 25 Aug 2005 20:35:25 +0000 (20:35 +0000)]
* path.cc (normalize_win32_path): Honor network paths. Fold more
than two leading dir separators into one. Check for dir separator
instead of just slashes to handle incoming Win32 paths correctly.
* exceptions.cc (handle_sigsuspend): Just sleep forever if called from non-main
thread.
(sigpacket:process): Simplify logic which determines when and how a signal is
masked. Don't trigger sigwait if there is a signal handler.
* sigproc.cc (wait_sig): Update comment. Try to process a signal which is in
the queue if it isn't queued for the target thread (this is still not right).
* spawn.cc (perhaps_suffix): Record errno-type error value in third argument.
(find_exec): On error, set errno returned from perhaps_suffix.
(spawn_guts): Ditto.
* fhandler_virtual.cc (fhandler_virtual::close): Don't free filebuf if it's
NULL.
* pinfo.cc (_pinfo::commune_send): Fix test for incorrect number of bytes read
from pipe.
* path.cc (path_conv::check): Fill in fileattr for /dev, defaulting to
directory if /dev doesn't actually exist.
(win32_device_name): Don't consider FH_DEV to be a device since it's really a
directory which should go through mount processing.
* cygheap.h (cygheap_types): Add HEAP_COMMUNE.
* fhandler_proc.cc: Use cygheap rather than user heap for allocation of filebuf
throughout.
* fhandler_registry.cc: Ditto.
* fhandler_virtual.cc: Ditto.
* fhandler_process.cc: Ditto.
(get_mem_values): Use malloc/realloc/free rather than new.
* pinfo.cc (_pinfo::commune_send): Allocate on cygwin heap rather than user
heap. Avoid calling ReadFile when correct number of characters have been read
or suffer buffer corruption.
(_pinfo::fd): Allocate on cygwin heap rather than user heap.
(_pinfo::fds): Ditto.
(_pinfo::root): Ditto.
(_pinfo::cwd): Ditto.
(_pinfo::cmdline): Ditto.
* devices.h (FH_DEV): New define.
* devices.in: Detect lone /dev.
* devices.cc: Regenerate.
* path.cc (path_conv::check): Treat FH_DEV as a special case.
* sigproc.h (set_signal_mask): Remove default on second parameter and make pass
by reference.
* signal.cc (abort): Accommodate change to set_signal_mask.
* select.cc (pselect): Ditto.
* exceptions.cc (handle_sigsuspend): Ditto.
(ctrl_c_handler): Ditto.
(sighold): Ditto.
(sigrelse): Ditto.
(set_process_mask_delta): Ditto.
(_cygtls::call_signal_handler): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Return ENMFILE if
__handle is not set. Set __handle to NULL when out of files.
(fhandler_disk_file::rewinddir): Don't close handle if it's NULL.
(fhandler_disk_file::closedir): Ditto.
* dir.cc (readdir_worker): Make static. Only add '.' and '..' when readdir
fails due to ENMFILE.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Only close handle on
error != ENMFILE.
Jeff Johnston [Mon, 22 Aug 2005 21:13:35 +0000 (21:13 +0000)]
2005-08-22 Shaun Jackman <sjackman@gmail.com>
* libc/include/_syslist.h: If HAVE_OPENDIR is not defined,
define _opendir as opendir, _readdir as readdir, and
_closedir as closedir so that the implementations in
libc/posix will be used.
* fhandler.h (dirent_states): Add dirent_saw_proc.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Fill in "proc" if it is
the root dir and it is missing.
* fhandler.h (dirent_states): Add dirent_isroot, dirent_saw_cygdrive,
dirent_saw_dev.
* dir.cc (opendir): Don't zero __flags here. Push that responsibility to
opendir methods.
(seekdir): Preserve dirent_isrrot in __flags.
(rewinddir): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Set dirent_isroot
appropriately.
(fhandler_disk_file::readdir): Fill in "cygdrive" and "dev" if it is the root
dir and they are missing.
* fhandler_process.cc (fhandler_process::opendir): Set __flags here.
* fhandler_virtual.cc (fhandler_virtual::opendir): Set __flags here.
Corinna Vinschen [Thu, 18 Aug 2005 20:25:43 +0000 (20:25 +0000)]
* passwd.c (longopts): Add --logonserver option.
(opts): Add -d option.
(GetPW): Add server parameter which is given to Net functions.
(ChangePW): Ditto.
(PrintPW): Ditto.
(SetModals): Ditto.
(usage): Add description for -d/--logonserver option.
(main): Add option handling for -d/--logonserver. Use LOGONSERVER
environment variable content for server to contact, unless
-d/--logonserver option is given. If both is missing, use NULL.
* fhandler.h (fhandler_tty_common::lseek): Declare new method.
(fhandler_tty_slave::lseek): Delete old method.
(fhandler_tty_master::lseek): Delete old method.
* fhandler_tty.cc (fhandler_tty_common::lseek): Define new method.
* dcrt0.cc (dll_crt0_1): Tweak debugging stuff.
* fhandler_tty.cc (fhandler_tty_common::close): Rearrange the code so that the
master end of the input and output pipes is closed before signalling an EOF
event to the slave.
(fhandler_pty_master::close): Likewise.