Commit Graph

13421 Commits

Author SHA1 Message Date
Yaakov Selkowitz 7dd9fa7ffb * new-features.sgml (ov-new1.7.10): Document CPU-time clock support.
Move pthread stack management APIs to separate listitem.
2011-05-17 17:09:32 +00:00
Yaakov Selkowitz c8ce54290d * cygwin.din (clock_getcpuclockid): Export.
(pthread_getcpuclockid): Export.
* hires.h (PID_TO_CLOCKID): New macro.
(CLOCKID_TO_PID): New macro.
(CLOCKID_IS_PROCESS): New macro.
(THREADID_TO_CLOCKID): New macro.
(CLOCKID_TO_THREADID): New macro.
(CLOCKID_IS_THREAD): New macro.
* ntdll.h (enum _THREAD_INFORMATION_CLASS): Add ThreadTimes.
* posix.sgml (std-notimpl): Add clock_getcpuclockid and
pthread_getcpuclockid from here...
(std-susv4): ... to here.
(std-notes): Remove limitations of clock_getres and clock_gettime.
Note limitation of timer_create to CLOCK_REALTIME.
* sysconf.cc (sca): Set _SC_CPUTIME to _POSIX_CPUTIME, and
_SC_THREAD_CPUTIME to _POSIX_THREAD_CPUTIME.
* thread.cc (pthread_getcpuclockid): New function.
* timer.cc (timer_create): Set errno to ENOTSUP for CPU-time clocks.
* times.cc (clock_gettime): Handle CLOCK_PROCESS_CPUTIME_ID and
CLOCK_THREAD_CPUTIME_ID.
(clock_getres): Ditto.
(clock_settime): Set errno to EPERM for CPU-time clocks.
(clock_getcpuclockid): New function.
* include/pthread.h (pthread_getcpuclockid): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-17 17:08:10 +00:00
Corinna Vinschen 5e3af166d7 * miscfuncs.cc (thread_wrapper): Remove unused _cygtls record.
* mmap.cc (is_mmapped_region): Avoid crash if no mmaps exist.
2011-05-17 15:37:01 +00:00
Alan Modra 89d3b82ee5 PR ld/12760
include/
	* bfdlink.h (struct bfd_link_callbacks <notice>): Add "flags" and
	"string" param.
bfd/
	* coff-aux.c (coff_m68k_aux_link_add_one_symbol): Adjust "notice" call.
	* elflink.c (elf_link_add_object_symbols): Likewise.
	* linker.c (_bfd_generic_link_add_one_symbol): Likewise.
ld/
	* ldmain.c (notice): Add "flags" and "string" param.
	* plugin.c (plugin_notice): Likewise.  Handle indirect, warning
	and constructor syms.
2011-05-17 13:02:16 +00:00
Yaakov Selkowitz 64a5e8a9a3 * libc/include/time.h (CLOCK_PROCESS_CPUTIME_ID): Rename from
CLOCK_PROCESS_CPUTIME.
(CLOCK_THREAD_CPUTIME_ID): Rename from CLOCK_THREAD_CPUTIME.
* libc/include/sys/features.h [__CYGWIN__] (_POSIX_CPUTIME): Define.
(_POSIX_THREAD_CPUTIME): Define.
2011-05-16 22:35:10 +00:00
Corinna Vinschen 553f08059b * globals.cc (__getlogin_username): Remove.
* uinfo.cc (getlogin_r): Fetch username from cygheap.
	(getlogin): Add static buffer username and fetch username from
	getlogin_r.
2011-05-16 17:58:21 +00:00
Corinna Vinschen bdc00a0d85 * cygtls.h (struct _local_storage): Remove unused members rarg and
_localtime_buf.  Remove username in favor of a global buffer.  Reorder
	slightly to keep the net.cc stuff together.
	* globals.cc (__getlogin_username): New global char buffer.
	* tlsoffsets.h: Regenerate.
	* uinfo.cc (getlogin): Copy username into __getlogin_username.
