Commit Graph

546 Commits

Author SHA1 Message Date
Corinna Vinschen 2de7601434 * uinfo.cc: Eliminate `#include <wchar.h>'. 2001-02-28 14:14:03 +00:00
Egor Duda 739db26a31 * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Determine
drive geometry or partition size to allow seeking from the end of
raw floppy device. Don't allow positioning past the end of media or
to offsets bigger then max off_t.
2001-02-28 09:59:54 +00:00
Egor Duda a53136cc46 * fhandler.h (class fhandler_console): Make all variables that
describe "state" of console to be members of fhandler_console.
default_color is now the color which is set when console recieves
reset command.
* fhandler_console.cc (fhandler_console::fhandler_console): Turn
mouse handling and raw keyboard mode off by default. Initialize
state information.
* fhandler.cc (fhandler_console::set_raw_win32_keyboard_mode): New
function.
* fhandler_console.cc (fhandler_console::set_default_attr): New
function. Reset console attributes to default values.
* fhandler_console.cc (fhandler_console::open): Reset attributes.
* fhandler_console.cc (fhandler_console::get_win32_attr): New function.
Calculate win32-style console attribute based on terminal attributes.
* fhandler_console.cc (fhandler_console::set_cursor_maybe): Use
member variable.
* fhandler_console.cc (fhandler_console::read): If in raw-win32
keyboard mode, encode win32 keyboard events in \033{x;y;z;t;u;wK
sequences.
* fhandler_console.cc (fhandler_console::dup): Copy all state
information to the dup()ed handle.
* fhandler_console.cc (fhandler_console::scroll_screen): Use current
fill-in	attribute.
* fhandler_console.cc (fhandler_console::clear_screen): Ditto.
* fhandler_console.cc (fhandler_console::char_command): Check if we
saw '?' symbol by member variable. Set terminal	attributes on \033[Xm
commands. \033[24m - turn off underline mode, \033[27m - turn off
reverse mode, \033[39m - restore default foreground color.
\033[49m - restore default background color. \033[2000h - turn on raw
keyboard mode, \033[2000l - turn off raw keyboard mode.
* fhandler_console.cc (fhandler_console::write): Set attribues to
default values on reset command.
2001-02-27 09:14:35 +00:00
Christopher Faylor 5b331f1ef1 * times.cc (settimeofday): Replace function stub with working code. 2001-02-26 22:36:09 +00:00
Corinna Vinschen 88429768bb * strace.cc (strace::vprntf): Move prntf functionality to this function
adding an va_list interface to strace.
        (strace::printf): Calls strace::vprntf now.
        (strace_printf): New function providing an extern "C" interface to
        trace output.
        * include/sys/strace.h: Make plain C clean.
        (class strace): Add `vprntf' method.
2001-02-26 09:50:24 +00:00
Corinna Vinschen 6626ebfef7 * shortcut.c: Remove #include <sys/strace.h>. 2001-02-25 23:14:52 +00:00
Corinna Vinschen 649033a811 * path.cc (symlink): Add a ".lnk" suffix regardless. Add a comment. 2001-02-25 09:34:00 +00:00
Corinna Vinschen 80ed95f2eb * shortcut.c: Change symlink condition. 2001-02-25 09:19:35 +00:00
Corinna Vinschen 675412e9d6 * mmap.cc (fhandler_disk_file::mmap): Use `addr' correctly.
* fhandler_mem.cc (fhandler_dev_mem::mmap): Ditto.
2001-02-23 09:49:19 +00:00
Corinna Vinschen 659b480b8a * path.cc (symlink): Keep relative paths relative in the DOS
path inside of a shortcut. If that's impossible or the target
        path is already absolute save an absolute path.
2001-02-22 16:26:13 +00:00
Corinna Vinschen ff413a9894 * path.cc (symlink): Keep relative paths relative in the DOS
path inside of a shortcut. If that's impossible for some
        reason, save an absolute path.
2001-02-22 16:14:59 +00:00
Corinna Vinschen c5a4eacc69 * cygerrno.h: Revert previous patch.
* errno.cc: Ditto.
        * dir.cc: Eliminate `dir_suffixes'.
        (opendir): Remove usage of `dir_suffixes'.
        (rmdir): Ditto.
        * fhandler.cc (fhandler_disk_file::open): Remove usage of
        `inner_suffixes'.
        * path.cc: Rename `inner_suffixes' to `lnk_suffixes'.
        (path_conv::check): Remove usage of `inner_suffixes'.
        (symlink): Ditto.
        (symlink_info::check): Handle checking for `.lnk' in path_conv
        exclusively here.
        (chdir): Remove usage of `dir_suffixes'.
        * shortcut.c: Eliminate debug_printf lines.
        (check_shortcut): Don't set error except on failing ReadFile.
        * spawn.cc: Remove ".lnk" from `std_suffixes'.
        * syscalls.cc (_unlink): Remove usage of `inner_suffixes'.
        Remove ".lnk" from `stat_suffixes'.
        (_rename): Add check for renaming a symlink to keep the ".lnk"
        suffix after renaming.
