summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_socket.cc
Commit message (Collapse)AuthorAgeFilesLines
* * fhandler_socket.cc (fhandler_socket::connect): Change errorThomas Pfaff2003-06-071-6/+8
| | | | | handling for nonblocking connects to return EALREADY when connect is called more than once for the same socket.
* * fhandler_socket.cc (connect_thread): Remove.Corinna Vinschen2003-06-031-53/+3
| | | | | | | | | (accept_thread): Remove. (fhandler_socket::connect): Remove all special blocking handling. (fhandler_socket::accept): Ditto. * net.cc (cygwin_connect): Make blocking sockets temporarily non-blocking and call cygwin_select on them to be interruptible. (cygwin_accept): Ditto.
* * fhandler_socket.cc (fhandler_socket::accept): Rename `signalled'Corinna Vinschen2003-06-021-2/+2
| | | | to `interrupted' as used in fhandler_socket::connect.
* * fhandler_socket.cc (fhandler_socket::connect): Simplify previousCorinna Vinschen2003-06-021-28/+10
| | | | | patch. (fhandler_socket::accept): Ditto.
* * fhandler_socket.cc: Include cygthread.h.Corinna Vinschen2003-06-021-108/+59
| | | | | | | | | (class sock_event): Remove. (thread_connect): New function. (thread_accept): Ditto. (fhandler_socket::connect): Use cygthread instead of socket event handling for blocking sockets. (fhandler_socket::accept): Ditto.
* * fhandler_socket.cc (fhandler_socket::dup): Rearrange. FixCorinna Vinschen2003-05-291-21/+22
| | | | conditional.
* * fhandler_socket.cc (fhandler_socket::dup): If running impersonated,Corinna Vinschen2003-05-281-10/+17
| | | | | | revert to original account before calling fixup_before_fork_exec and impersonate again afterwards. Change comment accordingly. Clean up error handling and debug output.
* * fhandler_socket.cc (sock_event::~sock_event): New method.Thomas Pfaff2003-05-271-21/+26
| | | | | | | (sock_event::load): Change to void. Check if winsock2 is available. (socke_event::wait): Return 0 if interruptible mode is not available. (fhandler_socket::connect): Remove checks for winsock2 availability. (fhandler_socket::accept): Ditto.
* * fhandler_socket.cc (fhandler_socket::dup): First try duplicatingCorinna Vinschen2003-05-271-7/+8
| | | | using WSADuplicateSocket/WSASocket, if that fails, try DuplicateHandle.
* * fhandler_socket.cc (fhandler_socket::connect): Guard calls toCorinna Vinschen2003-05-261-3/+3
| | | | | sock_event methods by a check for WinSock2 availability. (fhandler_socket::accept): Ditto.
* * fhandler_socket.cc (secret_event_name): Return void. Use incomingCorinna Vinschen2003-05-201-9/+8
| | | | | | | char *parameter instead of local static buffer. (fhandler_socket::create_secret_event): Accomodate new calling convention for secret_event_name. (fhandler_socket::close_secret_event): Ditto.
* * fhandler_socket.cc (SECRET_EVENT_NAME): Remove.Corinna Vinschen2003-05-201-20/+23
| | | | | | | | | | | | | | | | | (ENTROPY_SOURCE_NAME): Ditto. (secret_event_name): New static function. Create shared event name with "Global\" prefix on systems supporting terminal services. (fhandler_socket::set_connect_secret): Fix conditional. (fhandler_socket::create_secret_event): Create secret event using secret_event_name(). (fhandler_socket::close_secret_event): Ditto. * shared.cc (shared_name): Create shared object name with "Global\" prefix on systems supporting terminal services. * wincap.cc: Set has_terminal_services capability throughout. (wincap_2003): New global object representing Windows 2003 Server capabilities. (wincapc::init): Accomodate Windows 2003 Server. * wincap.h (struct wincaps): Add has_terminal_services capability.
* Replace ino_t by __ino64_t throughout.Corinna Vinschen2003-05-111-1/+1
|
* * dir.cc (readdir): Fill out new old_d_ino field.Christopher Faylor2003-05-111-2/+2
| | | | | | | | | | | | | | | | * fhandler.h (fhandler_base::namehash): Define as ino_t. (fhandler_base::get_namehash): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Accommodate new 64 bit st_ino. * fhandler_socket.cc (fhandler_socket::fstat): Ditto. * path.cc (hash_path_name): Return ino_t. * syscalls.cc (stat64_to_stat32): Convert 64 bit inode to 32 bit. * winsup.h (hash_path_name): Declare as returning ino_t. * include/cygwin/stat.h (__stat32): Use 32 bit st_ino. (__stat64): Use 64 bit st_ino. * include/cygwin/types.h (__ino64_t): Define. (__ino32_t): Ditto. (ino_t): Define appropriately.
* * fhandler.cc (fhandler_base::fstat): Set the uid and gid fieldsCorinna Vinschen2003-04-011-2/+0
| | | | | | | | | | from the current effective ids. * fhandler_socket.cc (fhandler_socket::fstat): Keep the uid and gid set by fhandler_base::fstat. * security.cc (get_nt_attribute): Do not test wincap.has_security (). (get_nt_object_attribute): Ditto. (get_file_attribute): Add test for wincap.has_security (). (get_object_attribute): Ditto.
* * fhandler_socket.cc (fhandler_socket::sendto): Restrict EPIPE andCorinna Vinschen2003-03-201-2/+7
| | | | SIGPIPE handling to connection oriented sockets. Add comment.
* * fhandler_socket.cc (fhandler_socket::dup): Don't callCorinna Vinschen2003-03-111-1/+14
| | | | | fhandler_base::dup() but call DuplicateHandle directly instead to have control over socket inheritence.
* 2003-03-11 Corinna Vinschen <corinna@vinschen.de>Corinna Vinschen2003-03-111-4/+13
| | | | | | | | | | | * fhandler_socket.cc (fhandler_socket::dup): On NT systems avoid using WinSock2 socket duplication methods. Add comment. 2003-03-11 Pierre Humblet <pierre.humblet@ieee.org> * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Set io_handle to INVALID_SOCKET in case of failure. (fhandler_socket::dup): Return 0 if the io_handle is valid.
* whitespace cleanupChristopher Faylor2003-03-091-30/+30
|
* * fhandler_socket.cc (fhandler_socket::dup): Initialize type.Corinna Vinschen2003-03-041-0/+1
|
* * fhandler_socket.cc (fhandler_socket::bind): Open and write socketCorinna Vinschen2003-03-011-20/+32
| | | | file using Win32 calls.
* * fhandler_socket.cc (get_inet_addr): Open and read socket file usingCorinna Vinschen2003-03-011-7/+27
| | | | Win32 calls.
* 2003-03-27 Corinna Vinschen <corinna@vinschen.de>Corinna Vinschen2003-02-271-61/+118
| | | | | | | | | | | | | * fhandler_socket.cc (class sock_event): New class managing Winsock events for interruptible socket calls. (fhandler_socket::connect): Move support for interruptible call to class sock_event. Use class object instead. (fhandler_socket::accept): Ditto. Remove useless casts. 2003-03-27 Thomas Pfaff <tpfaff@gmx.net> * fhandler_socket.cc (fhandler_socket::connect): Add support for an interruptable connect.
* * fhandler_socket.cc (fhandler_socket::fhandler_socket): Fix compilerCorinna Vinschen2003-02-211-11/+6
| | | | | | warning. (fhandler_socket::fstat): Simplify. Set st_uid/st_gid to effective uid/gid of current process in case of open sockets.
* * dtable.cc (dtable::build_fhandler_from_name): Set some fhandlerCorinna Vinschen2003-02-211-6/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | data on sockets to evaluate AF_LOCAL sockets correctly. (dtable::build_fhandler): Set unit number on sockets. * fhandler.h (fhandler_socket): Add unit number. (fhandler_socket::get_unit): New method. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Set unit number. (fhandler_socket::fstat): Reorganize to return more Linux-like values. * net.cc: include ctype.h. (fdsock): Set unit number when building fhandler. * path.cc (path_conv::check): Set device type to FH_SOCKET if file is a AF_UNIX socket. (get_devn): Evaluate unit for virtual socket devices. (win32_device_name): Set windows path for sockets to unix_path with just backslashes to keep the different names. * syscalls.cc (fstat64): Don't override st_ino, st_dev and st_rdev for sockets. (stat_worker): Ditto. From Pierre Humblet: * autoload.cc (AccessCheck): Add. (DuplicateToken): Add. * security.h (check_file_access): Declare. * syscalls.cc (access): Convert path to Windows, check existence and readonly attribute. Call check_file_access instead of acl_access. * security.cc (check_file_access): Create. * sec_acl (acl_access): Delete.
* * fhandler_disk_file.cc (fhandler_disk_file::opendir): Check descriptorCorinna Vinschen2003-02-201-11/+19
| | | | | | | | | | | | created by cygheap_fdnew constructor. * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto. * fhandler_socket.cc (fhandler_socket::accept): Ditto and move creation of file descriptor behind blocking OS call. * net.cc (cygwin_socket): Ditto. (cygwin_rcmd): Ditto. (cygwin_rresvport): Ditto. (cygwin_rexec): Ditto. (socketpair): Ditto.
* * fhandler_socket.cc (fhandler_socket::recvfrom): Return bufferCorinna Vinschen2003-02-031-1/+12
| | | | | length and don't set errno in case of WSAEMSGSIZE error. (fhandler_socket::recvmsg): Ditto.
* * fhandler_socket.cc (fhandler_socket::accept): On successful executionCorinna Vinschen2003-01-281-16/+15
| | | | set connection state of returned socket to CONNECTED.
* * uinfo.cc (pwdgrp::load): Regularize strace output. Add warning forChristopher Faylor2003-01-261-1/+1
| | | | CreateFile failure.
* Throughout, change fhandler_*::read and fhandler_*::raw_read to void functionsChristopher Faylor2002-12-141-4/+7
| | | | | | | | | | | 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.
* revert botched checkinChristopher Faylor2002-11-281-6/+6
|
* * include/cygwin/version.h: Bump DLL minor number.Christopher Faylor2002-11-281-6/+6
|
* * fhandler_socket.cc (fhandler_socket::sendto): Fix potential unitialized valueChristopher Faylor2002-11-271-3/+3
| | | | return.
* * fhandler_socket.cc (fhandler_socket::ioctl): Return correct flagsCorinna Vinschen2002-11-071-1/+2
| | | | for loopback interface when name is given on input instead of address.
* * fhandler_socket.cc (fhandler_socket::recvmsg): Call if from == NULLChristopher Faylor2002-11-051-8/+7
| | | | WSARecvFrom with fromlen = NULL.
* Change _function() to function() throughout.Christopher Faylor2002-10-211-11/+9
| | | | | | | | | | | | | | | | | | * 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.
* missed checkinChristopher Faylor2002-10-201-1/+1
|
* whitespaceChristopher Faylor2002-09-301-19/+19
|
* Remove \n from calls to strace class printfs throughout.Christopher Faylor2002-09-301-5/+5
|
* * fhandler.cc (fhandler_base::dup): Don't set handle on failure. Caller hasChristopher Faylor2002-09-221-1/+1
| | | | | | | 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.
* * cygthread.cc (cygthread::initialized): Avoid copying on fork or some threadsChristopher Faylor2002-09-191-48/+48
| | | | | | | | | | | | | | | | | | | | | | | 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.
* * fhandler.h (fhandler_socket::read): Remove method.Corinna Vinschen2002-09-041-106/+289
| | | | | | | | | | | | | | | | | (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.
* * miscfuncs.cc (check_iovec_for_read): Don't check buffer when zero lengthChristopher Faylor2002-08-301-1/+3
| | | | | | | | | | | | | | | | | | | | 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.
* * fhandler_socket.cc (fhandler_socket::recvfrom): Eliminate flagsCorinna Vinschen2002-08-281-2/+12
| | | | | | | | | 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.
* * fhandler_socket.cc (fhandler_socket::check_peer_secret_event):Corinna Vinschen2002-08-271-21/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * fhandler.h (fhandler_socket::recvfrom): Fix prototype.Corinna Vinschen2002-08-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | (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.
* * fhandler.h (fhandler_socket::recv): Remove method.Conrad Scott2002-08-121-79/+8
| | | | | | | | | | | | | (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.
* * winsup.h (__check_null_invalid_struct): Make ptr argument non-const.Conrad Scott2002-08-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | (__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.
* Fix by Conrad Scott <conrad.scott@dsl.pipex.com>:Corinna Vinschen2002-08-071-2/+3
| | | | * fhandler_socket.cc (fhandler_socket::accept): Fix FIONBIO call.
* * debug.h (handle_list): Move here from debug.cc. Add "inherit" flagChristopher Faylor2002-07-131-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.