Commit Graph

77 Commits

Author SHA1 Message Date
Corinna Vinschen f0f3ea68f3 * fhandler_socket.cc (fhandler_socket::recvfrom): Return buffer
length and don't set errno in case of WSAEMSGSIZE error.
	(fhandler_socket::recvmsg): Ditto.
2003-02-03 15:34:52 +00:00
Corinna Vinschen 01e3c89709 * fhandler_socket.cc (fhandler_socket::accept): On successful execution
set connection state of returned socket to CONNECTED.
2003-01-28 15:33:50 +00:00
Christopher Faylor 9a75162166 * uinfo.cc (pwdgrp::load): Regularize strace output. Add warning for
CreateFile failure.
2003-01-26 06:42:40 +00:00
Christopher Faylor 8bce0d723c Throughout, change fhandler_*::read and fhandler_*::raw_read to void functions
whose second arguments are both the lenght and the return value.
* fhandler.cc (fhandler_base::read): Rework slightly to use second argument as
input/output.  Tweak CRLF stuff.
(fhandler_base::readv): Accommodate fhandler_*::read changes.
* cygthread.h (cygthread::detach): Declare as taking optional handle argument.
(cygthread::detach): When given a handle argument, wait for the handle to be
signalled before waiting for thread to detach.  Return true when signal
detected.
2002-12-14 04:01:32 +00:00
Christopher Faylor ae799c9931 revert botched checkin 2002-11-28 00:41:02 +00:00
Christopher Faylor 7007fd238f * include/cygwin/version.h: Bump DLL minor number. 2002-11-28 00:40:20 +00:00
Christopher Faylor 50f4a61a36 * fhandler_socket.cc (fhandler_socket::sendto): Fix potential unitialized value
return.
2002-11-27 23:44:14 +00:00
Corinna Vinschen 59ba222ca2 * fhandler_socket.cc (fhandler_socket::ioctl): Return correct flags
for loopback interface when name is given on input instead of address.
2002-11-07 10:22:26 +00:00
Christopher Faylor 2f5e9ace2e * fhandler_socket.cc (fhandler_socket::recvmsg): Call if from == NULL
WSARecvFrom with fromlen = NULL.
2002-11-05 16:49:58 +00:00
Christopher Faylor 5ec14fe40a Change _function() to function() throughout.
* cygwin.din: Remove last vestiges (?) of newlib wrappers.
* cygthread.cc (cygthread::detach): Always wait for event or suffer an
apparently inavoidable race.
* dcrt0.cc (dll_crt0_1): Allocate threads after stack has been relocated.
* debub.cc (lock_debug): Don't acquire lock on exit.
* fork.cc (fork_child): Recreate mmaps before doing anything else since Windows
has a habit of using blocks of memory in the child that could previously have
been occupied by shared memory in the parent.
* mmap.cc (fhandler_disk_file::fixup_mmap_after_fork): Issue error here and
provide some details about what went wrong.
(fixup_mmaps_after_fork): Remove error message.
* shared.cc (open_shared): Move warning message so that more detail is
possible.
* sigproc.cc (sigproc_init): Initialize sync_proc_subproc to avoid a race.
(sigproc_terminate): Specifically wait for process thread to terminate.
2002-10-21 01:00:58 +00:00
Christopher Faylor 818089d9c8 missed checkin 2002-10-20 04:46:31 +00:00
Christopher Faylor 6cae97d5dc whitespace 2002-09-30 15:17:44 +00:00
Christopher Faylor f70389b541 Remove \n from calls to strace class printfs throughout. 2002-09-30 04:35:18 +00:00
Christopher Faylor c90e1cf179 * fhandler.cc (fhandler_base::dup): Don't set handle on failure. Caller has
already taken care of that.
* fhandler_console.cc (fhandler_console::open): Initialize handles to NULL.
(fhandler_console::close): Ditto.  GNUify non-GNU formatted functions calls
throughout.
2002-09-22 03:38:57 +00:00
Christopher Faylor 5bf785a017 * cygthread.cc (cygthread::initialized): Avoid copying on fork or some threads
may not end up in the pool.
(cygthread::new): Avoid race when checking for initialized.  Add debugging
code.
* fhandler.cc (fhandler_base::raw_read): Add case for ERROR_INVALID_HANDLE due
to Win95 directories.
(fhandler_base::open): Handle errors due to Win95 directories.
(fhandler_base::close): Add get_nohandle () test.
(fhandler_base::set_close_on_exec): Ditto.
(fhandler_base::fork_fixup): Ditto.
(fhandler_base::lock): Change error code to Posix EINVAL.
(fhandler_base::dup): If get_nohandle (), set new value to INVALID_HANDLE_VALUE
instead of NULL.
* fhandler_disk_file.cc (fhandler_disk_file::fstat): Call fstat_by_name if
get_nohandle ().  Remove extraneous element from strpbrk.
(fhandler_disk_file::open): Remove test for Win95 directory.
* fhandler_random.cc (fhandler_dev_random::open): Add set_nohandle ().
* fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto.
* fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
(fhandler_dev_zero::close): Delete.
* fhandler.h (class fhandler_dev_zero): Ditto.
2002-09-19 03:30:20 +00:00
Corinna Vinschen 4d147a03bd * fhandler.h (fhandler_socket::read): Remove method.
(fhandler_socket::write): Ditto.
	(fhandler_socket::readv): New method.
	(fhandler_socket::writev): Ditto.
	(fhandler_socket::recvmsg): Add new optional argument.
	(fhandler_socket::sendmsg): Ditto.
	* fhandler.cc (fhandler_socket::read): Remove method.
	(fhandler_socket::write): Ditto.
	(fhandler_socket::readv): New method.
	(fhandler_socket::writev): Ditto.
	(fhandler_socket::recvmsg): Use win32's scatter/gather IO where
	possible.
	(fhandler_socket::sendmsg): Ditto.
	* net.cc (cygwin_recvmsg): Check the msghdr's iovec fields.
	(cygwin_sendmsg): Ditto.  Add omitted sigframe.
