summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_socket.cc
Commit message (Collapse)AuthorAgeFilesLines
* Throughout, (mainly in fhandler*) fix remaining gcc 4.7 mismatchYaakov Selkowitz2013-05-011-2/+2
| | | | | | | | | warnings between regparm definitions and declarations. * smallprint.cc (__small_vswprintf): Conditionalize declaration and setting of l_opt for only x86_64. * spawn.cc (child_info_spawn::worker): Remove unused 'pid' variable. * thread.cc (verifyable_object_isvalid): Temporarily define as non-inline with gcc 4.7+, regardless of target.
* * Merge in cygwin-64bit-branch.Corinna Vinschen2013-04-231-119/+180
|
* * fhandler_socket.cc (get_inet_addr): Handle abstract AF_LOCAL socket.Corinna Vinschen2013-04-081-4/+33
| | | | | (fhandler_socket::recv_internal): Create abstract socket name for AF_LOCAL datagram sockets. Explain why we do that.
* * include/sys/un.h (UNIX_PATH_MAX): Rename from UNIX_PATH_LEN toCorinna Vinschen2013-03-071-9/+36
| | | | | | | | follow Linux. * fhandler_socket.cc: Change UNIX_PATH_LEN to UNIX_PATH_MAX throughout. (fhandler_socket::recv_internal): Don't return prematurely in case of successful return. For AF_LOCAL sockets, overwrite returned AF_INET name with AF_LOCAL name.
* * fhandler_socket.cc (fhandler_socket::bind): Fix check for AF_LOCALCorinna Vinschen2013-03-071-15/+28
| | | | | | | | filename length to allow non-NUL terminated strings within namelen bytes. Copy over sun_path to local array sun_path to have a NUL-terminated string for subsequent function calls. Move path_conv check before OS bind call to not bind the socket before being sure the file doesn't exist. Add and fix comments.
* * fhandler_socket.cc (fhandler_socket::bind): Fix error code forCorinna Vinschen2013-02-041-1/+1
| | | | empty filename.
* * fhandler_socket.cc (fhandler_socket::bind): Fix length check ofCorinna Vinschen2013-02-041-4/+6
| | | | | AF_LOCAL filename so it never accesses memory beyond namelen. Also make sure filename is NUL-terminated.
* Throughout, change __attribute__ ((regparm (N))) to just __regN. Throughout,Christopher Faylor2013-01-211-3/+3
| | | | | | | | | | | | | | | | | | | (mainly in fhandler*) start fixing gcc 4.7.2 mismatch between regparm definitions and declarations. * gendef: Define some functions to take @ declaration to accommodate _regN defines which use __stdcall. * gentls_offsets: Define __regN macros as empty. * autoload.cc (wsock_init): Remove unneeded regparm attribute. * winsup.h (__reg1): Define. (__reg2): Define. (__reg3): Define. * advapi32.cc (DuplicateTokenEx): Coerce some initializers to avoid warnings from gcc 4.7.2. * exceptions.cc (status_info): Declare struct to use NTSTATUS. (cygwin_exception::dump_exception): Coerce e->ExceptionCode to NTSTATUS. * fhandler_clipboard.cc (cygnativeformat): Redefine as UINT to avoid gcc 4.7.2 warnings. (fhandler_dev_clipboard::read): Ditto.
* * fhandler_registry.cc: Drop Mingw.org considerations.Corinna Vinschen2012-11-261-11/+0
| | | | | | | | | | | * fhandler_serial.cc: Ditto. * fhandler_socket.cc: Ditto. * fhandler_tape.cc: Ditto. * fhandler_tty.cc: Ditto. * net.cc: Ditto. * ntdll.h: Ditto. * sched.cc: Ditto. * sec_helper.cc: Ditto.
* Rename cancelable_wait -> cygwait throughout.Christopher Faylor2012-08-151-1/+1
| | | | | * DevNotes: Add entry cgf-000015. * cygwait.h (cygwait): Don't allow an optional PLARGE_INTERGER argument.
* * fhandler.h (fhandler_socket::recv_internal): Add bool parameter.Corinna Vinschen2012-08-011-14/+18
| | | | | | | | | | | | | | | | Add regparm attribute. * fhandler_socket.cc (fhandler_socket::read): Call recv_internal with second parameter set to false. (fhandler_socket::readv): Ditto. (fhandler_socket::recvfrom): Ditto. (fhandler_socket::recv_internal): Convert use_recvmsg from local variable to parameter. Use as request for using WSARecvMsg. Only fail if WSARecvMsg can't be loaded and wsamsg->Control.len > 0, otherwise use WSARecv{From}. Restrict dwFlags to MSG_PEEK when using WSARecvMsg. (fhandler_socket::recvmsg): Prefer using WSARecvMsg. Change priority of tests for not using WSARecvMsg. Call recv_internal with second parameter set accordingly.
* Change "set_thread_waiting" to "set_signal_arrived" throughout.Christopher Faylor2012-07-231-1/+1
|
* * DevNotes: Add entry cgf-000013.Christopher Faylor2012-07-211-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cygserver_ipc.h (ipc_set_proc_info): Use _cygtls::ipc_set_proc_info to set per-thread signal arrived value. * cygthread.cc (cygthread::detach): Use per-thread signal_arrived via set_thread_waiting. * fork.cc (_cygtls::fixup_after_fork): Clear signal_arrived. (_cygtls::remove): Close any signal_arrived handle when thread exists. (_cygtls::find_tls): Remove unneeded function. * cygtls.h: Update copyright. (class _cygtls): Reorganize to help avoid rebuilding newlib when structure changes. (_cygtls::event): Delete. (_cygtls::threadkill): Ditto. (_cygtls::signal_waiting): Declare new bool. (_cygtls::find_tls): Delete declaration. (_cygtls::set_threadkill): Ditto. (_cygtls::reset_threadkill): Ditto. (_cygtls::set_signal_arrived): Declare new function. (class set_thread_waiting): Declare new class. * cygwait.cc (cw_nowait_storage): Define. (cygwait): Set per-thread signal_arrived via set_thread_waiting. Don't special-case _main_tls. * cygwait.h (cw_nowait): Define. (cw_infinite): Ditto. (cygwait): Redefine pathological wait-only case. * dcrt0.cc (dll_crt0_0): Remove call to now-defunct events_init(). (dll_crt0_1): Remove call to now-defunct create_signal_arrived(). * exceptions.cc: Reflect set_signal_mask() argument reordering throughout. Remove signal mask synchronization throughout. (events_init): Delete definition. (mask_sync): Delete now-unneeded mask synchronization. (set_signal_mask): Reverse order of arguments to "standard" to, from layout. Rename "newmask" argument to "setmask". Remove debugging. (sig_handle_tty_stop): Use cancelable_wait rather than WFMO. (_cygtls::interrupt_setup): Don't treat "threadkill" events specially. Conditionally set signal_arrived depending on whether the thread has created it or not. (sigpacket::process): Reorganize to reflect thread-specific sending of signals which is more in line with the way it was actually supposed to work. * fhandler_socket.cc (get_inet_addr): Use cancelable_wait rather than IsEventSignalled to avoid potential race. (fhandler_socket::wait_for_events): Set signal_arrived event using set_thread_waiting(). (fhandler_socket::close): Use cygwait for the case of just waiting 10 ms for a signal. * fhandler_tape.cc (fhandler_dev_tape::_lock): Use cancelable_wait rather than WFMO. Redo switch/case tests accordingly. * fhandler_termios.cc (fhandler_termios::bg_check): Use cygwait for case of just waiting 0 ms for a potential signal. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Use cancelable_wait rather than WFSO. * fhandler_windows.cc (fhandler_windows::read): Set per-thread signal_arrived via set_thread_waiting(). * flock.cc (lf_setlock): Ditto. * select.cc (pselect): Ditto. Set per-thread signal_arrived using set_thread_waiting(). * gendef: Don't special case handling of _cygtls::sig for threads. * gentls_offsets: Use #pragma once in tlsoffsets.h. * ntdll.h: Use #pragma once. * poll.cc: Reflect set_signal_mask() argument reordering. * posix_ipc.cc (ipc_mutex_lock): Use cancelable_wait rather than WFMO. (ipc_cond_timedwait): Set perl-thread signal arrived using set_thread_waiting(). * security.h: Use #pragma once. * signal.cc (abort): Reflect set_signal_mask() argument reordering. (clock_nanosleep): Ditto. Change call to cancelable_wait to properly specify handling of cancel and interrupt. (sigwaitinfo): Remove handling of per-thread event in favor of per-thread signal_arrived. Use cancelable_wait rather than WFSO. * sigproc.cc (signal_arrived): Delete definition. (create_signal_arrived): Ditto. * sigproc.h (signal_arrived): Delete declaration. (set_signal_mask): Avoid defining as a "C" function. Don't conditionally declare. (create_signal_arrived): Delete declaration. * syscalls.cc (rename): Use cygwait() rather than WFSO. * thread.h (fast_mutex::lock): Use cw_infinite rather than LARGE_NULL. * wait.cc (wait4): Ditto. * thread.cc (pthread_mutex::lock): Ditto. (pthread::join): Ditto. (semaphore::_wait): Ditto. (pthread_kill): Remove set_threadkill() accommodation. * tlsoffsets.h: Regenerate.
* In terms of network related functionality, rely on Winsock definitionsCorinna Vinschen2012-07-061-19/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as much as possible: * dtable.cc: Drop including sys/socket.h. * fhandler_procnet.cc: Change includes accordingly. * fhandler_socket.cc: Ditto. (fhandler_socket::listen): Avoid gcc error message initializing sin6. (LPFN_WSARECVMSG): Only define when building against w32api headers. * net.cc: Change includes accordingly. Define USE_SYS_TYPES_FD_SET and __WSA_ERR_MACROS_DEFINED. Define _INC_NETIOAPI temporarily and explain why. (struct _IP_ADAPTER_UNICAST_ADDRESS_LH): Only define when building against w32api headers. (struct _IP_ADAPTER_ADDRESSES_LH): Ditto. (SIO_GET_INTERFACE_LIST): Ditto. (ws_freeaddrinfo): Rename from freeaddrinfo so as not to collide with Winsock declaration. Change througout. (ws_getaddrinfo): Ditto. (ws_getnameinfo): Ditto. * select.cc: Include netdb.h after defining USE_SYS_TYPES_FD_SET. * syslog.cc: Drop including netinet/in.h. Define USE_SYS_TYPES_FD_SET and include ws2tcpip.h. * include/netdb.h (struct addrinfo): Don't define when building Cygwin. * include/cygwin/if.h: Don't declare if_xxx functions when building Cygwin. * include/cygwin/in.h: Disable most definitions when building Cygwin. * include/cygwin/socket.h: Disable sockaddr and sockaddr_storage definitions when building Cygwin. Same for MCAST_INCLUDE/MCAST_EXCLUDE. * libc/inet_addr.c: Don't define __INSIDE_CYGWIN__ nor __INSIDE_CYGWIN_NET__. * libc/inet_network.c: Ditto. * libc/minires.h: Drop redundant inclusion of netdb.h. Define __INSIDE_CYGWIN_NET__ only before including netdb.h and resolver headers.
* Revert errneous checkin.Christopher Faylor2012-06-191-4/+3
| | | | Check in actual change associated with ChangeLog.
* * cygwait.cc (cancelable_wait): Mimic old cygwait behavior more closely wrtChristopher Faylor2012-06-191-3/+4
| | | | | | | | handling of call_signal_handler. * cygwait.h (WAIT_CANCELED): Move here and redefine. (WAIT_SIGNALED): Ditto. * thread.h (WAIT_CANCELED): Delete. (WAIT_SIGNALED): Ditto.
* * Throughout, replace usage of w32api's min with MIN from sys/param.h.Corinna Vinschen2012-03-081-8/+9
|
* * exceptions.cc (exception::handle): Drop abbreviation for "exception" since IChristopher Faylor2011-12-041-0/+2
| | | | | | | | | | | | | | | | | | | | | never remember what it stands for. (sig_handle_tty_stop): Remove obsolete call to sig_handle_tty_stop. (_cygtls::call_signal_handler): Rework to grab signal information from _main_tls if none is set for _my_tls. Try harder to keep thread locked. (reset_signal_arrived): Delete. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use new cygWFMO call to wait for an event + standard cygwin stuff. Modify debug output to acccomodate new function. * fhandler_console.cc (fhandler_console::read): Replace WaitForMultipleObjects with cygWFMO. * fhandler_socket.cc (get_inet_addr): Add comment. * gendef (_sigdelayed): Remove call to reset_signal_arrived. * sigproc.cc (_cygtls::signal_exit): Don't close my_readsig here unless we're in the signal thread. (create_signal_arrived): Create signal_arrived as auto-reset so that only one thread is woken when a signal arrives. * sigproc.h (cygWFMO): New function. (reset_signal_arrived): Delete declaration.
* Throughout, remove extra space after function name from debugging output.Christopher Faylor2011-12-031-2/+2
| | | | | | | | | | | | | | | Throughout, change syscalls to report on return values using new %R format option. * smallprint.cc (__small_vsprintf): Add parsing for %R to report on return values and possible errno from syscalls. * errno.cc (errmap): Add PRIVILEGE_NOT_HELD. * fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread use shorter name to reduce debuggging output. * select.cc (start_thread_pipe): Ditto. (start_thread_serial): Ditto. (start_thread_socket): Ditto. (start_thread_mailslot): Ditto. * sigproc.cc (talktome): Ditto.
* * cygerrno.h (__set_errno): Modify debugging output to make searching straceChristopher Faylor2011-10-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | logs easier. Throughout, change /dev/tty* to /dev/pty*. Throughout, add flags argument to fhandler_*::dup methods. * devices.in: Rename (temporarily?) /dev/ttyN to /dev/ptyN. Add /dev/ptymN devices for pty masters. * devices.cc: Regenerate. * devices.h (MAX_CONSOLES): Set to max number supported by devices.in. (fh_devices::FH_PTMX): Rename from FH_PTYM. (device::operator int): Return by reference. * dtable.cc (fh_alloc): Take pc as an argument rather than just the device. This makes debugging easier since more information is available. Actually implement handling for already-allocated pty master devices. Make different decisions when generating fhandler for not-opened devices. Add kludge to deal with opening /dev/tty. (cnew_no_ctor): New macro. (build_fh_pc): Make debugging output more verbose. Use new clone() fhandler interface to duplicate archetypes. Reset last term opened. (dtable::dup_worker): Use Use new clone() fhandler interface to duplicate archetypes. Pass flags to child dup handler. (dtable::dup3): Set O_NOCTTY flag if newfd is not stdin/stdout/stderr. * fhandler.cc (fhandler_base::reset): Rename from operator =() and reduce functionality and sense of copy direction. (fhandler_base::open_with_arch): Use published interface to query io_handle(). Use new copyto() fhandler method to copy from/to found archetype. * fhandler.h: Throughout, delete size(), add copyout, clone, and fhandler_* (void *) methods. (fhandler_base::reset): Rename from operator =(). (fhandler_termios::is_dev_tty): Delete. (fhandler_termios): change "protected" region to "private". (fhandler_termios::is_dev_tty): Delete. (fhandler_termios): Rearrange protected/public. (fhandler_termios::fhandler_termios): Remember last fhandler_termios "opened". (fhandler_termios::~fhandler_termios): Forget last fhandler_termios opened. (ioctl): Rename from ioctl_termios. Take a void * argument. Reflect argument change in pinfo::set_ctty. (fhandler_console::dup): Declare new function. Set ctty here if appropriate. (fhandler_pty_master::from_master): Privatize. (fhandler_pty_master::to_master): Ditto. (fhandler_pty_master::dwProcessId): Ditto. (fhandler_pty_master::fhandler_pty_master): Add an `int' argument. (fhandler_pty_master::open_setup): Declare new function. (fhandler_pty_master::~fhandler_pty_master): Declare new method. (fhandler_nodevice): Remove commented out function declaration. * fhandler_console.cc: Use get_ttyp() instead of tc() throughout. (fhandler_console::dup): Define new function to set controlling ctty on dup, as appropriate. (fhandler_console::ioctl): Reflect ioctl_termios name change. (fhandler_console::setup): Rename from get_tty_stuff. (fhandler_console::open_setup): Reflect argument change in pinfo::set_ctty. (fhandler_console::fhandler_console): Set _tc here. * fhandler_termios.cc (handler_termios::ioctl): Rename. Take a void * arg like other ioctl functions. * fhandler_tty.cc (fhandler_pty_slave::dup): Call myself->set_ctty to potentially reset the controlling terminal. (fhandler_pty_slave::ioctl): Reflect name/arg change for ioctl_termios. (fhandler_pty_slave::fhandler_pty_slave): Take a "unit" argument. Call setup() here so that we will know the unit number of this fhandler as soon as possible. Set the unit as appropriate. (handler_pty_master::open): Move most stuff to constructor and open_setup. (handler_pty_slave::open_setup): Reflect argument change in pinfo::set_ctty. (handler_pty_master::open_setup): Define new function. (fhandler_pty_master::cleanup): Clear handles as a flag that the destructor does not have to do "close" operations. (fhandler_pty_master::close): Ditto. (fhandler_pty_master::~fhandler_pty_master): Define new method. (fhandler_pty_master::ioctl): Reflect name/arg change for ioctl_termios. (fhandler_pty_master::setup): Allocate tty here. Rely on handles being returned from allocated test rather than opening them here. Avoid setting _need_nl here since it is already zeroed in the constructor. Set up device information with DEV_TTYM_MAJOR. * path.h (path_conv &operator =): Take a const argument. (path_conv::dup): Ditto. (pathconv_arg::PC_OPEN): New enum. (pathconv_arg::PC_CTTY): Ditto. (path_types::PATH_CTTY): Ditto. (path_types::PATH_OPEN): Ditto. (path_conv::isopen): New method. (path_conv::isctty_capable): Ditto. * path.cc (path_conv::check): Set PATH_OPEN and PATH_CTTY as appropriate. * pipe.cc (fhandler_pipe::open): Use copyto to copy pipe handle. * syscall.cc (open): Reinstate fd > 2 check to disallow resetting ctty on non-std* handles. * tty.cc (tty_list::allocate): Pass out handles for allocated tty. use `not_allocated' to find unallocated ttys. Avoid keeping the lock since the allocation of the tty should be sufficient to prevent multiple access. (tty::not_allocated): Clarify comment. Rename. Return handles when an unused tty is found. Simply test for existing tty. (tty::exists): Rewrite to use `not_allocated'. * tty.h (NTTYS): Reset down to actual number supported by devices.in. (tty::not_allocated): Declare new function. (tty_list::allocate): Pass out read/write tty handles. Zero them when not found. * fhandler_proc.cc: Reflect name change from FH_PTYM -> FH_PTMX. * pinfo.h (pinfo::set_ctty): Reduce/reorder arguments passed in. * pinfo.cc (pinfo::set_ctty): Ditto. Just use tc() built into the passed-in fhandler_termios pointer. Return true if ctty is assigned. * syscalls.cc (open): Call build_fh_pc with PC_OPEN flag. Set PC_CTTY if appropriate. (stat_worker): Remove is_dev_tty () stuff.
* * fhandler_socket.cc (fhandler_socket::send_internal): Fix settingCorinna Vinschen2011-08-231-2/+3
| | | | | nosignal flag. Convert ECONNABORTED on connection-oriented socket to EPIPE, too.
* * syscalls.cc (faccessat): Fix parens in flag expression when callingCorinna Vinschen2011-08-011-1/+1
| | | | | | | | | build_fh_name. * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Fix typo in comment. * fhandler_socket.cc (fhandler_socket::bind): Ditto. * path.cc (symlink_worker): Ditto.
* * fhandler.h (class fhandler_dev_mem): Remove dup method declaration.Corinna Vinschen2011-07-311-20/+3
| | | | | | | | | | | | * fhandler_clipboard.cc (fhandler_dev_clipboard::dup): Accommodate the fact that the entire fhandler gets copied over to the child in operator =. * fhandler_floppy.cc (fhandler_dev_floppy::dup): Ditto. * fhandler_raw.cc (fhandler_dev_raw::dup): Ditto. * fhandler_serial.cc (fhandler_serial::dup): Ditto. * fhandler_socket.cc (fhandler_socket::dup): Ditto. * fhandler_virtual.cc (fhandler_virtual::dup): Ditto. * fhandler_mem.cc (fhandler_dev_mem::dup): Ditto. Remove entirely.
* Throughout change "WinSock" to "Winsock" in comments.Corinna Vinschen2011-07-291-6/+14
| | | | | | | | * fhandler_socket.cc (fhandler_socket::sendmsg): Add missing call to get_inet_addr to convert AF_LOCAL to AF_INET sockets. * net.cc (cygwin_socket): Workaround UDP Winsock problem. Add comment to explain why. * select.cc: Include winsock2.h rather than winsock.h.
* * fhandler.cc (fhandler_base::open): Don't open file with WRITE_DACCorinna Vinschen2011-07-051-2/+6
| | | | | | | | access on remote filesystem. Explain why. * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto for directories. * fhandler_socket.cc (fhandler_socket::bind): Ditto for sockets. * path.cc (symlink_worker): Ditto for symlinks.
* whitespace eliminationChristopher Faylor2011-06-061-10/+10
|
* * fhandler_socket.cc (get_inet_addr): Rearrange for better readability.Corinna Vinschen2011-05-111-83/+111
| | | | | | | | | | | | | Make waiting loop interruptible and cancelable. Check for SYSTEM DOS flag before reading the file. Change return value to return 0 on success, SOCKET_ERROR on failure. (fhandler_socket::bind): Only set R/O DOS flag on filesystems not supporting ACLs. (fhandler_socket::connect): Accommodate changed return values from get_inet_addr. Use SOCKET_ERROR instead of -1. (fhandler_socket::sendto): Accommodate changed return values from get_inet_addr. * syslog.cc (connect_syslogd): Ditto.
* * fhandler.h (fhandler_socket::read): Declare.Corinna Vinschen2011-05-061-0/+16
| | | | | | | | | | | | | | (fhandler_socket::write): Declare. * fhandler_procsys.cc (fhandler_procsys::read): Add FIXME comment. (fhandler_procsys::write): Ditto. * fhandler_socket.cc (fhandler_socket::read): New method. (fhandler_socket::write): New method. * syscalls.cc: Rearrange order of read/write functions. (read): Call fhandler read method directly instead of just readv. (readv): Remove EINTR loop. This is done in all affected fhandler's now. (write): Call fhandler write method directly instead of just writev. Fix debug output.
* * fcntl.cc (fcntl64): Call pthread_testcancel.Corinna Vinschen2011-04-301-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fhandler_socket.cc (fhandler_socket::connect): Ditto. (fhandler_socket::accept4): Ditto. (fhandler_socket::recvfrom): Ditto. (fhandler_socket::recvmsg): Ditto. (fhandler_socket::sendto): Ditto. (fhandler_socket::sendmsg): Ditto. * flock.cc (lf_setlock): Allow to cancel thread running blocking file lock. Try to make code more readable. (lockf): Call pthread_testcancel. * mmap.cc (msync): Ditto. * posix_ipc.cc (ipc_cond_timedwait): Call pthread::static_cancel_self rather than pthread_testcancel. * select.cc (cygwin_select): Call pthread_testcancel. * syscalls.cc (pread): Ditto. (pwrite): Ditto. (readv): Ditto. (writev): Ditto. (open): Ditto. (close): Ditto. (fsync): Ditto. * termios.cc (tcdrain): Ditto. * thread.cc: Align list of cancellation points with above changes. Mark not-implemented functions, too. (cancelable_wait): Don't set unused object indices to WAIT_FAILED since that could result in wrong behaviour. Set them to the invalid value WAIT_TIMEOUT + 1 instead.
* * fhandler_socket.cc (fhandler_socket::evaluate_events): Handle theCorinna Vinschen2011-04-181-14/+38
| | | | | | | | | FD_CLOSE event specially when called from accept. Explain why. (fhandler_socket::shutdown): Fake success on not-connected socket and trigger socket event if the read side of a socket is affected. Explain why. * poll.cc (poll): Check for saw_shutdown_read on sockets to generate POLLHUP as well.
* * autoload.cc (GetExtendedTcpTable): Remove.Corinna Vinschen2011-04-021-68/+0
| | | | | | | | | | | | | (GetTcpTable): Remove. (CharNextExA): Remove. (FindWindowA): Remove. (ShowWindowAsync): Remove. * dcrt0.cc (disable_dep): Remove unused function. (dll_crt0_0): Drop comment babbling about TS & DEP. * fhandler_socket.cc (address_in_use): Remove unused function. * wincap.cc: Throughout, drop ts_has_dep_problem from wincaps. (wincapc::init): Drop code setting ts_has_dep_problem flag. * wincap.h (struct wincaps): Drop ts_has_dep_problem flags and method.
* * fhandler_socket.cc (get_inet_addr): Make externally available.Corinna Vinschen2011-03-291-1/+1
| | | | | | | | | | * autoload.cc (GetUdpTable): Define. * syslog.cc (connect_syslogd): Use get_inet_addr rather than _stat64 to check for local socket file. Create socket with type returned by get_inet_addr. If connect on UDP socket works, test if there's really a listening peer, otherwise fall back to Windows event log. (try_connect_syslogd): Use syslogd_inited flag to check if syslogd is available.
* * fhandler.cc (fhandler_base::open): When creating a file on aCorinna Vinschen2011-03-081-3/+10
| | | | | | | | | | | | | | | filesystem supporting ACLs, create the file with WRITE_DAC access. Explain why. * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto for directories. * fhandler_socket.cc (fhandler_socket::bind): Ditto for sockets. * path.cc (symlink_worker): Ditto for symlinks. * security.cc (get_file_sd): Always call GetSecurityInfo for directories on XP and Server 2003. Improve comment to explain why. (set_file_attribute): Explicitely cast mode_t value to bool in call to get_file_sd. * wincap.h (wincaps::use_get_sec_info_on_dirs): New element. * wincap.cc: Implement above element throughout.
* * fhandler_socket (fhandler_socket::readv): Call recv_internal directly,Corinna Vinschen2011-02-211-24/+20
| | | | | | | | | | rather than recvmsg. (fhandler_socket::writev): Call send_internal directly, rather than sendmsg. * net.cc (cygwin_recv): Call fhandler_socket::recvfrom directly, rather than cygwin_recvfrom. (cygwin_send): Call fhandler_socket::sendto directly, rather than cygwin_sendto.
* * Throughout fix copyright dates.Corinna Vinschen2011-02-151-1/+1
|
* * fhandler_socket.cc (address_in_use): Improve comment readability.Corinna Vinschen2011-01-311-3/+4
|
* * fhandler_socket.cc (address_in_use): Disable. Add comment.Corinna Vinschen2011-01-301-32/+10
| | | | | | | | | | | (fhandler_socket::bind): Change comment to explain setting the SO_EXCLUSIVEADDRUSE socket option. Remove code which checks for address in use. * net.cc (cygwin_setsockopt): Never set SO_REUSEADDR option. Improve comment to compensate for the deleted comment in fhandler_socket::bind. * wincap.cc: Throughout, drop has_enhanced_socket_security from wincaps. * wincap.h (struct wincaps): Drop has_enhanced_socket_security flags and method.
* * fhandler_socket.cc (fhandler_socket::wait_for_events): CallCorinna Vinschen2011-01-281-0/+2
| | | | | pthread_testcancel in case of timeout to enable pthread_cancel on waiting thread.
* * fhandler_socket.cc (fhandler_socket::bind): Drop has_exclusiveaddruseCorinna Vinschen2010-09-251-44/+39
| | | | | | | | | | | | | | | | | | | | | | condition. Fix comment about availability. Move remaining comment to the right spot. Drop has_ip_helper_lib condition. * net.cc (cygwin_setsockopt): Drop has_disabled_user_tos_setting condition. Fix comment. (get_2k_ifs): Fix comment. (get_nt_ifs): Remove. (getifaddrs): Drop call to get_nt_ifs. (get_ifconf): Ditto. * wincap.cc: Throughout, drop has_ip_helper_lib, has_disabled_user_tos_setting, and has_exclusiveaddruse settings from wincaps. (wincap_unknown): Remove. (wincap_nt4): Remove. (wincap_minimal): New macro, set to wincap_nt4sp4 for now. (wincapc::init): Drop test for pre-SP4 NT4. Just imply at least NT SP4. Replace references to wincap_unknown with references to wincap_minimal. * wincap.h (struct wincaps): Drop has_ip_helper_lib, has_disabled_user_tos_setting, and has_exclusiveaddruse flags and methods.
* * fhandler_socket.cc (get_inet_addr): Only test the file for being aCorinna Vinschen2010-04-131-14/+32
| | | | | | socket after opening it. Retry if opening failed with sharing violation. Explain why we do this. (fhandler_socket::bind): Create file with no sharing allowed.
* * fhandler_socket.cc (fhandler_socket::wait_for_events): Remove call toCorinna Vinschen2010-03-301-4/+1
| | | | sig_dispatch_pending.
* * fhandler_socket.cc (fhandler_socket::evaluate_events): Make eraseCorinna Vinschen2010-03-221-11/+12
| | | | | | | | | | | | | | | | | const in parameter list. (fhandler_socket::wait_for_events): Take a DWORD flags value instead of just a bool. Call evaluate_events with erase flag according to MSG_PEEK value in flags. Replace check for dontwait with check for MSG_DONTWAIT in flags. (fhandler_socket::connect): Call wait_for_events with 0 flags value. (fhandler_socket::accept4): Ditto. (fhandler_socket::recv_internal): Save flags in wait_flags. Drop dontwait variable. Call wait_for_events with wait_flags. (fhandler_socket::send_internal): Save MSG_DONTWAIT flag in wait_flags and call wait_for_events with wait_flags as argument. Drop dontwait variable. * fhandler.h (class fhandler_socket): Change second parameter in declaration of wait_for_events to const DWORD.
* * fhandler_socket.cc (fhandler_socket::accept4): Reset async flagCorinna Vinschen2010-01-161-1/+1
| | | | on accepted socket.
* * fhandler_socket.cc (fhandler_socket::accept4): Set nonblockingCorinna Vinschen2010-01-151-2/+1
| | | | | flag exactly according to flags, as on Linux. * net.cc (cygwin_accept): Maintain BSD semantics here.
* * cygwin.din (accept4): Export.Corinna Vinschen2010-01-151-3/+7
| | | | | | | | | | | | | | | | | | | * fhandler.h (fhandler_socket::accept4): Rename from accept. Take additional flag parameter. * fhandler_socket.cc (fhandler_socket::accept4): Ditto. Handle SOCK_NONBLOCK and SOCK_CLOEXEC flags. * net.cc (cygwin_socket): Handle SOCK_NONBLOCK and SOCK_CLOEXEC flags in type. Check for invalid flag values. (socketpair): Ditto. (cygwin_accept): Accommodate renaming of fhandler_socket::accept function to accept4. (accept4): New function. * posix.sgml: Mention accept4 as GNU extensions. * include/cygwin/socket.h (SOCK_NONBLOCK): Define. (SOCK_CLOEXEC): Define. (_SOCK_FLAG_MASK): Define when building Cygwin. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * include/sys/socket.h (accept4): Declare.
* * fhandler.h (fhandler_socket::wait_for_events): Drop parameter defaultCorinna Vinschen2009-12-281-3/+3
| | | | | | | | value. * fhandler_socket.cc (fhandler_socket::connect): Add false as second parameter to wait_for_events call. (fhandler_socket::accept): Ditto. (fhandler_socket::send_internal): Fix typo in call to wait_for_events.
* Throughout, replace hMainProc with GetCurrentProcess/NtCurrentProcessCorinna Vinschen2009-12-181-5/+7
| | | | | | | | | | | | 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.
* * fhandler_socket.cc (send_internal): Don't split datagram messagesCorinna Vinschen2009-12-021-4/+10
| | | | | | | into pieces. * syslog.cc (vsyslog): Set default facility to LOG_USER if it hasn't been set yet.
* * fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): AddCorinna Vinschen2009-11-231-3/+4
| | | | | | | | socket handle value to debug output. (fhandler_socket::fixup_after_fork): Ditto. Make new socket handle OVERLAPPED, just as if it has been created with socket(). * net.cc (fdsock): Close duplicated socket and explain why. Disable the entire WSADuplicateSocket test for now and explain why.
* * fhandler_socket.cc (fhandler_socket::set_close_on_exec): Only callCorinna Vinschen2009-11-231-2/+7
| | | | fhandler_base::set_close_on_exec for inheritable sockets.