Commit Graph

391 Commits

Author SHA1 Message Date
Corinna Vinschen 21fdffa58a * fhandler_mem.cc: Eliminate unused include statements.
(fhandler_dev_mem::fhandler_dev_mem): Check for 9X/ME.
2000-10-09 14:02:25 +00:00
Corinna Vinschen 42f1b6c544 * fhandler.h (fhandler_dev_mem): Erase member `init_phase' and
member function `init'.
        * fhandler_mem.cc: Add typedefs for NT internal data types
        `SYSTEM_INFORMATION_CLASS' and `SYSTEM_BASIC_INFORMATION'.
        Add prototype for `NtQuerySystemInformation' function.
        (fhandler_dev_mem::fhandler_dev_mem): Takes over initialization task
        from `init'. Use `NtQuerySystemInformation' function to evaluate the
        size of physical memory instead of interval search.
        (fhandler_dev_mem::init): Eliminated.
        (fhandler_dev_mem::open): Don't call `init'.
        (fhandler_dev_mem::read): Eliminate check for `init_phase'.
        (dummy_autoload): Add load statement for `NtQuerySystemInformation'.
2000-10-09 13:19:41 +00:00
Christopher Faylor 164a681ca5 * dtable.cc (set_std_handle): Use std_consts array to control SetStdHandle
settings.
(dtable::fixup_after_fork): Ditto.
* exceptions.cc (set_sig_errno): Remove some debugging output.
* path.cc (path_conv::check): Don't OR need_directory with flags sent to
symlink_info::check.
(symlink_info::check): Use PATH_ALL_EXEC to determine when a file is
executable.
* path.h (path_types): Add PATH_ALL_EXEC.
(isexec): Use PATH_ALL_EXEC so that cygexec types will be considered
executable.
* pinfo.h (_pinfo): Add a process handle that is kept open throughout the life
of a cygwin pid.
* sigproc.cc (proc_exists): Remove hopefully obsolete stuff.
(proc_subproc): Set up process handle that is kept open throughout the life of
a cygwin pid.  Reorganize PROC_WAIT stuff to use common code.
(proc_terminate): Close pid lifetime process handle.
(checkstate): Cleanup.
(stopped_or_terminated): Move zombie cleanup.
(remove_zombie): To here.
* spawn.cc (spawn_guts): Reorganize reparenting code for 1247th time.
2000-10-09 02:53:44 +00:00
Christopher Faylor 57bf29e825 * fhandler.h (fhandler_base): Remove obsolete _rpos and _rsize elements.
* fhandler.cc (fhandler_base::open): Ditto.
* fhandler.cc (fhandler_base::fhandler_base): Ditto.
(fhandler_base::read): Ditto.  Add more debugging output.  Don't issue a \r
when \r\n detected.
* pipe.cc (make_pipe): Streamline slightly.  Make debug output more
interesting.
* strace.cc (strace::vsprintf): Use __progname where appropriate to distinguish
strace output when exec'ing.
2000-10-07 18:12:11 +00:00
Corinna Vinschen 4ea34a6850 * fhandler.h (fhandler_dev_mem): Add methods mmap, munmap and msync.
Add `unit' member.
        * fhandler_mem.cc (fhandler_dev_mem): Initialize `unit' as well.
        (init): Care for differences between /dev/mem, /dev/kmem (not
        implemented yet) and /dev/port.
        (open): Change debug message to reflect the device.
        (mmap): New function.
        (munmap): Ditto.
        (msync): Ditto.
        (fstat): Use unit when setting st_dev in stat structure.
        * mmap.cc (mmap): Handle MAP_ANONYMOUS flag.
        Change error handling slightly.
        * path.cc (get_device_number): Handle /dev/port.
