Corinna Vinschen [Tue, 27 Mar 2012 18:30:28 +0000 (18:30 +0000)]
* fhandler_process.cc (process_tab): Add entry for mountinfo.
(format_process_mountstuff): New function, derived from
format_process_mounts. Only open another user's user_info shared
memory area if the process is owned by another user. Actually
access the opened shared user_info to get the right mount table.
For other users, don't print remote cygdrive mount points. Print
mountinfo or mounts output depending on the bool mountinfo argument.
(format_process_mounts): Just call format_process_mountstuff with
mountinfo set to false.
(format_process_mountinfo): Ditto with mountinfo set to true.
Corinna Vinschen [Mon, 26 Mar 2012 11:24:51 +0000 (11:24 +0000)]
* fhandler.h (class fhandler_dev_clipboard): Add fstat method.
* fhandler_clipboard.cc (cygcb_t): New type for Cygwin-specific
clipboard format.
(set_clipboard): Use new clipboard format to allow setting a timestamp.
(fhandler_dev_clipboard::fstat): New method. Read modification and
access timestamp as well as length from clipboard data.
(fhandler_dev_clipboard::read): Use new clipboard format.
Corinna Vinschen [Mon, 26 Mar 2012 09:05:50 +0000 (09:05 +0000)]
* hires.h (hires_ms::dmsecs): Drop unused method.
* times.cc (JITTER): Remove.
(gtod): Revert to process-local variable.
(hires_ms::nsecs): Just return system time to disallow discrepancy with
the OS.
(hires_ms::resolution): Return coarsest timer value from OS. Add
comment to explain why.
(clock_setres): Ditto.
* child_info.h (child_info::postfork): Define new function.
* fork.cc (frok::parent): Call postfork to do all of the manipulation required
prior to calling pinfo::remember.
* pinfo.h (pinfo::set_rd_proc_pipe): Just set pinfo's rd_proc_pipe. Don't
bother setting it to NULL.
* sigproc.cc (child_info_spawn::wait_for_myself): Call postfork to set up
myself for waiting.
* spawn.cc (child_info_spawn::worker): Avoid now-unnecessary global lock.
Consistently test mode rather than chtype when making wr_proc_pipe decisions.
Call postfork() to set up stuff prior to pinfo::remember.
* child_info.h: Reset magic number.
(child_info_spawn::wait_for_myself): Move function to sigproc.cc.
* pinfo.cc (is_toplevel_proc): Delete unneeded variable.
* sigproc.cc (child_info_spawn::wait_for_myself): Move function from header to
here. Do all setup required to properly wait for top-level execed process to
exit.
* spawn.cc (child_info_spawn::worker): Attempt to properly handle _P_DETACH.
Set wr_proc_pipe if top-level process even when execing. Just call
wait_for_myself() to... wait for myself. Don't call cleanup twice.
* dtable.cc (set_std_handle): Call SetStdHandle with NULL if fd is closed.
(dtable::release): "Close" standard handle if appropriate.
* dcrt0.cc (dll_crt0_0): Fix minor switch formatting problem.
* fork.cc (frok::parent): Make minor comment indentation change.
* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(child_info::rd_proc_pipe): Declare new field.
(child_info::wr_proc_pipe): Ditto.
(child_info::prefork): Declare new function, derived from previous pinfo
version.
* dcrt0.cc (child_info_fork::handle_fork): Close previous wr_proc_pipe when
appropriate and assign new one from passed-in child_info block.
(child_info_spawn::handle_spawn): Assign our wr_proc_pipe handle from passed-in
child_info block.
* fork.cc (child_info::prefork): Define new function.
(frok::child): Clear rd_proc_pipe and wr_proc_pipe so they will not be closed
by the child_info destructor.
(frok::parent): Use child_info prefork handling, outside of retry loop. Set
rd_proc_pipe in child's pinfo after successful CreateProcess. Eliminate
postfork call.
* globals.cc (my_wr_proc_pipe): Define/declare new variable.
* pinfo.cc (pinfo::pending_rd_proc_pipe): Delete.
(pinfo::pending_wr_proc_pipe): Ditto.
(pinfo::prefork): Ditto.
(pinfo::postfork): Ditto.
(pinfo::postexec): Ditto.
(pinfo::wait): Assume that rd_proc_pipe is set up correctly prior to call.
(_pinfo::alert_parent): Replace "wr_proc_pipe" with "my_wr_proc_pipe".
* pinfo.h (_pinfo::_wr_proc_pipe): Delete declaration.
(_pinfo::set_rd_proc_pipe): Define new function.
(pinfo::pending_rd_proc_pipe): Delete declaration.
(pinfo::pending_wr_proc_pipe): Ditto.
(pinfo::prefork): Ditto.
(pinfo::postfork): Ditto.
(pinfo::postexec): Ditto.
(pinfo::wr_proc_pipe): Ditto.
* sigproc.cc (child_info::child_info): Clear rd_proc_pipe and wr_proc_pipe.
(child_info::cleanup): Close rd_proc_pipe and wr_proc_pipe if necessary.
(child_info_fork::child_info_fork): Set forker_finished to NULL by default.
(child_info_spawn::child_info_spawn): Use my_wr_proc_pipe rather than
myself->wr_proc_pipe.
(child_info::sync): Ditto.
(child_info_spawn::cleanup): Call child_info::cleanup.
* spawn.cc (child_info_spawn::worker): Remove call to myself.prefork(). Set
wr_proc_pipe when execing or set up new rd_proc_pipe/wr_proc_pipe via
child_info::prefork when spawning. Remove call to pinfo::postexec. Set
rd_proc_pipe in child pinfo when spawning. Use my_wr_proc_pipe rather than
myself->wr_proc_pipe. Remove call to postfork.
* pinfo.cc (pinfo_init): Cosmetic change: unset "destroy" for myself.
(pinfo::wait): Change some comments.
(pinfo::prefork): Move a comment.
(pinfo::postfork): Set pending_*_pipe variables to NULL if closed.
(pinfo::postexec): Use right name when closing handle.
(_pinfo::alert_parent): Ditto.
* sigproc.h (hold_everything): Remove debugging label.
* cygprops.h: Use #pragma once.
* mkglobals_h: Ditto for generated globals.h file.
* globals.cc: Use specific NO_GLOBALS_H flag to control inclusion of globals.h.
* winsup.h: Honor NO_GLOBALS_H to control inclusion of globals.h. Make
clear_procimptoken extern inline so that it is only defined when needed.
* pinfo.cc (pinfo::wait): Handle case where prefork was not called prior to
calling wait(). This is the case when we are reabsorbing processes after being
execed.
Corinna Vinschen [Tue, 13 Mar 2012 17:15:28 +0000 (17:15 +0000)]
* hookapi.cc (hook_or_detect_cygwin): Change condition when to use
importRVAMaxSize or importRVASize for the mapping size. Make sure
to map never more than the section size. Change comments accordingly.
The GNU ar has "q" aliased to "r", and we generally want this behavior anyways
(replacing rather than always appending), so change our AR_FLAGS definition.
Christopher Faylor <me.cygwin2012@cgf.cx>
* fhandler.h (wait_return): Add overlapped_nullread.
* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Detect zero-byte
read as a special case.
(fhandler_base_overlapped::raw_read): Keep looping when zero-byte read detected
without EOF.
(fhandler_base_overlapped::raw_write): Quiet gcc warning by adding
overlapped_nullread to switch statement even though it will never actually be
hit.
* dtable.cc (fh_alloc): Treat pc.dev as unsigned.
* fhandler_console.cc (fhandler_console::set_unit): Use lock always to avoid
races between competing cygwin processes running on the console.
* hookapi.cc (rvadelta): Add parameter to return maximum available
size from start of import RVA table to end of section.
(find_first_notloaded_dll): Take big executables into account. Use
offset and size computation as in hook_or_detect_cygwin, just simpler.
(hook_or_detect_cygwin): Return NULL rather than false througout.
Change computation of required mapping size to take non-gcc compilers
into account. Explain the differences and what we do against them.
Don't alloca buf if fn is NULL. Never use buf if fn is NULL.
* net.cc (call_gaa): New thread function to call GetAdaptersAddresses.
(get_adapters_addresses): Call call_gaa. If necessary, call it as
child thread. Explain why that's necessary.
* pinfo.cc (_pinfo::dup_proc_pipe): Reorganize to provide more information for
failing condition.
(pinfo::wait): Pass name of function to dup_proc_pipe. Eliminate error check
for dup_proc_pipe since it never actually returned an error.
* pinfo.h (_pinfo::dup_proc_pipe): Add an argument.
* spawn.cc (child_info_spawn::worker): Pass name of function to dup_proc_pipe.
* dll_init.cc (dll_list::alloc): Compare linked DLLs by basename only.
Explain why. Add code to check if a DLL with the same basename but
different path is the same DLL. Bail out if not.
(in_load_after_fork): New static NO_COPY bool to allow to differ
between linked and loaded DLL at fork.
(dll_list::load_after_fork): Set in_load_after_fork accordingly.
(dll_dllcrt0_1): Don't treat DLL as linked if in_load_after_fork is set.
Drop test for in_forkee.
* dll_init.cc: Revert pathname changes from 2012-02-08.
(dll_list::operator[]): Add long comment to explain the misery.
(dll_list::alloc): Skip long pathname prefix potentially returned by
GetModuleFileNameW.
* dll_init.h (dll_list::find_by_modname): Add back declaration.
* fhandler_console.cc (fhandler_console::dup): Only set ctty when we haven't
specifically called setsid.
* fhandler_tty.cc (fhandler_pty_slave::dup): Ditto. Also add comment
documenting research into rxvt problem.
* fhandler_termios.cc (fhandler_termios::tcsetpgrp): Don't check specifically
for myself->ctty == -1. Test for > 0 as that is the correct test.
(fhandler_termios::sigflush): Ditto.
* flock.cc (allow_others_to_sync): Reorder conditional expression to
check for DACL presence first, since otherwise dacl pointer value is
undefined. Add comment.
* flock.cc (allow_others_to_sync): Use RtlGetDaclSecurityDescriptor
rather than accessing the SECURITY_DESCRIPTOR structure directly.
Take no DACL and NULL DACL into account.
* fhandler_console.cc (fhandler_console::input_tcsetattr): Revert
prevois patch.
(fhandler_console::open_setup): Install Ctrl-C handler here, if this
console is the controlling tty and the process hasn't been started by
a Cygwin process.
* faq-programming.xml (faq.programming.make-execvp): Remove obsolete
information about Tcl/Tk.
(faq.programming.dll-relocatable): Ditto.
* faq-using.xml (faq.using.tcl-tk): Rewrite to reflect switch to
X11 Tcl/Tk.
Corinna Vinschen [Mon, 27 Feb 2012 11:55:27 +0000 (11:55 +0000)]
* cygtls.cc (dll_cmp): New comparison function for bsearch.
(well_known_dlls): New array containing well-known DLLs.
(_cygtls::call2): Add code for BLODA detection.
* net.cc (fdsock): Ditto.
Alan Modra [Mon, 27 Feb 2012 06:37:38 +0000 (06:37 +0000)]
gas/
* config/tc-crx.c: Include bfd_stdint.h.
(getconstant): Remove irrelevant comment. Don't fail due to
sign-extension of int mask.
(check_range): Rewrite using unsigned arithmetic throughout.
opcodes/
* crx-dis.c (print_arg): Mask constant to 32 bits.
* crx-opc.c (cst4_map): Use int array.
include/opcode/
* crx.h (cst4_map): Update declaration.
Corinna Vinschen [Sun, 26 Feb 2012 15:47:43 +0000 (15:47 +0000)]
* environ.cc (enum settings): Add setbool. Rename justset to setdword
to avoid future problems.
(struct parse_thing): Change all justset to setbool for bool variables.
(parse_options): Add a case for setbool setting for bool variables
since justset (now setdword) always writes a DWORD value, thus
potentially overwriting adjacent memory locations.
* external.cc (cygwin_internal): Drop extern declaration.
Corinna Vinschen [Sun, 26 Feb 2012 12:34:17 +0000 (12:34 +0000)]
* flock.cc (LOCK_DIR_NAME_FMT): Define.
(LOCK_DIR_NAME_LEN): Define.
(LOCK_DIR_NAME_DEV_OFF): Define.
(LOCK_DIR_NAME_INO_OFF): Define.
(LOCK_OBJ_NAME_FMT): Define. Add comment.
(class lockf_t): Use bitsize-explicit types. Declare from_obj_name,
(class inode_t): Make use, unuse and inuse methods public. Add a
lock argument to get method declaration.
(inode_t::get): Add lock argument. Only lock node if lock arg is true.
(inode_t::inode_t): Use LOCK_DIR_NAME_FMT as format string.
(lockf_t::from_obj_name): New method to generate lockf_t content from
lock event object basename.
(inode_t::get_all_locks_list): Just call from_obj_name here and copy
result into final lockf_t.
(create_lock_obj_attr): Use LOCK_OBJ_NAME_FMT as format string.
(create_lock_in_parent): New thread function to create lockf_t
structure in parent process.
(delete_lock_in_parent): New thread function to reap stale BSD locks in
parent process.
(lockf_t::create_lock_obj): Try to duplicate lock object handle into
parent process and call create_lock_in_parent as parent remote thread.
(lockf_t::del_lock_obj): Call delete_lock_in_parent as parent remote
thread.
(fhandler_disk_file::lock): Add lock arg to inode_t::get call.
Walter Lee [Sat, 25 Feb 2012 22:24:21 +0000 (22:24 +0000)]
Improve TLS support on TILE-Gx/TILEPro:
- Add support for TLS LE references.
- Support linker optimization of TLS references.
- Delete relocations of GOT/tp relative offsets beyond 32-bits.
This brings binutils in line with the support expected in gcc 4.7, for
TILE-Gx/TILEPro.
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.