2001-02-22 14:51:16 +00:00
Corinna Vinschen 79e56091c9 * shortcut.c: New file. Provides a C interface to reading of
Windows shortcuts to avoid compiler flag `-fvtable-thunks'.
        * shortcut.h: Ditto.
        * Makefile.in: Add shortcut.o to DLL_OFILES.
        * cygerrno.h: Provide a C interface to `geterrno_from_win_error' for
        using in shortcut.c.
        * errno.cc (geterrno_from_win_error): Define as extern "C".
        * path.cc (struct symlink_info): Remove methods `check_shortcut' and
        `check_sysfile'.
        (shortcut_header): Move to shortcut.c.
        (shortcut_initalized): Ditto.
        (create_shortcut_header): Ditto.
        (cmp_shortcut_header): Ditto.
        (symlink_info::check_shortcut): Ditto. Reorganize as a plain C function.
        (symlink_info::check_sysfile): Redefine as a global function using the
        same parameter list as `check_shortcut' for clearness.
        (symlink_info::check): Change parameter list for calls to
        `check_shortcut' and `check_sysfile'.
2001-02-22 12:56:36 +00:00
Corinna Vinschen 87e6b0981f * fhandler.cc (fhandler_disk_file::open): Use `inner_suffixes' when
resolving real_path.
        * path.cc (symlink): Ditto for win32_topath.
2001-02-22 11:06:25 +00:00
Corinna Vinschen 10b06c5ee0 * Makefile.in: Add `-lshell32 -luuid' to link pass for new-cygwin1.dll.
* autoload.cc: Add LoadDLLinitfunc for ole32.dll.
        Add LoadDLLfuncEx statements for CoInitialize@4, CoUninitialize@0
        and CoCreateInstance@20.
        * dir.cc (dir_suffixes): New datastructure.
        (readdir): Check for R/O *.lnk files to hide the suffix.
        (opendir): Use `dir_suffixes' in path conversion.
        (rmdir): Ditto.
        * fhandler.cc (fhandler_disk_file::fstat): Add S_IFLNK flag
        before calling `get_file_attribute'. Take FILE_ATTRIBUTE_READONLY
        into account only if the file is no symlink.
        * path.cc (inner_suffixes): New datastructure.
        (SYMLINKATTR): Eliminated.
        (path_conv::check): Use `inner_suffixes' on inner path components.
        (shortcut_header): New global static variable.
        (shortcut_initalized): Ditto.
        (create_shortcut_header): New function.
        (cmp_shortcut_header): Ditto.
        (symlink): Create symlinks by creating windows shortcuts. Preserve
        the old code.
        (symlink_info::check_shortcut): New method.
        (symlink_info::check_sysfile): Ditto.
        (symlink_info::check): Check for shortcuts. Move code reading
        old system attribute symlinks into symlink_info::check_sysfile().
        (chdir): Use `dir_suffixes' in path conversion.
        * security.cc (get_file_attribute): Check for S_IFLNK flag.
        Force 0777 permissions then.
        * spawn.cc (std_suffixes): Add ".lnk" suffix.
        * syscalls.cc (_unlink): Use `inner_suffixes' in path conversion.
        Check for shortcut symlinks to eliminate R/O attribute before
        calling DeleteFile().
        (stat_suffixes): Add ".lnk" suffix.
        (stat_worker): Force 0777 permissions if file is a symlink.
2001-02-21 21:49:37 +00:00
Egor Duda 0917ed5950 * sigproc.cc (getsem): Make semaphore always non-inheritable. 2001-02-21 11:40:22 +00:00
Christopher Faylor 441d7aeef1 * dcrt0.cc (locale_init): Remove. 2001-02-20 03:28:01 +00:00
Christopher Faylor f97e7d754c * cygwin.din: Export rand48 functions.
* thread.cc (MTinterface::Init): Remove the initialization of `reent_data'.
* dcrt0.cc: Add the initalizer to the declaration of `reent_data'.
* include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 35.
2001-02-20 02:53:55 +00:00
Egor Duda fc68bf34bb * signal.cc (signal): Prohibit setting handlers for SIGKILL and SIGSTOP
* signal.cc (sigaction): Ditto
* syscalls.cc (_lseek): Return EINVAL on invalid input
2001-02-16 18:49:20 +00:00
Christopher Faylor ee2c7251d0 * dlfcn.cc (dlopen): Do not call LoadLibrary with a NULL pointer, when the
library is not found
2001-02-14 23:45:56 +00:00
Christopher Faylor 8f8e7442bb * fhandler_console.cc (fhandler_console::char_command): Ignore unknown
rendition codes in \033[xx;yym control sequences
2001-02-14 22:00:09 +00:00
Christopher Faylor cde0c2fbca * fork.cc (fork_parent): Return EAGAIN when can't record pid.
* pinfo.h (pinfo::remember): Return value of call to proc_subproc.
* sigproc.cc (proc_subproc): Return error if can't record pid.
2001-02-10 04:20:52 +00:00
Christopher Faylor c41482c7ee * syscalls.cc (mknod): Add valid parameters. 2001-02-09 17:17:34 +00:00
Corinna Vinschen 889109ab1f * mmap.cc (mmap): Check for reusing a mapping only on MAP_SHARED
and on MAP_PRIVATE|MAP_ANON in the special case of offset 0.
2001-02-08 21:10:45 +00:00
Corinna Vinschen db49d0b530 * mmap.cc (class list): Add member `hash'.
(list::list): Initialize `hash'.
        (list::get_list_by_fd): Use filepath hash value to get the correct
        mapping list if it's not an anonymous mapping.
        (map::add_list): Initialize `hash' with filepath hash value.
        (mmap): Check for reusing a mapping only on MAP_SHARED.
