Commit Graph

33 Commits

Author SHA1 Message Date
Christopher Faylor 56a1971526 Throughout use "have_execed" macro rather than "hExeced" global handle.
Throughout rename _PROC_* to _CH_*.
* child_info.h: Include "pinfo.h".
(child_info_types): Rename _PROC_* -> _CH_* to avoid confusion with similarly
named constants.
(_PROC_*): Delete unneeded aliases.
(PROC_*): Ditto.
(CURR_CHILD_INFO_MAGIC): Ditto.
(cchildren): Define using "pinfo_minimal".
(child_info::set_saw_ctrl_c): Move to
(child_info_spawn::set_saw_ctrl_c): Here.
(child_info_spawn::lock): New field.
(child_info_spawn::hExeced): Ditto.
(child_info_spawn::ev): Ditto.
(child_info_spawn::~child_info_spawn): Move to sigproc.cc.
(child_info_spawn::child_info_spawn): Ditto.
(child_info_spawn::cleanup): Declare new function.
(child_info_spawn::set_saw_ctrl_c): Move to this class.  Set flag only when
execed and return true when we have set the flag.
(child_info_spawn::child_info_spawn::signal_myself_exited): New function.
(child_info_spawn::wait_for_myself): Ditto.
(child_info_spawn::has_execed_cygwin): Ditto.
(child_info_spawn::has_execed): Ditto.  Replaces "hExeced" test.
(child_info_spawn::operator HANDLE&): New operator.
(child_info_spawn::worker): Define old "spawn_guts" as class member.
(ch_spawn): Declare.
(have_execed): Define.
(have_execed_cygwin): Ditto.
* cygheap.h: Update comment.
* dcrt0.cc (get_cygwin_startup_info): Use _CH_* enums.
(child_info_spawn::handle_spawn): Ditto.
(dll_crt0_0): Ditto.
(multiple_cygwin_problem): Ditto.
* exceptions.cc (chExeced): Delete obsolete declaration.
(ctrl_c_handler): Reference set_saw_ctrl_c via new ch_spawn global.
* globals.cc (hExeced): Delete.
* pinfo.cc (pinfo::thisproc): Refer to cygheap as ::cygheap for consistency in
handle naming when -DDEBUGGING.
(pinfo::init): Accommodate case where myself.h is known but h0 is passed in.
(pinfo::pinfo): New constructor for setting up a pinfo passed in by previous
exec'or.
(pinfo::proc_waiter): Don't handle subprocess if we're in the process of
exiting due to an exec of a cygwin process.  Don't close rd_proc_pipe here.
Close it when we actually are finished with the process.  Use new
ch_spawn.signal_myself_exited function to let exec stub know that subprocess
has exited.
(pinfo::wait): Clarify debugging output.
(pinfo::release): Use "close_h" to close all handles to avoid races.
(winpids::add): Assume that elements of the array do not need to be zeroed and
are properly initialized or suffer problems on pinfo::release.  Don't close
hProcess since release does that now.
* pinfo.h: Update comment.
(pinfo_minimal): Move some elements from pinfo here so that child_info_spawn
can use them.
(pinfo): Inherit from pinfo_minimal.
(pinfo::pinfo): Modify to accommodate new pinfo_minimal.
(pinfo::allow_remove): New function.
* sigproc.cc (proc_subproc): Use boolean values for true/false.  Implement
PROC_EXEC_CLEANUP.
(proc_terminate): Set ppid = 1 since the procs list will only be iterated when
the process has not execed.  Don't do any cleanup here since it is now handled
in pinfo::release.
(sigproc_init): Initialize sync_proc_subproc earlier.
(child_info::child_info): Assume that all important fields are properly
initialized and avoid memset().
(child_info_spawn::child_info_spawn): Specifically test for execing and then
set up appropriate fields in the struct.
(child_info_spawn::cleanup): Define new function.
(child_info_spawn::record_children): Specifically test for being execed here.
Fill in pinfo_minimal part of children array.
(child_info_spawn::reattach_children): Use constructor to duplicate information
for previous exec'or.  Add more debugging output.
(remove_proc): Force deletion of thread when exiting due to exec.  Rely on
pinfo::cleanup in release.
* sigproc.h (PROC_EXEC_CLEANUP): New enum.
(PROC_DETACHED_CHILD): Delete.
* spawn.cc (chExeced): Delete.
(child_info_spawn::worker): Rename from spawn_guts.  Use elements of
child_info_spawn throughout rather than ch.whatever.  Use ::cygheap to refer to
global rather than element of child_info.  Use wait_for_myself() rather than
waitpid().  Call child_info_spawn::cleanup on function return.
(spawnve): Reflect movement of spawn_guts functionality into
child_info_spawn::worker.
* syscalls.cc (popen): Ditto.
* winsup.h (spawn_guts): Delete declaration.
2011-11-14 01:29:49 +00:00
Corinna Vinschen 516fbf67a0 * fhandler.cc (off_current): Define local in fhandler_base::raw_write.
Drop erroneous NO_COPY, add _RDATA to make R/O.
	(off_append): Ditto.
	* globals.cc (_RDATA): Move definition from here...
	* winsup.h: ...to here.
