* autoload.cc (WSAIoctl): Remove.

* cygwin.din: Export freeifaddrs, getifaddrs.
	* fhandler_socket.cc (fhandler_socket::ioctl): Drop SOCKET parameter
	from get_ifconf.
	* net.cc: Include ifaddrs.h.
	(in_are_prefix_equal): Match addresses in network byte order.
	(ip_addr_prefix): Convert address into host byte order before
	testing with IN_LOOPBACK.
	(struct ifall): Define.
	(get_xp_ifs): Replace get_xp_ifconf.  Return struct ifall array.
	(get_2k_ifs): Ditto, replace get_2k_ifconf.
	(get_nt_ifs): Ditto, replace get_nt_ifconf.
	(getifaddrs): New function.
	(freeifaddrs): New function.
	(get_ifconf): Call matching get_XX_ifs function and create
	ifc content from here.  Drop lo fake since it's now in get_nt_ifs.
	* posix.sgml: Add freeifaddrs and getifaddrs to list of implemented
	BSD functions.
	* wincap.h (wincapc::has_broken_if_oper_status): New element.
	* wincap.cc: Implement above element throughout.
	* include/ifaddrs.h: New file.
	* include/cygwin/version.h: Bump API minor number.
This commit is contained in:
Corinna Vinschen 2007-06-21 15:57:54 +00:00
parent d3c73d4999
commit a71ecb55de
10 changed files with 657 additions and 465 deletions

View File

@ -1,3 +1,28 @@
2007-06-21 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (WSAIoctl): Remove.
* cygwin.din: Export freeifaddrs, getifaddrs.
* fhandler_socket.cc (fhandler_socket::ioctl): Drop SOCKET parameter
from get_ifconf.
* net.cc: Include ifaddrs.h.
(in_are_prefix_equal): Match addresses in network byte order.
(ip_addr_prefix): Convert address into host byte order before
testing with IN_LOOPBACK.
(struct ifall): Define.
(get_xp_ifs): Replace get_xp_ifconf. Return struct ifall array.
(get_2k_ifs): Ditto, replace get_2k_ifconf.
(get_nt_ifs): Ditto, replace get_nt_ifconf.
(getifaddrs): New function.
(freeifaddrs): New function.
(get_ifconf): Call matching get_XX_ifs function and create
ifc content from here. Drop lo fake since it's now in get_nt_ifs.
* posix.sgml: Add freeifaddrs and getifaddrs to list of implemented
BSD functions.
* wincap.h (wincapc::has_broken_if_oper_status): New element.
* wincap.cc: Implement above element throughout.
* include/ifaddrs.h: New file.
* include/cygwin/version.h: Bump API minor number.
2007-06-20 Eric Blake <ebb9@byu.net>
* cygwin.din: Export exp10, exp10f, pow10, pow10f, strcasestr,

View File

@ -383,7 +383,6 @@ LoadDLLfunc (WSACloseEvent, 4, ws2_32)
LoadDLLfunc (WSACreateEvent, 0, ws2_32)
LoadDLLfunc (WSAEnumNetworkEvents, 12, ws2_32)
LoadDLLfunc (WSAEventSelect, 12, ws2_32)
LoadDLLfunc (WSAIoctl, 36, ws2_32)
LoadDLLfunc (WSAGetLastError, 0, ws2_32)
LoadDLLfunc (WSARecvFrom, 36, ws2_32)
LoadDLLfunc (WSASendTo, 36, ws2_32)

View File

@ -489,6 +489,7 @@ _fread = fread SIGFE
free SIGFE
_free = free SIGFE
freeaddrinfo = cygwin_freeaddrinfo SIGFE
freeifaddrs SIGFE
freopen SIGFE
_freopen = freopen SIGFE
_freopen64 = freopen64 SIGFE
@ -605,6 +606,7 @@ gethostbyname = cygwin_gethostbyname SIGFE
gethostid SIGFE
gethostname = cygwin_gethostname SIGFE
_gethostname = cygwin_gethostname SIGFE
getifaddrs SIGFE
getitimer SIGFE
getline = __getline SIGFE
__getline SIGFE

View File