2000-10-07 17:35:36 +00:00
Christopher Faylor 7aadaf0f7e * syscalls.cc (_read): Behave properly when passed previous version of
O_NDELAY.  Fix up debugging output.
2000-10-07 03:25:38 +00:00
Christopher Faylor 829425c9fd * net.cc (set_socket_inheritance): Rename from duplicate_socket. Use NT
specific call when appropriate.
(__set_winsock_errno): Rename from set_winsock_errno.  Accept function and line
as arguments.
* path.cc (path_conv::check): Continue the neverending battle to make cygwin
properly understand that path specs ending in a slash require that the path
refer to a directory.  Windows does not do this by default.
(symlink_info::check): Remove ENOTDIR test.  Move it to path_conv::check.
* path.h: Remove obsolete constant.
* winsup.h (set_winsock_errno): New macro.
2000-10-06 19:11:14 +00:00
Corinna Vinschen d12eba25a5 =====================================
These changes require rebuilding all.
        =====================================
        * fhandler.h: Add mmap(), munmap() and msync() to fhandler_base
        and fhandler_disk_file.
        * mmem.cc (mmap): Eliminated device dependent implementation details.
        These are moved to the appropriate fhandler class.
        (munmap): Ditto.
        (msync): Ditto.
        (fhandler_base::mmap): New method.
        (fhandler_base::munmap): Ditto.
        (fhandler_base::msync): Ditto.
        (fhandler_disk_file::mmap): Ditto.
        (fhandler_disk_file::munmap): Ditto.
        (fhandler_disk_file::msync): Ditto.
2000-10-05 13:07:02 +00:00
Christopher Faylor 4e6a4ea8e8 * net.cc: General cleanup.
(fdsock): Return pointer to created fhandler_socket.
(cygwin_socket): Use pointer returned by fdsock.  Return correct errno when fd
< 0.
2000-10-05 05:57:00 +00:00
Christopher Faylor a5855dc341 * exceptions.cc (interruptible): Add extra debugging.
* sigproc.h (wait_sig): Fill in frame pointer, by default, prior to calling or
suffer confusion due to September 7 change below.
2000-10-05 04:53:17 +00:00
Christopher Faylor 1daf97f97e * include/netinet/tcp.h: Remove winsock.h include.
* include/sys/cygwin.h: Move windows specific reference within conditional.
2000-10-05 03:12:36 +00:00
Corinna Vinschen 95436d7cdb * include/sys/mman.h: Add missing MAP_FAILED macro. 2000-10-04 23:17:01 +00:00
Corinna Vinschen f4f898aca0 * fhandler.h (fhandler_dev_mem): Add method `init'. Add members
`mem_size' and `init_phase'.
        * fhandler_mem.cc (init): New function to figure out the size of
        the physical memory.
        (open): Add checking for illegal flags. Change usage of access mode.
        (write): Add intended functionality.
        (read): Add parameter checking. Eliminate page size constant. Use
        getpagesize() instead. Don't touch errno and don't create debug output
        while init() is running.
        (lseek): Add bounds checking. Fix SEEK_END.
        (fstat): Eliminate page size constant. Use getpagesize() instead.
        (dup): Add intended functionality.
2000-10-04 17:08:46 +00:00
Corinna Vinschen 52b5a97156 * dcrt0.cc: Add LoadDLLFunc statement for RegEnumValueA().
* net.cc: Change comments related to get_ifconf.
        (get_2k_ifconf): Eliminate `type' variable. Eliminate `sa' parameter.
        (get_nt_ifconf): Ditto.
        (get_9x_ifconf): Ditto. Rewritten.
        (get_ifconf): Chage calls to OS specific functions.
2000-10-02 20:21:47 +00:00
Christopher Faylor 17e8632267 * signal.cc (sigaction): Allow new action == oldaction. 2000-10-02 19:19:21 +00:00
Corinna Vinschen a26fb3150d * fhandler_mem.cc: Load ntdll functions via autoload method.
(load_ntdll_funcs): Eliminated.
2000-10-02 09:07:50 +00:00
Corinna Vinschen 2f696b4bdb * fhandler_mem.cc (load_ntdll_funcs): Add missing __stdcall qualifiers. 2000-10-02 08:31:07 +00:00
Christopher Faylor 9fc09d00f7 * cygheap.cc (cygheap_init): Born again function.
(_cmalloc): Reorganize to accomodate muto locking.
(_cfree): Use muto lock to avoid multi-thread problems.
* cygheap.h (incygheap): Just use cygheap_max to find upper cygwin heap bounds.
* dcrt0.cc (dll_crt0_1): Reinstitute cygheap_init call.
* path.cc (getcwd): Just return cwdstuff::get result, allowing correct handling
of negative length.
(cwdstuff::get): Malloc a buffer if one is not available.
2000-10-02 02:26:04 +00:00
Corinna Vinschen 51c22a5c86 * Makefile.in: Add fhandler_mem.o to the dependencies.
* dtable.cc (dtable::build_fhandler): Add case for FH_MEM.
        * fhandler.h: Add FH_MEM device type.  Add class fhandler_dev_mem.
        * fhandler_mem.cc: New file. Implementation of class fhandler_dev_mem.
        * path.cc: Add /dev/mem to windows_device_names.
        (get_device_number): Add FH_MEM type.
