libc/winsup/cygwin/fhandler_socket.cc

397 lines
9.6 KiB
C++
Raw Normal View History

/* fhandler_socket.cc. See fhandler.h for a description of the fhandler classes.
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#define __INSIDE_CYGWIN_NET__
In terms of network related functionality, rely on Winsock definitions 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.
2012-07-06 15:52:19 +02:00
#define USE_SYS_TYPES_FD_SET
#include "winsup.h"
#ifdef __x86_64__
/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte)
because a redefinition for LP64 systems is missing. This leads to a wrong
definition and size of sockaddr_in6 when building with winsock headers.
This definition is also required to use the right u_long type in subsequent
function calls. */
#undef u_long
#define u_long __ms_u_long
#endif
#include <ntsecapi.h>
2013-04-23 11:44:36 +02:00
#include <ws2tcpip.h>
#include <mswsock.h>
#include <iphlpapi.h>
#include "cygerrno.h"
#include "security.h"
Add "path.h" include throughout, where needed. Use new path_conv methods and operators to simplify testing for directory and attributes, throughout. * path.h (path_conv::exists): New method. (path_conv::has_attribute): Ditto. (path_conv::isdir): Ditto. (path_conv::DWORD &): New operator. (path_conv::int &): Ditto. * dir.cc (rmdir): Eliminate a goto. * dtable.cc (dtable::build_fhandler): Accept opt and suffix info for path_conv.check. Return fh == NULL on path_conv error. Pass unit to set_name as appropriate. (dtable::reset_unix_path_name): New method. * dtable.h (dtable): Declare new method. Reflect arg changes to build_fhandler. * fhandler.cc (fhandler_disk_dummy_name): Eliminate. (fhandler_base::set_name): Expect paths to be NULL. Build unix_path_name from win32_path_name when it is a device. (fhandler_base::reset_unix_path_name): New method. (fhandler_base::raw_read): Report EISDIR when ERROR_INVALID_FUNCTION or ERROR_INVALID_PARAMETER and reading a directory. (fhandler_disk_file::fstat): Don't call stat_dev since we should now never be calling fhandler_disk_file methods with devices. (fhandler_base::fhandler_base): Clear {unix,win32}_path_name. (fhandler_base::~fhandler_base): Always free {unix,win32}_path_name. (fhandler_disk_file::fhandler_disk_file): Remove set_no_free_names kludge. (fhandler_disk_file::open): Ditto. * fhandler.h (fhandler_base::no_free_names): Eliminate. (fhandler_base::set_no_free_names): Ditto. * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Don't set unix_path_name here. * path.cc (fchdir): Lock fd table throughout. Use new dtable::reset_unix_path_name method to reset path. * syscalls.cc (stat_worker): Reorganize to always call fstat method. Pass path_conv method to fhandler_*::open. (chroot): Elminate a goto.
2001-10-01 06:10:07 +02:00
#include "path.h"
* devices.cc: New file. * devices.gperf: New file. * devices.shilka: New file. * cygwin-gperf: New file. * cygwin-shilka: New file. * fhandler_fifo.cc: New file. * fhandler_nodevice.cc : New file. Reorganize headers so that path.h precedes fhandler.h throughout. Remove device argument and unit arguments from fhandler constructors throughout. Remove pc arguments to fhandler functions and use internal pc element instead, throughout. Use dev element in pc throughout. Use major/minor elements rather than units and device numbers previously in fhandler class. Use correct methods for fhandler file names rather than directly accessing file name variables, throughout. * Makefile.in (DLL_OFILES): Add devices.o, fhandler_fifo.o * dcrt0.cc (dll_crt0_1): Call device::init. * devices.h: Renumber devices based on more Linux-like major/minor numbers. Add more devices. Declare standard device storage. (device): Declare struct. * dir.cc (opendir): Use new 'build_fh_name' to construct a fhandler_* type. * dtable.cc (dtable::get_debugger_info): Ditto. (cygwin_attach_handle_to_fd): Ditto. (dtable::release): Remove special FH_SOCKET case in favor of generic "need_fixup_before" test. (dtable::init_std_file_from_handle): Use either build_fh_dev or build_fh_name to build standard fhandler. (dtable::build_fh_name): Renamed from dtable::build_fhandler_from_name. Move out of dtable class. Don't accept a path_conv argument. Just build it here and pass it to: (build_fh_pc): Renamed from dtable::build_fhandler. Move out of dtable class. Use intrinsic device type in path_conv to create new fhandler. (build_fh_dev): Renamed from dtable::build_fhandler. Move out of dtable class. Simplify arguments to just take new 'device' type and a name. Just return pointer to fhandler rather than trying to insert into dtable. (dtable::dup_worker): Accommodate above build_fh name changes. (dtable::find_fifo): New (currently broken) function. (handle_to_fn): Use strechr for efficiency. * dtable.h: Reflect above build_fh name changes and argument differences. (fhandler_base *&operator []): Return self rather than copy of self. * fhandler.cc (fhandler_base::operator =): Use pc element to set normalized path. (fhandler_base::set_name): Ditto. (fhandler_base::raw_read): Use method to access name. (fhandler_base::write): Correctly use get_output_handle rather than get_handle. (handler_base::device_access_denied): New function. (fhandler_base::open): Eliminate pc argument and use pc element of fhandler_base throughout. (fhandler_base::fstat): Detect if device is based in filesystem and use fstat_fs to calculate stat, if so. (fhandler_base::fhandler_base): Eliminate handling of file names and, instead, just free appropriate component from pc. (fhandler_base::opendir): Remove path_conv parameter. * fhandler.h: Remove all device flags. (fhandler_base::pc): New element. (fhandler_base::set_name): Change argument to path_conv. (fhandler_base::error): New function. (fhandler_base::exists): New function. (fhandler_base::pc_binmode): New function. (fhandler_base::dev): New function. (fhandler_base::open_fs): New function. (fhandler_base::fstat_fs): New function. (fhandler_base::fstat_by_name): New function. (fhandler_base::fstat_by_handle): New function. (fhandler_base::isfifo): New function. (fhandler_base::is_slow): New function. (fhandler_base::is_auto_device): New function. (fhandler_base::is_fs_special): New function. (fhandler_base::device_access_denied): New function. (fhandler_base::operator DWORD&): New operator. (fhandler_base::get_name): Return normalized path from pc. (fhandler_base::get_win32_name): Return windows path from pc. (fhandler_base::isdevice): Renamed from is_device. (fhandler_base::get_native_name): Return device format. (fhandler_fifo): New class. (fhandler_nodevice): New class. (select_stuff::device_specific): Remove array. (select_stuff::device_specific_pipe): New class element. (select_stuff::device_specific_socket): New class element. (select_stuff::device_specific_serial): New class element. (select_stuff::select_stuff): Initialize new elements. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Move to base class from fhandler_disk_file. (fhandler_base::fstat_by_name): Ditto. (fhandler_base::fstat_by_name): Ditto. (fhandler_disk_file::open): Move most functionality into fhandler_base::open_fs. (fhandler_base::open_fs): New function. (fhandler_disk_file::close): Move most functionality into fhandler_base::close_fs. (fhandler_base::close_fs): New function. * fhandler_mem.cc (fhandler_dev_mem::open): Use device name in debugging output. * fhandler_socket.cc (fhandler_socket::set_connect_secret): Copy standard urandom device into appropriate place. (fhandler_socket::accept): Reflect change in fdsock return value. * fhandler_tty.cc: See "throughouts" above. * net.cc: Accommodate fdsock change throughout. (fdsock): Return success or failure, accept fd argument and device argument. * path.cc (symlink_info::major): New element. (symlink_info::minor): New element. (symlink_info::parse_device): Declare new function. (fs_info::update): Accommodate changes in path_conv class. (path_conv::fillin): Ditto. (path_conv::return_and_clear_normalized_path): Eliminate. (path_conv::set_normalized_path): New function. (path_conv::path_conv): Set info in dev element. Use path_conv methods Check for FH_FS rather than FH_BAD to indicate when to fill in filesystem stuff. where appropriate rather than direct access. Use set_normalized_path to set normalized path. (windows_device_names): Eliminate. (get_dev): Ditto. (get_raw_device_number): Ditto. (get_device_number): Ditto. (win32_device_name): Call new device name parser to do most of the heavy lifting. (mount_info::conv_to_win32_path): Fill in dev field as appropriate. (symlink_worker): Handle new device files. (symlink_info::check): Ditto. (symlink_info::parse_device): Define new function. * path.h (executable_states): Move here from fhandler.h. (fs_info): Rename variables to *_storage and create methods for accessing same. (path_conv): Add dev element, remove devn and unit and adjust inline methods to accommodate. (set_normalized_path): Declare new function. * pinfo.cc (_pinfo::commune_recv): Add broken support for handling fifos. (_pinfo::commune_send): Ditto. * pipe.cc (fhandler_pipe::close): check for existence of handle before closing it. (handler_pipe::create): Rename from make_pipe. Change arguments to accept fhandler_pipe array. Accommodate fifos. (pipe): Rework to deal with fhandler_pipe::create changes. (_pipe): Ditto. * select.cc: Use individual device_specific types throughout rather than indexing with obsolete device number. (set_bits): Use is_socket call rather than checking device number. * shared_info.h (CURR_MOUNT_MAGIC): Update. (conv_to_win32_path): Reflect addition of device argument. * syscalls.cc (mknod_worker): New function. (open): Use build_fh_name to build fhandler. (chown_worker): Detect if this is an 'auto' device rather than an on-filesystem device and handle appropriately. (chmod_device): New function. (chmod): Detect if this is an 'auto' device rather than an on-filesystem device and handle appropriately. Use chmod_device to set mode of in-filesystem devices. (stat_worker): Eliminate path_conv argument. Call build_fh_name to construct fhandler. Use fh->error() rather than pc->error to detect errors in fhandler construction. (access_worker): New function pulled from access. Accommodate in-filesystem devices. (access): Use access_worker. (fpathconf): Detect if this is an 'auto' device rather than an on-filesystem device and handle appropriately. (mknod_worker): New function. (mknod32): New function. (chroot): Free normalized path -- assuming it was actually cmalloced. * tty.cc (create_tty_master): Tweak for new device class. (tty::common_init): Ditto. * winsup.h (stat_worker): Remove. (symlink_worker): Declare. * exceptions.cc (set_process_mask): Just call sig_dispatch_pending and don't worry about pending_signals since sig_dispatch_pending should always do the right thing now. (sig_handle): Reorganize SIGCONT handling to more closely conform to SUSv3. * pinfo.h: Move __SIG enum to sigproc.h. (PICOM_FIFO): New enum element. (_pinfo): Remove 'thread2signal' stuff throughout class. (_pinfo::commune_send): Make varargs. (_pinfo::sigtodo): Eliminate. (_pinfo::thread2signal): Ditto. * signal.cc (kill_worker): Eliminate call to setthread2signal. * sigproc.cc (local_sigtodo): Eliminate. (getlocal_sigtodo): Ditto. (sigelem): New class. (pending_signals): New class. (sigqueue): New variable, start of sigqueue linked list. (sigcatch_nonmain): Eliminate. (sigcatch_main): Eliminate. (sigcatch_nosync): Eliminate. (sigcomplete_nonmain): Eliminate. (pending_signals): Eliminate. (sig_clear): Call signal thread to clear pending signals, unless already in signal thread. (sigpending): Call signal thread to get pending signals. (sig_dispatch_pending): Eliminate use of pending_signals and just check sigqueue. (sigproc_terminate): Eliminate all of the obsolete semaphore stuff. Close signal pipe handle. (sig_send): Eliminate all of the obsolete semaphore stuff and use pipe to send signals. (getevent): Eliminate. (pending_signals::add): New function. (pending_signals::del): New function. (pending_signals::next): New function. (wait_sig): Eliminate all of the obsolete semaphore stuff. Use pipe to communicate and maintain a linked list of signals. * sigproc.h: Move __SIG defines here. Add __SIGPENDING. (sig_dispatch_pending): Remove "C" specifier. (sig_handle): Accept a mask argument. * thread.cc: Remove signal handling considerations throughout.
2003-09-25 02:37:18 +02:00
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
In terms of network related functionality, rely on Winsock definitions 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.
2012-07-06 15:52:19 +02:00
#include <asm/byteorder.h>
#include "cygwin/version.h"
#include "perprocess.h"
2006-07-25 Corinna Vinschen <corinna@vinschen.de> * include/cygwin/version.h: Bump DLL version to 1.7.0. 2006-07-25 Corinna Vinschen <corinna@vinschen.de> * select.h: Remove. * fhandler_socket.cc: Don't include select.h. * select.cc: Ditto. 2006-07-25 Corinna Vinschen <corinna@vinschen.de> * cygtls.h: Drop socket related includes. (struct _local_storage): Remove exitsock and exitsock_sin. Add select_sockevt. * cygtls.cc: Accomodate above change throughout. * fhandler.h (class fhandler_socket): Make wsock_evt public. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Accomodate reordering members. (fhandler_socket::evaluate_events): Drop FD_CONNECT event as soon as it gets read once. Never remove FD_WRITE event here. (fhandler_socket::wait_for_events): Wait 50 ms instead of INFINITE for socket events. (fhandler_socket::accept): Fix conditional. Set wsock_events members of accepted socket to useful start values. (fhandler_socket::recv_internal): Always drop FD_READ/FD_OOB events from wsock_events after the call to WSARecvFrom. (fhandler_socket::send_internal): Drop FD_WRITE event from wsock_events if the call to WSASendTo fails with WSAEWOULDBLOCK. Fix return value condition. * select.cc (struct socketinf): Change to accomodate using socket event handling. (peek_socket): Use event handling for peeking socket. (thread_socket): Ditto. (start_thread_socket): Ditto. (socket_cleanup): Same here. * tlsoffsets.h: Regenerate. 2006-07-20 Corinna Vinschen <corinna@vinschen.de> * fhandler.h (class fhandler_socket): Rearrange slightly to keep event handling methods and members together. Drop owner status flag. Split wait method. Rename event handling methods for readability. * fhandler_socket.cc (struct wsa_event): Add owner field. (LOCK_EVENTS): New macro. (UNLOCK_EVENTS): Ditto. (fhandler_socket::init_events): rename from prepare. (fhandler_socket::evaluate_events): First half of former wait method. Do everything but wait. Allow specifiying whether or not events from event_mask should be erased from wsock_events->events. Simplify OOB handling. Allow sending SIGURG to any process (group). (fhandler_socket::wait_for_events): Second half of former wait method. Call evaluate_events and wait in a loop if socket is blocking. (fhandler_socket::release_events): Rename from release. (fhandler_socket::connect): Accomodate above name changes. (fhandler_socket::accept): Ditto. (fhandler_socket::recv_internal): Ditto. (fhandler_socket::send_internal): Ditto. (fhandler_socket::close): Ditto. (fhandler_socket::fcntl): Always set owner to given input value on F_SETOWN. Handle F_GETOWN. * net.cc (fdsock): Accomodate above name changes. 2006-07-20 Corinna Vinschen <corinna@vinschen.de> * fhandler_socket.cc (fhandler_socket::wait): Set Winsock errno to WSAEWOULDBLOCK instead of WSAEINPROGRESS. 2006-07-18 Brian Ford <Brian.Ford@FlightSafety.com> Corinna Vinschen <corinna@vinschen.de> * winsup.h (mmap_region_status): New enum. (mmap_is_attached_or_noreserve_page): Adjust prototype and rename as below. * mmap.cc (mmap_is_attached_or_noreserve_page): Rename mmap_is_attached_or_noreserve. Add region length parameter. Return enum above. * exceptions.cc (_cygtls::handle_exceptions): Accomodate above. * fhandler.cc (fhandler_base::raw_read): Call above for NOACCESS errors and retry on success to allow reads into untouched MAP_NORESERVE buffers. 2006-07-18 Corinna Vinschen <corinna@vinschen.de> * cygwin.din (posix_openpt): Export. * tty.cc (posix_openpt): New function. * include/cygwin/stdlib.h (posix_openpt): Declare. * include/cygwin/version.h: Bump API minor number. 2006-07-14 Corinna Vinschen <corinna@vinschen.de> * security.cc (get_token_group_sidlist): Always add the interactive group to the token. Add comment. Create logon_id group SID by copying it from incoming group list. (create_token): Add subauth_token parameter. Use information in subauth_token if present. Tweak SourceIdentifier if subauth_token is present for debugging purposes. * security.h (create_token): Add subauth_token parameter in declaration. * syscalls.cc (seteuid32): Call subauth first. Call create_token regardless. Use subauth token in call to create_token if subauth succeeded. 2006-07-13 Corinna Vinschen <corinna@vinschen.de> * include/netinet/in.h: Update copyright. 2006-07-13 Corinna Vinschen <corinna@vinschen.de> * fhandler_socket.cc (fhandler_socket::wait): Rework function so that WaitForMultipleObjects is really only called when necessary. 2006-07-12 Corinna Vinschen <corinna@vinschen.de> * include/netdb.h: Declare rcmd, rcmd_af, rexec, rresvport, rresvport_af, iruserok, iruserok_sa, ruserok. 2006-07-12 Corinna Vinschen <corinna@vinschen.de> * Makefile.in (DLL_OFILES): Drop iruserok.o. Add rcmd.o. * autoload.cc (rcmd): Drop definition. * cygwin.din: Export bindresvport, bindresvport_sa, iruserok_sa, rcmd_af, rresvport_af. * net.cc (cygwin_rcmd): Remove. (last_used_bindresvport): Rename from last_used_rrecvport. (cygwin_bindresvport_sa): New function implementing bindresvport_sa. (cygwin_bindresvport): New function implementing bindresvport. (cygwin_rresvport): Remove. * include/cygwin/version.h: Bump API minor number. * include/netinet/in.h: Declare bindresvport and bindresvport_sa. * libc/iruserok.c: Remove file. * libc/rcmd.cc: New file implementing rcmd, rcmd_af, rresvport, rresvport_af, iruserok_sa, iruserok and ruserok. 2006-07-12 Corinna Vinschen <corinna@vinschen.de> * fhandler_socket.cc (fhandler_socket::getsockname): Return valid result for unbound sockets. 2006-07-11 Corinna Vinschen <corinna@vinschen.de> * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Handle wsock_mtx and wsock_evt on fork, thus handling close_on_exec correctly. (fhandler_socket::fixup_after_exec): Drop misguided attempt to handle close_on_exec here. (fhandler_socket::dup): Call fixup_after_fork with NULL parent. Add comment. (fhandler_socket::set_close_on_exec): Handle wsock_mtx and wsock_evt. 2006-07-10 Corinna Vinschen <corinna@vinschen.de> * fhandler.h (class fhandler_socket): Add wsock_mtx, wsock_evt and wsock_events members. Remove closed status flag, add listener status flag. Accomodate new implementation of socket event handling methods. Declare recv* and send* functions ssize_t as the POSIX equivalents. (fhandler_socket::recv_internal): Declare. (fhandler_socket::send_internal): Ditto. * fhandler_socket.cc (EVENT_MASK): Define mask of selected events. (fhandler_socket::fhandler_socket): Initialize new members. (fhandler_socket::af_local_setblocking): Don't actually set the socket to blocking mode. Keep sane event selection. (fhandler_socket::af_local_unsetblocking): Don't actually set the socket to previous blocking setting, just remember it. (struct wsa_event): New structure to keep event data per shared socket. (NUM_SOCKS): Define number of shared sockets concurrently handled by all active Cygwin processes. (wsa_events): New shared datastructure keeping all wsa_event records. (socket_serial_number): New shared variable to identify shared sockets. (wsa_slot_mtx): Global mutex to serialize wsa_events access. (search_wsa_event_slot): New static function to select a new wsa_event slot for a new socket. (fhandler_socket::prepare): Rewrite. Prepare event selection per new socket. (fhandler_socket::wait): Rewrite. Wait for socket events in thread safe and multiple process safe. (fhandler_socket::release): Rewrite. Close per-socket descriptor mutex handle and event handle. (fhandler_socket::dup): Duplicate wsock_mtx and wsock_evt. Fix copy-paste error in debug output. (fhandler_socket::connect): Accomodate new event handling. (fhandler_socket::listen): Set listener flag on successful listen. (fhandler_socket::accept): Accomodate new event handling. (fhandler_socket::recv_internal): New inline method centralizing common recv code. (fhandler_socket::recvfrom): Call recv_internal now. (fhandler_socket::recvmsg): Ditto. Streamline copying from iovec to WSABUF. (fhandler_socket::send_internal): New inline method centralizing common send code. (fhandler_socket::sendto): Call send_internal now. (fhandler_socket::sendmsg): Ditto. Streamline copying from iovec to WSABUF. (fhandler_socket::close): Call release now. (fhandler_socket::ioctl): Never actually switch to blocking mode. Just keep track of the setting. * net.cc (fdsock): Call prepare now. (cygwin_connect): Revert again to event driven technique. (cygwin_accept): Ditto. * poll.cc (poll): Don't call recvfrom on a listening socket. Remove special case for failing recvfrom. * include/sys/socket.h: Declare recv* and send* functions ssize_t as requested by POSIX. 2006-07-07 Corinna Vinschen <corinna@vinschen.de> * net.cc (cygwin_inet_ntop): Fix data type of forth parameter. 2006-07-06 Corinna Vinschen <corinna@vinschen.de> * include/cygwin/in6.h (struct in6_addr): Fix typo. 2006-07-06 Corinna Vinschen <corinna@vinschen.de> * cygwin.din: Export in6addr_any, in6addr_loopback, freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo. * fhandler_socket.cc: Include cygwin/in6.h. (get_inet_addr): Accomodate AF_INET6 usage. (fhandler_socket::connect): Ditto. (fhandler_socket::listen): Ditto. (fhandler_socket::sendto): Ditto. * net.cc: Include cygwin/in6.h. (in6addr_any): Define. (in6addr_loopback): Define. (cygwin_socket): Accomodate AF_INET6 usage. (socketpair): Bind socketpairs only to loopback for security. (inet_pton4): New static function. (inet_pton6): Ditto. (cygwin_inet_pton): New AF_INET6 aware inet_pton implementation. (inet_ntop4): New static function. (inet_ntop6): Ditto. (cygwin_inet_ntop): New AF_INET6 aware inet_ntop implementation. (ga_aistruct): New static function. (ga_clone): Ditto. (ga_echeck): Ditto. (ga_nsearch): Ditto. (ga_port): Ditto. (ga_serv): Ditto. (ga_unix): Ditto. (gn_ipv46): Ditto. (ipv4_freeaddrinfo): Ditto. (ipv4_getaddrinfo): Ditto. (ipv4_getnameinfo): Ditto. (gai_errmap_t): New structure holding error code - error string mapping. (cygwin_gai_strerror): New function implementing gai_strerror. (w32_to_gai_err): New static function. (get_ipv6_funcs): Ditto. (load_ipv6_funcs): Ditto. (cygwin_freeaddrinfo): New function implementing freeaddrinfo. (cygwin_getaddrinfo): New function implementing getaddrinfo. (cygwin_getnameinfo): New function implementing getnameinfo. * include/netdb.h: Include stdint.h and cygwin/socket.h. Define data types and macros used by getaddrinfo and friends. Declare freeaddrinfo, gai_strerror, getaddrinfo and getnameinfo. * include/cygwin/in.h: Add IPv6 related IPPROTOs. Remove definition of struct sockaddr_in6. Include cygwin/in6.h instead. * include/cygwin/in6.h: New header file defining IPv6 releated data types and macros. * include/cygwin/socket.h: Enable AF_INET6 and PF_INET6. Add IPv6 related socket options. * include/cygwin/version.h: Bump API minor number. 2006-07-06 Corinna Vinschen <corinna@vinschen.de> * autoload.cc (DsGetDcNameA): Define. (NetGetAnyDCName): Define. * security.cc: Include dsgetdc.h. (DsGetDcNameA): Declare. (DS_FORCE_REDISCOVERY): Define. (get_logon_server): Add bool parameter to control rediscovery of DC. Use DsGetDcNameA function if supported, NetGetDCName/NetGetAnyDCName otherwise. (get_server_groups): Rediscover DC if get_user_groups fails and try again. (get_reg_security): Use correct error code macro when testing RegGetKeySecurity return value. * security.h (get_logon_server): Remove default vaue from wserver parameter. Add rediscovery parameter. * uinfo.cc (cygheap_user::env_logsrv): Accomodate rediscovery parameter in call to get_logon_server.
2006-07-25 21:23:23 +02:00
#include "shared_info.h"
#include "sigproc.h"
#include "wininfo.h"
#include <unistd.h>
#include <sys/param.h>
#include <sys/statvfs.h>
#include <cygwin/acl.h>
#include "cygtls.h"
In terms of network related functionality, rely on Winsock definitions 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.
2012-07-06 15:52:19 +02:00
#include <sys/un.h>
#include "ntdll.h"
#include "miscfuncs.h"
#include "tls_pbuf.h"
#define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT)
2006-07-25 Corinna Vinschen <corinna@vinschen.de> * include/cygwin/version.h: Bump DLL version to 1.7.0. 2006-07-25 Corinna Vinschen <corinna@vinschen.de> * select.h: Remove. * fhandler_socket.cc: Don't include select.h. * select.cc: Ditto. 2006-07-25 Corinna Vinschen <corinna@vinschen.de> * cygtls.h: Drop socket related includes. (struct _local_storage): Remove exitsock and exitsock_sin. Add select_sockevt. * cygtls.cc: Accomodate above change throughout. * fhandler.h (class fhandler_socket): Make wsock_evt public. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Accomodate reordering members. (fhandler_socket::evaluate_events): Drop FD_CONNECT event as soon as it gets read once. Never remove FD_WRITE event here. (fhandler_socket::wait_for_events): Wait 50 ms instead of INFINITE for socket events. (fhandler_socket::accept): Fix conditional. Set wsock_events members of accepted socket to useful start values. (fhandler_socket::recv_internal): Always drop FD_READ/FD_OOB events from wsock_events after the call to WSARecvFrom. (fhandler_socket::send_internal): Drop FD_WRITE event from wsock_events if the call to WSASendTo fails with WSAEWOULDBLOCK. Fix return value condition. * select.cc (struct socketinf): Change to accomodate using socket event handling. (peek_socket): Use event handling for peeking socket. (thread_socket): Ditto. (start_thread_socket): Ditto. (socket_cleanup): Same here. * tlsoffsets.h: Regenerate. 2006-07-20 Corinna Vinschen <corinna@vinschen.de> * fhandler.h (class fhandler_socket): Rearrange slightly to keep event handling methods and members together. Drop owner status flag. Split wait method. Rename event handling methods for readability. * fhandler_socket.cc (struct wsa_event): Add owner field. (LOCK_EVENTS): New macro. (UNLOCK_EVENTS): Ditto. (fhandler_socket::init_events): rename from prepare. (fhandler_socket::evaluate_events): First half of former wait method. Do everything but wait. Allow specifiying whether or not events from event_mask should be erased from wsock_events->events. Simplify OOB handling. Allow sending SIGURG to any process (group). (fhandler_socket::wait_for_events): Second half of former wait method. Call evaluate_events and wait in a loop if socket is blocking. (fhandler_socket::release_events): Rename from release. (fhandler_socket::connect): Accomodate above name changes. (fhandler_socket::accept): Ditto. (fhandler_socket::recv_internal): Ditto. (fhandler_socket::send_internal): Ditto. (fhandler_socket::close): Ditto. (fhandler_socket::fcntl): Always set owner to given input value on F_SETOWN. Handle F_GETOWN. * net.cc (fdsock): Accomodate above name changes. 2006-07-20 Corinna Vinschen <corinna@vinschen.de> * fhandler_socket.cc (fhandler_socket::wait): Set Winsock errno to WSAEWOULDBLOCK instead of WSAEINPROGRESS. 2006-07-18 Brian Ford <Brian.Ford@FlightSafety.com> Corinna Vinschen <corinna@vinschen.de> * winsup.h (mmap_region_status): New enum. (mmap_is_attached_or_noreserve_page): Adjust prototype and rename as below. * mmap.cc (mmap_is_attached_or_noreserve_page): Rename mmap_is_attached_or_noreserve. Add region length parameter. Return enum above. * exceptions.cc (_cygtls::handle_exceptions): Accomodate above. * fhandler.cc (fhandler_base::raw_read): Call above for NOACCESS errors and retry on success to allow reads into untouched MAP_NORESERVE buffers. 2006-07-18 Corinna Vinschen <corinna@vinschen.de> * cygwin.din (posix_openpt): Export. * tty.cc (posix_openpt): New function. * include/cygwin/stdlib.h (posix_openpt): Declare. * include/cygwin/version.h: Bump API minor number. 2006-07-14 Corinna Vinschen <corinna@vinschen.de> * security.cc (get_token_group_sidlist): Always add the interactive group to the token. Add comment. Create logon_id group SID by copying it from incoming group list. (create_token): Add subauth_token parameter. Use information in subauth_token if present. Tweak SourceIdentifier if subauth_token is present for debugging purposes. * security.h (create_token): Add subauth_token parameter in declaration. * syscalls.cc (seteuid32): Call subauth first. Call create_token regardless. Use subauth token in call to create_token if subauth succeeded. 2006-07-13 Corinna Vinschen <corinna@vinschen.de> * include/netinet/in.h: Update copyright. 2006-07-13 Corinna Vinschen <corinna@vinschen.de> * fhandler_socket.cc (fhandler_socket::wait): Rework function so that WaitForMultipleObjects is really only called when necessary. 2006-07-12 Corinna Vinschen <corinna@vinschen.de> * include/netdb.h: Declare rcmd, rcmd_af, rexec, rresvport, rresvport_af, iruserok, iruserok_sa, ruserok. 2006-07-12 Corinna Vinschen <corinna@vinschen.de> * Makefile.in (DLL_OFILES): Drop iruserok.o. Add rcmd.o. * autoload.cc (rcmd): Drop definition. * cygwin.din: Export bindresvport, bindresvport_sa, iruserok_sa, rcmd_af, rresvport_af. * net.cc (cygwin_rcmd): Remove. (last_used_bindresvport): Rename from last_used_rrecvport. (cygwin_bindresvport_sa): New function implementing bindresvport_sa. (cygwin_bindresvport): New function implementing bindresvport. (cygwin_rresvport): Remove. * include/cygwin/version.h: Bump API minor number. * include/netinet/in.h: Declare bindresvport and bindresvport_sa. * libc/iruserok.c: Remove file. * libc/rcmd.cc: New file implementing rcmd, rcmd_af, rresvport, rresvport_af, iruserok_sa, iruserok and ruserok. 2006-07-12 Corinna Vinschen <corinna@vinschen.de> * fhandler_socket.cc (fhandler_socket::getsockname): Return valid result for unbound sockets. 2006-07-11 Corinna Vinschen <corinna@vinschen.de> * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Handle wsock_mtx and wsock_evt on fork, thus handling close_on_exec correctly. (fhandler_socket::fixup_after_exec): Drop misguided attempt to handle close_on_exec here. (fhandler_socket::dup): Call fixup_after_fork with NULL parent. Add comment. (fhandler_socket::set_close_on_exec): Handle wsock_mtx and wsock_evt. 2006-07-10 Corinna Vinschen <corinna@vinschen.de> * fhandler.h (class fhandler_socket): Add wsock_mtx, wsock_evt and wsock_events members. Remove closed status flag, add listener status flag. Accomodate new implementation of socket event handling methods. Declare recv* and send* functions ssize_t as the POSIX equivalents. (fhandler_socket::recv_internal): Declare. (fhandler_socket::send_internal): Ditto. * fhandler_socket.cc (EVENT_MASK): Define mask of selected events. (fhandler_socket::fhandler_socket): Initialize new members. (fhandler_socket::af_local_setblocking): Don't actually set the socket to blocking mode. Keep sane event selection. (fhandler_socket::af_local_unsetblocking): Don't actually set the socket to previous blocking setting, just remember it. (struct wsa_event): New structure to keep event data per shared socket. (NUM_SOCKS): Define number of shared sockets concurrently handled by all active Cygwin processes. (wsa_events): New shared datastructure keeping all wsa_event records. (socket_serial_number): New shared variable to identify shared sockets. (wsa_slot_mtx): Global mutex to serialize wsa_events access. (search_wsa_event_slot): New static function to select a new wsa_event slot for a new socket. (fhandler_socket::prepare): Rewrite. Prepare event selection per new socket. (fhandler_socket::wait): Rewrite. Wait for socket events in thread safe and multiple process safe. (fhandler_socket::release): Rewrite. Close per-socket descriptor mutex handle and event handle. (fhandler_socket::dup): Duplicate wsock_mtx and wsock_evt. Fix copy-paste error in debug output. (fhandler_socket::connect): Accomodate new event handling. (fhandler_socket::listen): Set listener flag on successful listen. (fhandler_socket::accept): Accomodate new event handling. (fhandler_socket::recv_internal): New inline method centralizing common recv code. (fhandler_socket::recvfrom): Call recv_internal now. (fhandler_socket::recvmsg): Ditto. Streamline copying from iovec to WSABUF. (fhandler_socket::send_internal): New inline method centralizing common send code. (fhandler_socket::sendto): Call send_internal now. (fhandler_socket::sendmsg): Ditto. Streamline copying from iovec to WSABUF. (fhandler_socket::close): Call release now. (fhandler_socket::ioctl): Never actually switch to blocking mode. Just keep track of the setting. * net.cc (fdsock): Call prepare now. (cygwin_connect): Revert again to event driven technique. (cygwin_accept): Ditto. * poll.cc (poll): Don't call recvfrom on a listening socket. Remove special case for failing recvfrom. * include/sys/socket.h: Declare recv* and send* functions ssize_t as requested by POSIX. 2006-07-07 Corinna Vinschen <corinna@vinschen.de> * net.cc (cygwin_inet_ntop): Fix data type of forth parameter. 2006-07-06 Corinna Vinschen <corinna@vinschen.de> * include/cygwin/in6.h (struct in6_addr): Fix typo. 2006-07-06 Corinna Vinschen <corinna@vinschen.de> * cygwin.din: Export in6addr_any, in6addr_loopback, freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo. * fhandler_socket.cc: Include cygwin/in6.h. (get_inet_addr): Accomodate AF_INET6 usage. (fhandler_socket::connect): Ditto. (fhandler_socket::listen): Ditto. (fhandler_socket::sendto): Ditto. * net.cc: Include cygwin/in6.h. (in6addr_any): Define. (in6addr_loopback): Define. (cygwin_socket): Accomodate AF_INET6 usage. (socketpair): Bind socketpairs only to loopback for security. (inet_pton4): New static function. (inet_pton6): Ditto. (cygwin_inet_pton): New AF_INET6 aware inet_pton implementation. (inet_ntop4): New static function. (inet_ntop6): Ditto. (cygwin_inet_ntop): New AF_INET6 aware inet_ntop implementation. (ga_aistruct): New static function. (ga_clone): Ditto. (ga_echeck): Ditto. (ga_nsearch): Ditto. (ga_port): Ditto. (ga_serv): Ditto. (ga_unix): Ditto. (gn_ipv46): Ditto. (ipv4_freeaddrinfo): Ditto. (ipv4_getaddrinfo): Ditto. (ipv4_getnameinfo): Ditto. (gai_errmap_t): New structure holding error code - error string mapping. (cygwin_gai_strerror): New function implementing gai_strerror. (w32_to_gai_err): New static function. (get_ipv6_funcs): Ditto. (load_ipv6_funcs): Ditto. (cygwin_freeaddrinfo): New function implementing freeaddrinfo. (cygwin_getaddrinfo): New function implementing getaddrinfo. (cygwin_getnameinfo): New function implementing getnameinfo. * include/netdb.h: Include stdint.h and cygwin/socket.h. Define data types and macros used by getaddrinfo and friends. Declare freeaddrinfo, gai_strerror, getaddrinfo and getnameinfo. * include/cygwin/in.h: Add IPv6 related IPPROTOs. Remove definition of struct sockaddr_in6. Include cygwin/in6.h instead. * include/cygwin/in6.h: New header file defining IPv6 releated data types and macros. * include/cygwin/socket.h: Enable AF_INET6 and PF_INET6. Add IPv6 related socket options. * include/cygwin/version.h: Bump API minor number. 2006-07-06 Corinna Vinschen <corinna@vinschen.de> * autoload.cc (DsGetDcNameA): Define. (NetGetAnyDCName): Define. * security.cc: Include dsgetdc.h. (DsGetDcNameA): Declare. (DS_FORCE_REDISCOVERY): Define. (get_logon_server): Add bool parameter to control rediscovery of DC. Use DsGetDcNameA function if supported, NetGetDCName/NetGetAnyDCName otherwise. (get_server_groups): Rediscover DC if get_user_groups fails and try again. (get_reg_security): Use correct error code macro when testing RegGetKeySecurity return value. * security.h (get_logon_server): Remove default vaue from wserver parameter. Add rediscovery parameter. * uinfo.cc (cygheap_user::env_logsrv): Accomodate rediscovery parameter in call to get_logon_server.
2006-07-25 21:23:23 +02:00
#define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE)
extern "C" {
int sscanf (const char *, const char *, ...);
} /* End of "C" section */
/**********************************************************************/
/* fhandler_socket */
fhandler_socket::fhandler_socket () :
fhandler_base (),
uid (myself->uid),
gid (myself->gid),
mode (S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO),
_rcvtimeo (INFINITE),
_sndtimeo (INFINITE),
status ()
{
}
fhandler_socket::~fhandler_socket ()
{
}
char *
fhandler_socket::get_proc_fd_name (char *buf)
{
__small_sprintf (buf, "socket:[%lu]", get_plain_ino ());
return buf;
}
int
fhandler_socket::getpeereid (pid_t *pid, uid_t *euid, gid_t *egid)
{
set_errno (EINVAL);
return -1;
}
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
/* Definitions of old ifreq stuff used prior to Cygwin 1.7.0. */
#define OLD_SIOCGIFFLAGS _IOW('s', 101, struct __old_ifreq)
#define OLD_SIOCGIFADDR _IOW('s', 102, struct __old_ifreq)
#define OLD_SIOCGIFBRDADDR _IOW('s', 103, struct __old_ifreq)
#define OLD_SIOCGIFNETMASK _IOW('s', 104, struct __old_ifreq)
#define OLD_SIOCGIFHWADDR _IOW('s', 105, struct __old_ifreq)
#define OLD_SIOCGIFMETRIC _IOW('s', 106, struct __old_ifreq)
#define OLD_SIOCGIFMTU _IOW('s', 107, struct __old_ifreq)
#define OLD_SIOCGIFINDEX _IOW('s', 108, struct __old_ifreq)
#define CONV_OLD_TO_NEW_SIO(old) (((old)&0xff00ffff)|(((long)sizeof(struct ifreq)&IOCPARM_MASK)<<16))
struct __old_ifreq {
2011-06-06 07:02:13 +02:00
#define __OLD_IFNAMSIZ 16
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
union {
char ifrn_name[__OLD_IFNAMSIZ]; /* if name, e.g. "en0" */
} ifr_ifrn;
union {
struct sockaddr ifru_addr;
struct sockaddr ifru_broadaddr;
struct sockaddr ifru_netmask;
struct sockaddr ifru_hwaddr;
short ifru_flags;
int ifru_metric;
int ifru_mtu;
int ifru_ifindex;
} ifr_ifru;
};
int
fhandler_socket::ioctl (unsigned int cmd, void *p)
{
extern int get_ifconf (struct ifconf *ifc, int what); /* net.cc */
int res;
struct ifconf ifc, *ifcp;
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
struct ifreq *ifrp;
switch (cmd)
{
case SIOCGIFCONF:
ifcp = (struct ifconf *) p;
if (!ifcp)
{
set_errno (EINVAL);
return -1;
}
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
if (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ)
{
ifc.ifc_len = ifcp->ifc_len / sizeof (struct __old_ifreq)
* sizeof (struct ifreq);
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
ifc.ifc_buf = (caddr_t) alloca (ifc.ifc_len);
}
else
{
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
ifc.ifc_len = ifcp->ifc_len;
ifc.ifc_buf = ifcp->ifc_buf;
}
res = get_ifconf (&ifc, cmd);
if (res)
debug_printf ("error in get_ifconf");
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
if (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ)
{
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
struct __old_ifreq *ifr = (struct __old_ifreq *) ifcp->ifc_buf;
for (ifrp = ifc.ifc_req;
(caddr_t) ifrp < ifc.ifc_buf + ifc.ifc_len;
++ifrp, ++ifr)
{
memcpy (&ifr->ifr_ifrn, &ifrp->ifr_ifrn, sizeof ifr->ifr_ifrn);
ifr->ifr_name[__OLD_IFNAMSIZ - 1] = '\0';
memcpy (&ifr->ifr_ifru, &ifrp->ifr_ifru, sizeof ifr->ifr_ifru);
}
ifcp->ifc_len = ifc.ifc_len / sizeof (struct ifreq)
* sizeof (struct __old_ifreq);
}
else
ifcp->ifc_len = ifc.ifc_len;
break;
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
case OLD_SIOCGIFFLAGS:
case OLD_SIOCGIFADDR:
case OLD_SIOCGIFBRDADDR:
case OLD_SIOCGIFNETMASK:
case OLD_SIOCGIFHWADDR:
case OLD_SIOCGIFMETRIC:
case OLD_SIOCGIFMTU:
case OLD_SIOCGIFINDEX:
cmd = CONV_OLD_TO_NEW_SIO (cmd);
/*FALLTHRU*/
case SIOCGIFFLAGS:
case SIOCGIFBRDADDR:
case SIOCGIFNETMASK:
case SIOCGIFADDR:
case SIOCGIFHWADDR:
case SIOCGIFMETRIC:
case SIOCGIFMTU:
case SIOCGIFINDEX:
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
case SIOCGIFFRNDLYNAM:
case SIOCGIFDSTADDR:
{
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
if (!p)
{
debug_printf ("ifr == NULL");
set_errno (EINVAL);
return -1;
}
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
if (cmd > SIOCGIFINDEX && CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ)
{
debug_printf ("cmd not supported on this platform");
set_errno (EINVAL);
return -1;
}
ifc.ifc_len = 64 * sizeof (struct ifreq);
ifc.ifc_buf = (caddr_t) alloca (ifc.ifc_len);
if (cmd == SIOCGIFFRNDLYNAM)
{
struct ifreq_frndlyname *iff = (struct ifreq_frndlyname *)
alloca (64 * sizeof (struct ifreq_frndlyname));
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
for (int i = 0; i < 64; ++i)
ifc.ifc_req[i].ifr_frndlyname = &iff[i];
}
res = get_ifconf (&ifc, cmd);
if (res)
{
debug_printf ("error in get_ifconf");
break;
}
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
if (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ)
{
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
struct __old_ifreq *ifr = (struct __old_ifreq *) p;
debug_printf (" name: %s", ifr->ifr_name);
for (ifrp = ifc.ifc_req;
(caddr_t) ifrp < ifc.ifc_buf + ifc.ifc_len;
++ifrp)
{
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
debug_printf ("testname: %s", ifrp->ifr_name);
if (! strcmp (ifrp->ifr_name, ifr->ifr_name))
{
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
memcpy (&ifr->ifr_ifru, &ifrp->ifr_ifru,
sizeof ifr->ifr_ifru);
break;
* autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure.
2007-01-21 23:54:05 +01:00
}
}
}
else
{
struct ifreq *ifr = (struct ifreq *) p;
debug_printf (" name: %s", ifr->ifr_name);
for (ifrp = ifc.ifc_req;
(caddr_t) ifrp < ifc.ifc_buf + ifc.ifc_len;
++ifrp)
{
debug_printf ("testname: %s", ifrp->ifr_name);
if (! strcmp (ifrp->ifr_name, ifr->ifr_name))
{
if (cmd == SIOCGIFFRNDLYNAM)
/* The application has to care for the space. */
memcpy (ifr->ifr_frndlyname, ifrp->ifr_frndlyname,
sizeof (struct ifreq_frndlyname));
else
memcpy (&ifr->ifr_ifru, &ifrp->ifr_ifru,
sizeof ifr->ifr_ifru);
break;
}
}
}
if ((caddr_t) ifrp >= ifc.ifc_buf + ifc.ifc_len)
{
set_errno (EINVAL);
return -1;
}
break;
}
default:
res = fhandler_base::ioctl (cmd, p);
break;
}
2013-04-23 11:44:36 +02:00
syscall_printf ("%d = ioctl_socket(%x, %p)", res, cmd, p);
return res;
}
int
2013-04-23 11:44:36 +02:00
fhandler_socket::fcntl (int cmd, intptr_t arg)
{
int res = 0;
int request, current;
switch (cmd)
{
case F_SETFL:
{
/* Carefully test for the O_NONBLOCK or deprecated OLD_O_NDELAY flag.
Set only the flag that has been passed in. If both are set, just
record O_NONBLOCK. */
2013-04-23 11:44:36 +02:00
int new_flags = arg & O_NONBLOCK_MASK;
if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK))
new_flags = O_NONBLOCK;
current = get_flags () & O_NONBLOCK_MASK;
request = new_flags ? 1 : 0;
if (!!current != !!new_flags && (res = ioctl (FIONBIO, &request)))
break;
set_flags ((get_flags () & ~O_NONBLOCK_MASK) | new_flags);
break;
}
default:
res = fhandler_base::fcntl (cmd, arg);
break;
}
return res;
}
int
fhandler_socket::open (int flags, mode_t mode)
{
set_errno (ENXIO);
return 0;
}
int __reg2
fhandler_socket::fstat (struct stat *buf)
{
int res;
res = fhandler_socket::fstat (buf);
if (!res)
{
buf->st_dev = FHDEV (DEV_SOCK_MAJOR, 0);
if (!(buf->st_ino = get_plain_ino ()))
sscanf (get_name (), "/proc/%*d/fd/socket:[%lld]",
(long long *) &buf->st_ino);
buf->st_uid = uid;
buf->st_gid = gid;
buf->st_mode = mode;
buf->st_size = 0;
}
return res;
}
int __reg2
fhandler_socket::fstatvfs (struct statvfs *sfs)
{
memset (sfs, 0, sizeof (*sfs));
sfs->f_bsize = sfs->f_frsize = 4096;
sfs->f_namemax = NAME_MAX;
return 0;
}
int
fhandler_socket::fchmod (mode_t newmode)
{
mode = (newmode & ~S_IFMT) | S_IFSOCK;
return 0;
}
int
fhandler_socket::fchown (uid_t newuid, gid_t newgid)
{
bool perms = check_token_membership (&well_known_admins_sid);
/* Admin rulez */
if (!perms)
{
/* Otherwise, new uid == old uid or current uid is fine */
if (newuid == ILLEGAL_UID || newuid == uid || newuid == myself->uid)
perms = true;
/* Otherwise, new gid == old gid or current gid is fine */
else if (newgid == ILLEGAL_GID || newgid == gid || newgid == myself->gid)
perms = true;
else
{
/* Last but not least, newgid in supplementary group list is fine */
tmp_pathbuf tp;
gid_t *gids = (gid_t *) tp.w_get ();
int num = getgroups (65536 / sizeof (*gids), gids);
for (int idx = 0; idx < num; ++idx)
if (newgid == gids[idx])
{
perms = true;
break;
}
}
}
if (perms)
{
if (newuid != ILLEGAL_UID)
uid = newuid;
if (newgid != ILLEGAL_GID)
gid = newgid;
return 0;
}
set_errno (EPERM);
* Throughout, use __try/__except/__endtry blocks, rather than myfault handler. * cygtls.cc (_cygtls::remove): Accommodate the fact that pathbufs has been moved from _local_storage to _cygtls. * cygtls.h (class tls_pathbuf): Add comment to hint to gendef usage of counters. Change type of counters to uint32_t for clarity. Remove _cygtls as friend class. (struct _local_storage): Move pathbufs from here... (struct _cygtls): ...to here, allowing to access it from _sigbe. (class san): Only define on 32 bit. Remove errno, _c_cnt and _w_cnt members. (san::setup): Drop parameter. Don't initialize removed members. (san::leave): Don't set removed members. (class myfault): Only define on 32 bit. (myfault::faulted): Only keep implementation not taking any parameter. Drop argument in call to sebastian.setup. (__try/__leave/__except/__endtry): Implement to support real SEH. For now stick to SJLJ on 32 bit. * dcrt0.cc (dll_crt0_0): Drop 64 bit call to exception::install_myfault_handler. * exception.h (exception_handler): Define with EXCEPTION_DISPOSITION as return type. (PDISPATCHER_CONTEXT): Define as void * on 32 bit. Define as pointer to _DISPATCHER_CONTEXT on 64 bit. (class exception): Define separately for 32 and 64 bit. (exception::myfault): Add handler for myfault SEH handling on 64 bit. (exception::exception): Fix mangled method name to account for change in type of last parameter. (exception::install_myfault_handler): Remove. * exceptions.cc (exception::myfault_handle): Remove. (exception::myfault): New SEH handler for 64 bit. * gendef (_sigbe): Set tls_pathbuf counters to 0 explicitely when returning to the caller. * ntdll.h: Move a comment to a better place. (struct _SCOPE_TABLE): Define on 64 bit. * thread.cc (verifyable_object_isvalid): Remove gcc 4.7 workaround. * tls_pbuf.cc (tls_pbuf): Fix to accommodate new place of pathbufs. (tls_pathbuf::destroy): Change type of loop variables to uint32_t. * tls_pbuf.h (class tmp_pathbuf): Change type of buffer counters to uint32_t. Accommodate new place of pathbufs. * tlsoffsets.h: Regenerate. * tlsoffsets64.h: Regenerate.
2014-08-22 11:21:33 +02:00
return -1;
}
int
fhandler_socket::facl (int cmd, int nentries, aclent_t *aclbufp)
{
set_errno (EOPNOTSUPP);
return -1;
}
int
fhandler_socket::link (const char *newpath)
{
return fhandler_base::link (newpath);
}