2011-11-03 17:47:33 +00:00
Christopher Faylor b79b15e9e3 * child_info.h (cchildren): New struct.
(child_info_spawn::nchildren): Rename from nprocs.
(child_info_spawn::children): Change type to cchildren for more bookkeeping
possibilities.
(child_info_spawn::child_info_spawn): Clear nchildren.
(child_info_spawn::record_children): Declare new function.
(child_info_spawn::reattach_children): Ditto.
* dcrt0.cc (child_info_spawn::handle_spawn): Call reattach_children to gather
list of processes we are potentially waiting for.
* pinfo.h (pinfo::pinfo): Make sure that rd_proc_pipe is always cleared.
(pinfo::reattach): New function.
* sigproc.cc: Move pinfo.h earlier so that it can be used in sigproc.h.
(get_proc_lock): Don't bother with a lock during DLL initialization.
(proc_subproc): Handle PROC_REATTACH_CHILD.
(proc_terminate): Orphan children only when we are not an execed process or
when the pid is about to be occupied by a non-cygwin process.
(child_info_spawn::record_children): Define new function.
(child_info_spawn::reattach_children): Ditto.
* sigproc.h (procstuff): Define PROC_REATTACH_CHILD and renumber other
elements.
* spawn.cc (spawn_guts): Record any to-be-waited-for subprocesses if about to
exec a cygwin process.
* sigproc.cc (sig_send): Fix harmless transposition of fifth and six arguments
to DuplicateHandle().
(child_info::child_info): Ditto.
* globals.cc (hExeced): Make NO_COPY.
2011-10-26 19:42:39 +00:00
Corinna Vinschen 69178ca038 * globals.cc (ro_u_ncfsd): New R/O unicode string.
* mount.cc (fs_info::update): Check for "NcFsd" FS.  Set flags and
	change comments accordingly.
	(fs_names): Add entry for NcFsd FS.
	* mount.h (enum fs_info_type): Add ncfsd.
	(class fs_info): Add ncfsd flag and accessor methods.
	* path.h (class path_conv): Add fs_is_ncfsd method.
	* syscalls.cc (unlink_nt): Experimentally try delete-on-close on NcFsd
	in STATUS_CANNOT_DELETE case.