2011-05-16 15:12:35 +00:00
Corinna Vinschen f783f223cb * libc/stdlib/strtod.c (_strtod_r): Fix nf/nd counts to not exceed
DBL_DIG.
2011-05-16 13:34:06 +00:00
Corinna Vinschen 883ea27df0 * heap.cc (heap_init): Rewrite initial heap allocation to use addresses
beyond 0x20000000.  Explain why and how.
	* shared.cc (shared_info::heap_slop_size): Remove.
	* shared_info.h (class shared_info): Remove heap_slop_inited and
	heap_slop members.  Remove heap_slop_size declaration.
	(CURR_SHARED_MAGIC): Update.
	* wincap.cc: Throughout, drop heapslop.
	* wincap.h (struct wincaps): Drop heapslop.
2011-05-16 10:27:14 +00:00
Corinna Vinschen 6d6cfa4840 * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Check if the
requested stack is application-provided within the user heap or an
	mmapped region.  If so, just use it.  Add comment to explain why.
	* miscfuncs.cc (thread_wrapper): If an application-provided stack
	has been given, implement cygtls area at the stackbase.  Fix comment.
	* mmap.cc (is_mmapped_region): New function.
	* winsup.h (is_mmapped_region): Declare.
2011-05-16 09:55:18 +00:00
Alan Modra 943e23a49f include/
* bfdlink.h (struct bfd_link_hash_entry): Remove u.undef.weak field.
bfd/
	* linker.c (_bfd_generic_link_add_one_symbol): Don't init u.undef.weak.
2011-05-15 23:44:06 +00:00
Corinna Vinschen daa69fff5b * miscfuncs.cc (thread_wrapper): Add comments to assembler code. 2011-05-15 19:04:41 +00:00
Corinna Vinschen 7afc14c003 * new-features.sgml (ov-new1.7.10): Document pthread_attr_getguardsize,
pthread_attr_setstack, pthread_attr_setstackaddr and
	pthread_attr_setguardsize.
2011-05-15 18:51:49 +00:00
Corinna Vinschen aaded2f90e * libc/include/sys/features.h (_POSIX_THREAD_ATTR_STACKADDR): Define
to 200112L for Cygwin.
2011-05-15 18:50:52 +00:00
Corinna Vinschen cdb4231369 * cygwin.din (pthread_attr_getguardsize): Export.
(pthread_attr_setguardsize): Export.
	(pthread_attr_setstack): Export.
	(pthread_attr_setstackaddr): Export.
	* init.cc (dll_entry): Remove wow64_test_stack_marker.  Check for
	unusual stack address by testing stack addresses from current TEB.
	Check validity of _my_tls by testing if it's within the stack as
	given in current TEB.
	* miscfuncs.cc (struct thread_wrapper_arg): New structure used to
	push all required information to thread_wrapper function.
	(thread_wrapper): Wrapper function for actual thread function.
	If an application stack has been given, change %ebp and %esp so that
	the thread function runs on that stack.  If the thread has been created
	by CygwinCreateThread, set up the POSIX guard pages if necessary.
	(CygwinCreateThread): New function.
	* miscfuncs.h (CygwinCreateThread): Declare.
	* ntdll.h (struct _TEB): Define all members up to Peb.
	* posix.sgml (std-susv4): Move pthread_attr_getguardsize,
	pthread_attr_setguardsize and pthread_attr_setstack here.
	(std-deprec): Add pthread_attr_setstackaddr.
	* sysconf.cc (sca): Set _SC_THREAD_ATTR_STACKADDR to
	_POSIX_THREAD_ATTR_STACKADDR.
	* thread.cc (pthread::precreate): Copy pthread_attr stackaddr and
	guardsize members.
	(pthread::create): Call CygwinCreateThread.
	(pthread_attr::pthread_attr): Initialize guardsize.
	(pthread_attr_setstack): New function.
	(pthread_attr_setstackaddr): New function.
	(pthread_attr_setguardsize): New function.
	(pthread_attr_getguardsize): New function.
	(pthread_getattr_np): Copy attr.guardsize.
	* thread.h (pthread_attr): Add member guardsize.
	* include/pthread.h (pthread_attr_getguardsize): Declare.
	(pthread_attr_setguardsize): Declare.
	* include/cygwin/version.h: Bump API minor number.