2000-10-01 01:02:40 +00:00
Christopher Faylor 8d82847a29 * cygheap.cc (init_cheap): Set aside space for heap walk pointer.
(_csbrk): Make logic for detecting when to alloc cognizant of initialization
condition.
(_cmalloc): Use a structure to hold bucket size and heap chain pointer.  Store
pointer to next freed block in bucket size location so that it will be easy to
see if a block is allocated.
(_cfree): Store pointer to next freed block in bucket size location.
(_crealloc): Use macro to retrieve bucket size.
(cygheap_init): Eliminate.
(cygheap_fixup_in_child): Add second argument to determine if we were execed or
not.  In execed case, walk the heap, cleaning up any orphaned blocks.
* cygheap.h: Add a "MAX" value to cygheap_types.  Remove cygheap_init
declaration.  Accomodate new argument to cygheap_fixup_in child.
* fork.cc (fork): Accomodate extra argument to cygheap_fixup_in_child.
* dcrt0.cc (dll_crt0_1): Ditto.  Remove call to cygheap_init.
2000-09-30 04:54:11 +00:00
Christopher Faylor 90fe77395a * path.cc (symlink_info::check): Set executable bit for a file if the first two
characters are 'MZ' to mirror spawn_guts check.
2000-09-30 01:56:40 +00:00
Corinna Vinschen 84ecbb38d6 * winsup.h: Add `winME' to os_type symbols.
* dcrt0.cc (set_os_type): Identify Windows ME systems.
        * (host_dependent_constants::init): Care for winME.
        * uname.cc (uname): Ditto.
2000-09-30 01:38:13 +00:00
Corinna Vinschen 7326d4e4b1 * net.cc (get_ifconf): Code cleanup. Split. Call os dependent
subfunctions instead.
        (get_9x_ifconf): New function for 9X systems, called by get_ifconf.
        (get_nt_ifconf): New function for NT systems, called by get_ifconf.
        (get_2k_ifconf): New function for W2K systems, called by get_ifconf.
2000-09-28 06:34:38 +00:00
Christopher Faylor e564846577 * spawn.cc (spawn_guts): Attempt to accomodate archaic windows quoting
mechanism when dealing with '\' and '"'.
2000-09-27 05:12:09 +00:00
Christopher Faylor 4eafa56ec2 * dcrt0.cc (quoted): Fix problem where ' quoted strings were skipped.
* fhandler.h (fhandler_socket::~fhandler_socket): Delete declaration.
* net.cc: Remove unnecessary "number_of_sockets" usage.
(fhandler_socket::fhandler_socket): Ditto.
(fhandler_socket::~fhandler_socket): Delete definition.
* spawn.cc (spawn_guts): Force first argument passed to CreateProcess as a
command line to be windows style.
2000-09-26 00:52:21 +00:00
Christopher Faylor fb5956da13 * spawn.cc (av::dup_maybe): Make function void rather than void *.
* environ.cc (environ_init): Remember to reparse CYGWIN if envp is
supplied.
* heap.cc (_sbrk): Remember frame for signal handling.
* syscalls.cc (read_handler): Eliminate.
(_read): Move read_handler code here.  Reorganize for one path through
'ready_for_read'.
2000-09-25 16:36:12 +00:00
Christopher Faylor b963175618 * spawn.cc (spawn_guts): Use actual program argument passed in for argv[0] as
originally suggested by Kazuhiro Fujieda <fujieda@jaist.ac.jp>.
2000-09-19 13:48:52 +00:00
Christopher Faylor 6e604fb15d * path.h: Create new input path flag PATH_NEEDDIR.
* path.cc (path::check): Detect trailing slash before converting to windows
path.  Tell symlink_info::check to check for directory if one is found.
(symlink_info::check): Set errno when path is not a directory if pflags &
PATH_NEEDDIR.
2000-09-19 03:22:45 +00:00
Christopher Faylor a3ad824178 * fhandler_tty.cc (fhandler_tty_slave::write): Correct typo which caused
resetting of windows error to ERROR_IO_DEVICE to be ignored.
2000-09-18 23:46:10 +00:00
Christopher Faylor 9a02bdb58c * path.cc (mount_info::read_mounts): Don't delete mount entries of which mount
points have the cygdrive prefix.
* (mount_info::add_reg_mount): Properly catch errors on registry operations.
* (mount_info::write_cygdrive_info_to_registry): Ditto.
* (mount_info::del_reg_mount): Cosmetic changes to be consistent with other
methods.
* (mount_info::add_item): Check arguments more precisely.  Increment nmounts
only when registry operations succeed.
2000-09-18 16:42:28 +00:00
Christopher Faylor ca7ea5a6e7 * exceptions.cc (interruptible): Return 0 if given an address in uncommitted
memory.
2000-09-18 02:20:42 +00:00
Egor Duda a12b2260d0 * signal.cc (sleep): If interrupted by signal, return the
requested time minus the time actually slept.
2000-09-16 13:19:52 +00:00
Christopher Faylor f9f2ed0e2b * exceptions.cc (handle_exceptions): Just "core dump" if SIGSEGV in signal
thread.
* external.cc (fillout_pinfo): Fix compiler warning.
* sigproc.h: Eliminate special asm naming for sig_dispatch_pending.
* sigproc.cc (sig_send): Remove debugging statements.
2000-09-16 02:36:11 +00:00
Christopher Faylor 4f46dbc790 Commit change mentioned in ChangeLog. 2000-09-13 19:57:36 +00:00
Christopher Faylor 99d7d12af0 * spawn.cc (av): Hide 'calloced' field and limit cstrduping to class methods
only.
(spawn_guts): Use methods for manipulating most newargv stuff.
* child_info.h (child_info_spawn::~child_info_spawn): Avoid memory leaks in
cygheap.
* spawn.cc (spawn_guts): Ditto.
* dcrt0.cc (quoted): Return next character after a quoted string when not doing
special quote processing.  Also ensure that non-NULL is returned in all circumstances.
* spawn.cc (spawn_guts): Ensure that argv[0] is correctly set to the full path
when a script is detected.  Suggested by Kazuhiro Fujieda
<fujieda@jaist.ac.jp>.
2000-09-13 19:57:00 +00:00
Christopher Faylor 858f524917 * external.cc (fillout_pinfo): Handle explicit pids correctly. 2000-09-13 02:35:05 +00:00
Christopher Faylor 67826e2264 * path.cc (normalize_posix_path): Fix more slashdot madness. 2000-09-12 18:41:36 +00:00
Christopher Faylor 1d233ab53e * Makefile.in: Make clean target remove *.d. 2000-09-12 16:31:01 +00:00
Christopher Faylor 867df927a6 * path.cc (normalize_posix_path): Correctly deal with a "." parameter. 2000-09-11 17:21:13 +00:00
Christopher Faylor 9149d76e50 * cygheap.cc (init_cheap): Just use any old address for the cygwin heap.
* exceptions.cc (signal_exit): Don't terminate the main thread.  Just try to
exit in this thread really quickly.
* signal.cc (kill_pgrp): Fix typo which caused pinfo structure to be assigned
incorrectly.
2000-09-11 00:25:57 +00:00
Christopher Faylor 4f7ac76aae * dcrt0.cc (dll_crt0_1): Initialize thread and debug stuff before handling
exec/fork.
* dtable.cc (dtable::fixup_after_exec): Always clear out the read ahead buffer
whether closing or adjusting.
* path.cc (chdir): Avoid a compiler warning.
2000-09-10 16:43:47 +00:00
Christopher Faylor 4497c0df52 * path.cc (chdir): Use the full path for cwd_win32. Consider attempts to chdir
to strings of dots > 2 to be an error.  Pass 'dir' argument to cygcwd.set.
(cwdstuff::set): Need to treat arguments from chdir differently.
* path.h (cwdstuff): Add an argument to set.
2000-09-10 03:36:40 +00:00
Christopher Faylor 2137295d10 * lib/_cygwin_crt0_common.cc: Add missing header files. 2000-09-08 15:54:36 +00:00
Christopher Faylor 3b0d65eab9 * sigproc.h (sigframe::set): Eliminate second argument. Default bp to current
frame pointer rather than using this within the function, which is unstable
when this method is not inlined.
* net.cc: Eliminate use of second argument to sigframe.set throughout.
* select.cc (cygwin_select): Ditto.
* sigproc.cc (sig_send): Ditto.
2000-09-08 03:12:13 +00:00
Christopher Faylor f0338f545d Break out more header info into separate files. Use appropriate header files
throughout.
* shared.h: Remove.
* cygwin_version.h: New file.
* delqueue.h: New file.
* environ.h: New file.
* host_dependent.h: New file.
* perprocess.h: New file.
* registry.h: New file.
* security.h: New file.
2000-09-08 02:56:55 +00:00
Christopher Faylor 29ac7f89e3 Split out tty and shared_info stuff into their own headers and use throughout.
Include sys/termios.h for files which need it.
* tty.h: New file.
* shared_info.h: New file.
* fhandler.h: Move inline methods that rely on tty stuff to
fhandler_console.cc.
* fhandler_tty.cc (fhandler_pty_master::process_slave_output): Set
output_done_event immediately after reading data to speed up tty output
processing.
(process_output): Set write_error to errno or zero.
(fhandler_tty_slave::write): Check previous write error prior to writing to
slave end of pipe.  This allows tty output to be slightly less synchronous.
* fhandler_console.cc (fhandler_console::tcsetpgrp): Moved here from
fhandler.h.
(fhandler_console::set_input_state): Ditto.
2000-09-07 16:23:51 +00:00
Christopher Faylor c1644acb23 * exceptions.cc (signal_exit): Reset all mutos owned by the main thread.
* fhandler.h: Define *_output_mutex macros for serializing tty output.
(fhandler_termios): Remove restart_output_event.  Define dummy output mutex
methods.
(fhandler_pty_master): Remove unneeded fixup_after_fork method.
* fhandler_termios.cc (fhandler_termios::line_edit): Acquire output_mutex when
CTRL-S is hit.  Release it on CTRL-Q.
* fhandler_tty.cc (fhandler_pty_master::process_slave_output): Remove
inappropriate OutputStopped test here.  Just use the output mutex.
(fhandler_pty_master::fhandler_pty_master): Remove obsolete reference to
restart_output_event.
(fhandler_tty_common::close): Ditto.
(fhandler_pty_master::set_close_on_exec): Ditto.
(fhandler_pty_master::fixup_after_fork): Delete.
* tty.cc (tty::common_init): Ditto.
* sync.cc (muto::reset): New method.
* sync.h: Declare above method.
2000-09-07 01:18:37 +00:00
Christopher Faylor 8dec7b0379 * sigproc.cc: Add include file for proper definitions.
* spawn.cc: Ditto.
* winsup.h: Define cfree to avoid newlib pollution.
2000-09-06 21:03:10 +00:00
Christopher Faylor 3a71405fe2 * Makefile.in (CFLAGS): Ensure that -MD is always added even when CFLAGS is
overwritten.
2000-09-06 18:13:38 +00:00
Christopher Faylor b8a0fafe80 * path.cc (cwdstuff::get_initial): Keep caching alive.
(mount_info::conv_to_win32_path): Fill out relative path in failing case.
2000-09-06 06:42:08 +00:00