2002-09-04 09:39:35 +00:00
Christopher Faylor ab7f9b938f * miscfuncs.cc (check_iovec_for_read): Don't check buffer when zero length
iov_len.
(check_iovec_for_write): Ditto.
* fhandler.h (fhandler_base::readv): New method.
(fhandler_base::writev): Ditto.
* fhandler.cc (fhandler_base::readv): New method.
(fhandler_base::writev): Ditto.
* syscalls.cc (_read): Delegate to readv(2).
(_write): Ditto, mutatis mutandi.
(readv): Rewrite, based on the old _read code, to use the new
fhandler_base::readv method.  Improve access mode handling and ensure all calls
reach the final strace statement.
(writev): Ditto, mutatis mutandi.
* include/sys/uio.h (struct iovec): Change field types to match SUSv3.
* winsup.h (check_iovec_for_read): New function.
(check_iovec_for_write): Ditto.
* miscfuncs.cc (check_iovec_for_read): Ditto.
(check_iovec_for_write): Ditto.
2002-08-30 15:47:10 +00:00
Corinna Vinschen 281d8a3232 * fhandler_socket.cc (fhandler_socket::recvfrom): Eliminate flags
not understood by WinSock.
	(fhandler_socket::sendto): Ditto.  If WinSock sendto() returns
	WSAESHUTDOWN, change errno to EPIPE and raise SIGPIPE if MSG_NOSIGNAL
	isn't set in flags.
	* include/cygwin/socket.h: Define MSG_WINMASK and MSG_NOSIGNAL.
	* include/cygwin/version.h: Bump API minor number.
2002-08-28 10:18:20 +00:00
Corinna Vinschen 0a64232525 * fhandler_socket.cc (fhandler_socket::check_peer_secret_event):
Fix strace message.
	(fhandler_socket::connect): Remove sigframe.
	(fhandler_socket::accept): Ditto.
	(fhandler_socket::getsockname): Ditto.
	(fhandler_socket::getpeername): Ditto.
	(fhandler_socket::recvfrom): Ditto.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
	(fhandler_socket::close): Ditto.
	(fhandler_socket::ioctl): Ditto.
	* ioctl.cc (ioctl): Add sigframe.
	*net.cc (cygwin_sendto): Ditto.
	(cygwin_recvfrom): Ditto.
	(cygwin_recvfrom): Ditto.
	(cygwin_connect): Ditto.
	(cygwin_shutdown): Ditto.
	(cygwin_getpeername): Ditto.
	(cygwin_accept): Ditto.  Improve strace message.
	(cygwin_getsockname): Ditto.  Ditto.
	(cygwin_recvmsg): Ditto.  Ditto.
	(cygwin_sendmsg): Fix strace message.