2011-05-15 18:49:40 +00:00
Corinna Vinschen 2922c6c4aa * include/winbase.h (STACK_SIZE_PARAM_IS_A_RESERVATION): Define. 2011-05-15 16:40:48 +00:00
Corinna Vinschen b4966f9139 * fhandler_process.cc (struct heap_info::heap): Convert base to
uintptr_t.  Add heap_id, end, flags members.
	(heap_info::heap_vm_chunks): Rename from heaps.
	(heap_info::heap_info): Rearrange using RtlQueryProcessDebugInformation
	to get information of heap virtual memory blocks.  Store heap id and
	flags, as well as end address of each block.
	(heap_info::fill_if_match): Check incoming base address against full
	address range of heap chunks.  Convert flag values in extra heap
	information.
	(format_process_maps): Change order so that heap check is done before
	MEM_MAPPED check since there are shareable heaps.
	* ntdll.h (PDI_HEAP_BLOCKS): Define.
	(HEAP_FLAG_NOSERIALIZE): Define.
	(HEAP_FLAG_GROWABLE): Define.
	(HEAP_FLAG_EXCEPTIONS): Define.
	(HEAP_FLAG_NONDEFAULT): Define.
	(HEAP_FLAG_SHAREABLE): Define.
	(HEAP_FLAG_EXECUTABLE): Define.
	(HEAP_FLAG_DEBUGGED): Define.
	(struct _DEBUG_HEAP_ARRAY): Define.
	(struct _DEBUG_HEAP_BLOCK): Define.
2011-05-13 06:50:20 +00:00
Corinna Vinschen 4fda571831 Based on newlib patch to strptime by Peter Rosin <peda@lysator.liu.se>:
* libc/time/strptime.c (is_leap_year): New static function.
	(first_day): Ditto.
	(__strptime): Fill in tm_yday when all of tm_year, tm_mon and tm_mday
	are updated. Fill in tm_mon, tm_mday and tm_wday when both of tm_year
	and tm_yday are updated.
2011-05-12 13:44:54 +00:00
Corinna Vinschen 4d1bf2fbb8 * libc/time/strptime.c (strptime): Fill in tm_yday when all of tm_year,
tm_mon and tm_mday are updated. Fill in tm_mon, tm_mday and tm_wday
	when both of tm_year and tm_yday are updated.
2011-05-12 13:41:22 +00:00
Corinna Vinschen 7bb76e751b * libc/time/strptime.c (first_day): Actually return the wday
of the first day of the year.
2011-05-12 12:43:43 +00:00
Yaakov Selkowitz 205b82080b * fhandler_proc.cc (format_proc_meminfo): Rewrite to use sysinfo().
Support RAM and swap space larger than 4GB.
Remove output elements not found with modern Linux kernels.
(format_proc_swaps): Support paging files larger than 4GB.
2011-05-12 11:13:02 +00:00
Corinna Vinschen 2fade21617 * autoload.cc: Remove useless comment. 2011-05-11 13:33:17 +00:00
Corinna Vinschen 31ddf45dd8 * autoload.cc (EnumProcessModules): Remove.
* dlfcn.cc (dlopen): Make sure errno is set if an error occurs.
	(dlsym): Rewrite using RtlQueryProcessDebugInformation instead of
	EnumProcessModules.
	* ntdll.h (struct _DEBUG_MODULE_ARRAY): Define.
	(RtlCreateQueryDebugBuffer): Declare.
	(RtlDestroyQueryDebugBuffer): Declare.
	(RtlQueryProcessDebugInformation): Declare.
2011-05-11 13:25:27 +00:00
Corinna Vinschen b27800ad45 * autoload.cc (GetModuleFileNameExW): Remove.
* autoload.cc (GetModuleInformation): Remove.
2011-05-11 10:41:03 +00:00
Corinna Vinschen 76f1b21604 * autoload.cc (QueryWorkingSet): Remove. 2011-05-11 10:34:27 +00:00
Corinna Vinschen 8285dae540 * fhandler_process.cc (format_process_maps): Rework to report
all mapped address space in a process (committed or reserved),
	identifying the nature of the mapping (mapped file/image, heap,
	shared memory) when possible.
	(dos_drive_mappings): New helper classes.
	(heap_info): Ditto.
	* ntdll.h (struct _MEMORY_SECTION_NAME): Define.