2011-10-21 08:29:19 +00:00
Christopher Faylor b6510ccdcd * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
(child_info::old_title): Delete.
(child_info::~child_info_spawn): Remove recording of old_title.
* dcrt0.cc (title_buf): Delete.
(child_info_spawn::handle_spawn): Remove recording of old_title.
(dll_crt0_1): Get rid of all title handling.
(do_exit): Ditto.
* environ.cc (known): Delete strip_title and title.
* fhandler_console.cc (fhandler_console::write): Remove recording of old_title.
* globals.cc (exit_states): Remove ES_TITLE.
(display_title): Delete.
(strip_title_path): Delete.
(old_title): Delete.
* spawn.cc (spawn_guts): Remove old_title accommodation.
2011-06-09 21:20:27 +00:00
Christopher Faylor b86f999af1 whitespace elimination 2011-06-06 05:02:13 +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 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 a413f8a20e * devices.in: Throughout use slashes instead of backslashes in the
native path of devices not backed by native NT devices.
	* devices.cc: Regenerate.
	* globals.cc (ro_u_pmem): Use correct case.
	(ro_u_globalroot): New R/O unicode string.
	* path.cc (path_conv::check): Fix incorrect handling of /proc/sys
	block devices if they are just visited due to a component check.
	(symlink_info::posixify): Fix typo in comment.
	(cygwin_conv_path): Use ro_u_globalroot instead of string constant.
	(fast_cwd_version): New shared variable to store FAST_CWD version
	used on the system.
	(find_fast_cwd_pointer): Rename from find_fast_cwd_pointers.  Don't
	set global fast_cwd_ptr pointer here.  Return pointer value instead.
	(find_fast_cwd): New function to set fast_cwd_ptr and fast_cwd_version.
	(cwdstuff::override_win32_cwd): Call find_fast_cwd from here.
	Check for fast_cwd_version to differ between old and new FAST_CWD
	structure.  Check old_cwd for NULL to avoid SEGV.  Don't set CWD if
	we have neitehr a valid fast_cwd_ptr, nor a valid CWD handle in the
	process parameter block.
	(cwdstuff::set): Create Win32 path taking /proc/sys paths into account.
	* spawn.cc (spawn_guts): Recode creating runpath.  Also take /proc/sys
	paths into account.  Drop special CWD handling when starting non-Cygwin
	processes.
2011-02-15 15:25:59 +00:00
Christopher Faylor 589e430baa cygwin:
* cygwin.din: Export program_invocation_name and
	program_invocation_short_name.
	* dcrt0.cc: Set program_invocation*name to correct values, based on
	argv[0].
	* globals.cc (program_invocation_name): Define.
	(program_invocation_short_name): Ditto
newlib:
	* libc/include/sys/errno.h (program_invocation_name): Declare.
	(program_invocation_short_name): Ditto.
2010-12-26 21:11:38 +00:00
Christopher Faylor 5160c5f430 * dcrt0.cc (do_exit): Don't set thread termination until all fds have been
closed since an fd may rely on a thread.
* fhandler_tty.cc: Reformat comment.
(fhandler_pty_master::pty_master_thread): Refuse ERROR_PIPE_CONNECTED state as
an error.
* globals.cc (exit_states): Reorder ES_THREADTERM.
* path.cc (find_fast_cwd_pointers): Remove excessively wordy DEBUGGING output.
2010-10-24 18:50:57 +00:00
Christopher Faylor 92117cb21f * winlean.h: New file.
* automode.c: Use "winlean.h".
* binmode.c: Ditto.
* gmon.c: Ditto.
* textmode.c: Ditto.
* textreadmode.c: Ditto.
* winsup.h: Ditto.
* lib/cygwin_attach_dll.c: Ditto.
* lib/dll_main.cc: Ditto.
* profile.c: Ditto.
* crt0.c: Ditto.  Cleanup ancient cruft.  Add dummy calls to cygwin_premain*.
* include/sys/cygwin.h: Remove old stuff.  Move premain declarations nearer to
other cygwin-specific function declarations.
* globals.cc: Add comment.
2010-08-30 01:57:37 +00:00
Corinna Vinschen 893a8b78fc * 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.
2010-08-28 08:51:21 +00:00
Corinna Vinschen 1121c57f54 * external.cc (sync_wincwd): Remove.
(cygwin_internal): Drop CW_SYNC_WINCWD case.
	* globals.cc (ro_u_pipedir): New R/O unicode string.
	* ntdll.h (RtlSetCurrentDirectory_U): Declare.
	* path.cc (cwdstuff::set): Improve comments.  Drop setting Win32 CWD to
	\\?\PIPE\ on init.  Keep Win32 CWD in sync, if possible.  Set to
	\\?\PIPE\ otherwise.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Revert to 230.
	* include/sys/cygwin.h (cygwin_getinfo_types): Remove CW_SYNC_WINCWD.