2002-08-27 09:24:50 +00:00
Corinna Vinschen c250f9145b * fhandler.h (fhandler_socket::recvfrom): Fix prototype.
(fhandler_socket::sendto): Ditto.
	* fhandler_socket.cc (fhandler_socket::recvfrom): Ditto.
	(fhandler_socket::sendto): Ditto.
	* include/sys/socket.h (recv): Fix prototype.
	(recvfrom): Ditto.
	(send): Ditto.
	(sendto): Ditto.
	* net.cc (cygwin_sendto): Ditto. Improve strace message
	(cygwin_recvfrom): Ditto.  Ditto.
	(cygwin_setsockopt): Improve strace message.
	(cygwin_getsockopt): Ditto.
	(cygwin_connect): Ditto.
	(cygwin_accept): Ditto.
	(cygwin_bind): Ditto.
	(cygwin_getsockname): Ditto.
	(cygwin_getpeername): Ditto.
	(cygwin_recv): Fix prototype.
	(cygwin_send): Ditto.
	(cygwin_recvmsg): Improve strace message.
	(cygwin_sendmsg): Ditto.
2002-08-26 09:57:27 +00:00
Conrad Scott e120995086 * fhandler.h (fhandler_socket::recv): Remove method.
(fhandler_socket::send): Ditto.
	* fhandler_socket.cc (fhandler_socket::recv): Ditto.
	(fhandler_socket::send): Ditto.
	(fhandler_socket::read): Delegate to fhandler_socket::recvfrom.
	(fhandler_socket::write): Delegate to fhandler_socket::sendto.
	(fhandler_socket::sendto): Check for null `to' address.
	* net.cc (cygwin_sendto): Check for zero request length.
	(cygwin_recvfrom): Ditto.  Fix signature, use void *buf.
	(cygwin_recv): Delegate to cygwin_recvfrom.
	(cygwin_send): Delegate to cygwin_sendto.
2002-08-12 13:54:12 +00:00
Conrad Scott b4f06520f4 * winsup.h (__check_null_invalid_struct): Make ptr argument non-const.
(__check_null_invalid_struct_errno): Ditto.
	* miscfuncs.cc (__check_null_invalid_struct): Ditto.
	(__check_null_invalid_struct_errno): Ditto.
	(__check_invalid_read_ptr_errno): Remove superfluous cast.
	* net.cc (get): Set appropriate errno if fd is not a socket.
	(cygwin_sendto): Fix parameter checking.
	(cygwin_recvfrom): Ditto.
	(cygwin_setsockopt): Ditto.
	(cygwin_getsockopt): Ditto.
	(cygwin_connect): Ditto.
	(cygwin_gethostbyaddr): Ditto.
	(cygwin_accept): Ditto.
	(cygwin_bind): Ditto.
	(cygwin_getsockname): Ditto.
	(cygwin_listen): Ditto.
	(cygwin_getpeername): Ditto.
	(cygwin_send): Ditto.
	(cygwin_shutdown): Ditto.  Move sigframe to fhandler_socket.
	(cygwin_recvmsg): Fix parameter checking.  Add tracing.
	(cygwin_sendmsg): Ditto.
	* fhandler_socket.cc (fhandler_socket::shutdown): Add sigframe.
	* resource.cc (setrlimit): Fix parameter checking.
2002-08-08 17:03:20 +00:00
Corinna Vinschen 235d9fdadc Fix by Conrad Scott <conrad.scott@dsl.pipex.com>:
* fhandler_socket.cc (fhandler_socket::accept): Fix FIONBIO call.
2002-08-07 10:08:17 +00:00
Christopher Faylor 0301bfd0ac * debug.h (handle_list): Move here from debug.cc. Add "inherit" flag
functionality.
* cygheap.cc (init_cheap): Move cygheap_max calculation to _csbrk.
(_csbrk): Reorganize to not assume first allocation is <= 1 page.
(cygheap_setup_for_child): Mark protected handle as inheritable.
* cygheap.h (cygheap_debug): New struct.
(init_cygheap): Add new structure when debugging.
* dcrt0.cc (dll_crt0_1): Remove call to debug_init.  Close ppid_handle here, if
appropriate.  Don't protect subproc_ready, since it is already protected in the
parent.  Call memory_init prior to ProtectHandle to ensure that cygheap is set
up.  Call debug_fixup_after_fork_exec when appropriate.
(_dll_crt0): Don't close ppid_handle here.
* debug.cc: Use cygheap debug structure rather than static elements throughout.
(add_handle): Don't issue a warning if attempt to protect handle in exactly the
same way from exactly the same place.  Add pid info to warning output.  Accept
additional argument controlling whether handle is to be inherited.  Add pid to
stored information.
(debug_fixup_after_fork_exec): Renamed from debug_fixup_after_fork.  Reorganize
to avoid erroneously skipping handles.
(mark_closed): Add pid info to warning output.
(setclexec): Rename from setclexec_pid.
* fhandler.cc (fhandler_base::get_default_fmode): Minor reorg.
(fhandler_base::fstat): Add debugging output.
(fhandler_base::set_inheritance): Call setclexec rather than setclexec_pid.
(fhandler_base::fork_fixup): Ditto.
* fhandler_console.cc (get_tty_stuff): Mark protected handle as inheritable.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
* tty.cc (tty::make_pipes): Ditto.
(tty::common_init): Ditto.
* fork.cc (fork_parent): Ditto.
(fork_child): Close protected handles with correct name.  Remove
debug_fixup_after_fork call.
* fhandler_socket.cc (fhandler_socket::create_secret_event): Mark protected
handle as inheritable/non-inheritable, as appropriate.
* shared.cc (memory_init): Mark protected handle as inheritable.  Call
debug_init here.
* sigproc.cc (wait_sig): Close protected handle with correct name.
* spawn.cc (spawn_guts): Rename spr to subproc_ready and mark it as
inheritable.
* exceptions.cc (debugger_command): Try to run dumper.exe, if found.
* syscalls.cc (fstat64): Don't follow symlinks for path_conv lookup since path
is already resolved.
2002-07-13 20:00:27 +00:00
Corinna Vinschen 6bb769efa0 * fhandler.h (fhandler_socket::is_unconnected): Constify.
(fhandler_socket::is_connect_pending): Ditto.
	(fhandler_socket::is_connected): Ditto.
	(fhandler_socket::set_connect_state): New method.
	(struct select_record): Add member `except_on_write'.
	(select_record::select_record): Initialize all bool values to `false'.
	* fhandler_socket.cc: Use set_connect_state() method throughout.
	(fhandler_socket::connect): Set state always to connected if connection
	isn't pending.
	* net.cc (cygwin_getsockopt): Revert erroneous previous patch.
	* select.cc (set_bits): Check for `except_on_write'.  Set fd in
	write_fds if set.  Set connect state to connected if fd has been
	returned by WINSOCK_SELECT.
	(peek_socket): Check for `except_on_write'.
	(start_thread_socket): Ditto.
	(fhandler_socket::select_write): Don't set `write_ready' if connect
	is pending.  Set `except_on_write' if connect is pending.
2002-07-06 11:16:07 +00:00
Corinna Vinschen d5591d9df6 * fhandler.h (UNCONNECTED): New define.
(CONNECT_PENDING): Ditto.
	(CONNECTED): Ditto.
	(class fhandler_socket): Add member `had_connect_or_listen'.
	Add member functions `is_unconnected', `is_connect_pending' and
	`is_connected'.
	* fhandler_socket.cc (fhandler_socket::connect): Set member
	`had_connect_or_listen' according to return code of WinSock
	call.
	(fhandler_socket::listen): Ditto.
	* net.cc (cygwin_getsockopt): Modify SO_ERROR return value in
	case of socket with pending connect().
	* select.cc (peek_socket): Only add socket to matching fd_set
	if it's not "ready".  Call WINSOCK_SELECT only if at least one
	socket is in one of the fd_sets.
	(start_thread_socket): Only add socket to matching fd_set
	if it's not "ready".
	(fhandler_socket::select_write): Set write_ready to true also
	if socket isn't connected or listening.