2001-02-08 21:02:36 +00:00
Christopher Faylor 91d385fed3 * signal.cc (killpg): Correct first argument. 2001-02-07 23:48:09 +00:00
Corinna Vinschen 9182099c10 * autoload.cc: Add LoadDLLinitfunc for iphlpapi.dll.
Add LoadDLLfuncEx statements for GetIfTable@12 and GetIpAddrTable@12.
        * fhandler_socket.cc (fhandler_socket::ioctl): Move variable
        definitions to the beginning of the function to allow better debugging.
        Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU.
        * net.cc: Include iphlpapi.h.
        (get_2k_ifconf): Rewritten. Uses IP Helper API now.
        (get_nt_ifconf): Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC
        and SIOCGIFMTU.
        (get_95_ifconf): Ditto. Renamed from `get_9x_ifconf'.
        (get_ifconf): Name loopback `lo' instead of `lo0' as in Linux.
        Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU.
        Call `get_95_ifconf' only on Windows 95, `get_nt_ifconf' only
        on Windows NT < Service Pack 3, `get_2k_ifconf otherwise.
        * include/asm/socket.h: Add defines for SIOCGIFHWADDR, SIOCGIFMETRIC
        and SIOCGIFMTU.
        * include/cygwin/if.h: Add `ifr_hwaddr', `ifr_metric' and `ifr_mtu'.
        (struct ifreq): Add `ifru_hwaddr'.