2010-08-27 17:58:45 +00:00
Christopher Faylor 27f564e9a3 * Makefile.in (DLL_OFILES): Add pseudo-reloc.o.
* dcrt0.cc (child_info_fork::handle_fork): Call _pei386_runtime_relocator here.
(dll_crt0_1): Ditto for non-fork case.
* dll_init.cc (dll::init): Complain more in comment.  Clean up slightly.
(dll_dllcrt0_1): Call _pei386_runtime_relocator when we know we have a
filled-in per_process structure.
* globals.cc (__cygwin_user_data): Accommodate new fields for
_pei386_runtime_relocator.
* pseudo-reloc.cc: New file adapted from old lib/pseudo-reloc.c.  Include
winsup.h directly.  Collapse #ifdef __CYGWIN__ into one block.  Perform minor
whitespace code reformatting.
(__report_error): Use small_printf to output error.
(_pei386_runtime_relocator): Conditionalize for cygwin to take per_process
pointer parameter.
* winsup.h (_pei386_runtime_relocator): Declare.
* include/cygwin/version.h
(CYGWIN_VERSION_PER_PROCESS_API_VERSION_COMBINED): New macro.
(CYGWIN_VERSION_USER_API_VERSION_COMBINED): Use above macro.
(CYGWIN_VERSION_USE_PSEUDO_RELOC_IN_DLL): New macro.
(CYGWIN_VERSION_API_MINOR): Bump to 227.
* include/sys/cygwin.h: Remove obsolete comment.
(per_process::unused2): Shorten.
(per_process::pseudo_reloc_start): New field.
(per_process::pseudo_reloc_end): Ditto.
(per_process::image_base): Ditto.
* lib/_cygwin_crt0_common.cc: Declare pseudo runtime externs needed for
per_process structure.
(_cygwin_crt0_common): Fill in pseudo_reloc runtime constants.
* lib/pseudo-reloc-dummy.c: New file.  Dummy function to satisify ld.
* lib/pseudo-reloc.c: Delete.
2010-05-07 21:25:19 +00:00
Christopher Faylor c019a66c32 * globals.cc (exit_status): Add new ES_EXIT_STARTING enum.
* dcrt0.cc (cygwin_exit): Set exit_state to ES_EXIT_STARTING prior to calling
real exit.
* dll_init.cc (dll_list::detach): Remove dll from linked list and call
destructors even if exiting.  Don't call __cxa_finalize in exiting case.
2010-03-28 17:27:52 +00:00
Corinna Vinschen c04ed45d82 * globals.cc (ro_u_nwfs): New R/O unicode string.
* mount.cc (fs_info::update): Check for NWFS filesystem.  Set
	has_buggy_basic_info, if so.  Add comment to explain why.
	(fillout_mntent): Add "nwfs" string to fs_names array.
	* mount.h (enum fs_info_type): Add nwfs.
	(class fs_info): Add has_buggy_basic_info status flag.  Add accessors
	for has_buggy_basic_info and is_nwfs.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Accommodate
	filesystems with broken FileBasicInformation handling.
	* path.cc (symlink_info::check): Ditto.
	* path.h (path_conv::has_buggy_basic_info): Add method.
2010-01-12 14:47:46 +00:00
Corinna Vinschen 1b71ce005c Throughout, revert ill-conceived replacement of hMainThread with
GetCurrentThread/NtCurrentThread.
	* dcrt0.cc (dll_crt0_0): Duplicate main thread handle to hMainThread
	again.