2002-07-05 18:26:23 +00:00
Corinna Vinschen 5cff62d656 * fhandler_socket.cc (fhandler_socket::set_sun_path): Don't free
memory here.  Allow NULL parameter.
2002-07-04 17:18:14 +00:00
Corinna Vinschen e48947085c * fhandler_socket.cc (fhandler_socket::dup): Add missing copy operation
on sun_path.
2002-07-04 15:32:34 +00:00
Corinna Vinschen 3c6bd99175 * autoload.cc (WSAEventSelect): Define new autoload function.
(WSAEnumNetworkEvents): Ditto.
	* fhandler_socket.cc (fhandler_socket::accept): If socket is
	in blocking mode wait for incoming connection and signal.
2002-07-03 09:20:24 +00:00
Corinna Vinschen be5007aa52 * fhandler.h (fhandler_socket::bind): Add method definition.
(fhandler_socket::connect): Ditto.
	(fhandler_socket::listen): Ditto.
	(fhandler_socket::accept): Ditto.
	(fhandler_socket::getsockname): Ditto.
	(fhandler_socket::getpeername): Ditto.
	(fhandler_socket::recvfrom): Ditto.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
	(fhandler_socket::shutdown): Ditto.
	* fhandler_socket.cc (get_inet_addr): Move here from net.cc.
	(fhandler_socket::bind): New method.
	(fhandler_socket::connect): Ditto.
	(fhandler_socket::listen): Ditto.
	(fhandler_socket::accept): Ditto.
	(fhandler_socket::getsockname): Ditto.
	(fhandler_socket::getpeername): Ditto.
	(fhandler_socket::recvfrom): Ditto.
	(fhandler_socket::recvmsg): Ditto.
	(fhandler_socket::sendto): Ditto.
	(fhandler_socket::sendmsg): Ditto.
	(fhandler_socket::shutdown): Ditto.
	* net.cc: Various formatting cleanups throughout.
	(get_inet_addr): Move to fhandler_socket.cc.
	(cygwin_bind): Move base functionality to appropriate fhandler_socket
	method.
	(cygwin_connect): Ditto.
	(cygwin_listen): Ditto.
	(cygwin_accept): Ditto.
	(cygwin_getsockname): Ditto.
	(cygwin_getpeername): Ditto.
	(cygwin_recvfrom): Ditto.
	(cygwin_recvmsg): Ditto.
	(cygwin_sendto): Ditto.
	(cygwin_sendmsg): Ditto.
	(cygwin_shutdown): Ditto.