2001-02-07 22:50:50 +00:00
Corinna Vinschen d7ed877ba3 * syscalls.cc (stat_worker): Add a check for the special case when
a process creates a file using mode 000 using ntsec.
2001-02-06 14:07:02 +00:00
Corinna Vinschen ae9b22c69b * fhandler.cc (fhandler_base::open): Always add GENERIC_READ access
when opening raw disk devices.
        * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Implement bytewise
        access.
        * fhandler_raw.cc (fhandler_dev_raw::open): Always open raw disk device
        binary.
        (fhandler_dev_raw::raw_write): Don't drop read buffer content when
        writing after read.
2001-02-05 16:10:06 +00:00
Corinna Vinschen cada03f92f * mmap.cc (mmap_record::fixup_map): New method to duplicate
the memory protection in a just forked child.
        (mmap): Realign gran_len to page boundary only on anonymous
        mapping before saving in the mmap_record.
        (munmap): Cleanup code.
        (msync): Ditto.
        (fixup_mmaps_after_fork): Ditto. Call mmap_record::fixup_map now.
2001-02-05 12:36:41 +00:00
Christopher Faylor 47f810920a * cygheap.cc (creturn): Correctly calculate cygheap_max. 2001-02-02 04:32:02 +00:00
Christopher Faylor f8da150758 * shared.cc (shared_info::initialize): Reduce size of heap. 2001-01-31 15:06:06 +00:00
Corinna Vinschen 8344351113 * include/sys/resource.h: Fix typo. 2001-01-31 12:24:24 +00:00
Corinna Vinschen 44e6d951c7 * include/sys/resources.h: Add RLIMIT_NLIMITS and RLIM_NLIMITS. 2001-01-31 12:21:23 +00:00
Christopher Faylor 4f42df7bc4 * include/cygwin/version.h: Bump version to 1.3.0. 2001-01-30 23:19:19 +00:00
Corinna Vinschen 9928a7e108 * pinfo.cc (pinfo::init): Use INVALID_HANDLE_VALUE instead of
explicit cast (HANDLE) 0xffffffff.
        * shared.cc (open_shared): Ditto.
