Commit Graph

7588 Commits

Author SHA1 Message Date
Dave Korn 97bef5b7fd * winbase.h (ilockexch): Avoid making 'ret' volatile.
(ilockcmpexch): Likewise.
2009-07-07 21:41:43 +00:00
Dave Korn cd6c79f4fe * ChangeLog: Assorted minor whitespace fixes in old entries. 2009-07-07 20:25:34 +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 6499c6e07b * cygtls.cc (_cygtls::remove): Fix typo. 2009-07-07 08:07:38 +00:00
Christopher Faylor 37b9360dc6 * Makefile.in (clean): Clean generated files in srcdir.
* tlsoffsets.h: Regenerate.
2009-07-06 23:19:08 +00:00
Christopher Faylor 421dde25fa * cygtls.cc (_cygtls::remove): Avoid closing a NULL handle. 2009-07-06 23:05:10 +00:00
Corinna Vinschen 58fc288ada * fhandler_socket.cc (fhandler_socket::recv_internal): Convert wsabuf
and wsacnt to references.  Fix handling of WSAEMSGSIZE.
2009-07-06 20:30:34 +00:00
Corinna Vinschen 023c25829c * cygtls.h (struct _local_storage): Add thread storage pointers for
memory used by socket select functions.  Combine them into a single
	struct select.
	* cygtls.cc: Accommodate above change throughout.
	(_cygtls::init_thread): Drop initalizing of sockevt to
	INVALID_HANDLE_VALUE.
	(_cygtls::fixup_after_fork): Reset sockevt to NULL.
	(_cygtls::remove): Don't use sockevt value to bail out prematurely.
	Set sockevt to NULL.  Free malloced select members.
	* select.h (struct select_socket_info): Drop max_w4 member.
	* select.cc (thread_socket): Use INFINITE timeout value if number of
	objects to wait for is <= MAXIMUM_WAIT_OBJECTS.  Use num_w4 member
	of select_socket_info struct rather than dropped max_w4.
	(init_tls_select_info): New inline function to initialize TLS select
	members.
	(start_thread_socket): Just call init_tls_select_info to initialize TLS
	select members and use them later on.
	(socket_cleanup): Don't free select_socket_info pointer members since
	they are thread local now.
2009-07-06 15:42:01 +00:00
Christopher Faylor 1183d7fb13 * dtable.cc (handle_to_fn): Detect failing NtQueryObject. 2009-07-06 15:11:30 +00:00
Corinna Vinschen e4001d4ccd * autoload.cc: Delete stray CR. 2009-07-06 10:44:14 +00:00
Christopher Faylor 5ea3e685eb * fhandler_console.cc: Change workstation -> windows station throughout. 2009-07-05 16:49:56 +00:00
Christopher Faylor cea37699d1 * cygwin-console-helper.cc: New file. 2009-07-05 00:01:26 +00:00
Christopher Faylor 01d8a2dfd6 * autoload.cc (SetParent): Add new import.
* fhandler.h (fhandler_console::create_invisible_console): Declare new
function.
(create_invisible_console_workaround): Ditto.
* fhandler_console.cc (fhandler_console::create_invisible_console): Define new
function.
(create_invisible_console_workaround): Ditto.  Add too much code to deal with
broken Windows 7.  Use a helper app to start an invisible console window.
(fhandler_console::need_invisible): Reorganize to use helper functions to
create invisible console.
* spawn.cc (spawn_guts): Avoid zeroing already zeroed fields in si.
2009-07-04 23:51:10 +00:00
Dave Korn 38a58dd13c * autoload.cc (AttachConsole): Correct size of args. 2009-07-04 14:51:09 +00:00
Christopher Faylor 3c4f2024a1 * dcrt0.cc (jit_debug): New global.
(initial_env): Set jit_debug when we are automatically starting a gdb process.
* dtable.cc (dtable::get_debugger_info): Don't tty tricks when we are being
debugged by our own captive gdb, as determined by jit_debug == true.
(dtable::init_std_file_from_handle): Detect errors when initializing a tty
early rather than at random points later.
* fhandler.h (fhandler_*::init): Return int to indicate success/failure.
* fhandler.cc (fhandler_base::init): Reflect change in return value.
* pipe.cc (fhandler_pipe::init): Ditto.
(fhandler_pipe::create_selectable): Don't say we're retrying when we aren't.
* fhandler_console.cc (fhandler_console::init): Ditto.  Return success/failure.
* fhandler_serial.cc (fhandler_serial::init): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::init): Ditto.
(fhandler_tty_slave::open): Make debugging output more detailed.
* tty.cc (tty_list::terminate): Don't close I/O handles before all slaves have
checked in.
(tty::slave_alive): Make a non-inlined function.  Check if tty pipe handles can
be created as an additional exists check.
* tty.h (tty::slave_alive): Just define here.
2009-07-03 18:05:51 +00:00
Corinna Vinschen 3e62013829 * new-features.sgml (ov-new1.7-file): Add fpurge and mkstemps to new
API functions.
2009-07-03 13:06:34 +00:00
Corinna Vinschen 8d7471ab44 * posix.sgml: Add fpurge and mkstemps to BSD list. 2009-07-03 13:04:01 +00:00
Corinna Vinschen e5f37aa148 * cygwin.din (fpurge, mkstemps): New exports.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* mktemp.cc (_gettemp): Add parameter.
	(mkstemps): New function.
	(mkstemp, mkdtemp, mktemp): Adjust clients.
