summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_socket.cc
Commit message (Collapse)AuthorAgeFilesLines
* * fhandler.h (fhandler_socket::get_connect_state): New method toCorinna Vinschen2003-07-051-0/+1
| | | | | | | | | | return socket connection state. * fhandler_socket.cc (dup): Copy socket connect state to new file handle. * net.cc (cygwin_rcmd): Mark file handles of sockets returned by rcmd() as CONNECTED state. (cygwin_rexec): Similarly for rexec(). (socketpair): Mark both ends of a new socket pair as CONNECTED.
* * cygheap.h (enum impersonation): New enum.Corinna Vinschen2003-06-301-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (cygheap_user::token): Delete. (cygheap_user::impersonated): Delete. (cygheap_user::external_token): New member. (cygheap_user::internal_token): New member. (cygheap_user::impersonation_state): New member. (cygheap_user::issetuid): Modify. (cygheap_user::token): New method. (cygheap_user::deimpersonate): New method. (cygheap_user::reimpersonate): New method. (cygheap_user::has_impersonation_tokens): New method. (cygheap_user::close_impersonation_tokens): New method. * dtable.cc (dtable::vfork_child_dup): Use new cygheap_user methods. * fhandler_socket.cc (fhandler_socket::dup): Ditto. * fork.cc (fork_child): Ditto. (fork_parent): Ditto. * grp.cc (internal_getgroups): Ditto. * security.cc (verify_token): Ditto. (check_file_access): Ditto. (cygwin_set_impersonation_token): Detect conflicts. Set user.external_token. * spawn.cc (spawn_guts): Use new cygheap_user methods. * syscalls.cc (seteuid32): Rearrange to use the two tokens in cygheap_user. (setegid32): Use new cygheap_user methods. * uinfo.cc: (internal_getlogin): Ditto.
* Throughout, remove "include <errno.h>" from files which already includeChristopher Faylor2003-06-161-1/+0
| | | | | | | | | | | | | | | | | | | cygerrno.h. * include/cygwin/config.h (__DYNAMIC_REENT__): Define. * include/cygwin/version.h: Bump API minor version. * cygwin.din: Export __getreent * cygerrno.h: Include errno.h. Fix places where _impure_ptr is used directly to store the errno value. * debug.cc (__set_errno): Ditto. * errno.cc: Remove _RRENT_ONLY define to get errno.cc compiled. * signal.cc: Rename _reent_clib to _REENT throughout. * thread.h (reent_clib): Remove prototype. * thread.cc (reent_clib): Rename reent_clib to __getreent. Return _impure_ptr until MTinterface is initialized. (reent_winsup): Fix a possible SEGV when _r == NULL. Return NULL instead. * MTinterface::fixup_after_fork: Switch reent back to _impure_ptr to keep signal handling running when fork is called from a thread other than the mainthread.
* * 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.