2009-12-21 09:38:25 +00:00
Corinna Vinschen f16706de97 Throughout, replace hMainProc with GetCurrentProcess/NtCurrentProcess
according to context.  Throughout, replace hMainThread with
	GetCurrentThread/NtCurrentThread according to context.
	* dcrt0.cc (dll_crt0_0): Drop duplication of GetCurrentProcess to
	hMainProc.  Drop duplication of GetCurrentThread to hMainThread.
	* dtable.cc (dtable::stdio_init): Remove useless comment.
	* globals.cc (hMainProc): Remove.
	(hMainThread): Remove.
	* ntdll.h (NtCurrentProcess): Define.
	(NtCurrentThread: Define.
2009-12-18 20:32:04 +00:00
Corinna Vinschen d9e9c7b5a7 * globals.cc (ro_u_dll): New R/O unicode string.
* syscalls.cc (nt_path_has_executable_suffix): Add ro_u_dll to
	blessed_executable_suffixes array.  Explain why.
2009-11-21 12:44:13 +00:00
Corinna Vinschen b36d8c46e5 * globals.cc (ro_u_scr): New R/O unicode string.
(ro_u_sys): Ditto.
	* syscalls.cc (nt_path_has_suffix): Replace with ...
	(nt_path_has_executable_suffix): New function checking for explicit
	executable suffixes.
	(rename): Call nt_path_has_executable_suffix instead of
	nt_path_has_suffix.  Check oldpath for nt_path_has_executable_suffix
	as well to set old_explicit_suffix.
2009-11-06 20:51:03 +00:00
Corinna Vinschen 526b0fbca3 * cygprops.h: New file.
* dtable.cc (handle_to_fn): Add check for correct installation_key
	string in object name for pipes and ttys.
	* external.cc (cygwin_internal): Add CW_GET_INSTKEY to allow fetching
	the installation_key from cygserver.
	* fhandler_fifo.cc (fhandler_fifo::fifo_name): Add installation_key
	to fifo name.
	* globals.cc: Include cygprops.h.
	(_RDATA): Move slightly and add comment.
	(cygwin_props): Define.
	* mount.cc (mount_info::init): Accommodate the fact that
	installation_root is now a global variable in DLL common shared memory,
	rather than a member of cygwin_shared.
	* pipe.cc (fhandler_pipe::create_selectable): Add installation_key to
	pipe name.
	* shared.cc (installation_root): Define here for storage in DLL
	common shared memory.
	(installation_key): Ditto.
	(installation_key_buf): Ditto.
	(init_installation_root): Convert from shared_info method to ordinary
	function.  Add initializing installation_key.  Invalidate
	installation_key depending of value of disable_key property.  Add
	comment to explain.
	(get_shared_parent_dir): Add installation_key to directory name.
	(get_session_parent_dir): Ditto.
	(shared_info::initialize): Move call to init_installation_root from
	here...
	(memory_init): ...to here.  Add debug output to print installation root
	and installation key.  Add comment to explain why.
	* shared_info.h (SHARED_INFO_CB): Recalculate.
	(CURR_SHARED_MAGIC): Ditto.
	(class shared_info): Remove definition of installation_root and
	declaration of init_installation_root.
	(init_installation_root): Declare.
	(installation_root): Declare.
	(installation_key): Declare.
	* uinfo.cc (pwdgrp::load): Accommodate the fact that installation_root
	is now a global variable in DLL common shared memory.
	* include/cygwin/version.h: Bump API minor number.
	(CYGWIN_INFO_INSTALLATIONS_NAME): Add.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_INSTKEY.
2009-10-31 13:24:06 +00:00
Christopher Faylor a12518a37c * exceptions.cc: Move global variable sigExeced...
* globals.cc: here.
* pinfo.cc (pinfo::maybe_set_exit_code_from_windows): Remove now unneeded
declaration.
2009-10-06 03:39:38 +00:00
Corinna Vinschen 11788f8ce0 * globals.cc (ro_u_volume): New R/O unicode string.
* path.cc (symlink_info::check_reparse_point): Fix check for volume
	mount points to work on Vista and later as well.
2009-08-24 11:14:30 +00:00
Corinna Vinschen 900f20710f * globals.cc (enum exit_states::ES_GLOBAL_DTORS): Delete.
* dcrt0.cc (__main): Schedule dll_global_dtors to run
	atexit before global dtors.
	(do_exit): Delete test for ES_GLOBAL_DTORS and call to
	dll_global_dtors.
2009-07-30 15:48:51 +00:00
Corinna Vinschen 0fb0fb8391 * globals.cc: Improve comment on R/O UNICODE_STRINGs.
* mount.h (class fs_info): Add is_mvfs bit.
	* mount.cc (fs_info::update): Recognize MVFS remote filesystem.
	(fillout_mntent): Reorder filesystem checks for speed.  Add
	mvfs, unixfs, and sunwnfs filesystem types.
	* path.h (class path_conv): Add fs_is_mvfs method.
	* path.cc (symlink_worker): On MVFS, always create symlinks as
	Windows shortcuts.  Explain why.
2009-07-17 09:00:19 +00:00
Corinna Vinschen fc261e53f0 * globals.cc: Reorder constant UNICODE_STRINGs for clarity.
* mount.h (fs_info::sttaus): Move filesystem type flags into
	substructure.  Add union to allow simple test for having set any
	one filesystem type flag.  Replace has_buggy_open flag with is_sunwnfs
	flag.  Replace has_buggy_fileid_dirinfo with is_unixfs flag.
	(fs_info::got_fs): New private method.
	(fs_info::has_buggy_open): New explicit implementation.
	(fs_info::has_buggy_fileid_dirinfo): Ditto.
	* mount.cc (fs_info::update): Optimize filesystem checks for speed.
	* winsup.h (IMPLEMENT_STATUS_FLAG): Change write accessor to return
	value just set.
2009-07-16 09:56:25 +00:00
Corinna Vinschen 8deb411836 Throughout avoid having to initialize constant UNICODE_STRINGs.
* globals.cc: Define constant UNICODE_STRINGs and store in .rdata
	section.
	* fhandler_disk_file.cc: Throughout, use readonly UNICODE_STRINGs
	rather then initializing local UNICODE_STRING variable where
	applicable.
	* fhandler_mem.cc (fhandler_dev_mem::open): Ditto.
	* flock.cc (inode_t::inode_t): Ditto.
	* mmap.cc: Ditto.
	* syscalls.cc: Ditto.
	* mount.cc (fs_info::update): Ditto.
	* path.cc: Ditto.

	* ntdll.h (RtlEqualUnicodePathPrefix): Redefine to take prefix as
	UNICODE_STRING.
	(RtlEqualUnicodePathSuffix): Redefine to take suffix as UNICODE_STRING.
	* fhandler_disk_file.cc: Accommodate throughout.
	* mount.cc (fs_info::update): Ditto.
	* path.cc (cwdstuff::set): Ditto.
	* syscalls.cc: Ditto.
2009-07-14 17:37:42 +00:00
Corinna Vinschen 472345a06c * globals.cc (active_codepage): Remove. 2009-07-14 16:24:33 +00:00
Dave Korn b602bb90e2 winsup/ChangeLog:
* Makefile.common (COMPILE_CXX): Add support for per-file overrides
	to exclude $(nostdinc) and $(nostdincxx) from compiler flags.
	(COMPILE_CC): Likewise for $(nostdinc).

winsup/cygwin/ChangeLog:

	* Makefile.in (DLL_OFILES): Add libstdcxx_wrapper.o
	(libstdcxx_wrapper_CFLAGS): Add flags for new module.
	(_cygwin_crt0_common_STDINCFLAGS): Define per-file override.
	(libstdcxx_wrapper_STDINCFLAGS, cxx_STDINCFLAGS): Likewise.
	* cxx.cc: Include "cygwin-cxx.h".
	(operator new): Tweak prototype for full standards compliance.
	(operator new[]): Likewise.
	(operator new (nothrow)): New fallback function.
	(operator new[] (nothrow), operator delete (nothrow),
	operator delete[] (nothrow)): Likewise.
	(default_cygwin_cxx_malloc): New struct of pointers to the above,
	for final last-resort fallback default.
	* cygwin-cxx.h: New file.
	(struct per_process_cxx_malloc): Define.
	(default_cygwin_cxx_malloc): Declare extern.
	* cygwin.din (__wrap__ZdaPv): Export new wrapper.
	(__wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
	__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
	__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
	__wrap__ZnwjRKSt9nothrow_t): Likewise.
	* globals.cc (__cygwin_user_data): Init newly-repurposed 'forkee'
	field (now 'cxx_malloc') to point to default_cygwin_cxx_malloc.
	* libstdcxx_wrapper.cc: New file.
	(__wrap__ZdaPv, __wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
	__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
	__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
	__wrap__ZnwjRKSt9nothrow_t): Define wrapper functions for libstdc++
	malloc operators and their overrides.
	* winsup.h (default_cygwin_cxx_malloc): Declare extern.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* include/sys/cygwin.h (struct per_process_cxx_malloc): Forward
	declare here.
	(struct per_process::forkee): Rename and repurpose from this ...
	(struct per_process::cxx_malloc): ... to this.
	* lib/_cygwin_crt0_common.cc: Include cygwin-cxx.h.
	(WEAK): Define shorthand helper macro.
	(__cygwin_cxx_malloc): Define and populate with weak references
	to whatever libstdc++ malloc operators will be visible at final
	link time for Cygwin apps and dlls.
	(_cygwin_crt0_common): Always look up cygwin DLL's internal
	per_process data, and don't test for (impossible) failure.  Inherit
	any members of __cygwin_cxx_malloc that we don't have overrides
	for from the DLL's default and store the resulting overall set of
	overrides back into the DLL's global per_process data.
2009-07-07 20:12:44 +00:00
Corinna Vinschen 161211d186 * ctype.cc (_CTYPE_DATA_0_127): Add _B class to TAB character.
(__ctype_default): New character class array for default ASCII
	character set.
	(__ctype_iso): New array of character class array for ISO charsets.
	(__ctype_cp): Ditto for singlebyte Windows codepages.
	(tolower): Implement as distinct function to support any singlebyte
	charset.
	(toupper): Ditto.
	(__set_ctype): New function to copy singlebyte character classes
	corresponding to current charset to ctype_b array.
	Align copyright text to upstream.
	* dcrt0.cc (dll_crt0_1): Reset current locale to "C" per POSIX.
	* environ.cc (set_file_api_mode): Remove.
	(codepage_init): Remove.
	(parse_thing): Remove "codepage" setting.
	(environ_init): Set locale according to environment settings, or
	to current codepage, before converting environment to multibyte.
	* fhandler.h (fhandler_console::write_replacement_char): Drop argument.
	* fhandler_console.cc (dev_console::str_to_con): Call sys_cp_mbstowcs
	rather than MultiByteToWideChar.
	(fhandler_console::write_replacement_char): Always print a funny
	half filled square if a character isn't in the current charset.
	(fhandler_console::write_normal): Convert to using __mbtowc
	rather than next_char.
	* fork.cc (frok::child): Drop call to set_file_api_mode.
	* globals.cc (enum codepage_type) Remove.
	(current_codepage): Remove.
	* miscfuncs.cc (cygwin_wcslwr): Unused, dangerous.  Remove.
	(cygwin_wcsupr): Ditto.
	(is_cp_multibyte): Remove.
	(next_char): Remove.
	* miscfuncs.h (is_cp_multibyte): Drop declaration.
	(next_char): Ditto.
	* strfuncs.cc (get_cp): Remove.
	(__db_wctomb): New function to implement _wctomb_r functionality for
	doublebyte charsets using WideCharToMultiByte.
	(__sjis_wctomb): New function to replace unusable newlib function.
	(__jis_wctomb): Ditto.
	(__eucjp_wctomb): Ditto.
	(__gbk_wctomb): New function.
	(__kr_wctomb): Ditto.
	(__big5_wctomb): Ditto.
	(__db_mbtowc): New function to implement _mbtowc_r functionality for
	doublebyte charsets using MultiByteToWideChar.
	(__sjis_mbtowc): New function to replace unusable newlib function.
	(__jis_mbtowc): Ditto.
	(__eucjp_mbtowc): Ditto.
	(__gbk_mbtowc): New function.
	(__kr_mbtowc): New function
	(__big5_mbtowc): New function
	(__set_charset_from_codepage): New function.
	(sys_wcstombs): Reimplement, basically using same wide char to multibyte
	conversion as newlib's application level functions.  Plus extras.
	Add lengthy comment to explain.  Change return type to size_t.
	(sys_wcstombs_alloc): Just use sys_wcstombs.  Change return type to
	size_t.
	(sys_cp_mbstowcs): Replace sys_mbstowcs, take additional codepage
	argument.  Explain why.  Change return type to size_t.
	(sys_mbstowcs_alloc): Just use sys_mbstowcs.  Change return type to
	size_t.
	* wchar.h: Declare internal functions implemented in strfuncs.cc.
	(wcscasecmp): Remove.
	(wcsncasecmp): Remove.
	(wcslwr): Remove.
	(wcsupr): Remove.
	* winsup.h (codepage_init): Remove declaration.
	(get_cp): Ditto.
	(sys_wcstombs): Align declaration to new implementation.
	(sys_wcstombs_alloc): Ditto.
	(sys_cp_mbstowcs): Add declaration.
	(sys_mbstowcs): Define as inline function.
	(sys_mbstowcs_alloc): Align declaration to new implementation.
	(set_file_api_mode): Remove declaration.
	* include/ctype.h (isblank): Redefine to use _B character class.
	(toupper): Remove ASCII-only definition.
	(tolower): Ditto.
2009-03-24 12:18:34 +00:00
Christopher Faylor 66a83f3eac Remove unneeded header files from source files throughout. Update copyrights
where appropriate.
* globals.cc: New file for generic global variables.
* mkglobals_h: New file to generate globals.h.
* mkstatic: New Script used to build a (currently non-working) static
libcygwin_s.a.
* Makefile.in: Add unused rule to build a non-working libcygwin_s.a.
(DLL_OFILES): Add globals.o.  Make all objects rely on globals.h.
(globals.h): New target.  Generate globals.h.
* cygtls.h: Honor new CYGTLS_HANDLE define to control when the HANDLE operator
is allowed in _cygtls.
* dcrt0.cc: Move most globals to globals.cc.
* init.cc: Ditto.
* environ.cc (strip_title_path): Remove now-unneeded extern.
* fhandler_serial.cc (fhandler_serial::open): Ditto.
* pinfo.cc: Ditto.
(commune_process): Ditto.
* shared.cc: Ditto.
* glob.cc: Ditto.
* strace.cc: Ditto.
* exceptions.cc: Define CYGTLS_HANDLE before including winsup.h.
* path.cc (stat_suffixes): Move here.
* security.h: Add forward class path_conv declaration.
* smallprint.cc (__small_vsprintf): Make a true c++ function.
(__small_sprintf): Ditto.
(small_printf): Ditto.
(console_printf): Ditto.
(__small_vswprintf): Ditto.
(__small_swprintf): Ditto.
* spawn.cc (spawn_guts): Remove _stdcall decoration in favor of regparm.
(hExeced): Move to globals.cc
* strfuncs.cc (current_codepage): Ditto.
(active_codepage): Ditto.
* sync.cc (lock_process::locker): Move here from dcrt0.cc.
* syscalls.cc (stat_suffixes): Move to path.cc.
* tty.cc (tty::create_master): Uncapitalize fatal warning for consistency.
* winsup.h: Include globals.h to declare most of the grab bag list of globals
which were previously defined here.
* mount.h: Move USER_* defines back to shared_info.h.
* speclib: Force temporary directory cleanup.
2009-01-03 05:12:22 +00:00