2009-07-03 13:01:17 +00:00
Corinna Vinschen a4175657bf * autoload.cc: Fix typo in comment.
(ShowWindowAsync): Define.
	(AttachConsole): Define.
	* fhandler_console.cc (fhandler_console::need_invisible): Add band-aid
	for Windows 7 AllocConsole bug.
2009-07-03 10:50:51 +00:00
Christopher Faylor 75da5017d7 Clean up some sources.redhat.com references. 2009-07-01 22:07:31 +00:00
Corinna Vinschen d3920e10ad * net.cc (get_xp_ifs): Fix typo in comment. 2009-07-01 15:45:23 +00:00
Corinna Vinschen 128b854b57 * lib/comctl32.def (StrCSpnA@8, StrCSpnIA@8, StrCSpnW@8, StrChrA@8,
StrChrIA@8, StrChrIW@8, StrChrW@8, StrCmpNA@12, StrCmpNIA@12,
	StrCmpNIW@12, StrCmpNW@12, StrRChrA@12, StrRChrIA@12, StrRChrW@12,
	StrRStrIA@12, StrRStrIW@12, StrStrA@8, StrStrIA@8, StrStrIW@8,
	StrStrW@8, StrToIntA@4, StrToIntW@4): Remove erroneously defined
	entry points.
2009-07-01 11:06:12 +00:00
Corinna Vinschen 975a630109 * fhandler.h (class fhandler_socket): Add class members and methods
to store and retrieve the SO_RCVBUF and SO_SNDBUF sizes.
	* fhandler_socket.cc (fhandler_socket::dup): Duplicate new members.
	(fhandler_socket::send_internal): Check for SO_SNDBUF size and
	restrict send to 1 byte less per KB 823764.  Leave loop immediately
	if WSASendMsg has been used.
	* net.cc (fdsock): Change comment again.  Set buffer sizes to 65536.
	Store values in fhandler_socket.
	(cygwin_setsockopt): Store SO_RCVBUF and SO_SNDBUF sizes in
	fhandler_socket.
	(cygwin_sendto): Drop call to sig_dispatch_pending.
	(cygwin_recvfrom): Ditto.
	(cygwin_recvmsg): Ditto.
	(cygwin_sendmsg): Ditto.