2011-05-11 10:31:22 +00:00
Corinna Vinschen 34a6eeabff * autoload.cc (GetProcessMemoryInfo): Remove.
* resource.cc (fill_rusage): Call NtQueryInformationProcess rather than
	GetProcessMemoryInfo to drop a psapi dependency.
2011-05-11 09:07:20 +00:00
Corinna Vinschen 933d2af50d * fhandler_socket.cc (get_inet_addr): Rearrange for better readability.
Make waiting loop interruptible and cancelable.  Check for SYSTEM DOS
	flag before reading the file.  Change return value to return 0 on
	success, SOCKET_ERROR on failure.
	(fhandler_socket::bind): Only set R/O DOS flag on filesystems not
	supporting ACLs.
	(fhandler_socket::connect): Accommodate changed return values from
	get_inet_addr.  Use SOCKET_ERROR instead of -1.
	(fhandler_socket::sendto): Accommodate changed return values from
	get_inet_addr.
	* syslog.cc (connect_syslogd): Ditto.
2011-05-11 08:20:17 +00:00
Christian Franke 3bcc74a9ae * security.cc (check_registry_access): Handle missing
security descriptor of HKEY_PERFORMANCE_DATA.
2011-05-10 17:19:37 +00:00
Corinna Vinschen b6151db104 * lc_msg.h: Regenerate. 2011-05-10 16:43:34 +00:00
Corinna Vinschen 94335e0842 * libc/locale/lmessages.c (_C_messages_locale): Add missing comma. 2011-05-10 16:37:14 +00:00
Corinna Vinschen c29e693388 * fhandler_proc.cc (format_proc_uptime): Don't call GetSystemInfo.
Fetch CPU count from wincap.
	(format_proc_stat): Ditto.
	* globals.cc (system_info): Move to wincap.
	* heap.cc (heap_init): Fetch page size from wincap.
	* syscalls.cc (getpagesize): Fetch allocation granularity from wincap.
	(getsystempagesize): Fetch page size from wincap.
	* wincap.cc (wincap_2003): Default is_server to false.
	(wincapc::init): Call GetSystemInfo here.  Always set is_server value.
	* wincap.h (class wincapc): Add system_info as private member.
	(wincapc::cpu_count): New public method.
	(wincapc::page_size): Ditto.
	(wincapc::allocation_granularity): Ditto.
2011-05-10 15:39:02 +00:00
Corinna Vinschen 6cfbf1a573 * cygwinenv.sgml: Move "forkchunk:xxx" to the removed options section.
Change text accordingly.
2011-05-10 10:23:57 +00:00
Corinna Vinschen e0d1c52693 * environ.cc (set_chunksize): Remove.
(parse_thing): Remove forkchunk entry.
	* fork.cc (child_copy): Drop handling external chunksize setting.
	* wincap.cc: Througout, drop chunksize.
	(wincapc::set_chunksize): Remove.
	* wincap.h (struct wincaps): Drop chunksize and declaration of
	set_chunksize.
2011-05-10 10:17:30 +00:00
Corinna Vinschen d2302a485f * Makefile.in: Don't override CC.
* cyglsa.c: Don't include wchar.h.  Declare wcscpy and wcslen instead.
	* cyglsa64.dll: Rebuild.
2011-05-10 10:06:51 +00:00
Corinna Vinschen 4964dafb65 * setup2.sgml (setup-env-ov): Make sure everybody knows that the
CYGWIN settings are just an example.
2011-05-10 08:56:04 +00:00
Doug Kwan 2e7bf520eb 2011-05-08 Doug Kwan <dougkwan@google.com>
Merge from gcc:

	2011-05-08  Doug Kwan  <dougkwan@google.com>

		* configure.ac: Propagate LDFLAGS_FOR_TARGET.
		* configure: Regenerated.
		* Makefile.tpl (LDFLAGS_FOR_TARGET): Use LDFLAGS_FOR_TARGET
		value from configure.
		* Makefile.in: Regenerated.