2002-06-26 19:25:09 +00:00
Christopher Faylor 035bfbddf5 * fhandler.cc (fhandler_base::fstat): Set S_IFIFO for pipes.
* fhandler_socket.cc (fhandler_socket.cc::fstat): Set S_IFSOCK.
2002-06-24 02:23:14 +00:00
Corinna Vinschen 3d78e129b7 * fhandler.h (fhandler_socket::fixup_after_fork): Revert patch from
2002-06-04.
	* fhandler_socket.cc (fhandler_socket::fixup_after_fork): Ditto.
	(fhandler_socket::dup): Ditto.
	* net.cc (fdsock): Make sockets explicitely noninheritable on NT.
2002-06-10 11:07:44 +00:00
Christopher Faylor f61563846d coerce 2002-06-08 01:35:54 +00:00
Christopher Faylor 9cde3cf3b5 * fhandler_socket.cc (fhandler_socket::fstat): Don't assume that socket is
unix-domain socket.
* times.cc (hires_ms::prime): Set init flag.
* times.cc (hires_ms::prime): Adjust epoch of initime_us from 1601 to 1970.
2002-06-08 01:24:58 +00:00
Christopher Faylor e35f391fa5 Remove fcntl.h includes throughout.
* fhandler.h: Move fcntl.h include here.
(fhandler_base::set_flags): Accept supplied_bin argument.  Make non-inlined.
* dtable.cc (dtable::init_std_file_from_handle): Just use binmode from pc.
(reset_to_open_binmode): Use set_flags.
* cygwin.din (open): Avoid newlib wrapper.
(read): Ditto.
(unlink): Ditto.
(write): Ditto.
* fhandler.cc (fhandler_base::set_flags): Accept supplied_bin argument.  Make
binmode decisions here.
(fhandler_base::open): Avoid using pc if it is NULL.  Eliminate binmode logic.
Just call set_flags with binmode argument.
(fhandler_base::init): Call set_flags with binmode argument.
* fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto.
* fhandler_console.cc (fhandler_console::open): Ditto.
(fhandler_console::init): Force binary on open.
* fhandler_disk_file.cc (fhandler_disk_file::open): Don't set binmode here.
Let it happen in base class.
* fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode open.  Set return
value appropriately if unable to open.
* fhandler_proc.cc (fhandler_proc::open): Make sure flags are set before
open_status.
* fhandler_process.cc (fhandler_process::open): Ditto.
* fhandler_registry.cc (fhandler_registry::open): Ditto.
* fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::open): Force O_BINARY by default.
* fhandler_serial.cc (fhandler_serial::init): Ditto.
* fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
(fhandler_pty_master::open): Ditto.
* fhandler_virtual.cc (fhandler_virtual::open): Ditto.
* fhandler_windows.cc (fhandler_windows::open): Ditto.
* fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
* net.cc (fdsock): Ditto.
* path.cc (path_conv::check): Avoid checking for extension when error or
directory.
(set_flags): Set PATH_TEXT explicitly, when appropriate.
(mount_info::conv_to_win32_path): Use set_flags() to set path flags.
* path.h (PATH_TEXT): New enum.
(path_conv::binmode): Return appropriate constant based on binmode.
* pipe.cc (make_pipe): Set binmode to O_TEXT xor O_BINARY.
* syscalls.cc (setmode_helper): Make debugging message a little clearer.
(setmode): Set binmode via set_flags.
2002-06-05 01:42:28 +00:00
Corinna Vinschen 4e1388472d * fhandler.h (class fhandler_socket): Add private method
fixup_after_fork (bool, HANDLE).
	* fhandler_socket.cc (fhandler_socket::fixup_after_fork): Move
	functionality to new private method.  Add closing parent socket
	if not called from dup().  Create method new calling private method
	with appropriate parameter.
	(fhandler_socket::fixup_after_exec): Call private method
	fixup_after_fork with appropriate parameter.
	(fhandler_socket::dup): Ditto.
