* dcrt0.cc (dll_crt0_0): Move sigproc_init later, after cygheap initialization
since it relies on the cygheap existing (even if it shouldn't matter do to dll
initialization serialization).
Corinna Vinschen [Mon, 30 Aug 2010 10:39:43 +0000 (10:39 +0000)]
* autoload.cc (MsgWaitForMultipleObjectsEx): Define.
(MsgWaitForMultipleObjects): Remove.
* select.cc (select_stuff::wait): Use MsgWaitForMultipleObjectsEx with
QS_ALLPOSTMESSAGE and, if possible, MWMO_INPUTAVAILABLE flags. Explain
why. Fix a potential crash due to a NULL pointer in WAIT_FAILED case.
(peek_windows): Use filter pattern on NT4. Explain why.
* wincap.h (wincaps::has_mwmo_inputavailable): New element.
* wincap.cc: Implement above element throughout.
Corinna Vinschen [Sat, 28 Aug 2010 11:22:37 +0000 (11:22 +0000)]
* loadlib.h: New header implementing safe LoadLibrary calls.
Include throughout files using LoadLibrary function.
* cygcheck.cc (dump_sysinfo): Retrieve kernel32.dll handle via
GetModuleHandle, rather than using LoadLibrary.
* cygpath.cc (get_long_name): Ditto.
(do_sysfolders): Append .dll suffix in LoadLibrary call.
* ldh.cc (WinMain): Use LoadLibraryExW with DONT_RESOLVE_DLL_REFERENCES
to avoid loading malicious library code.
* locale.cc (print_locale_with_codeset): Change way to retrieve
kernel32.dll path.
Corinna Vinschen [Sat, 28 Aug 2010 08:51:21 +0000 (08:51 +0000)]
* autoload.cc (LoadDLLprime): Change dllname storage to string16.
(struct dll_info): Convert name to WCHAR.
(std_dll_init): Load DLLs with full path to windows system directory.
Add hint to Microsoft security advisory.
* dcrt0.cc (init_windows_system_directory): New function.
(dll_crt0_0): Call init_windows_system_directory first.
* exceptions.cc (windows_system_directory): Move to globals.cc.
(windows_system_directory_length): Ditto.
(events_init): Drop code fetching windows_system_directory.
* globals.cc (windows_system_directory): New global variable.
(windows_system_directory_length): Ditto.
* net.cc (load_ipv6_funcs): Use windows_system_directory rather than
GetSystemDirectoryW.
* netdb.cc (open_system_file): Ditto. Simplify debug output.
Corinna Vinschen [Fri, 27 Aug 2010 18:56:28 +0000 (18:56 +0000)]
* new-features.sgml (ov-new1.7.7): Change to describe partial
reversion to pre-1.7.6 behaviour.
(ov-new1.7.6): Deprecate description of CWD handling.
* pathnames.sgml (pathnames-win32-api): Rewrite to reflect new CWD
behaviour.
Chris Sutcliffe [Wed, 25 Aug 2010 23:33:14 +0000 (23:33 +0000)]
2010-08-25 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* include/winbase.h (GetEnvironmentStrings, GetEnvironmentStringsA): Per
MSDN, change return type to LPCH.
(GetEnvironmentStringsW): Per MSDN, change return type to LPWCH.
* winnt.h: Fix several SUBLANG ID errors (ref:
http://msdn.microsoft.com/en-us/library/dd318693(VS.85).aspx).
(SUBLANG_UI_CUSTOM_DEFAULT): 0x05, not 0x03.
(SUBLANG_HAUSA_NIGERIA): Bad ID name, correct one is ...
(SUBLANG_HAUSA_NIGERIA_LATIN): ... this.
(SUBLANG_INUKTITUT_CANADA_LATIN): 0x02, not 0x01.
(SUBLANG_IRISH_IRELAND): 0x02, not 0x01.
(SUBLANG_LAO_LAO_PDR): Bad ID name, correct one is ...
(SUBLANG_LAO_LAO): ... this.
(SUBLANG_LOWER_SORBIAN_GERMANY): 0x02, not 0x01.
(SUBLANG_SAMI_SKOLT_FINLAND): 0x08, not 0x03.
(SUBLANG_SAMI_INARI_FINLAND): 0x09, not 0x03.
(SUBLANG_SYRIAC_SYRIA): define as SUBLANG_SYRIAC (what MSDN mentions).
(SUBLANG_TIGRIGNA_ERITREA): 0x02, not 0x01.
(SUBLANG_BENGALI_INDIA): 0x01, not 0x00.
(SUBLANG_BENGALI_BANGLADESH): 0x02, not 0x01.
(SUBLANG_PUNJABI_INDIA): 0x01, not 0x00.
(SUBLANG_PUNJABI_PAKISTAN): not defined in MSDN.
(SUBLANG_ROMANIAN_ROMANIA): 0x01, not 0x00.
(SUBLANG_ROMANIAN_MOLDOVA): not defined in MSDN.
Corinna Vinschen [Fri, 20 Aug 2010 11:18:58 +0000 (11:18 +0000)]
* fhandler_disk_file.cc (readdir_check_reparse_point): Rename from
is_volume_mountpoint. Return valid d_type value for underlying
reparse point type.
(readdir_get_ino): Don't rely on the handle set in pc.check. Open
file here if pc.handle() is NULL.
(fhandler_disk_file::readdir_helper): Try to set a correct d_type value
more diligent.
(fhandler_disk_file::readdir): Don't reset dirent_set_d_ino unless
we're really sure it's due to an untrusted FS. Simplify usage of
FileAttributes, which is 0 if buf is NULL, anyway. Set d_type
correctly for faked "." and ".." entries. Improve debug output.
* path.cc (symlink_info::check): Don't keep handle to volume mount
point open. Explain why.
Corinna Vinschen [Fri, 20 Aug 2010 08:52:25 +0000 (08:52 +0000)]
* fhandler_disk_file.cc (fhandler_disk_file::fstatvfs): Revert usage
of get_stat_handle () to get_handle (). Add comment to explain why.
* syscalls.cc (statvfs): Drop using PC_KEEP_HANDLE.
Corinna Vinschen [Thu, 19 Aug 2010 10:35:25 +0000 (10:35 +0000)]
* new-features.sgml (ov-new1.7.7): New section.
* pathnames.sgml: Throughout, align style of screen elements.
Throughout, make all emphasis elements bold.
(pathnames-win32-api): Rewrite section.
Corinna Vinschen [Wed, 18 Aug 2010 14:22:07 +0000 (14:22 +0000)]
* exceptions.cc (open_stackdumpfile): Don't try to open file if we
have no filesystem based CWD. Add comment.
* path.cc (cwdstuff::set): Set CWD handle to NULL if CWD is a virtual
path. Simplify matching comment.
Corinna Vinschen [Fri, 13 Aug 2010 11:51:54 +0000 (11:51 +0000)]
* cygheap.h (class cwdstuff): Make drive_length private.
Add "error" member.
(cwdstuff::get_error): New inline method.
(cwdstuff::get_error_desc): Declare.
(cwdstuff::set): Change first parameter to pointer to path_conv.
* path.cc (chdir): Drop doit. Align call to cwdstuff::set to
new arguments.
(cwdstuff::init): Only call cwdstuff::set if it's not already
initialized. Add comment. Drop third parameter in call to
cwdstuff::set.
(cwdstuff::set): Partially rewrite. Add lots of comments to explain
everything. Drop "doit" since it's not used anymore. Always create
new handle to CWD if not in a virtual path. Drop PEB locking when
reading PEB values in init phase. Check for accessibility to set
correct error code. Drop Vista workaround. Never write back into PEB.
Set Win32 CWD to \\?\PIPE\ on init. Simplify creation of win32 path.
Set new error member to a meaningful value.
(cwdstuff::get_error_desc): New method to generate error message
from cwd error code.
* spawn.cc (spawn_guts): Call cwdstuff::get_error_desc to create
more meaningful error message when not being able to start native
Win32 app due to CWD restrictions. When starting native Win32 app,
lock cwd and use in calls to CreateProcessW/CreateProcessAsUserW.
Corinna Vinschen [Wed, 11 Aug 2010 11:01:14 +0000 (11:01 +0000)]
* mount.cc (do_mount): Don't treat "bind" mount as remote mount.
(mount_entries): Drop the "bind" option from output.
* utils.sgml (mount): Match examples to actual mount output. Add
"bind" option and add example.
* cygheap.h (cygheap_fdmanip): Delete fh and use fd index into cygheap->fdtab
throughout.
(cygheap_fdnew): Replace fh by using fd index into cygheap->fdtab throughout.
(cygheap_fdget): Ditto. (cygheap_fdenum): Ditto.
Implement POSIX.1-2004 Monotonic Clock.
* hires.h: Change hires_us to hires_ns, with nanosecond resolution.
(hires_ns::primed_ft): Remove.
(hires_ns::nsecs): New prototype.
(hires_ns::usecs): Rewrite in terms of nsecs.
(hires_ns::resolution): New prototype.
* times.cc: Change hires_us to hires_ns.
(ntod): Declare.
(systime): Remove.
(hires_ns::prime): Increase resolution to nanoseconds.
(hires_ns::nsecs): Rename usecs to nsecs to reflect increased resolution.
Remove justdelta argument.
(hires_ns::resolution): New function.
(clock_gettime): Accept CLOCK_MONOTONIC.
Use EINVAL instead of ENOSYS per POSIX.1-2004.
(clock_getres): Ditto.
(clock_setres): Use EINVAL instead of ENOSYS to conform with other
implementations.
* strace.cc (strace::microseconds): Adjust for hires_ns.
* sysconf.cc (sca): Set _SC_MONOTONIC_CLOCK to _POSIX_MONOTONIC_CLOCK.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* fhandler_proc.cc: Add /proc/filesystems virtual file.
(format_proc_filesystems): New function.
* mount.cc (fs_names): Move to global scope. Redefine as array
of { "name", block_device? } structs.
(fillout_mntent): Use name member of fs_names.
* mount.h (fs_names): New prototype.
* path.cc (cygwin_conv_path): Rearrange test for "." in POSIX to
relative DOS path conversion. Simplify fixing the path.
In CCP_POSIX_TO_WIN_W conversion, always drop long path prefix if path
fits into MAX_PATH. Explain why.
* libm/common/s_lrint.c (lrint): Annotate shift operations with
possible shift amount ranges, and use SAFE_RIGHT_SHIFT to avoid
undefined behaviour.
* libm/common/s_llrint.c (llrint): Likewise.
* libm/common/s_lround.c (lround): Correct some comments on ranges.
* libm/common/s_llround.c (llround): Likewise.
* exceptions.cc (_cygtls::interrupt_now): Revert to checking for "spinning"
when choosing to defer signal.
(_cygtls::call_signal_handler): Grab func when we have the lock.
* gendef: Update copyright.
(__sigbe): Simplify slightly.
(_sigdelayed): Grab a lock before manipulating stuff.
(_cygtls::pop): Properly return popped value.
(stabilize_sig_stack): Set incyg when we have the lock.
* sigproc.cc: Update copyright.
* cygthread.h (LPVOID_THREAD_START_ROUTINE): Define.
(cygthread::create): Rename from cygthread::cygthread.
(cygthread::cygthread): Define new constructor which accepts
LPVOID_THREAD_START_ROUTINE as the first argument. Call cygthread::create.
* cygthread.cc (cygthread::create): Rename from cygthread::cygthread. Use
'arglen' rather than 'n' since 'n' is no longer supplied.
* fhandler_tty.cc (process_input): Define as void/noreturn.
(process_output): Ditto.
(process_ioctl): Ditto.
(fhandler_tty_master::init): Don't "zap_h" cygthreads which are noreturn. It's
now implied.
DJ Delorie [Thu, 29 Jul 2010 18:41:26 +0000 (18:41 +0000)]
[include/opcode]
* rx.h (RX_Operand_Type): Add TwoReg.
(RX_Opcode_ID): Remove ediv and ediv2.
[opcodes]
* rx-decode.opc (SRR): New.
(rx_decode_opcode): Use it for movbi and movbir. Decode NOP2 (mov
r0,r0) and NOP3 (max r0,r0) special cases.
* rx-decode.c: Regenerate.
[sim/rx]
* rx.c (decode_cache_base): New.
(id_names): Remove ediv and edivu.
(optype_names): Add TwoReg.
(maybe_get_mem_page): New.
(rx_get_byte): Call it.
(get_op): Add TwoReg support.
(put_op): Likewise.
(PD, PS, PS2, GD, GS, GS2, DSZ, SSZ, S2SZ, US1, US2, OM): "opcode"
is a pointer now.
(DO_RETURN): New. We use longjmp to return an exception result.
(decode_opcode): Make opcode a pointer to the decode cache. Save
decoded opcode information and re-use. Call DO_RETURN instead of
return throughout. Remove ediv and edivu.
* mem.c (ptdc): New. Adds decode cache.
(rx_mem_ptr): Support it.
(rx_mem_decode_cache): New.
* mem.h (enum mem_ptr_action): add MPA_DECODE_CACHE.
(rx_mem_decode_cache): Declare.
* gdb-if.c (sim_resume): Add decode_opcode's setjmp logic here...
* main.c (main): ...and here. Use a fast loop if neither trace
nor disassemble is given.
* cpu.h (RX_MAKE_STEPPED, RX_MAKE_HIT_BREAK, RX_MAKE_EXITED,
RX_MAKE_STOPPED, RX_EXITED, RX_STOPPED): Adjust so that 0 is not a
valid code for anything.