Commit Graph

30 Commits

Author SHA1 Message Date
Corinna Vinschen c70761df66 Cygwin: Define SO_PASSCRED and SCM_CREDENTIALS
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 21:00:43 +01:00
Corinna Vinschen b89b6f4349 Cygwin: socket.h: Add SIOCINQ, equivalent to FIONREAD
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-23 13:33:23 +01:00
Yaakov Selkowitz 1e39db3062 cygwin: add asm/bitsperlong.h, dummy asm/posix_types.h headers
These changes are necessary for cross-compiling the Linux kernel.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 03:09:35 -06:00
Corinna Vinschen 6e623e9320 Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option
Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause.

Everything else stays under GPLv3+.

New Linking Exception exempts resulting executables from LGPLv3 section 4.

Add CONTRIBUTORS file to keep track of licensing.

Remove 'Copyright Red Hat Inc' comments.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-23 10:09:17 +02:00
Sebastian Huber 76a2110b47 BSD compatibility for <machine/endian.h>
Introduce <machine/_endian.h> to let target based customization of
<machine/endian.h> via

 * _LITTLE_ENDIAN,
 * _BIG_ENDIAN,
 * _PDP_ENDIAN, and
 * _BYTE_ORDER.

defines.  Add definitions expected by FreeBSD to
<machine/endian.h> like

 * _QUAD_HIGHWORD,
 * _QUAD_LOWWORD,
 * __bswap16(),
 * __bswap32(),
 * __bswap64(),
 * __htonl(),
 * __htons(),
 * __ntohl(), and
 * __ntohs().

Also, if __BSD_VISIBLE

 * LITTLE_ENDIAN,
 * BIG_ENDIAN,
 * PDP_ENDIAN, and
 * BYTE_ORDER.

Targets that define __machine_host_to_from_network_defined in
<machine/_endian.h> must provide their own implementation of

 * __htonl(),
 * __htons(),
 * __ntohl(), and
 * __ntohs(),

otherwise a default implementation is provided by <machine/endian.h>.
In case of GCC defines to builtins are used.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-19 16:36:51 +02:00
Corinna Vinschen 977912ff93 Fix FIONBIO comments
FIONBIO is defined in sys/termios.h and asm/socket.h.  Align the comments.
Remove unused REAL_FIONBIO.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-24 16:12:28 +01:00
Corinna Vinschen b1b46d4580 Drop usage of old-age BSD types in generically used Cygwin headers
u_char, u_short, u_int, u_long are BSD-only types.  Remove them from
Cygwin headers which are supposed to be used in a non-BSD scenario.
Drop special Cygwin handling of those types in sys/types.h.

newlib:
	* libc/include/sys/types.h (u_char,u_short,u_int,u_long): Drop
	Cygwin exception.

cygwin:
	* fhandler_socket.cc (fhandler_socket::ioctl): Accommodate change
	in include/asm/socket.h.  Continue using u_long since that's the
	MS type here.
	* include/asm/socket.h: Since the type given in _IOR/_IOW macros
	is only used for its sizeof, replace u_long with equivalent long.
	* netdb.h (getnetbyaddr): Fix prototype.
	* netinet/ip.h: Replace old BSD-only types with generically defined
	old BSD types (u_char -> u_int8_t, etc).
	* netinet/tcp.h: Ditto.
	* netinet/udp.h: Ditto.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-24 15:55:25 +01:00
Corinna Vinschen 49c051c133 Define __s64 and __u64
* include/asm/types.h: Add __s64 and __u64 types.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-27 14:40:27 +02:00
Corinna Vinschen 61522196c7 * Merge in cygwin-64bit-branch. 2013-04-23 09:44:36 +00:00
Christopher Faylor bc837d22f3 Throughout, update copyrights to reflect dates which correspond to main-branch
checkins.  Regularize copyright format.
2013-01-21 04:38:31 +00:00
Corinna Vinschen 7be671075d * include/endian.h: Move definitions of __BIG_ENDIAN, __LITTLE_ENDIAN,
and __BYTE_ORDER into ...
	* include/bits/endian.h: New file.
	* include/arpa/nameser_compat.h: Include endian.h rather than defining
	BYTE_ORDER here.
	* include/asm/byteorder.h: Include bits/endian.h.  Drop definition of
	__LITTLE_ENDIAN.
	* include/netinet/ip.h: Include bits/endian.h.  Drop definitions of
	BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER.  Use underscored variants
	of aforementioned constants.
	* include/netinet/tcp.h: Ditto.
	* include/sys/param.h: Drop disabled definitions of BIG_ENDIAN,
	LITTLE_ENDIAN, and BYTE_ORDER.

	* include/netinet/ip.h: Reformat.  Define setsockopt IP_TOS options
	matching recent RFCs.  Tweak comments.
