Iain D Sandoe [Thu, 23 Feb 2012 16:29:56 +0000 (16:29 +0000)]
deal with endian-ness in mach-o non-scattered relocs.
BFD:
* mach-o.c (bfd_mach_o_swap_in_non_scattered_reloc): New.
(bfd_mach_o_canonicalize_one_reloc): Swap non-scattered reloc
bit-fields when target and host differ in endian-ness. When
PAIRs are non-scattered find the 'symbol' from the preceding
reloc. Add FIXME re. reloc symbols on section boundaries.
(bfd_mach_o_swap_out_non_scattered_reloc): New.
(bfd_mach_o_write_relocs): Use bfd_mach_o_encode_non_scattered_reloc.
include/mach-o:
* external.h: Add comments about relocations fields. Add macros
for non-scattered relocations. Move scattered relocation macros to here.
* reloc.h: Remove macros related to external representation of reloc fields.
Corinna Vinschen [Tue, 21 Feb 2012 17:03:51 +0000 (17:03 +0000)]
* shared.cc (shared_info::init_obcaseinsensitive): Check actual state
of case sensitivity on post-Windows 2000 systems.
* wincap.h (wincaps::kernel_is_always_casesensitive): New element.
* wincap.cc: Implement above element throughout.
Corinna Vinschen [Mon, 20 Feb 2012 14:08:37 +0000 (14:08 +0000)]
* flock.cc (inode_t::del_my_locks): Drop useless counter lc. Close
lock object handle explicitely in case of called during fork. Add
comment to explain why.
* fork.cc (frok::child): Drop declaration of fixup_lockf_after_fork.
Corinna Vinschen [Fri, 17 Feb 2012 17:34:01 +0000 (17:34 +0000)]
* timer.cc (getitimer): Don't create another local ret variable in
timer_gettime calling branch. Simplify conditional since timer_gettime
always returns 0 or -1 anyway.
Corinna Vinschen [Fri, 17 Feb 2012 14:26:18 +0000 (14:26 +0000)]
* ntdll.h (struct _PEB): Add EnvironmentUpdateCount member.
* spawn.cc (child_info_spawn::worker): Speed up job recognition. Expand
comment to explain every little detail and so we never forget.
* wincap.h (wincaps::has_program_compatibility_assitant): New element.
* wincap.cc: Implement above element throughout.
Corinna Vinschen [Thu, 16 Feb 2012 11:02:05 +0000 (11:02 +0000)]
* autoload.cc (NetUseGetInfo): Define.
* fhandler_disk_file.cc (fhandler_cygdrive::opendir): Rename flptst
to drive. Call new get_disk_type function rather than is_floppy and
check SMB drives with the NetUseGetInfo function. Explain why.
* mount.cc (get_disk_type): New function to evaluate disk type from
native NT device name.
(is_floppy): Remove.
* mount.h (enum disk_type): Define.
(get_disk_type): Declare.
* path.h (is_floppy): Drop declaration.
Corinna Vinschen [Wed, 15 Feb 2012 21:34:06 +0000 (21:34 +0000)]
* miscfuncs.cc: Revert change from 2012-02-13 which used the
Windows-provided stack rather than an own stack created in
CygwinCreateThread.
(struct thread_wrapper_arg): Rename commitsize to stacklimit.
(CygwinCreateThread): Rename commitsize to real_stacklimit.
* smallprint.cc (tmpbuf): Declare new class holding a static buffer, protected
by a lock.
(__small_vsprintf): Use tmpbuf to hold large buffer.
(__small_vswprintf): Ditto.
Corinna Vinschen [Wed, 15 Feb 2012 14:43:07 +0000 (14:43 +0000)]
* flock.cc (lf_setlock): Add timeout variable and set before calling
WFMO. Drop debug output if process is not available. Set timeout to
0 instead. Document timeout 0 in WFMO comment.
(lf_getblock): Drop invalid F_POSIX lock type shortcut. Only return
overlap if event is not signalled. Fix comment.
* pinfo.cc (_pinfo::set_ctty): Revert 2012-02-07 change to skip function if tty
in question == our ctty.
* syscalls.cc (setsid): Avoid two function calls.
* dtable.cc (dtable::dup_worker): Remove debugging.
* init.cc (search_for): Calculate for every new process rather than using
shared value.
(threadfunc_ix): Fill in for ever new process rather than sing shared value.
Corinna Vinschen [Mon, 13 Feb 2012 15:23:03 +0000 (15:23 +0000)]
* miscfuncs.cc (struct thread_wrapper_arg): Convert char * to PBYTE.
Change related casts throughout.
(thread_wrapper): Only do the thread change if the application provided
the stack. Otherwise, just use the Windows-provided stack. Set up
POSIX guardpage here, if necessary. Move related comment from
CygwinCreateThread here.
(CygwinCreateThread): Never allocate and set up own stack here. Just
compute stack size to reserve and use value in CreateThread call if
stack hasn't been provided by the application.
Corinna Vinschen [Mon, 13 Feb 2012 13:12:37 +0000 (13:12 +0000)]
* Makefile.in (clean): Remove non-existant regexp dir.
* collate.h: New header.
(__collate_range_cmp): Declare.
(__collate_load_error): Define.
* glob.cc: Pull in latest version from FreeBSD. Simplify and reduce
Cygwin-specific changes.
* regex/regcomp.c: Include collate.h on Cygwin as well.
(__collate_range_cmp): Move from here...
* nlsfuncs.cc (__collate_range_cmp): ...to here.
* miscfuncs.cc (thread_wrapper): Fix typo in comment.
(CygwinCreateThread): Take dead zone of Windows stack into account.
Change the way how the stack is commited and how to handle guardpages.
Explain how and why.
* thread.h (PTHREAD_DEFAULT_STACKSIZE): Change definition. Explain why.
* exception.h (stackdump): Declare.
* exceptions.cc (stackdump): Rework to perform all operations needed for a
stackdump and to avoid recursion.
(exception::handle): Use simplified stackdump interface.
* sigproc.cc (signal::exit): Ditto. Delete now, uneeded declaration.
Corinna Vinschen [Sat, 11 Feb 2012 17:37:02 +0000 (17:37 +0000)]
* miscfuncs.cc (DEFAULT_STACKSIZE): Remove.
(CygwinCreateThread): Simplify code by assuming that now stack-related
input values are undefined. Set stack protection to PAGE_READWRITE,
as is default on Windows. Add lengthy comment to explain POSIX
guardpage.
* thread.cc (pthread_attr::pthread_attr): Initialize stacksize as
PTHREAD_DEFAULT_STACKSIZE. Initialize guardsize as
PTHREAD_DEFAULT_GUARDSIZE.
* thread.h (PTHREAD_DEFAULT_STACKSIZE): Define. Add comment to explain.
(PTHREAD_DEFAULT_GUARDSIZE): Define.
Corinna Vinschen [Fri, 10 Feb 2012 20:56:22 +0000 (20:56 +0000)]
* miscfuncs.cc (DEFAULT_STACKSIZE): Set to 1 Megs. Drop comment about
RLIMIT_STACK.
* registry.cc (get_registry_hive_path): Expect the user hive path to
be never longer than MAX_PATH. Don't prepend native NT path prefix
here. Add comment.
(load_registry_hive): Prepend native NT path prefix here. Additionally
try to load user's classes hive.
* uinfo.cc (cygheap_user::env_userprofile): Reduce size of
userprofile_env_buf to MAX_PATH. Add comment.
* syscalls.cc (setsid): On second thought, in the spirit of keeping things
kludgy, set ctty to -2 here as a special flag, and...
(open): ...only eschew setting O_NOCTTY when that case is detected.
* dll_init.h (struct dll): Re-add modname.
* dll_init.cc: Throughout, use modname where it was used before.
(dll_list::operator[]): Use modname. Move comment from dll_list::alloc
here and remove hint about GetModuleBaseNameW.
(dll_list::alloc): Store full path in name, pointer to basename in
modname. Search dll using modname.
* thread.cc (__pthread_cond_wait_init): New static function replacing
__pthread_cond_dowait. Only check and potentially initialize cond and
mutex, drop call to (*cond)->wait.
(pthread_cond_timedwait): Replace call to __pthread_cond_dowait with
separate calls to __pthread_cond_wait_init and (*cond)->wait to be
able to initialize cond before accessing its clock_id member.
(pthread_cond_wait): Ditto (more or less).
* include/sys/wait.h: Remove C++ inline functions for `union wait'. For C++
use `void *' as __wait_status_ptr_t instead. This is less type safe but fixes
compile error on `wait(NULL)'. Remove extra `;'.
* config/tc-i386.c (HLE_PREFIX): New.
(check_hle): Likewise.
(_i386_insn): Add have_hle.
(cpu_arch): Add .hle and .rtm.
(md_assemble): Call check_hle if i.have_hle isn't zero.
(parse_insn): Set i.have_hle to 1 for HLE prefix.
(output_jump): Support up to 2 byte opcode.
* doc/c-i386.texi: Document hle/.hle and rtm/.rtm.
* dll_init.cc: Throughout, drop usage of modname in favor of name.
(dll_list::find_by_modname): Remove.
(dll_list::alloc): Only store module basename in name. Add comment to
explain why. Simplify address check. Fix formatting in comment.
* dll_init.h (struct dll): Drop modname and find_by_modname.
* faq-using.xml (faq.using.sshd-in-domain): Document autoload error
1114 when loading user32.dll as potential problem when not using
a domain service account.
* include/process.h: Move here from include/cygwin subdir.
* exec.cc: Change include of process.h to reflect the fact that it's
now back in include.
* spawn.cc: Ditto.
* syscalls.cc: Ditto.
Fix memory and handle leaks due to fdopendir:
* dir.cc (closedir): Call global close instead of just releasing the
fhandler.
* fhandler_disk_file.cc (fhandler_disk_file::closedir): Don't close
fhandler handle here, rely on global closedir doing the right thing.
* fhandler_registry.cc (fhandler_registry::readdir): Also delete
d_hash when closing registry key.
(fhandler_registry::rewinddir): Ditto.
Avoid infinite recursion in VirtualStore under UAC:
* fhandler_registry.cc (VIRT_CLASSES_KEY_PREFIX): Define.
(VIRT_CLASSES_KEY_SUFFIX): Ditto.
(VIRT_CLASSES_KEY): Ditto.
(VIRT_CLASSES_LINKTGT): Ditto.
(fhandler_registry::exists): Return virt_symlink as file type if
this is a Classes key under the VirtualStore.
(fhandler_registry::fstat): Handle virt_symlink.
(fhandler_registry::readdir): Return DT_LNK as d_type if this is a
Classes key under the VirtualStore.
(fhandler_registry::fill_filebuf): Handle Classes symlink.
Handle user impersonation in /proc/registry access:
* autoload.cc (RegOpenUserClassesRoot): Define.
(RegOpenCurrentUser): Define.
* fhandler_registry.cc (RegOpenUserClassesRoot): Declare function
missing in w32api.
(RegOpenCurrentUser): Ditto.
(fetch_hkey): New function.
(fhandler_registry::open): Call fetch_hkey to get root registry key.
(open_key): Ditto.
* fhandler.cc (fhandler_base_overlapped::has_ongoing_io): Don't block
GetOverlappedResult since previous IsEventSignalled will have reset the handle.
* select.cc (cygwin_select): Remove space before parentheses in syscall
debugging output.
(pipe_data_available): Streamline if block.
* syscalls.cc (dup3): Fix debug typo.
* fhandler.cc (flush_async_io): Assume only called for writer. Call
GetOverlappedResult directly rather than kluding call to has_ongoing_io.
(fhandler_base_overlapped::close): Only start flush thread when closing write
handle. Only cancel I/O when reading.