2002-06-04 16:38:13 +00:00
Christopher Faylor ff93854697 * dtable.cc (dtable::build_fhandler_from_name): Just pass posix path along to
set_name via return_and_clear_normalized_path.
(dtable::build_fhandler): New method with const char * argument.
(dtable::reset_unix_path_name): Eliminate.
(dtable::dup_worker): Use correct build_fhandler method.
* mmap.cc (mmap_record::alloc_fh): Ditto.
* dtable.h (dtable::build_fhandler): New method.
(dtable::reset_unix_path_name): Eliminate.
* fhandler.cc (fhandler_base::set_name): Assume that unix_name has already been
cmalloced.
(fhandler_base::reset_unix_path_name): Eliminate.
(fhandler_base::~fhandler_base): Coercion for cfree.
* fhandler.h (fhandler_base::unix_path_name): Make const char *.
(fhandler_base::win32_path_name): Ditto.
(fhandler_base::reset_unix_path_name): Eliminate.
* fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Accommodate const char
*ness of win32_path_name.
* fhandler_socket.cc (fhandler_socket::fstat): Accommodate new set_name
requirements.
* path.cc (path_conv::return_and_clear_normalized_path): New method.
(path_conv::clear_normalized_path): Eliminate.
(path_conv::~path_conv): Ditto.
(path_conv::check): Accommodate new build_fhandler method.
* path.h (path_conv::~path_conv): Eliminate.
(path_conv::clear_normalized_path): Ditto.
(path_conv::return_and_clear_normalized_path): Declare new method.
2002-05-24 05:44:10 +00:00
Christopher Faylor eeac69d835 * fhandler_socket.cc (fhandler_socket::close): Respond to signals while
looping, waiting for socket to close.  Superstitiously clear last error when
WSAEWOULDBLOCK.
2002-03-05 18:02:53 +00:00
Corinna Vinschen acb5617538 * cygwin.din (fstat64): New symbol.
(ftruncate64): Ditto.
	(lseek64): Ditto.
	(lstat64): Ditto.
	(mmap64): Ditto.
	(seekdir64): Ditto.
	(stat64): Ditto.
	(telldir64): Ditto.
	(truncate64): Ditto.
	* dir.cc (telldir64): New function.
	(telldir): Call telldir64().
	(seekdir64): New function.
	(seekdir): Call seekdir64().
	* fhandler.h: Redefine all methods using __off32_t to use __off64_t.
	* fhandler.cc: Use __off64_t and struct __stat64 throughout.
	* fhandler_clipboard.cc: Ditto.
	* fhandler_disk_file.cc: Ditto.
	* fhandler_dsp.cc: Ditto.
	* fhandler_floppy.cc: Ditto.
	* fhandler_mem.cc: Ditto.
	* fhandler_random.cc: Ditto.
	* fhandler_socket.cc: Ditto.
	* fhandler_tape.cc: Ditto.
	* fhandler_zero.cc: Ditto.
	* pipe.cc: Ditto.
	* glob.c: Ditto, call lstat64 and stat64 in Cygwin.
	* mmap.cc: Use __off64_t throughout.
	(mmap64): New function.
	* sec_acl.cc (acl_worker): Use struct __stat64, call stat64 and lstat64.
	* syscalls.cc (lseek64): New function.
	(stat64_to_stat32): Ditto.
	(fstat64): Ditto.
	(stat64): Ditto.
	(lstat64): Ditto.
	(ftruncate64): Ditto.
	(truncate64): Ditto.
	(_fstat): Call fstat64.
	(_stat): Call stat64.
	(cygwin_lstat): Rename to avoid declaration problem.  Call lstat64.
	(stat_worker): Use struct __stat64.
	(access): Ditto.
	(ftruncate): Call ftruncate64.
	(truncate): Call truncate64.
	* wincap.cc: Set flag has_64bit_file_access appropriately.
	* wincap.h: Add flag has_64bit_file_access.
	* winsup.h (ILLEGAL_SEEK): Define as __off64_t.
	(stat_dev): Declare using struct __stat64.
	(stat_worker): Ditto.
	* include/cygwin/stat.h (struct __stat32): Define if compiling Cygwin.
	(struct __stat64): Ditto.
	(struct stat): Revert definition with explicitly sized datatypes.
	Eliminate sized field names.
	* include/cygwin/types.h (blksize_t): New type.
	(__blkcnt32_t): Ditto.
	(__blkcnt64_t): Ditto.
	(blkcnt_t): Ditto.