2011-05-09 17:56:47 +00:00
Paul Brook 481ff3f386 2011-05-09 Paul Brook <paul@codesourcery.com>
bfd/
	* elf32-tic6x.c (is_tic6x_elf_unwind_section_name,
	elf32_tic6x_fake_sections): New functions.
	(elf_backend_fake_sections): Define.

	gas/
	* config/tc-tic6x.c (streq): Define.
	(tic6x_get_unwind): New.
	(s_tic6x_cantunwind, s_tic6x_handlerdata, s_tic6x_endp,
	s_tic6x_personalityindex, s_tic6x_personality): New functions.
	(md_pseudo_table): Add "endp", "handlerdata", "personalityindex",
	"personality" and "cantunwind".
	(tic6x_regname_to_dw2regnum, tic6x_frame_initial_instructions,
	tic6x_start_unwind_section, tic6x_unwind_frame_regs,
	tic6x_pop_rts_offset_little, tic6x_pop_rts_offset_big,
	tic6x_unwind_reg_from_dwarf, tic6x_flush_unwind_word,
	tic6x_unwind_byte, tic6x_unwind_2byte, tic6x_unwind_uleb,
	tic6x_cfi_startproc, output_exidx_entry, tic6x_output_unwinding,
	tic6x_cfi_endproc): New.
	* config/tc-tic6x.h (TIC6X_NUM_UNWIND_REGS): Define.
	(tic6x_unwind_info): New.
	(tic6x_segment_info_type): Add marked_pr_dependency, unwind and
	text_unwind.
	(TARGET_USE_CFIPOP, tc_regname_to_dw2regnum,
	tc_cfi_frame_initial_instructions, DWARF2_DEFAULT_RETURN_COLUMN,
	DWARF2_CIE_DATA_ALIGNMENT, tc_cfi_startproc, tc_cfi_endproc,
	tc_cfi_section_name): Define.
	* doc/c-tic6x.texi: Document new unwinding directives.
	* dw2gencfi.c (tc_cfi_startproc, tc_cfi_endproc): Add default
	definitions.
	(cfi_insn_data, fde_entry, CFI_adjust_cfa_offset, CFI_return_column,
	CFI_rel_offset, CFI_escape, CFI_signal_frame, CFI_val_encoded_addr):
	Move to dw2gencfi.h.
	(CFI_EMIT_target): Define.
	(dot_cfi_sections): Check tc_cfi_section_name.
	(dot_cfi_startproc): Use tc_cfi_startproc.
	(dot_cfi_endproc): Use tc_cfi_endproc.
	* dw2gencfi.h (cfi_insn_data, fde_entry, CFI_adjust_cfa_offset,
	CFI_return_column, CFI_rel_offset, CFI_escape, CFI_signal_frame,
	CFI_val_encoded_addr):  Move to here from dw2gencfi.c.

	gas/testsuite:
	* gas/tic6x/unwind-1.d: New test.
	* gas/tic6x/unwind-1.s: New test.
	* gas/tic6x/unwind-2.d: New test.
	* gas/tic6x/unwind-2.s: New test.
	* gas/tic6x/unwind-3.d: New test.
	* gas/tic6x/unwind-3.s: New test.
	* gas/tic6x/unwind-bad-1.d: New test.
	* gas/tic6x/unwind-bad-1.s: New test.
	* gas/tic6x/unwind-bad-1.l: New test.
	* gas/tic6x/unwind-bad-2.d: New test.
	* gas/tic6x/unwind-bad-2.s: New test.
	* gas/tic6x/unwind-bad-2.l: New test.

	include/
	* elf/tic6x.h (ELF_STRING_C6000_unwind,
	ELF_STRING_C6000_unwind_info, ELF_STRING_C6000_unwind_once,
	ELF_STRING_C6000_unwind_info_once): Define.
2011-05-09 13:17:58 +00:00
Yaakov Selkowitz 0519948756 * new-features.sgml (ov-new1.7.10): Document clock_settime. 2011-05-09 08:58:59 +00:00
Yaakov Selkowitz 6758d2a3aa * times.cc (settimeofday): Add EFAULT handler.
Set errno to EINVAL if tv.tv_nsec is invalid, and to EPERM if
SetSystemTime fails.  Return -1 in case of failure, all for
compatibility with BSD and Linux.
(clock_settime): New function.
* cygwin.din (clock_settime): Export.
* posix.sgml (std-susv4): Add clock_settime.
Move clock_setres from here...
(std-deprec): ... to here.
(std-notes): Correct limitation of clock_setres to only CLOCK_REALTIME.
Add limitation of clock_settime to only CLOCK_REALTIME.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-09 08:57:46 +00:00
Corinna Vinschen b6a46e417b * registry.cc (get_registry_hive_path): Change system_printf to
debug_printf.
	(load_registry_hive): Ditto.
