summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/net.cc
Commit message (Collapse)AuthorAgeFilesLines
* * net.cc (cygwin_accept): Set sun_path for newly connected socket.Corinna Vinschen2002-01-091-0/+2
|
* * net.cc: Replace usage of AF_UNIX by Posix compliant AF_LOCALCorinna Vinschen2002-01-041-29/+114
| | | | | | | | throughout. (socketpair): Explicitly allow SOCK_STREAM and SOCK_DGRAM socket types in families AF_UNIX and AF_LOCAL. Explicitly allow PF_UNSPEC, PF_LOCAL and PF_INET protocols. Return error otherwise. Implement datagram socketpairs.
* * fhandler.h (fhandler_socket::sun_path): New private member.Corinna Vinschen2002-01-011-5/+23
| | | | | | | | | | | | (fhandler_socket::set_sun_path): New method. (fhandler_socket::get_sun_path): Ditto. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize sun_path to NULL. (fhandler_socket::~fhandler_socket): Free sun_path if needed. (fhandler_socket::set_sun_path): New method. * net.cc (cygwin_bind): Set sun_path to path of local socket file. (cygwin_getsockname): Add code to return correct sockaddr for unix domain sockets.
* * net.cc (cygwin_getsockopt): Dereference optlen pointer when passing toChristopher Faylor2001-12-041-1/+1
| | | | __check_null_invalid_struct_errno.
* * net.cc (cygwin_getsockopt): Allow NULL optval.Christopher Faylor2001-12-031-8/+8
| | | | | * path.cc (mount_info::read_cygdrive_info_from_registry): Don't write cygdrive to registry if it doesn't exist.
* * net.cc (cygwin_hstrerror): Allow s == NULL.Corinna Vinschen2001-11-241-1/+13
| | | | | (cygwin_rcmd): Add parameter checking. (cygwin_rexec): Ditto.
* * net.cc (cygwin_inet_ntoa): Add parameter checking.Corinna Vinschen2001-11-241-1/+11
| | | | | | | | | (cygwin_inet_network): Return INADDR_NONE instead of 0 in case of EFAULT. (cygwin_hstrerror): Add parameter checking. (cygwin_rresvport): Ditto. (socketpair): Ditto. * winsup.h (check_null_str): Add extern declaration.
* * net.cc (inet_makeaddr): Revert previous change.Christopher Faylor2001-11-241-1/+1
|
* * dtable.cc (dtable::vfork_parent_restore): Add debugging statement.Christopher Faylor2001-11-241-112/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | * exceptions.cc (try_to_debug): Spin only as long as we don't have a debugger attached. * fhandler.h (fhandler_base::set_nohandle): New method. (fhandler_base::get_nohandle): New method. * fhandler.cc (fhandler_base::dup): Avoid duplicating handle if there is no handle. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Set nohandle flag on dummy fd. * Makefile.in: Make intermediate library for eventual inclusion in libcygwin.a * fhandler.h (fhandler_pipe::fhandler_pipe): Remove default argument setting since it is no longer used. * miscfuncs.cc (check_null_str): New function. (+check_null_str_errno): Ditto. * net.cc: Add defensive buffer checking throughout. (cygwin_sendto): Protect against invalid fd. (cygwin_recvfrom): Ditto. (cygwin_getpeername): Ditto. (cygwin_recv): Ditto. (cygwin_send): Ditto. * winsup.h: Declare a new function. * select.cc (set_bits): Fix conditional for setting fd in exceptfds. * dtable.cc (dtable::build_fhandler): Create fhandler_pipe using correct device type. * path.cc (get_devn): Set correct pipe device type from device name.
* * dtable.cc (dtable::build_fhandler): Don't increment console fd count if newChristopher Faylor2001-11-101-1/+0
| | | | | | operation fails. Increment fork_fixup field here. (dtable::dup2): Don't increment fork_fixup field here. (fdsock): Ditto.
* Eliminate excess whitespace.Christopher Faylor2001-11-051-16/+16
|
* * net.cc (get_2k_ifconf): Change multiple IP address naming schemeCorinna Vinschen2001-10-221-74/+88
| | | | | | | | to Linux style. Patch by Alexander Gottwald <ago@informatik.tu-chemnitz.de>: * net.cc (get_2k_ifconf): Added support for multiple IP addresses on one interface.
* * fhandler.cc (fhandler_base::fork_fixup): Don't protect handle.Christopher Faylor2001-10-151-61/+45
| | | | | | | | | | | | | | | | | | | * dlfcn.cc: Fix to confirm to coding standards. Reorganize includes throughout to accomodate new cygheap.h usage. * cygheap.h (cygheap_fdmanip): New class: simplifies locking and retrieval of fds from cygheap->fdtab. (cygheap_fdget): Ditto. (cygheap_fdnew): Ditto. * fcntl.cc (_fcntl): Use new method to lock fdtab and retrieve info. * ioctl.cc (ioctl): Ditto. * mmap.cc (mmap): Ditto. * net.cc: Ditto, throughout. * passwd.cc (getpass): Ditto. * path.cc (fchdir): Ditto. * pipe.cc (make_pipe): Ditto. * sec_acl.cc (facl): Ditto. * syscalls.cc: Ditto, throughout. * termios.cc: Ditto, throughout.
* * autoload.cc (load_wsock32): Declare dummy function to force loading ofChristopher Faylor2001-10-141-31/+25
| | | | | | | | | | | | | | | | | | | | | | | | winsock. * fhandler.cc (fhandler_base::set_inheritance): Make debugging output more verbose. * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Force loading of winsock32 if winsock2 not available. * net.cc (set_socket_inheritance): Use DuplicateHandle in all cases to set inheritance correctly. (fdsock): Use winsock2_active macro to determine when to set socket inheritance. Remove fdtab resource locking since this function should already be protected. (cygwin_accept): Simplify logic. Ensure that fdtab unlock is not called inappropriately. (cygwin_rcmd): Use fdtab locking. (cygwin_rresvport): Ditto. (cygwin_rexec): Ditto. * select.cc (peek_socket): Set errno appropriately if winsock select fails. * winsup.h: Declare check_pty_fds. * syscalls.cc (check_pty_fds): Rename from check_ttys_fds. Also check pty master. (setsid): Use check_pty_fds. * dtable.cc (dtable::dec_console_fds): Add check on pty fds.
* * fhandler_dsp.cc (fhandler_dsp::ioctl): Return 0 for successfulChristopher Faylor2001-10-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | SNDCTL_DSP_GETBLKSIZE operation. Remove obsolete 'name' arg from fhandler_* constructors throughout. * winsup.h (winsock_active): New macro. (winsock2_active): Ditto. * autoload.cc (wsock_init): Use new macros to decide if winsock or winsock2 is loaded. (nonexist_wsock32): Dummy function to force winsock load. (nonexist_ws2_32): Dummy function to force winsock2 load. * fhandler.h (fhandler_socket::fstat): Declare new method. Currently unused. * fhandler_socket.cc (fhandler_socket::fixup_before_fork_exec): Check that winsock2 is active before trying WSADuplicateSocketA. (fhandler_socket::fixup_after_fork): Add extra check for winsock2_active. Otherwise use iffy procedures for Windows 95. (fhandler_socket::fixup_after_exec): Add debugging. (fhandler_socket::dup): Add debugging. (fhandler_socket::fstat): New method. (fhandler_socket::set_close_on_exec): Attempt to perform iffy stuff on Windows 95. * errno.cc (_sys_nerr): Work around compiler strangeness. * pinfo.cc (winpids::add): Add extra element at end of allocated array for setting to NULL. (winpids::enumNT): Ditto. (winpids::init): Don't modify pidlist if it hasn't been allocated (possibly due to malloc problem).
* * autoload.cc (wsock_init): Reorganize slightly to accomodate a new compiler.Christopher Faylor2001-10-131-1/+1
|
* * net.cc (cygwin_sendto): Use correct socket address when sendingEgor Duda2001-10-111-2/+2
| | | | data to AF_UNIX socket.
* * net.cc (get_95_ifconf): Using other registry values pointing toCorinna Vinschen2001-10-101-49/+26
| | | | correct networkdevice identification for Windows95.
* * net.cc (dup_servent_ptr): Detect old Windows 95 misaligned structure andChristopher Faylor2001-09-161-2/+18
| | | | realign appropriately.
* * Makefile.in: Build wincap.o.Corinna Vinschen2001-09-121-17/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | * wincap.cc: New file. * wincap.h: Ditto. * autoload.cc: Add dynamic load statement for `CreateHardLinkA'. * dcrt0.cc (os_being_run): Eliminated. (osname): Ditto. (iswinnt): Ditto. (set_os_type): Ditto. (dll_crt0_1): Call wincap.init() instead of set_os_type(). (_dll_crt0): Ditto. * environ.cc (set_chunksize): New function. (parse_thing): `forkchunk' setting now invokes function `set_chunksize'. * fork.cc (chunksize): Eliminated. Moved to be member of wincap. * host_dependent.h: Removed. * syscalls.cc (_link): Try using `CreateHardLinkA' first, if available. * cygheap.cc, dcrt0.cc, delqueue.cc, dir.cc, environ.cc, fhandler.cc, fhandler.h, fhandler_console.cc, fhandler_mem.cc, fork.cc, mmap.cc, net.cc, pinfo.cc, pinfo.h, security.cc, syscalls.cc, sysconf.cc, syslog.cc, thread.cc, times.cc, tty.cc, uinfo.cc, uname.cc, winsup.h: Use new wincap capability check throughout. * winsup.h: Include wincap.h. Eliminate extern declarations of `os_being_run' and `iswinnt'. Eliminate `os_type" definition. * include/cygwin/version.h: Bump version to 1.3.4.
* Update copyrights.Christopher Faylor2001-09-111-1/+1
|
* * cygheap.h (init_cygheap): Move heap pointers here.Christopher Faylor2001-09-071-18/+18
| | | | | | | | | | | | | | | | | | | * include/sys/cygwin.h (perprocess): Remove heap pointers. * dcrt0.cc (__cygwin_user_data): Reflect obsolete perprocess stuff. (_dll_crt0): Don't initialize heap pointers. (cygwin_dll_init): Ditto. (release_upto): Use heap pointers from cygheap. * heap.h: Ditto. * fork.cc (fork_parent): Ditto. Don't set heap pointers in ch. (fork_child): Remove obsolete sigproc_fixup_after_fork. * shared.cc (memory_init): Reorganize so that cygheap initialization is called prior to regular heap since regular heap uses cygheap now. * sigproc.cc (proc_subproc): Eliminate zombies allocation. (sigproc_init): Move zombies alloation here. Don't free up array on fork, just reuse it. (sigproc_fixup_after_fork): Eliminate. * sigproc.h: Ditto. * include/cygwin/version.h: Reflect change to perprocess structure.
* Move appropriate variables to NO_COPY segment, throughout.Christopher Faylor2001-09-061-2/+2
|
* Remove initialization of static or global values to zero, throughout. ThisChristopher Faylor2001-09-061-2/+2
| | | | | | just needlessly grows the size of the DLL. * tty.cc (tty::alive): Make inuse handle non-inheriting on open, just for thread safety.
* * net.cc (cygwin_connect): Add WSAEALREADY and WSAEINVAL handlingCorinna Vinschen2001-09-051-5/+10
| | | | for non-blocking sockets.
* * cygwin.sc: New file -- linker script for building cygwin DLL.Christopher Faylor2001-08-311-0/+14
| | | | | | | | | | | | | | | | | | | | | | | * Makefile.in: Use linker script to control location of cygheap. * cygheap.cc (buckets): Make static. (init_cheap): Remove special iswinnt handling. Allocate cygheap at a fixed location. Display more info when allocation fails. (cygheap_fixup_in_child): Try harder to move cygheap to correct location. Display more info when allocation fails. * fhandler.h (fhandler_socket): Add macros for tracking socket shutdown state. * net.cc (cygwin_shutdown): Set appropriate shutdown value for future use. * select.cc (select_stuff::cleanup): New method. (cygwin_select): Call cleanup explicitly to avoid a race. (select_stuff:~select_stuff): Call cleanup chain via cleanup method. (fhandler_socket::select_read): Set *_ready when shutdown has been called on the socket. (fhandler_socket::select_write): Ditto. (fhandler_socket::select_except): Ditto. * winsup.h: Move NO_COPY to "COMMON" section. * autoload.cc (wsock_started): Avoid initializing NO_COPY value. * sigproc.cc: Remove initialization from NO_COPY variables. (sigproc_init): Initialize sig_loop_wait here, rather than via initialization. (subproc_init): Initialize proc_loop_wait here, rather than via initialization.
* * net.cc (free_addr_list): Add define for symmetry.Corinna Vinschen2001-08-241-2/+24
| | | | | | | (free_hostent_ptr): Use free_addr_list to free h_addr_list element. (dup_addr_list): New static function. (dup_hostent_ptr): Use dup_addr_list instead of dup_char_list in order to handle embedded null characters.
* * net.cc (cygwin_inet_ntoa): Rearrange previous patch to useCorinna Vinschen2001-08-221-56/+72
| | | | | | | | | | | | | | | thread local buffer space when compiled thread safe. (cygwin_getprotobyname): Ditto. (cygwin_getprotobynumber): Ditto. (cygwin_getservbyname): Ditto. (cygwin_getservbyport): Ditto. (cygwin_gethostbyname): Ditto. (cygwin_gethostbyaddr): Ditto. Move near to cygwin_gethostbyname. * thread.h (struct _winsup_t): Add pointers for above used buffer space. * passwd.cc (getpwduid): Remove initializing passwd. (setpwent): Ditto. (endpwent): Ditto. (setpassent): Ditto.
* * net.cc (free_char_list): New static function.Corinna Vinschen2001-08-221-7/+186
| | | | | | | | | | | | | | | | | | (dup_char_list): Ditto. (free_protoent_ptr): Ditto. (dup_protoent_ptr): Ditto. (free_servent_ptr): Ditto. (dup_servent_ptr): Ditto. (free_hostent_ptr): Ditto. (dup_hostent_ptr): Ditto. (cygwin_inet_ntoa): Use local static buffer to allow propagating of the result to child processes. (cygwin_getprotobyname): Ditto. (cygwin_getprotobynumber): Ditto. (cygwin_getservbyname): Ditto. (cygwin_getservbyport): Ditto. (cygwin_gethostbyname): Ditto. (cygwin_gethostbyaddr): Ditto.
* * fhandler.cc (fhandler_base::is_nonblocking): New method.Corinna Vinschen2001-08-151-5/+4
| | | | | | | | | | | | | | | | | | (fhandler_base::set_nonblocking): Ditto. * fhandler.h (fhandler_base): Declare new methods `is_nonblocking' and `set_nonblocking'. * fhandler_socket.cc (fhandler_socket::ioctl): Use `set_nonblocking'. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Use `is_nonblocking'. (fhandler_tty_slave::read): Ditto. (fhandler_tty_slave::ioctl): Use `set_nonblocking'. (fhandler_pty_master::ioctl): Ditto. * net.cc (cygwin_sendto): Fallback to winsock 1 functionality in case of nonblocking IO. (cygwin_recvfrom): Ditto. (cygwin_recv): Ditto. (cygwin_send): Ditto. * syscalls.cc (_read): Use `is_nonblocking'.
* * fhandler.cc (fhandler_base::fcntl): Use new O_NONBLOCK_MASK define.Corinna Vinschen2001-08-141-1/+1
| | | | | | | | | | | | | | | | | | | * fhandler.h: Move definitions of O_NOSYMLINK, O_DIROPEN and OLD_O_NDELAY from winsup.h to here. Add O_NONBLOCK_MASK define. * fhandler_socket.cc (fhandler_socket::close): Add hack to allow a graceful shutdown even if shutdown() hasn't been called by the application. Add debug output. (fhandler_socket::ioctl): Set fhandler's NONBLOCK flag according to FIONBIO setting. (fhandler_socket::fcntl): Use new O_NONBLOCK_MASK define. Actually set `request' before using it. * fhandler_tty.cc: Use new O_NONBLOCK_MASK define throughout. (fhandler_tty_slave::ioctl): Set fhandler's NONBLOCK flag according to FIONBIO setting. (fhandler_pty_master::ioctl): Ditto. * net.cc (wsock_event::prepare): Compare WSACreateEvent return code with `WSA_INVALID_EVENT' according to MSDN. * syscalls.cc (_read): Use new O_NONBLOCK_MASK define.
* * cygheap.cc (cygheap_root::set): Avoid treating '/' specially.Christopher Faylor2001-08-071-2/+2
| | | | | | | | | * fhandler.cc (fhandler_base::fcntl): Only set specific O_NDELAY style flag passed in from application. * fhandler_socket.cc (fhandler_socket::fcntl): Ditto. * fhandler.h: Set constant for future use. * winsup.h: Define OLD_O_NDELAY only for old programs. * include/cygwin/version.h: Define CYGWIN_VERSION_CHECK_FOR_OLD_O_NONBLOCK.
* Throughout, change check for running under Windows NT to 'iswinnt'.Christopher Faylor2001-08-041-3/+3
| | | | | | | | | | | | | * dcrt0.cc (set_os_type): Set 'iswinnt' appropriately. * cygheap.cc (init_cheap): Revert to using VirtualAlloc for allocating cygheap. (cygheap_setup_for_child_cleanup): New function. Standard function to call after calling CreateProcess to cleanup cygheap info passed to child. (cygheap_fixup_in_child): Copy cygheap from shared memory into allocated space under Windows 9x or if can't relocate shared space under NT. * cygheap.h: Declare new function. * spawn.cc (spawn_guts): Use cygheap_fixup_in_child. * fork.cc (fork_parent): Ditto. * winsup.h: Declare iswinnt.
* * net.cc (cygwin_accept): Allow NULL peer and len parameters.Corinna Vinschen2001-08-031-0/+11
| | | | * include/cygwin/socket.h: Define socklen_t as int.
* Throughout, reorganize header file inclusion to put security.h prior toChristopher Faylor2001-07-261-0/+1
| | | | | | | | fhandler.h. * fhandler.h (fhandler_base::get_inheritance): New method. * fhandler_socket.cc (fhandler_socket::create_secret_event): Use proper close-on-exec inheritance when creating. (fhandler_socket::check_peer_secret_event): Create handle as non-inheritable.
* * mmap.cc: Clean up *ResourceLock calls throughout.Christopher Faylor2001-06-261-315/+315
| | | | | | | * thread.cc (pthread_cond::TimedWait): Check for WAIT_TIMEOUT as well as WAIT_ABANDONED. (__pthread_cond_timedwait): Calculate a relative wait from the abstime parameter.
* * fhandler_socket.cc (fhandler_socket::signal_secret_event): NewEgor Duda2001-06-201-11/+21
| | | | | | | | | | | function. * fhandler.h: Declare it. * fhandler_socket.cc (fhandler_socket::create_secret_event): Don't signal secret event immediately. (fhandler_socket::check_peer_secret_event): Do it after peer event was opened. * net.cc (cygwin_connect): Or if socket is non-blocking. (cygwin_accept): Ditto.
* * net.cc (wsock_event): Add destructor.Corinna Vinschen2001-06-031-0/+6
|
* * net.cc (wsock_event::wait): Explicitely cancel IO when a signalCorinna Vinschen2001-05-181-1/+7
| | | | | arrived to avoid data loss. Fallback to blocking IO when canceling fails.
* * net.cc (errmap): Add missing mapping from WSAEINTR to EINTR.Corinna Vinschen2001-05-161-0/+1
|
* * autoload.h: Eliminate.Christopher Faylor2001-05-161-40/+1
| | | | | | | | | | * autoload.cc: Pull in autoload.h. Eliminate many macros. Rewrite to avoid necessity of initialization routines. Just use a standard one. (wsock_init): New function. Moved from net.cc. * net.cc (wsock_init): Move to autoload.cc. (wsadata): Make global. * dtable.cc (dtable::build_fhandler): Use more reliable method for checking if net stuff has been loaded.
* * autoload.cc: Add autoload statements for ws2_32 functionsCorinna Vinschen2001-05-151-25/+166
| | | | | | | | | | | | | | `WSACloseEvent', `WSACreateEvent', `WSAGetOverlappedResult', `WSARecv', `WSARecvFrom', `WSASend', `WSASendTo' and `WSASetEvent', `WSAWaitForMultipleEvents'. * net.cc: Define wsock_evt. (wsock_event): New class. (cygwin_sendto): Use overlapped socket io if available. (cygwin_recvfrom): Ditto. (cygwin_recv): Ditto. (cygwin_send): Ditto. * security.cc (subauth): Set Win32 error to 0 to safely ask for the error code of dynamically loaded function `LsaRegisterLogonProcess'.
* Revert much of previous erroneous checkin. Add ChangeLog entry.Christopher Faylor2001-05-041-3/+3
| | | | | | | | | | | * pinfo.h: Correctly set __SIGOFFSET. * path.cc (hash_path_name): Avoid calling library functions for simple copying of characters. * shortcut.c: Use WIN32_LEAN_AND_MEAN. * smallprint.c: Ditto. * environ.cc (getwinenv): Minor clarity fix. * localtime.c: No need to include windows.h * string.h: New file.
* * exceptions.cc (ctrl_c_handler): Always send signal to process if it has noChristopher Faylor2001-05-041-3/+3
| | | | tty.
* * net.cc (wsock_init): Rename `was_in_progress' to `wsock_started'Corinna Vinschen2001-05-031-3/+3
| | | | for clearness.
* * autoload.cc: Use new definition of LoadDLLinitfunc throughout.Corinna Vinschen2001-05-031-16/+33
| | | | | | | | | | | Redefine wrapper for wsock32.dll and ws2_32.dll. (std_dll_init): New function. * autoload.h: Rename LoadDLLinitfunc to LoadDLLinitfuncdef. Add new defines LoadDLLinitfunc and LoadDLLstdfunc. * net.cc (wsock_init): Add guard variable handling. Take care to call WSAStartup only once. Load WSAStartup without using autoload wrapper to eliminate recursion. Eliminate FIONBIO and srandom stuff.
* * net.cc [errmap]: Add '0' condition.Christopher Faylor2001-04-231-1/+2
| | | | (find_winsock_errno): Don't translate no error to EPERM.
* Throughout, change fdtab references to cygheap->fdtab.Christopher Faylor2001-04-181-26/+21
| | | | | | | | | | | | | | | | | | | | | | | * child_info.h (cygheap_exec_info): Eliminate special fdtab stuff. * spawn.cc (spawn_guts): Ditto. * cygheap.cc (cygheap_init): Initialize fdtab, if appropriate. * cygheap.h (CYGHEAPSIZE): Include size of init_cygheap. (_cmalloc_entry): Include fdtab here. * dtable.h (dtable): Declare/define new methods. * dtable.cc (dtable::vfork_child_fixup): New method. (dtable::fixup_after_exec): Remove unneeded extra arguments. * dcrt0.cc (dll_crt0_1): Ditto. * environ.cc (getwinenv): Use case sensitive comparison. (winenv): Make a copy of environment cache to avoid realloc problems when duplicate environment variables exist in the environment. (From Egor Duda) * net.cc (cygwin_socket): Revert Apr 14 change. * include/sys/file.h: Protect against previous X_OK definition. * passwd.cc: Eliminate passwd_sem throughout. * security.cc: Ditto. * cygwin.din: Export New functions. * passwd.cc (read_etc_passwd): Make race safe. (getpwuid_r): New function. (getpwnam_r): New function.
* * net.cc (cygwin_socket): Set SO_LINGER to small value so closed UNIX domainChristopher Faylor2001-04-141-1/+6
| | | | | | sockets will not stay around. * select.cc (socket_cleanup): Set SO_LINGER to small value so closed dummy sockets do not stay around. Use correct value for second argument to shutdown.
* * fhandler.h (class fhandler_socket): Add members and methods toEgor Duda2001-04-091-9/+86
| | | | | | | | | | | | | | | | | support secure connections on AF_UNIX sockets. * fhandler_socket.cc (fhandler_socket::set_connect_secret): New method. (fhandler_socket::get_connect_secret): Ditto. (fhandler_socket::create_secret_event): Ditto. (fhandler_socket::close_secret_event): Ditto. (fhandler_socket::check_peer_secret_event): Ditto. (fhandler_socket::fixup_after_fork): Duplicate secret event to child. (fhandler_socket::dup): Copy address family. (fhandler_socket::close): Close secret event. * net.cc (get_inet_addr): Read secret cookie. (cygwin_connect): Check if peer knows secret cookie value. (cygwin_accept): Ditto. Copy address family to newly created socket. (cygwin_bind): Generate and write secret cookie. (wsock_init): Initialize random number generator.