2009-07-01 09:16:17 +00:00
Christopher Faylor b4fa816474 * select.h: New file split from fhandler.h.
(select_record::select_record): Define do-nothing constructor for "new" to
avoid gratuitous zeroing.
(select_info): New base class.
(select_pipe_info): New class with methods for dealing with pipes.
(select_socket_info): New class with methods for dealing with sockets.
(select_serial_info): Dummy class for serial.
(select_mailslot_info): Dummy class for mailslots.
(select_stuff): Define device_specific_* as actual classes rather than void *.
* dtable.h (dtable::select_read): Accommodate return value change to 'bool' and
argument change to "select_stuff".
(dtable::select_write): Ditto.
(dtable::select_except): Ditto.
* dtable.cc (dtable::select_read): Accommodate return value change to 'bool'
and argument change to "select_stuff".
(dtable::select_write): Ditto.
(dtable::select_except): Ditto.
* fhandler.h: Excise select-related classes.
(fhandler_*::select_read): Change argument to select_stuff.
(fhandler_*::select_write): Ditto.
(fhandler_*::select_except): Ditto.
* select.cc (UNIX_FD_ZERO): Use memset rather than bzero.
(select_stuff::test_and_set): Change return type to bool.  Allocate
select_record on entry and let fhandler_*::select_* operate on the start.next
field of select_stuff.
(pipeinf): Delete.
(select_pipe_info::select_pipe_info): New constructor.  Allocates event for
controlling pipe waits.
(select_pipe_info::~select_pipe_info): New destructor.  Destroy event.  Stop
thread.
(select_pipe_info::add_watch_handle): New function.
(thread_pipe): Wait for the hEvent part of any overlapped pipes before peeking.
(start_thread_pipe): Don't allocate device_specific_pipe stuff here.  Assume
that it has been allocated earlier.
(pipe_cleanup): Rely on select_pipe_info destructor to clean up pipe
paraphenalia.
(fhandler_*::select_*): Derive select_record from new select_stuff argument.
(fhandler_pipe::select_*): Ditto.  Allocate pipe-specific field if not already
allocated.
(serialinf): Delete.
(thread_serial): serialinf -> select_serial_info.
(fhandler_base::ready_for_read): Rewrite to accommodate change in argument to
fhandler_*::select_*.
(socketinf): Delete.
(thread_socket): socketinf -> select_socket_info.
(mailslotinf): Delete.
(thread_mailslot): mailslotinf -> select_mailslot_info.
2009-06-30 21:18:44 +00:00
Christopher Faylor 840bb39798 * fhandler.cc (fhandler_base::has_ongoing_io): Accept an argument indicating
whether the overlapped event should be tested.
(fhandler_base::read_overlapped): Pass is_overlapped state to has_ongoing_io.
(fhandler_base::write_overlapped): Ditto.
* fhandler.h (fhandler_base::has_ongoing_io): Accommodate argument change.
* select.cc (peek_pipe): Ditto.
2009-06-30 14:36:11 +00:00
Corinna Vinschen 4a83803381 * net.cc (fdsock): Set default socket buffer sizes to 65520. Change
comment accordingly.
	* fhandler_socket.cc (fhandler_socket::send_internal): Set maximum
	send size to 65520 as well.
2009-06-30 10:36:40 +00:00
Christopher Faylor 9adef9ffef * select.cc (peek_pipe): Turn on (temporarily?) the experimental code which
tries to determine when a pipe is writable.
2009-06-29 14:32:58 +00:00
Christopher Faylor 7fc7ee1726 * select.cc (peek_pipe): Use has_ongoing_io() to determine if the pipe is ready
for writing rather than performing brute-force checks.
2009-06-28 19:27:15 +00:00
Christopher Faylor c81ceaefec * fhandler.h (fhandler_base::has_ongoing_io): Declare new function.
* fhandler.cc (fhandler_base::has_ongoing_io): Define new function.
(fhandler_base::read_overlapped): Use has_ongoing_io to avoid writing when
handle has not completed last I/O.
(fhandler_base::write_overlapped): Ditto.
* select.cc (peek_pipe): Be more careful about accessing hEvent field from
get_overlapped().
2009-06-28 19:23:13 +00:00
Christopher Faylor 91000b5d66 * gendef (cleanup): Rename from 'nocr'. Remove comments and trailing spaces.
* cygwin.din: Add long-needed comment describing what dll_crt0__FP11per_process
demangles to.
2009-06-28 18:23:35 +00:00
Corinna Vinschen 8d1d548fd8 * wincap.h (wincaps::has_broken_alloc_console): New element.
* wincap.cc: Implement above element throughout.
2009-06-26 15:12:06 +00:00
Corinna Vinschen 21a49eaeeb * sec_auth.cc (lsaauth): Close unused handle.
(lsaprivkeyauth): Ditto.
2009-06-25 08:22:09 +00:00
Corinna Vinschen 9ed8b4d807 * include/wtsapi32.h (WTSQueryUserToken, WTSEnumerateSessionsW,
WTSEnumerateSessionsA): Add function prototypes.
	(struct _WTS_SESSION_INFOW, struct _WTS_SESSION_INFOA): Add typedefs.
	(WTS_SESSION_INFO, PWTS_SESSION_INFO, WTSEnumerateSessions): Add
	defines dependent on UNICODE setting.