2011-05-07 18:56:39 +00:00
Christopher Faylor c395d22876 * fhandler.h (fhandler_base::close_with_arch): Make non-virtual.
(fhandler_base::open_fs): Move closer to it's close counterpart.
2011-05-06 20:22:45 +00:00
Christopher Faylor f4c566233f * fhandler.cc (fhandler_base::dup): Avoid duping a handle when an fhandler has
an archetype.
* fhandler_console.cc (fhandler_console::invisible_console): Move to the top.
(fhandler_console::set_close_on_exec): Don't set close-on-exec on handle since
it's an archetype and you don't know how many things could be using it.
2011-05-06 20:12:20 +00:00
Christopher Faylor b66dba56c5 * fhandler.h (fhandler_dev_dsp): Cosmetic change.
* fhandler_tty.cc (fhandler_pty_master::process_slave_output): Put back
Sleep(10) for tty_master case.
* sigproc.cc (stopped_or_terminated): Don't consider a pid which has been
reaped to be terminated.
2011-05-06 19:13:22 +00:00
Yaakov Selkowitz 57aac4bf26 * new-features.sgml (ov-new1.7.10): Document sysinfo. 2011-05-06 18:55:02 +00:00
Yaakov Selkowitz 2f52cad971 * sysconf.cc (sysinfo): New function.
* cygwin.din (sysinfo): Export.
* posix.sgml (std-gnu): Add sysinfo.
* include/sys/sysinfo.h (struct sysinfo): Define.
(sysinfo): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2011-05-06 18:53:21 +00:00
Corinna Vinschen cc718e26c6 * libc/minires-os-if.c (get_dns_info): Drop printing uninitialized
value of dwRetVal in debug output.
2011-05-06 18:43:37 +00:00
Corinna Vinschen a4e5706eb2 * fhandler.h (fhandler_socket::read): Declare.
(fhandler_socket::write): Declare.
	* fhandler_procsys.cc (fhandler_procsys::read): Add FIXME comment.
	(fhandler_procsys::write): Ditto.
	* fhandler_socket.cc (fhandler_socket::read): New method.
	(fhandler_socket::write): New method.
	* syscalls.cc: Rearrange order of read/write functions.
	(read): Call fhandler read method directly instead of just readv.
	(readv): Remove EINTR loop.  This is done in all affected fhandler's
	now.
	(write): Call fhandler write method directly instead of just writev.
	Fix debug output.
