aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/fhandler_socket.cc
AgeCommit message (Collapse)AuthorFilesLines
2006-07-04 * fhandler_socket.cc (fhandler_socket::listen): Allow listening onCorinna Vinschen1-3/+17
unbound INET socket.
2006-06-26 Revert patches from 2005-10-22 and 2006-06-14 to use event drivenCorinna Vinschen1-64/+3
accept and connect back to using select: * fhandler.h (class fhandler_socket): Remove accept_mtx. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Drop initializing accept_mtx. (fhandler_socket::accept): Drop event handling. (fhandler_socket.cc (fhandler_socket::connect): Ditto. (fhandler_socket::dup): Drop accept_mtx handling. (fhandler_socket::listen): Ditto. (fhandler_socket::prepare): Ditto. (fhandler_socket::release): Ditto. (fhandler_socket::close): Ditto. * net.cc (cygwin_accept): Revert to calling cygwin_select to implement interuptible accept. (cygwin_connect): Ditto for connect.
2006-06-14 * fhandler.h (class fhandler_socket): Add private mutex handleCorinna Vinschen1-1/+35
accept_mtx. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize accept_mtx to NULL. (fhandler_socket::dup): Duplicate accept_mtx, if available. (fhandler_socket::listen): Create accept_mtx before trying to listen. (fhandler_socket::prepare): Wait for accept_mtx if available to serialize accepts on the same socket. (fhandler_socket::release): Release accept_mtx. (fhandler_socket::close): Close accept_mtx on successful closesocket.
2006-05-28white spaceChristopher Faylor1-10/+10
2006-04-21 * fhandler_socket.cc (fhandler_socket::wait): Reorder settingCorinna Vinschen1-1/+1
WSAError to avoid spurious errors with WSAError set to 0.
2006-04-05* fhandler_socket.cc: Move iptypes.h include after winsock2 since it now reliesChristopher Faylor1-1/+1
on it. * net.cc: Ditto.
2006-02-06 * fhandler_socket.cc (fhandler_socket::connect): Fix formatting.Corinna Vinschen1-1/+10
(fhandler_socket::wait): Handle SA_RESTART when signal arrives.
2006-02-01 * autoload.cc (GetTcpTable): Define.Corinna Vinschen1-1/+42
* fhandler_socket.cc (address_in_use): New function to check if sockaddr_in address is already in use. (fhandler_socket::bind): Check if address is alreay in use in case of SO_REUSEADDR, to circumvent WinSock non-standard behaviour.
2006-01-29 * fhandler.h (class fhandler_socket): Add saw_reuseaddr status flag.Corinna Vinschen1-3/+26
* fhandler_socket.cc (fhandler_socket::bind): Set socket to SO_EXCLUSIVEADDRUSE if application didn't explicitely set SO_REUSEADDR socket option, on systems supporting SO_EXCLUSIVEADDRUSE. * net.cc (cygwin_setsockopt): Set fhandler's saw_reuseaddr status flag if SO_REUSEADDR socket option has been successsfully set. * wincap.h (wincaps::has_exclusiveaddruse): New element. * wincap.cc: Implement above element throughout.
2006-01-23 * fhandler_socket.cc (fhandler_socket::fixup_after_fork): ResetCorinna Vinschen1-1/+10
inheritance for duplicated socket.
2006-01-20 * fhandler_socket.cc (fhandler_socket::prepare): Fix debug output.Corinna Vinschen1-8/+16
(fhandler_socket::release): Add debug output for WSAEventSelect failure. (fhandler_socket::ioctl): Always cancel WSAEventSelect before switching to blocking mode. Only set nonblocking flag if ioctlsocket call succeeded. Only print new socket state if ioctlsocket call succeeded.
2005-12-22whitespace cleanup to force snapshot.Christopher Faylor1-4/+4
2005-12-08 * fhandler_socket.cc (fhandler_socket::recvfrom): Mask flags withCorinna Vinschen1-9/+14
MSG_WINMASK for Windows socket calls. (fhandler_socket::recvmsg): Ditto. (fhandler_socket::sendmsg): Ditto.
2005-11-14* cygheap.h (init_cygheap::manage_console_count): Declare new function.Christopher Faylor1-1/+0
(init_cygheap::console_count): Renamed from open_fhs. Make private. * cygheap.cc (init_cygheap::manage_console_count): Define new function. * dtable.cc (dtable::fixup_after_exec): Always call fixup_after_exec on elements of fd even when they are about to be closed. * fhandler.h (report_tty_counts): Remove open_fhs from debugging output. * fhandler_console.cc (fhandler_console::open): Use manage_console_count rather than manipulating count directly. (fhandler_console::close): Ditto. (fhandler_console::fixup_after_fork): Ditto. (fhandler_console::fixup_after_exec): Ditto. Don't close handles if close_on_exec. * fhandler_tty.cc (fhandler_tty_slave::open): Use manage_console_count() rather than manipulating count directly. Reflect change in arguments to report_tty_counts(). (fhandler_tty_slave::close): Ditto for both. (fhandler_tty_slave::dup): Ditto for both. (fhandler_tty_slave::ioctl): Use myctty() rather than raw ctty #. (fhandler_tty_slave::fixup_after_fork): Reflect change in arguments to report_tty_counts(). (fhandler_tty_master::init_console): Use manage_console_count() rather than manipulating count directly. * fhandler_clipboard.cc (fhandler_dev_clipboard::fixup_after_exec): Don't perform any operations if close_on_exec. * fhandler_dsp.cc (fhandler_dev_dsp::fixup_after_exec): Ditto. * fhandler_raw.cc (fhandler_dev_raw::fixup_after_exec): Ditto. * fhandler_serial.cc (fhandler_serial::fixup_after_exec): Ditto. * pinfo.h (_pinfo::_ctty): Declare new function. (myctty): Declare new macro. (__ctty): Declare new macro. * pinfo.cc (_pinfo::_ctty): Define new function. (_pinfo::set_ctty): Use manage_console_count() rather than manipulating count directly. * signal.cc (kill_pgrp): Use myctty() and __ctty() macros rather than raw ctty #. * syscalls.cc (setsid): Ditto. Use manage_console_count() rather than manipulating count directly.
2005-11-13 * fhandler_socket.cc (fhandler_socket::recvfrom): Just return 0 (EOF)Corinna Vinschen1-0/+10
in case of WSAESHUTDOWN. (fhandler_socket::recvmsg): Ditto. * poll.cc (poll): Set revents to POLLIN instead of POLLHUP. Add comment.
2005-10-22 * fhandler_socket.cc (fhandler_socket::connect): Don't restrictCorinna Vinschen1-3/+24
WSAEINVAL -> WSAEISCONN conversion to nonblocking sockets. (fhandler_socket::accept): Use event driven technique to implement interuptible accept. (fhandler_socket::wait): Allow FD_ACCEPT handling. * net.cc (cygwin_accept): Remove workaround for allowing blocking accept. That's entirely in fhandler_socket::accept now.
2005-10-22 * fhandler.h (class fhandler_socket): Add timeout parameter to wait()Corinna Vinschen1-4/+24
method. * fhandler_socket.cc (fhandler_socket::connect): Use event driven technique (prepare/wait/release) to implement interuptible connect. (fhandler_socket::wait): Add timeout parameter. Allow FD_CONNECT handling. * net.cc (cygwin_connect): Remove braindead workaround for allowing blocking connect. That's entirely in fhandler_socket::connect now.
2005-10-17 * autoload.cc: Never load wsock32.dll. Load all wsock32 functionCorinna Vinschen1-265/+137
from ws2_32. Rearrange symbol order accordingly. None of the ws2_32 functions is optional right now. (wsadata): Move from net.cc here. Define NO_COPY. (wsock_init): Drop unused symbols ws2_32_handle and wsock32_handle. (load_wsock32): Remove. (WSACleanup): Remove. * fhandler_socket.cc: Drop Winsock 1 accommodations throughout. (fhandler_socket::readv): Accomodate new POSIX style struct msghdr. (fhandler_socket::writev): Ditto. (fhandler_socket::recvmsg): Ditto. Handle "old" applications using former struct msghdr correctly. * net.cc: Drop Winsock 1 accommodations throughout. (wsadata): Move definition to autoload.cc. (set_socket_inheritance): Remove. (convert_ws1_ip_optname): New static function to convert Winsock1 IPPROTO_IP option values into Winsock2 IPPROTO_IP option values. (cygwin_setsockopt): Remove wrong and incomplete cleartext printing of optname. For "old" applications, convert optname from Winsock1 to Winsock2 values before using them. Add comment to describe the IP_TOS weirdness on W2K and above. (cygwin_getsockopt): Remove wrong and incomplete cleartext printing of optname. For "old" applications, convert optname from Winsock1 to Winsock2 values before using them. * select.cc (start_thread_socket): Forget about winsock2_active. * winsup.h (wsock32_handle): Remove declaration. (ws2_32_handle): Ditto. (netapi32_handle): Ditto. (wsadata): Ditto. (winsock2_active): Remove definition. * include/cygwin/socket.h: Change formatting slightly. (socklen_t): Move definition up in file. (struct msghdr): Convert to POSIX style. (struct cmsghdr): New type. (CMSG_ALIGN): New macro. (CMSG_LEN): Ditto. (CMSG_SPACE): Ditto. (CMSG_FIRSTHDR): Ditto. (CMSG_NXTHDR): Ditto. (CMSG_DATA): Ditto. (SCM_RIGHTS): Ditto. (struct OLD_msghdr): Define old msghdr structure for Cygwin internal purposes. (MSG_TRUNC): New macro. (MSG_CTRUNC): Ditto. (IP_OPTIONS): Redefine IPPROTO_IP option values to Winsock2 values. Keep Winsock1 values for Cygwin internal purposes. * include/cygwin/version.h: Bump API minor version. (CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR): Define to check for applications using old struct msghdr. (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES): Define to check for applications using old Winsock1 IPPROTO_IP values.
2005-09-28 Revert erroneous checkin.Corinna Vinschen1-91/+22
2005-09-28 * fhandler.h (class fhandler_dev_raw): Delete current_position andCorinna Vinschen1-22/+91
eof_detected status flag. Delete is_eom and is_eof methods. Move drive_size, bytes_per_sector, eom_detected status flag, as well as the methods read_file, write_file, raw_read and raw_write to ... (class fhandler_dev_floppy): ... here. Remove is_eom and is_eof methods. Add dup method. * fhandler_floppy.cc (IS_EOM): New macro. (fhandler_dev_floppy::is_eom): Remove. (fhandler_dev_floppy::is_eof): Remove. (fhandler_dev_floppy::fhandler_dev_floppy): Initialize status flags. (fhandler_dev_floppy::get_drive_info): Only call EX functions on systems supporting them and stop suffering strange delays. (fhandler_dev_floppy::read_file): Move here, drop setting current_position. (fhandler_dev_floppy::write_file): Move here, drop setting current_position. (fhandler_dev_floppy::open): Rearrange comment. (fhandler_dev_floppy::dup): New method. (fhandler_dev_floppy::get_current_position): New inline method. Use instead of former current_position were appropriate. (fhandler_dev_floppy::raw_read): Move here. Drop EOF handling. (fhandler_dev_floppy::raw_write): Move here. Drop EOF handling. (fhandler_dev_floppy::lseek): Remove useless conditions. Convert sector_aligned_offset to LARGE_INTEGER to improve SetFilePointer call. (fhandler_dev_floppy::ioctl): Move blocksize check in RDSETBLK case to here. * fhandler_raw.cc (fhandler_dev_raw::is_eom): Remove. (fhandler_dev_raw::is_eof): Remove. (fhandler_dev_raw::write_file): Remove. (fhandler_dev_raw::read_file): Remove. (fhandler_dev_raw::raw_read): Remove. (fhandler_dev_raw::raw_write): Remove. (fhandler_dev_raw::dup): Drop copying removed members. (fhandler_dev_raw::ioctl): Drop blocksize testing. * wincap.h: Implement has_disk_ex_ioctls throughout. * wincap.cc: Ditto. (wincap_vista): Preliminary wincaps for Windows Vista/Longhorn. (wincapc::init): Add Vista/Longhorn handling.
2005-08-18 * fhandler_socket.cc (fhandler_socket::recvfrom): Always initializeCorinna Vinschen1-4/+4
ret to 0. (fhandler_socket::recvmsg): Ditto.
2005-08-12white spaceChristopher Faylor1-1/+1
2005-07-05Change foo (void) to foo () for all c++ functions throughout. Remove allChristopher Faylor1-8/+8
fhandler_*::dump functions throughout. * fhandler.h (fhandler_dev_mem::close): Remove pass-through function in favor of virtual method. (handler_dev_raw::close): Ditto. (fhandler_dev_clipboard::fixup_after_exec): New method. * fhandler_dev_mem.cc (fhandler_dev_mem::close): Eliminate pass through * fhandler_dev_raw.cc (fhandler_dev_raw::close): Ditto. * fhandler_clipboard.cc (fhandler_dev_clipboard::close): Don't go to extra effort when execing. (fhandler_dev_clipboard::fixup_after_exec): New function. * fhandler_console.cc (fhandler_console::close): Don't do "extra stuff" when we know we're execing. * fhandler_disk_file.cc (fhandler_disk_file::close): Ditto. * fhandler_dsp.cc (fhandler_dev_dsp::close): Ditto. * fhandler_fifo.cc (fhandler_fifo.cc::close): Ditto. function in favor of base function. * fhandler_random.cc (fhandler_dev_random::close): Ditto. * fhandler_registry.cc (fhandler_registry::close): Ditto. * fhandler_tty.cc (fhandler_tty_slave::close): Ditto. * fhandler_virtual.cc (fhandler_virtual::close): Ditto. * pinfo.cc (proc_waiter): Remove unneeded hExeced declaration. * sigproc.cc: Ditto. * winsup.h (hExeced): Define here. * fhandler_virtual.cc (fhandler_virtual::fixup_after_exec): Just call close() to reinitialize things to known state.
2005-07-03Replace valid memory checks with new myfault class "exception handling", almostChristopher Faylor1-3/+7
everywhere. Leave some thread.cc stuff alone for now. * cygtls.h: Kludge some definitions to avoid including a problematic windows header. (_cygtls::_myfault): New entry. (_cygtls::_myfault_errno): Ditto. (_cygtls::fault_guarded): New function. (_cygtls::setup_fault): Ditto. (_cygtls::return_from_fault): Ditto. (_cygtls::clear_fault): Ditto. (myfault): New class. * exceptions.cc (handle_exceptions): Handle case of guarded fault in system routine. * gendef: Add another entry point for setjmp that the compiler doesn't know about and won't complain about. * gentls_offsets: Just include windows.h rather than kludging a HANDLE def. * miscfuncs.cc (check_null_str): Delete. (check_null_empty_str): Ditto. (check_null_empty_str_errno): Ditto. (check_null_str_errno): Ditto. (__check_null_invalid_struct): Ditto. (__check_null_invalid_struct_errno): Ditto. (__check_invalid_read_ptr): Ditto. (__check_invalid_read_ptr_errno): Ditto. (dummytest): New function. (check_iovec_for_read): Delete. (chec_iovec): Rename from check_iovec_for_write. Take a read/write parameter. * tlsoffsets.h: Regenerate. * winsup.h: Remove check_* declarations. (check_iovec_for_read): Delete declaration. Turn into a define instead. (check_iovec_for_write): Ditto. (check_iovec): New declaration. * thread.h: Use ifdef guard name consistent with other header files.
2005-06-12 * fhandler_socket.cc (fhandler_socket::recvmsg): Avoid SEGV in OpenSSHCorinna Vinschen1-0/+1
when trying to pass file descriptor by setting msg->msg_accrightslen to 0.
2005-06-10 * fhandler_socket.cc (fhandler_socket::sendto): Always initializeCorinna Vinschen1-4/+4
ret to 0. (fhandler_socket::sendmsg): Ditto.
2005-05-03 * fhandler_socket.cc (get_inet_addr): Add missing __seterrno call.Corinna Vinschen1-0/+2
2005-05-02white space and minor comment cleanup.Christopher Faylor1-8/+8
2005-04-18 * fhandler.h (enum conn_state): Add connect_failed state.Corinna Vinschen1-1/+3
* fhandler_socket.cc (fhandler_socket::connect): Set connect_state to connect_failed when connect failed. * poll.cc (poll): Change errno to EINVAL if allocating memory fails, according to SUSv3. Add socket descriptors always to except_fds. Test for failed connect and set revents flags appropriately. * select.cc (set_bits): Set connect_state to connect_failed when select indicates failed nonblocking connect. (fhandler_dev_null::select_except): Set except_ready to false so that /dev/null is not always in except state. (peek_socket): Fix bogus conditional. (fhandler_socket::select_write): Treat all connect_states except unconnected equivalent to return consistent results. (fhandler_windows::select_except): Set except_ready to false so that /dev/windows is not always in except state.
2005-04-13 * fhandler.h (class fhandler_socket): Remove utimes.Corinna Vinschen1-11/+0
* fhandler_socket.cc (fhandler_socket::utimes): Remove.
2005-04-06 * fhandler_socket.cc (get_inet_addr): Add type parameter to returnCorinna Vinschen1-4/+19
unix socket type. Read socket type from unix socket file. (fhandler_socket::bind): Write socket type to unix socket file. (fhandler_socket::connect): Return with errno EPROTOTYPE if socket type of socket doesn't match socket type of unix socket trying to connect to.
2005-03-24 * fhandler.h (fhandler_socket::secret_event): Remove.Corinna Vinschen1-233/+140
(fhandler_socket::af_local_set_secret): New function combining former set_connect_secret and get_connect_secret into one function. (fhandler_socket::af_local_setblocking): Rename from eid_setblocking. (fhandler_socket::af_local_unsetblocking): Rename from eid_unsetblocking. (fhandler_socket::af_local_set_cred): New method. (fhandler_socket::af_local_copy): New method. (fhandler_socket::af_local_recv_secret): New method. (fhandler_socket::af_local_send_secret): New method. (fhandler_socket::af_local_recv_cred): Rename from eid_recv. (fhandler_socket::af_local_send_cred): Rename from eid_send. (fhandler_socket::af_local_accept): New method. (fhandler_socket::af_local_set_sockpair_cred): Rename from set_socketpair_eids. (fhandler_socket::eid_accept): Remove. (fhandler_socket::eid_connect): Remove. (fhandler_socket::set_connect_secret): Remove. (fhandler_socket::get_connect_secret): Remove. (fhandler_socket::create_secret_event): Remove. (fhandler_socket::check_peer_secret_event): Remove. (fhandler_socket::signal_secret_event): Remove. (fhandler_socket::close_secret_event): Remove. (fhandler_socket::sec_event_accept): Remove. (fhandler_socket::sec_event_connect): Remove. * fhandler_socket.cc (secret_event_name): Remove. (fhandler_socket::af_local_set_sockpair_cred): Rename from set_socketpair_eids. (fhandler_socket::af_local_setblocking): Rename from eid_setblocking. (fhandler_socket::af_local_unsetblocking): Rename from eid_unsetblocking. (fhandler_socket::af_local_recv_secret): New function to receive AF_LOCAL connect secret over socket itself. (fhandler_socket::af_local_send_secret): New function to send AF_LOCAL connect secret over socket itself. (fhandler_socket::af_local_recv_cred): Rename from eid_recv. (fhandler_socket::af_local_send_cred): Rename from eid_send. (fhandler_socket::eid_connect): Remove. (fhandler_socket::af_local_connect): Take over connect side handling of AF_LOCAL secret and credential handshake. (fhandler_socket::eid_accept): Remove. (fhandler_socket::af_local_accept): New method, take over accept side handling of AF_LOCAL secret and credential handshake. (fhandler_socket::af_local_set_cred): New method, set eid credentials to start values. (fhandler_socket::af_local_copy): New method, copy secret and credentials to another socket. (fhandler_socket::af_local_set_secret): New function combining former set_connect_secret and get_connect_secret into one function. (fhandler_socket::create_secret_event): Remove. (fhandler_socket::signal_secret_event): Remove. (fhandler_socket::close_secret_event): Remove. (fhandler_socket::check_peer_secret_event): Remove. (fhandler_socket::sec_event_connect): Remove. (fhandler_socket::sec_event_accept): Remove. (fhandler_socket::fixup_after_fork): Drop secret_event handling. (fhandler_socket::bind): Call af_local_set_secret. (fhandler_socket::connect): Call af_local_set_cred and af_local_connect. (fhandler_socket::listen): Call af_local_set_cred. (fhandler_socket::accept): Call af_local_copy and af_local_accept on accepted socket. (fhandler_socket::close): Don't call close_secret_event. (fhandler_socket::set_close_on_exec): Don't set secret_event inheritance. * net.cc (cygwin_getsockopt): Add debug output. (socketpair): Call af_local_set_sockpair_cred instead of set_socketpair_eids. * select.cc (set_bits): Drop AF_LOCAL special handling in case of except bit set.
2005-03-23 * fhandler.h (fhandler_socket::eid_connect): Make private.Corinna Vinschen1-66/+86
(fhandler_socket::set_connect_secret): Ditto. (fhandler_socket::get_connect_secret): Ditto. (fhandler_socket::create_secret_event): Ditto. Remove secret argument. (fhandler_socket::check_peer_secret_event): Ditto. (fhandler_socket::signal_secret_event): Make private. (fhandler_socket::close_secret_event): Ditto. (fhandler_socket::sec_event_accept): New private method. (fhandler_socket::sec_event_connect): Ditto. (fhandler_socket::af_local_connect): New public method. * fhandler_socket.cc: Use 'struct sockaddr' and 'struct sockaddr_in' rather than just 'sockaddr' and 'sockaddr_in' throughout. (fhandler_socket::eid_connect): Drop AF_LOCAL/SOCK_STREAM test. (fhandler_socket::create_secret_event): Remove secret argument. Always use connect_secret instead. (fhandler_socket::check_peer_secret_event): Ditto. (fhandler_socket::sec_event_connect): New method, combining entire secret event handshake on connect side. (fhandler_socket::af_local_connect): New method, combining secret event handshake and eid credential transaction on connect side, to be called from select. (fhandler_socket::sec_event_accept): New method, combining entire secret event handshake on accept side. (fhandler_socket::connect): Drop secret, use connect_secret instead. Move entire secret event handshake to sec_event_connect. (fhandler_socket::accept): Move entire secret event handshake to sec_event_accept. * select.cc (set_bits): Just call af_local_connect here.
2005-03-22* Makefile.in (DLL_OFILES): Add hookapi.o. Eliminate some cruft.Christopher Faylor1-1/+3
* cygheap.h (cygheap_types): Add new enum: HEAP_1_HOOK. (hook_chain): New struct. (init_cygheap::hooks): Define new element. * cygheap.cc (cygheap_fixup_in_child): Zero hook chain on exec. * dcrt0.cc (dll_crt0_1): Call ld_preload just before calling main function. * external.cc (cygwin_internal): Implement CW_HOOK. * fork.cc (fork_child): Call fixup_hooks_after_fork. * init.cc (cygwin_hmodule): Reinstate after a long absence. * include/sys/cygwin.h: Define CW_HOOK. * hookapi.cc: New file. * select.cc (start_thread_socket): Add debugging output. * fhandler_disk_file.cc (fhandler_disk_file::fchmod): gcc 4.x accommodation. * fhandler_socket.cc (fhandler_socket::connect): Make sure that err is initialized.
2005-03-21 * fhandler.h (class cygthread): Forward declare.Corinna Vinschen1-131/+169
(fhandler_socket::sec_pipe): Remove. (fhandler_socket::eid_pipe_name): Remove. (fhandler_socket::eid_setblocking): New private method. (fhandler_socket::eid_unsetblocking): Ditto (fhandler_socket::eid_recv): Ditto (fhandler_socket::eid_send): Ditto (fhandler_socket::eid_accept): Ditto (fhandler_socket::eid_connect): New public method. * fhandler_socket.cc (ASYNC_MASK): Move to beginning of file. (fhandler_socket::eid_pipe_name): Remove. (fhandler_socket::set_socketpair_eids): Move down to fhandler_socket methods. (fhandler_socket::fhandler_socket): Drop initializing sec_pipe. (fhandler_socket::~fhandler_socket): Drop closing sec_pipe. (fhandler_socket::eid_setblocking): New method. (fhandler_socket::eid_unsetblocking): New method. (fhandler_socket::eid_recv): New method. (fhandler_socket::eid_send): New method. (fhandler_socket::eid_connect): New method. (fhandler_socket::eid_accept): New method. (fhandler_socket::dup): Drop sec_pipe handling. (fhandler_socket::connect): Fix WinSock error handling. Prepare eid credential transaction. Call eid_connect on successful connect. (fhandler_socket::listen): Drop creating sec_pipe. (fhandler_socket::accept): Slightly simplify code. Call eid_accept on accepted socket. (fhandler_socket::getpeereid): Reshuffle code for readability. Fix test for invalid pid. * select.cc (set_bits): Call eid_connect on successfully connected socket.
2005-03-17 * fhandler_socket.cc (fhandler_socket::connect): Always set sun_pathCorinna Vinschen1-42/+34
in case of a successful or pending connect. (fhandler_socket::accept): Don't run secret event and eid credential transactions if OS accept returned WSAEWOULDBLOCK.
2005-03-09 * fhandler_socket.cc (fhandler_socket::eid_pipe_name): Fix formatCorinna Vinschen1-43/+51
string. (fhandler_socket::connect): Set sun_path before running eid credential transaction. Run transaction only if OS connect was successful. (fhandler_socket::accept): Run transaction only if OS accept was successful.
2005-03-08 * fhandler_socket.cc (fhandler_socket::listen): Don't limit the numberCorinna Vinschen1-2/+2
of pipe instances.
2005-03-04 * fhandler_socket.cc (fhandler_socket::ioctl): Only cancelCorinna Vinschen1-1/+1
WSAAsyncSelect when async mode is on.
2005-02-28 * fhandler.h (class fhandler_socket): Declare new methodCorinna Vinschen1-36/+92
set_socketpair_eids. * fhandler_socket.cc (fhandler_socket::set_socketpair_eids): New method. (fhandler_socket::dup): Duplicate sec_pipe if necessary. (fhandler_socket::listen): Only create sec_pipe if named pipes are available. Initialized sec_peer_pid to 0 as on Linux. (fhandler_socket::connect): Only run eid credential transaction if named pipes are available. Fake otherwise. Initialized sec_peer_pid to 0 as on Linux. (fhandler_socket::accept): Ditto. (fhandler_socket::close): Move closing sec_pipe handle from here... (fhandler_socket::~fhandler_socket): ... to here. * net.cc (socketpair): Set eid credentials by calling fhandler_socket::set_socketpair_eids() on both socket ends. * wincap.h (wincaps::has_named_pipes): New element. * wincap.cc: Implement above element throughout.
2005-02-23 * cygwin.din (getpeereid): Export.Corinna Vinschen1-3/+99
* fhandler.h (class fhandler_socket): Add pipe and id members to exchange eid credentials for AF_LOCAL sockets. (eid_pipe_name): Declare new method. (getpeereid): Ditto. * fhandler_socket.cc (fhandler_socket::eid_pipe_name): New method. (fhandler_socket::fhandler_socket): Initialize sec_pipe. (fhandler_socket::connect): Exchange eid credentials with accepting socket process. (fhandler_socket::listen): Prepare eid credential transaction. (fhandler_socket::accept): Exchange eid credentials with connecting socket process. (fhandler_socket::close): Close eid credentials pipe if open. (fhandler_socket::getpeereid): New method. * net.cc (cygwin_getsockopt): Add SO_PEERCRED handling. (getpeereid): New function. * include/asm/socket.h (SO_PEERCRED): Define. * include/cygwin/socket.h (struct ucred): Define new type. * include/cygwin/version.h: Bump API minor version.
2005-02-20 * fhandler.h (enum query_state): Add query_write_attributes state.Corinna Vinschen1-8/+15
(fhandler_base::status.query_open): Add a bit to make room for more states. (class fhandler_base): Declare new method utimes. (class fhandler_socket): Ditto. (class fhandler_disk_file): Ditto. (fhandler_disk_file::fhandler_disk_file): Add constructor with path_conv parameter. * fhandler.cc (fhandler_base::open): Add query_write_attributes handling. (fhandler_base::utimes): New method. * fhandler_disk_file.cc (fhandler_disk_file::link): Simplify. Open file with query_write_attributes instead of query_write_control. (fhandler_disk_file::utimes): New method. (fhandler_disk_file::fhandler_disk_file): Add constructor with path_conv parameter setting pc member immediately. * fhandler_socket.cc (fhandler_socket::fchmod): Use new fhandler_disk_file constructor. (fhandler_socket::fchown): Ditto. (fhandler_socket::facl): Ditto. (fhandler_socket::link): Ditto. (fhandler_socket::utimes): New method. * times.cc: Include dtable.h. (timeval_to_filetime): Make non-static. (utimes): Move functionality into fhandler method utimes. Just call this method from here. * winsup.h: Simplify declarations of time helper functions. (timeval_to_filetime): Add extern declaration.
2005-02-20copyrightChristopher Faylor1-1/+1
2005-02-19 * fhandler.h (class fhandler_base): Declare new method link.Corinna Vinschen1-0/+12
(class fhandler_socket): Ditto. (class fhandler_disk_file): Ditto. * fhandler.cc (fhandler_base::open): Add FILE_WRITE_ATTRIBUTES to query_write_control access flags. (fhandler_base::link): New method. * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't try to open with O_WRONLY since query_write_control includes FILE_WRITE_ATTRIBUTES. (fhandler_disk_file::fchown): Ditto. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::link): New method. Touch st_ctime on successful link. * fhandler_socket.cc (fhandler_socket::link): New method. * syscalls.cc (link): Move functionality into fhandler method link. Just call this method from here.
2005-02-19 * fhandler.h (class fhandler_socket): Declare new methods fchown,Corinna Vinschen1-5/+57
fchmod and facl. * fhandler_socket.cc (fhandler_socket::fstat): Handle AF_LOCAL sockets. (fhandler_socket::fchmod): New method. (fhandler_socket::fchown): New method. (fhandler_socket::facl): New method.
2005-02-01 * fhandler.cc (fhandler_base::get_proc_fd_name): Don't generateCorinna Vinschen1-18/+11
"device:" entry. * fhandler.h (fhandler_socket::open): New method. (fhandler_pipe::open): New method. * fhandler_proc.cc (fhandler_proc::exists): Return -2 in case of /proc/self. * fhandler_process.cc (fhandler_process::exists): Return -2 in case of symlinks, -3 for pipes and -4 for sockets. (fhandler_process::fstat): Handle pipes and sockets. (fhandler_process::open): Handle opening /proc/<pid>/fd. (fhandler_process::fill_filebuf): Generate empty names for non exisiting file descriptors. * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): Always generate "socket:[number]" strings as on Linux. (fhandler_socket::open): New method. (fhandler_socket::fstat): Always return socket type. * path.cc (symlink_info::set): Remove unused second parameter. (path_conv::check): Handle pipes and sockets in /proc. Set correct device type for AF_LOCAL sockets. * pinfo.cc (_pinfo::commune_recv): Generate empty names for non exisiting file descriptors. (_pinfo::fd): Ditto. * pipe.cc (fhandler_pipe::open): New method.
2005-01-31 * cygheap.h (class cygheap_fdenum): New class to enumerate usedCorinna Vinschen1-0/+9
fhandlers. * dtable.h (class dtable): Add cygheap_fdenum as friend class. * fhandler.h (fhandler_base::get_proc_fd_name): New virtual method to return a name for /proc/<pid>/fd. (fhandler_socket::get_proc_fd_name): Ditto. (fhandler_pipe::get_proc_fd_name): Ditto. (fhandler_virtual::opendir): Make virtual method. (fhandler_process::opendir): New method. * fhandler.cc (fhandler_base::get_proc_fd_name): New method. * fhandler_process.cc: Include ctype.h. (PROCESS_FD): Define. (process_listing): Add "fd". (fhandler_process::exists): Fix comment. Return 1 in case of "fd" directory. Handle files below "fd". (fhandler_process::fstat): Drop "self" handling. Set correct link count for directories. (fhandler_process::opendir): New method to handle "fd" directory. (fhandler_process::readdir): Add "fd" handling. (fhandler_process::open): Drop "self" handling. (fhandler_process::fill_filebuf): Ditto. Add "fd" handling. Fix "maps" output string. * fhandler_registry.cc (fhandler_registry::fstat): Set correct link count for directories. * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): New method. * path.cc (symlink_info::set): Fix thinko. * pinfo.cc (_pinfo::commune_recv): Rename pathbuf to path throughout. Drop local path variable in PICOM_FIFO case. Fix debug output. Close handles as early as possible. Add PICOM_FDS and PICOM_FD handling. (_pinfo::commune_send): Add PICOM_FDS and PICOM_FD handling. (_pinfo::fd): New method. (_pinfo::fds): New method. * pinfo.h (enum picom): Add PICOM_FDS and PICOM_FD. (_pinfo::fd): Declare. (_pinfo::fds): Declare. * pipe.cc (fhandler_pipe::get_proc_fd_name): New method.
2004-10-26* cygtls.cc (_cygtls::fixup_after_fork): Wipe out exitsock local since itChristopher Faylor1-2/+2
should not be used by the child. * select.cc (start_thread_socket): Turn off inheritance for exitsock. Don't add exitsock to exception mask since it should never get an exception. (socket_cleanup): Change some debug messages for consistency. * fhandler_socket.cc (fhandler_socket::dup): Change comment wording slightly.
2004-09-03Regularize most strace_prints throughout so that %E is always preceded by aChristopher Faylor1-2/+2
comma and elminate most uses of "foo = %s" to "foo %s".
2004-08-19 * fhandler_socket.cc (fhandler_socket::dup): Decrement dtable'sCorinna Vinschen1-1/+5
need_fixup_before counter on successful dup. * net.cc (cygwin_getpeername): Add file descriptor to debug output.