2011-02-11 12:42:30 +00:00
Corinna Vinschen 4fedce119c * include/asm/byteorder.h (__ntohl): Prototype before define to avoid
a warning with -Wmissing-prototypes.  Use _ELIDABLE_INLINE macro from
	_ansi.h.
	(__ntohs): Ditto.
2009-04-04 15:49:05 +00:00
Corinna Vinschen 62818522c2 * include/asm/byteorder.h (__ntohl): Align definition to ISO C99.
(__ntohs): Ditto.
2009-03-26 10:40:29 +00:00
Corinna Vinschen 1199a53979 * include/asm/byteorder.h (__constant_ntohs): Remove declaration.
(__constant_ntohl): Ditto.
2009-03-23 14:26:55 +00:00
Corinna Vinschen 2895b8b502 * net.cc: Include asm/byteorder.h.
(htonl): Move to end of file.  Add comment to explain why.  Align
	definition to POSIX.  Use related macro from asm/byteorder.h.
	(ntohl): Ditto.
	(htons): Ditto.
	(ntohs): Ditto.
	* include/asm/byteorder.h: Revert previous patch.
2009-03-03 11:44:18 +00:00
Corinna Vinschen ed296a4727 * include/asm/byteorder.h: Disable optimization when building
Cygwin network code.
2009-03-03 11:11:26 +00:00
Corinna Vinschen 8e4a60b383 * autoload.cc (GetIpForwardTable): Define.
* fhandler_socket.cc (fhandler_socket::ioctl): Handle SIOCGIFDSTADDR.
	* net.cc (get_routedst): New static function to get destination
	address of point-to-point interfaces.
	(get_xp_ifconf): Handle SIOCGIFDSTADDR.
	(get_2k_ifconf): Ditto.
	(get_nt_ifconf): Ditto.
	(get_ifconf): Ditto.
	* include/asm/socket.h (SIOCGIFDSTADDR): Define.
	* include/cygwin/if.h (struct ifreq): Add ifru_dstaddr member.
	(ifr_dstaddr): Define.
	* include/cygwin/in.h: Cast ipv4 addresses correctly to in_addr_t in
	definitions.
2007-06-14 16:02:32 +00:00
Corinna Vinschen bff4389137 * 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 22:54:05 +00:00
Corinna Vinschen 12ffdde350 * include/asm/socket.h (SIOGIFINDEX): Define. 2007-01-17 13:43:47 +00:00
Corinna Vinschen 835fc32a3a * fhandler_socket.cc (fhandler_socket::ioctl): Handle SIOCGIFINDEX.
* net.cc (get_2k_ifconf): Ditto.
	(get_nt_ifconf): Fake SIOCGIFINDEX.
	(get_95_ifconf): Ditto.
	(get_ifconf): Handle SIOCGIFINDEX.  Fake it for loopback on systems
	not supporting IP Helper Lib.
	* include/asm/socket.h (SIOCGIFINDEX): Define.
	* include/cygwin/if.h (struct ifreq): Add member for interface index.
	(ifr_ifindex): Define.
2007-01-16 12:01:36 +00:00
Corinna Vinschen c28fea1bdc * include/asm/byteorder.h: Fix copyright dates.
Fix typos in ChangeLog.
2006-10-16 12:34:34 +00:00
Christopher Faylor b44ba33a1f * byteorder.h: Correct typo. 2006-09-17 23:22:10 +00:00
Christopher Faylor 22aa38a0a8 * byteorder.h: Don't #define n* macros if -fnoinline is specified. 2006-09-17 22:34:45 +00:00
Corinna Vinschen 053fc4771a * include/asm/byteorder.h (__ntohl): Fix the missing uint32_t. 2006-04-21 14:29:54 +00:00
Corinna Vinschen 387e6a35d8 * include/asm/byteorder.h: Include stdint.h. Per standard, change
datatypes in ntohX and htonX functions to uintXX_t types.
2006-04-21 09:59:07 +00:00
Corinna Vinschen c8b404bf5c * cygwin.din (getpeereid): Export.
* fhandler.h (class fhandler_socket): Add pipe and id members to
	exchange eid credentials for AF_LOCAL sockets.
	(eid_pipe_name): Declare new method.
	(getpeereid): Ditto.
	* fhandler_socket.cc (fhandler_socket::eid_pipe_name): New method.
	(fhandler_socket::fhandler_socket): Initialize sec_pipe.
	(fhandler_socket::connect): Exchange eid credentials with accepting
	socket process.
	(fhandler_socket::listen): Prepare eid credential transaction.
	(fhandler_socket::accept): Exchange eid credentials with connecting
	socket process.
	(fhandler_socket::close): Close eid credentials pipe if open.
	(fhandler_socket::getpeereid): New method.
	* net.cc (cygwin_getsockopt): Add SO_PEERCRED handling.
	(getpeereid): New function.
	* include/asm/socket.h (SO_PEERCRED): Define.
	* include/cygwin/socket.h (struct ucred): Define new type.
	* include/cygwin/version.h: Bump API minor version.