2011-05-06 10:56:37 +00:00
Christopher Faylor 92ddb74290 * cygheap.cc (cygheap::close_ctty): Close ctty via close_with_arch().
* debug.cc (close_handle): Call debugger on failure.
* devices.in (device::tty_to_real_device): Delete.
* devices.h (device::tty_to_real_device): Ditto.
* devices.cc: Regenerate.
* dtable.cc: Delete old ifdef'ed vfork code.
(dtable::release): Don't handle archetype here.
(dtable::init_std_file_from_handle): Consolidate console tests.  Generate
major/minor for tty ASAP.  Fix incorrect setting of DEV_TTYS* for serial.
(fh_alloc): New function derived from build_fh_pc.  Pass current tty when
building tty.
(build_pc_pc): Use fh_alloc to create.  Set name from fh->dev if appropriate.
Generate an archetype or point to one here.
(dtable::dup_worker): Deal with archetypes.  Rely on = operator copying whole
class rather than just fhandler_base.
(dtable::fixup_after_exec): Call close_with_arch to handle closing of fhandlers
with archetypes.
* fhandler.cc (fhandler_base::operator =): Call memcpy with fhandler's size()
rather than sizeof fhandler_base.
(fhandler_base::open_with_arch): New function.  Handles opening of fhandler's
with archetypes, dealing with usecounts, etc.
(fhandler_base::close_with_arch): Ditto for close.
* fhandler.h: Many changes for archetypes.
(fhandler_base::set_name): Set both normalized path and regular path.
(fhandler_base::open_with_arch): New function.
(fhandler_base::open_setup): Ditto.
(fhandler_base::use_archetype): Ditto.
(fhandler_base::_archetype_usecount): Ditto.
(fhandler_*::size): Ditto.
(fhandler_dev_tape::open): Remove virtual decoration.
(fhandler_console::use_archetype): New function.  Return true.
(fhandler_console::open_setup): New function.
(fhandler_console::dup): Delete.
(fhandler_tty_slave::fhandler_tty_slave): Redeclare to take an argument.
(fhandler_tty_slave::use_archetype): New function.  Return true.
(fhandler_tty_slave::cleanup): New function.
(fhandler_pty_master::use_archetype): New function.  Return true.
(fhandler_pty_master::cleanup): New function.
(fhandler_pty_master::is_tty_master): New function.  Return false.
(fhandler_tty_master::is_tty_master): New function.  Return true.
(fhandler_dev_dsp::fhandler_dev_dsp): New function.  Return true.
(report_tty_counts): Only report on archetype's usecount if there is one.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Remove handling of
setsid, set_ctty, set_flags, and manage_console_count.
(fhandler_console::open_setup): New function.  Implement functionality removed
from get_tty_stuff.
(fhandler_console::dup): Delete.
(fhandler_console::output_tcsetattr): Set errno on error.
(fhandler_console::fhandler_console): Set device early.
(fhandler_console::init): Use open_with_arch to open console handles.
(fhandler_console::fixup_after_fork_exec): Nuke most of the stuff for dealing
with console handles.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Remove archetype handling.
(fhandler_dev_dsp::write): Ditto.
(fhandler_dev_dsp::read): Ditto.
(fhandler_dev_dsp::close): Ditto.
(fhandler_dev_dsp::dup): Ditto.
(fhandler_dev_dsp::ioctl): Ditto.
(fhandler_dev_dsp::fixup_after_fork): Ditto.
(fhandler_dev_dsp::fixup_after_exec): Ditto.
* fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Add a little
more debugging.
(fhandler_tty_common::__release_output_mutex): Ditto.
(fhandler_pty_master::process_slave_output): Ditto.  Don't do signal handling
or pthread_cancel handling in the tty master thread.
(process_output): Minor reorg.
(fhandler_tty_slave::fhandler_tty_slave): Set device based on new ntty
argument.
(fhandler_tty_slave::open): Remove archetype handling.  Move some processing
into open_setup().
(fhandler_tty_slave::open_setup): New function.
(fhandler_tty_slave::cleanup): New function.
(fhandler_tty_slave::close): Remove archetype handling.  Move some processing
into cleanup().
(fhandler_tty_slave::init): Rename argument from f to h.  Open device using
open_with_arch().  Remove archetype handling.
(fhandler_pty_master::dup): Ditto.
(fhandler_pty_master::open): Ditto.
(fhandler_pty_master::close): Ditto.  Move some handling to cleanup().
(fhandler_pty_master::cleanup): New function.
(fhandler_tty_master::init_console): Give unique name to captive console
fhandler.
* pinfo.cc (_pinfo::set_ctty): Rename argument from arch to fh.  Eliminate
archetype assumption.
* syscalls.cc (close_all_files): Use close_with_arch for closing.
(open): Use open_with_arch() rather than open().
(close): Use close_with_arch() rather than close().
2011-05-05 22:30:53 +00:00
Corinna Vinschen d8ff96389f * pinfo.h (class push_process_state): New class to push a process state
flag temporarily into myself->process_state.
	* fhandler_console.cc (fhandler_console::read): Add push_process_state
	handler.
	(fhandler_console::write): Call bg_check from here.  Add
	push_process_state handler.
	* fhandler_tty.cc (fhandler_tty_slave::write): Ditto.
	(fhandler_tty_slave::read): Ditto.
	(fhandler_pty_master::write): Ditto.
	(fhandler_pty_master::read): Ditto.
	* syscalls.cc (readv): Remove bg_check call and setting process state.
	(writev): Ditto.
2011-05-05 19:43:04 +00:00