2001-01-30 08:10:04 +00:00
Christopher Faylor 747e88d3f6 * fhandler_serial.cc (raw_write): Use local copy of OVERLAPPED structure
instead of shared structure to fix a race condition between read/write.
2001-01-30 01:52:29 +00:00
Corinna Vinschen 68ea0dc2fc * mmap.cc (mmap): Remove obsolete check for MAP_SHARED|MAP_ANON as
being invalid.
2001-01-29 13:39:17 +00:00
Corinna Vinschen f977222f70 * mmap.cc (mmap_record::find_empty): Fix loop condition. 2001-01-29 09:25:10 +00:00
Christopher Faylor 6a4878cf16 * syscalls.cc (_link): Make sure that newpath does not exist. Set errno if it
does.
* cygheap.cc (init_cheap): Don't specify a load address for the heap.  It
doesn't work on #!*& Windows 9x.
(cygheap_init): Move GetUserName to memory_init.
* dcrt0.cc (dll_crt0_1): Call new memory_init functin, eliminate call to
heap_init.
* heap.cc (heap_init): Improve error output.
* heap.h: Correct some declarations.
* shared.cc (mount_table_init): Remove.
(memory_init): Renamed from shared_init.  Reorganize to accomodate strange
Windows 9x problems with cygheap/heap interaction.
* shared_info.h: Rename shared_init to memory_init.
2001-01-29 00:46:25 +00:00
Christopher Faylor ae6c8e4fc2 * include/cygwin/version.h: Bump API version. 2001-01-28 06:26:50 +00:00
Christopher Faylor 9a089f21ea * cygheap.cc (init_cheap): Move username initialization.
(cygheap_init): Here.
* shared_info.h (mount_info): Add a sys_mount_table_counter field.
(shared_info): Ditto.
* path.cc (mount_info::conv_to_win32_path): Check that our mount table is in
sync with the system mount table and reinitialize it if not.
(mount_info::add_reg_mount): Bump sys_mount_table counters if the system mount
table changes.
(mount_info::del_reg_mount): Ditto.
(mount_info::write_cygdrive_info_to_registry): Ditto.
(mount_info::remove_cygdrive_info_from_registry): Ditto.
2001-01-28 06:23:42 +00:00
Christopher Faylor 2a6fc028ba Throughout, change 'cygwin_shared.mount' to 'mount_table'.
* child_info.h (child_info): Move shared_h, console_h to cygheap.  Add mount_h.
* cygheap.h (init_cygheap): Add shared_h, console_h.
* cygheap.cc (init_cheap): Initialize heap at a fixed location after the shared
memory regions.  Initialize cygheap->user name here.
* dcrt0.cc (dll_crt0_1): Call getpagesize () to initialize constants.  Remove
cygheap_init since it is done in shared_init now.
(_dll_crt0): Initialize mount_h, remove shared_h and console_h initialization.
* fhandler_console.cc (console_shared_h): Eliminate.
(get_tty_stuff): Use cygheap->console_h rather than console_shared_h.
* heap.cc (heap_init): Use page size constant calculated earlier in
initialization.
* shared.cc: Eliminate cygwin_shared_h.  Add cygwin_mount_h.
(mount_table_init): New function for initializing a user mount table.
(open_shared_file_map): Use constant for shared memory region.  Initialize
cygheap and mount table here.
(open_shared): Improve debugging output.
(shared_info::initialize): Eliminate call to mount.init.
(shared_terminate): Use cygheap->shared_h.  Close cygwin_mount_h.
(open_shared_file_map): Eliminate.
* shared_info.h (mount_info): Add a version field.
(shared_align_past): New macro for calculating location for shared memory
regions.
* sigproc.cc (init_child_info): Eliminate shared_h, console_h.
* spawn.cc (spawn_guts): Pass on cygwin_mount_h iff not a different user.
* syscalls.cc (system_info): New global holding system memory defaults.
(getpagesize): Use system_info.
* uinfo.cc (internal_getlogin): Only fill in user name if nonexistent.
* winsup.h: Declare system_info.
* passwd.cc (read_etc_passwd): Use cygheap->user.name () rather than retrieving
the name again.
2001-01-28 05:51:15 +00:00
Christopher Faylor bdfeca609b * path.cc (path_conv::check): Detect when path has symlinks.
(symlink_info::check): Remove debugging stuff.
(chdir): Use posix'ized win32 path if cd'ed to a path using symlinks.
2001-01-27 15:34:38 +00:00
Christopher Faylor 206a8d884b * exceptions.cc (sigreturn): Call any pending signals prior to resetting the
signal mask so that stacked signals behave correctly.
(sigdelayed): Avoid a race where a signal could end up calling an incorrect
signal handler if two signals come in close together.
2001-01-27 02:23:46 +00:00
Corinna Vinschen 174f1a392e * mmap.cc (fhandler_disk_file::mmap): Call CreateFileMapping with
len != 0 only when performing an anonymous mapping.
2001-01-24 04:00:41 +00:00
Christopher Faylor 4c7b82500d * path.h: Add a new constant.
* syscalls.cc (_read): Oscillate errno check.
2001-01-22 20:36:38 +00:00
Christopher Faylor c65a318355 * include/cygwin/version.h: Bump API to reflect setlogmask. 2001-01-22 20:29:24 +00:00
Christopher Faylor 29c39fe3dd * cygwin.din: Add export for setlogmask().
* syslog.cc (setlogmask): New function.
2001-01-22 15:55:34 +00:00
Corinna Vinschen c807d3552a * resource.cc (setrlimit): Support RLIMIT_NOFILE. 2001-01-18 09:30:37 +00:00