2002-02-25 17:47:51 +00:00
Corinna Vinschen ff86860ba6 * dtable.cc (dtable::dup2): Revert previous patch.
* fhandler.h: Ditto.
	(fhandler_socket::recv): Define new method.
	(fhandler_socket::send): Ditto.
	* fhandler_socket.cc (fhandler_socket::recv): New method.
	(fhandler_socket::send): Ditto.
	(fhandler_socket::read): Call fhandler_socket::recv() now.
	(fhandler_socket::write): Call fhandler_socket::send() now.
	* net.cc (class wsock_event): Move definition to wsock_event.h.
	(fdsock): Revert previous patch.
	(cygwin_recv): Move implementation to fhandler_socket::recv().
	(cygwin_send): Move implementation to fhandler_socket::send().
	* wsock_event.h: New file.
2002-02-09 10:40:48 +00:00
Corinna Vinschen fae28904e9 * dtable.cc (dtable::dup2): Store fd for fhandler_socket.
* fhandler.h (fhandler_base::set_fd): New virtual method.
	(fhandler_base::get_fd): Ditto.
	(fhandler_socket::set_fd): Ditto.
	(fhandler_socket::get_fd): Ditto.
	* fhandler_socket.cc (fhandler_socket::read): Call cygwin_recv instead
	of native Winsock recv.
	(fhandler_socket::write): Call cygwin_send instead of native Winsock
	send.
	* net.cc (fdsock): Store fd in fhandler_socket.
2002-02-08 11:54:10 +00:00
Corinna Vinschen 2fe2790925 * fhandler.h (fhandler_socket::sun_path): New private member.
(fhandler_socket::set_sun_path): New method.
	(fhandler_socket::get_sun_path): Ditto.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
	sun_path to NULL.
	(fhandler_socket::~fhandler_socket): Free sun_path if needed.
	(fhandler_socket::set_sun_path): New method.
	* net.cc (cygwin_bind): Set sun_path to path of local socket file.
	(cygwin_getsockname): Add code to return correct sockaddr for unix
	domain sockets.