2005-02-23 17:39:46 +00:00
Corinna Vinschen a887211b00 * include/a.out.h: Add copyright hint.
* include/fcntl.h: Ditto.
        * include/lastlog.h: Ditto.
        * include/memory.h: Ditto.
        * include/mntent.h: Ditto.
        * include/paths.h: Ditto.
        * include/poll.h: Ditto.
        * include/syslog.h: Ditto.
        * include/termio.h: Ditto.
        * include/tzfile.h: Ditto.
        * include/arpa/inet.h: Ditto.
        * include/asm/byteorder.h: Ditto.
        * include/asm/socket.h: Ditto.
        * include/asm/types.h: Ditto.
        * include/cygwin/if.h: Ditto.
        * include/cygwin/mtio.h: Ditto.
        * include/cygwin/rdevio.h: Ditto.
        * include/cygwin/socket.h: Ditto.
        * include/net/if.h: Ditto.
        * include/netinet/in.h: Ditto.
        * include/netinet/in_systm.h: Ditto.
        * include/netinet/ip.h: Ditto.
        * include/netinet/ip_icmp.h: Ditto.
        * include/netinet/tcp.h: Ditto.
        * include/sys/cdefs.h: Ditto.
        * include/sys/cygwin.h: Ditto.
        * include/sys/ioctl.h: Ditto.
        * include/sys/mman.h: Ditto.
        * include/sys/mount.h: Ditto.
        * include/sys/mtio.h: Ditto.
        * include/sys/procfs.h: Ditto.
        * include/sys/resource.h: Ditto.
        * include/sys/smallprint.h: Ditto.
        * include/sys/socket.h: Ditto.
        * include/sys/strace.h: Ditto.
        * include/sys/syslog.h: Ditto.
        * include/sys/sysmacros.h: Ditto.
        * include/sys/termio.h: Ditto.
        * include/sys/termios.h: Ditto.
        * include/sys/uio.h: Ditto.
        * include/sys/un.h: Ditto.
        * include/sys/utsname.h: Ditto.
        * include/sys/vfs.h: Ditto.
        * include/sys/wait.h: Ditto.
        * regexp/regerror.c: Ditto.
        * regexp/regexp.h: Ditto.
        * regexp/regmagic.h: Ditto.
2001-03-05 21:29:24 +00:00
Corinna Vinschen 9182099c10 * autoload.cc: Add LoadDLLinitfunc for iphlpapi.dll.
Add LoadDLLfuncEx statements for GetIfTable@12 and GetIpAddrTable@12.
        * fhandler_socket.cc (fhandler_socket::ioctl): Move variable
        definitions to the beginning of the function to allow better debugging.
        Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU.
        * net.cc: Include iphlpapi.h.
        (get_2k_ifconf): Rewritten. Uses IP Helper API now.
        (get_nt_ifconf): Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC
        and SIOCGIFMTU.
        (get_95_ifconf): Ditto. Renamed from `get_9x_ifconf'.
        (get_ifconf): Name loopback `lo' instead of `lo0' as in Linux.
        Add handling for SIOCGIFHWADDR, SIOCGIFMETRIC and SIOCGIFMTU.
        Call `get_95_ifconf' only on Windows 95, `get_nt_ifconf' only
        on Windows NT < Service Pack 3, `get_2k_ifconf otherwise.
        * include/asm/socket.h: Add defines for SIOCGIFHWADDR, SIOCGIFMETRIC
        and SIOCGIFMTU.
        * include/cygwin/if.h: Add `ifr_hwaddr', `ifr_metric' and `ifr_mtu'.
        (struct ifreq): Add `ifru_hwaddr'.
2001-02-07 22:50:50 +00:00
Christopher Faylor 75a57bf04a Whitespace cleanup.
* configure.in: Eliminate subdir stuff.
* configure: Regenerate.
* include/getopt.h (option): Make name field 'const'.
2000-10-28 05:41:44 +00:00
Christopher Faylor 1fd5e000ac import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00