2009-06-24 10:30:07 +00:00
Corinna Vinschen e192c48eec * faq-setup.xml (faq.setup.setup-fails-on-ts): Fix another typo. 2009-06-24 07:57:03 +00:00
Corinna Vinschen f95b410d77 * faq-setup.xml (faq.setup.setup-fails-on-ts): Fix typo. 2009-06-24 07:49:37 +00:00
Corinna Vinschen f948b1050e * faq-setup.xml (faq.setup.setup-failes-on-ts): Change rebaseall to
rebase.
2009-06-23 16:16:57 +00:00
Corinna Vinschen fe0dbf69f9 * faq-setup.xml (faq.setup.setup-failes-on-ts): New FAQ entry. 2009-06-23 15:52:20 +00:00
Corinna Vinschen bc4020d725 * sec_auth.cc (get_server_groups): Ignore errors from
get_user_local_groups.
2009-06-23 10:23:16 +00:00
Corinna Vinschen d6bb3f330d * spawn.cc (spawn_guts): Don't run additional check for Win32
incompatible CWD if newargv.fixup bailed out already.
	(av::fixup): Check shell scripts for executability.
2009-06-22 15:40:59 +00:00
Corinna Vinschen d66550cae6 * new-features.sgml (ov-new1.7-misc): Add new link libs.
* setup2.sgml (setup-locale-ov): Explain locale-specific wcwidth
	feature.
2009-06-19 09:33:45 +00:00
Corinna Vinschen 1279c76b6a * path.cc (chdir): Check error conditions first. 2009-06-18 09:47:13 +00:00
Chris Sutcliffe 339dde8fe5 2009-06-16 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* include/stdlib.h (_wtof): Define.
2009-06-17 22:01:36 +00:00
Corinna Vinschen 3477392bd7 * fhandler_socket.cc (fhandler_socket::recv_internal): Mark WSARecvMsg
as NO_COPY.
2009-06-17 08:23:17 +00:00
Christopher Faylor 6a451dce26 * fhandler.cc (fhandler_base::read_overlapped): Use a better variable name. 2009-06-16 20:33:45 +00:00
Christopher Faylor 4844eaa5f8 * fhandler.cc (fhandler_base::read_overlapped): Preserve len when looping due
to received signal.
2009-06-16 19:05:43 +00:00
Corinna Vinschen ea3923078a * net.cc (get_flags): New static function to generate interface flags
value.
	(get_ipv4fromreg_ipcnt): New static function to fetch number of
	configured IPv4 addresses for a given NIC from registry.
	(get_ipv4fromreg): New static function to fetch configured IPv4
	addresses for a given NIC from registry.
	(get_friendlyname): New static function to generate friendly name.
	(get_hwaddr): New static function to copy hardware address.
	(get_xp_ifs): Restructure slightly.  Add code to generate IPv4 entries
	entries for interfaces which are disconnected.
2009-06-15 20:04:15 +00:00
Christopher Faylor fee56469d4 * errno.cc (errmap): Add mapping for ERROR_IO_INCOMPLETE.
* fhandler.cc (fhandler_base::fcntl): Fix comment.
(fhandler_base::wait_overlapped): Accept an optional len parameter.  Use the
len parameter when WriteFile fails with ERROR_IO_PENDING.  Make debug output
less alarming.
(fhandler_base::write_overlapped): Pass len to wait_overlapped.
* fhandler.h (fhandler_base::wait_overlapped): Add an optional argument
denoting the number of characters intended to be written.
* fhandler_tty.cc (fhandler_pty_master::close): Don't close archetype handles
when cygwin is still initializing since the handles aren't actually opened at
that point.
2009-06-14 23:42:09 +00:00
Corinna Vinschen 313c719cb8 * localtime.cc (time2): Take another stab at fixing a compiler warning. 2009-06-14 09:35:35 +00:00
Christopher Faylor b5b99c0486 * localtime.cc (time2): Take a stab at fixing a compiler warning. 2009-06-14 05:49:01 +00:00
Christopher Faylor 6a712635dd * fhandler.cc (fhandler_base::wait_overlapped): Honor nonblocking flag for
writes.  Don't reset event handle when we see a ERROR_IO_PENDING.
* sigproc.cc (stopped_or_terminated): Use bool constants for consistency.
* wait.cc (wait4): Remove nonsensical comment.
2009-06-14 05:38:55 +00:00