2002-01-01 16:25:31 +00:00
Christopher Faylor 9c510edc61 Eliminate excess whitespace. 2001-11-05 06:09:15 +00:00
Corinna Vinschen 05230a4a29 * fhandler_socket.cc (fhandler_socket::close): Add error handling.
Fixed ChangeLog entries.
2001-10-30 11:48:36 +00:00
Corinna Vinschen fc79ce17c7 * (fhandler_socket::dup): Revert previous change. 2001-10-30 10:07:39 +00:00
Christopher Faylor 19ba6f2195 * dtable.cc (dtable::dup2): Add some debugging. Use methods from passed in
class rather than cygheap->fdtab.
* fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Add more
debugging output.
(fhandler_socket::dup): Allocate new space for prot_info_ptr for duplicated
entry.
* syscalls.cc (stat_worker): Always delete fh if it has been created.
2001-10-30 07:43:46 +00:00
Christopher Faylor 711ded6d28 * fhandler.h (fhandler_serial::fhandler_serial): Change to only accept unit
argument.
* fhandler_serial.cc (fhandler_serial::fhandler_serial): Ditto.
(fhandler_serial::open): Avoid else when previous clause is a return().
* path.cc (get_devn): Alias /dev/ttyS0 -> /dev/com1, etc.
(get_device_number): Reallow standalone "com1" as a valid name for /dev/com1.
2001-10-29 05:28:24 +00:00
Christopher Faylor a0626ebe27 Ensure that all fhandler_*::read definitions are __stdcall throughout.
* fhandler.cc (fhandler_base::set_inheritance): Be more defensive in debugging
code.
* fhandler.h: Adjust regparms throughout to reflect passing 'this' parameter.
* fhandler_console.cc (fhandler_console::read): Remove unneeded test.  Only
honor "key down" events.
* miscfuncs.cc (strcasestr): Reorganize for efficient code use.
(check_null_empty_str_errno): Ditto.
(__check_null_invalid_struct_errno): Ditto.
(__check_invalid_read_ptr_errno): Ditto.
* syscalls.cc (_read): Return 0 when length == 0, as per Single UNIX
Specification.
2001-10-24 04:16:45 +00:00
Christopher Faylor e7e231e531 Remove 'cb' parameter and modify fhandler_* constructors throughout.
* dtable.cc (dtable::build_fhandler): Remove debugging output which uses 'cb'.
* exec.cc (execvp): New function.
(execvpe): Ditto.
* fhandler.cc (fhandler_base::fhandler_base): Use constructor initialization.
* fhandler.h (fhandler_tty_common::fhandler_tty_common): Ditto.
* fhandler_clipboard.cc (fhandler_dev_clipboard::fhandler_dev_clipboard):
Ditto.
* fhandler_console.cc (fhandler_console::fhandler_console): Ditto.
* fhandler_raw.cc (fhandler_dev_raw::fhandler_dev_raw): Ditto.
* fhandler_serial.cc (fhandler_serial::fhandler_serial): Ditto.
* fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Ditto.
(fhandler_tty_slave::fhandler_tty_slave): Ditto.
(fhandler_pty_master::fhandler_pty_master): Ditto.
* fhandler_windows.cc (fhandler_windows::fhandler_windows): Ditto.
2001-10-22 18:39:22 +00:00
Christopher Faylor 611d92e24c * autoload.cc (load_wsock32): Declare dummy function to force loading of
winsock.
* fhandler.cc (fhandler_base::set_inheritance): Make debugging output more
verbose.
* fhandler_socket.cc (fhandler_socket::fixup_after_fork): Force loading of
winsock32 if winsock2 not available.
* net.cc (set_socket_inheritance): Use DuplicateHandle in all cases to set
inheritance correctly.
(fdsock): Use winsock2_active macro to determine when to set socket
inheritance.  Remove fdtab resource locking since this function should already
be protected.
(cygwin_accept): Simplify logic.  Ensure that fdtab unlock is not called
inappropriately.
(cygwin_rcmd): Use fdtab locking.
(cygwin_rresvport): Ditto.
(cygwin_rexec): Ditto.
* select.cc (peek_socket): Set errno appropriately if winsock select fails.
* winsup.h: Declare check_pty_fds.
* syscalls.cc (check_pty_fds): Rename from check_ttys_fds.  Also check pty
master.
(setsid): Use check_pty_fds.
* dtable.cc (dtable::dec_console_fds): Add check on pty fds.
2001-10-14 04:14:24 +00:00