@ -1455,7 +1455,7 @@ struct __old_ifreq {
int
fhandler_socket::ioctl (unsigned int cmd, void *p)
{
extern int get_ifconf (SOCKET s, struct ifconf *ifc, int what); /* net.cc */
extern int get_ifconf (struct ifconf *ifc, int what); /* net.cc */
int res;
struct ifconf ifc, *ifcp;
struct ifreq *ifrp;
@ -1480,7 +1480,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
ifc.ifc_len = ifcp->ifc_len;
ifc.ifc_buf = ifcp->ifc_buf;
}
res = get_ifconf (get_socket (), &ifc, cmd);
res = get_ifconf (&ifc, cmd);
if (res)
debug_printf ("error in get_ifconf");
if (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ)
@ -1544,7 +1544,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
ifc.ifc_req[i].ifr_frndlyname = &iff[i];
}
res = get_ifconf (get_socket (), &ifc, cmd);
res = get_ifconf (&ifc, cmd);
if (res)
{
debug_printf ("error in get_ifconf");

View File

@ -312,12 +312,13 @@ details. */
170: Export insque, remque.
171: Export exp10, exp10f, pow10, pow10f, strcasestr, funopen,
fopencookie.
172: Export getifaddrs, freeifaddrs.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 171
#define CYGWIN_VERSION_API_MINOR 172
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible

View File

@ -0,0 +1,57 @@
/* $OpenBSD: ifaddrs.h,v 1.4 2004/01/22 21:48:02 espie Exp $ */
/*
* Copyright (c) 1995, 1999
* Berkeley Software Design, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp
*/
#ifndef _IFADDRS_H_
#define _IFADDRS_H_
struct ifaddrs {
struct ifaddrs *ifa_next;
char *ifa_name;
unsigned int ifa_flags;
struct sockaddr *ifa_addr;
struct sockaddr *ifa_netmask;
struct sockaddr *ifa_dstaddr;
void *ifa_data;
};
/*
* This may have been defined in <net/if.h>. Note that if <net/if.h> is
* to be included it must be included before this header file.
*/
/* CV 2007-06-20: Not a problem on Cygwin right now. */
#ifndef ifa_broadaddr
#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
#endif
#include <sys/cdefs.h>
__BEGIN_DECLS
extern int getifaddrs(struct ifaddrs **);
extern void freeifaddrs(struct ifaddrs *);
__END_DECLS
#endif

File diff suppressed because it is too large Load Diff

View File

@ -836,6 +836,7 @@ also ISO/IEC 9945:2003 and IEEE Std 1003.1-2001 (POSIX.1-2001).</para>
fiprintf
flock
forkpty
freeifaddrs
fstatfs
fts_children
fts_close
@ -851,6 +852,7 @@ also ISO/IEC 9945:2003 and IEEE Std 1003.1-2001 (POSIX.1-2001).</para>
gammaf
gammaf_r
getdtablesize
getifaddrs
getpagesize
getpeereid
getprogname

View File

@ -18,6 +18,7 @@ static NO_COPY wincaps wincap_unknown = {
is_server:false,
has_security_descriptor_control:false,
has_ip_helper_lib:false,
has_broken_if_oper_status:false,
has_physical_mem_access:true,
has_process_io_counters:false,
has_terminal_services:false,
@ -45,6 +46,7 @@ static NO_COPY wincaps wincap_nt4 = {
is_server:false,
has_security_descriptor_control:false,
has_ip_helper_lib:false,
has_broken_if_oper_status:false,
has_physical_mem_access:true,
has_process_io_counters:false,
has_terminal_services:false,
@ -72,6 +74,7 @@ static NO_COPY wincaps wincap_nt4sp4 = {
is_server:false,
has_security_descriptor_control:false,
has_ip_helper_lib:true,
has_broken_if_oper_status:true,
has_physical_mem_access:true,
has_process_io_counters:false,
has_terminal_services:false,
@ -99,6 +102,7 @@ static NO_COPY wincaps wincap_2000 = {
is_server:false,
has_security_descriptor_control:true,
has_ip_helper_lib:true,
has_broken_if_oper_status:false,
has_physical_mem_access:true,
has_process_io_counters:true,
has_terminal_services:true,
@ -126,6 +130,7 @@ static NO_COPY wincaps wincap_xp = {
is_server:false,
has_security_descriptor_control:true,
has_ip_helper_lib:true,
has_broken_if_oper_status:false,
has_physical_mem_access:true,
has_process_io_counters:true,
has_terminal_services:true,
@ -153,6 +158,7 @@ static NO_COPY wincaps wincap_2003 = {
is_server:true,
has_security_descriptor_control:true,
has_ip_helper_lib:true,
has_broken_if_oper_status:false,
has_physical_mem_access:false,
has_process_io_counters:true,
has_terminal_services:true,
@ -180,6 +186,7 @@ static NO_COPY wincaps wincap_vista = {
is_server:false,
has_security_descriptor_control:true,
has_ip_helper_lib:true,
has_broken_if_oper_status:false,
has_physical_mem_access:false,
has_process_io_counters:true,
has_terminal_services:true,

View File

@ -18,6 +18,7 @@ struct wincaps
unsigned is_server : 1;
unsigned has_security_descriptor_control : 1;
unsigned has_ip_helper_lib : 1;
unsigned has_broken_if_oper_status : 1;
unsigned has_physical_mem_access : 1;
unsigned has_process_io_counters : 1;
unsigned has_terminal_services : 1;
@ -61,6 +62,7 @@ public:
bool IMPLEMENT (is_server)
bool IMPLEMENT (has_security_descriptor_control)
bool IMPLEMENT (has_ip_helper_lib)
bool IMPLEMENT (has_broken_if_oper_status)
bool IMPLEMENT (has_physical_mem_access)
bool IMPLEMENT (has_process_io_counters)
bool IMPLEMENT (has_terminal_services)