Mail Archives: djgpp/2015/12/29/17:13:54
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
X-Recipient: | djgpp AT delorie DOT com
|
Message-ID: | <5682F830.7050504@gmx.de>
|
Date: | Tue, 29 Dec 2015 22:16:32 +0100
|
From: | "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
|
User-Agent: | Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7
|
MIME-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
Subject: | Re: ANNOUNCE: tcp/ip library Watt-32 (version 2.2 dev-rel. 10) compiled
|
| with DJGPP.
|
References: | <201511221836 DOT tAMIa8Lv013405 AT delorie DOT com> <n5tnsv$g4t$1 AT speranza DOT aioe DOT org> <56827271 DOT 2020607 AT gmx DOT de> <5682BE36 DOT 6080100 AT yahoo DOT no>
|
In-Reply-To: | <5682BE36.6080100@yahoo.no>
|
X-Provags-ID: | V03:K0:5ry+5avheFtJPWWPOmORLQoItPUgVAvEa2KVvbgnp38Zo17de4C
|
| X9jfcW5WRgdY4RYDG6CGyFtzsgP/xv3pkb/vWbvilVusMo+/yGHs4B6fnl+96Vn11rXw8Xi
|
| Y6DPX8PI30HuETzO/nIjJfjNrwPJFAf1XlaBXDCV7tqK5089agCZSxRoHfICHkjzpwxYtVJ
|
| TVLHqVevRYSZEBOc3aoQQ==
|
X-UI-Out-Filterresults: | notjunk:1;V01:K0:s19f3zW/lO0=:xw5Sdm2pg6aThivwos5Fqj
|
| 1w5M2i2J65+69Cx7r2ef5ncYciZONz8nQP+Q67KO7Nk2UohBQcnXP9mced8PFQ+br0i+pDPFQ
|
| fGs+QaME9OQwCmUkHgFFQpf0kKXTgm/J++gfmKXlEOPG23U5hAi8zp8qDQwOscN+DVVhSG+P1
|
| 8WfbLZE09XIrx95Q85eU6WPKNmERKh2ueSltygEi7tjT7irAALwOoShSdCOSZVvN/+ND7fYHz
|
| hLpNul0cvaq1Y2GJOaSQeRnibrctCLAEo5S7G6zt54rpi2mnFSWF6KUeaDCdqmGuTVVFWqguU
|
| 3CrCrlSrxPwDxB/+10nHNDjQcEbkqUuLgb0p73Vbw0yodd9X4ROMP1cLA8DFJ7HgMlEjn+Aea
|
| Hzoeq5oJBpiCR6dKfoxAaxzmlh4dfkIyImwgYF/0vAeL3jzT3QbEMhuVe0vwr8YqmA+d5GuWI
|
| uAHGRKMXQbfTpTspCB5bSRUP5Y/KEnde9iynTakW36MhofIF4tOpXEoQ2OeHyAyMDov9VELNx
|
| fhLrTmOzxLn7gXR23yI3IjNrY3gz5ADGSh3dXaGsZc5Z/ZfOCGURV6OTPWEJf0exm6TTowmbV
|
| wa4+bkxTMvoYmPmiWDBCe+NsMhhCQ8Qt3QlCCJoPfs6ePLI1Ca7hxtNU4o9K+i6KaX5Dr+rf0
|
| NX4VofXDr25faY7aCTvZJCNBNBk5NqNbDEVTmhC4lEAIYolG6s3UboS7uvwdkCQdsPJhbhhre
|
| iqVLufaG8JBrZfwWnHDjJVVo1xyKmHLwCgLYAZYORMbZdd6zKkrh9QZTZRGMU0EkAVyYQR07a
|
| Fn1gerf
|
Reply-To: | djgpp AT delorie DOT com
|
Am 29.12.2015 18:09, schrieb Gisle Vanem (gvanem AT yahoo DOT no) [via djgpp AT delorie DOT com]:
> Juan Manuel Guerrero wrote:
>
>> Sorry I cannot reproduce anything of what you are describing.
>> I really hope that you have a clean DJGPP 2.05 installation
>> and no previous Watt-32 installation in your DJGPP tree.
>
> The OP can try the unreleased version here:
> http://www.watt-32.net/watt32s.zip
>
> (from Jule 2015).
>
>> gcc -O3 -g -I. -I../inc -W -Wall -falign-loops=2 -falign-jumps=2 -falign-functions=2 -ffast-math -march=i386
>> -mtune=i586 -o djgpp/tcp_md5.o -c tcp_md5.c
>
> Note Juan, I've changed/removed many of those CFLAGS long
> time ago.
>
In a couple of days I will upload a new release (aka wat3222sr6) of the DJGPP
port of Watt-32 using http://www.watt-32.net/watt32s.zip and http://www.watt-32.net/watt32b.zip.
That port will be used for the DJGPP ports of OpenSSL 1.0.1q and OpenSSL 1.0.2e.
I am using the port of Watt-32 and OpenSSL to try to port OpenSSH. But this
is a lot of work. The OpenSSH must not be perfect (aka full functional) but
good enough for a CVS port.
I am aware that the BSD API support of Watt-32 is not complete. To be able to
get the OpenSSH configure process running until its end I had to add typedef's for
sa_family_t and even more important for socklen_t. For Watt-32 backward compatibility
socklen_t is typedef'ed to int. That is OK. I had to adjust different structs
and the corresponding function prototypes and definitions accordingly. When
the porting process advances probably more BSD-API specific changes will be
required for Watt-32. Also there were some minor issues in the configur.bat file
that inhibit to build Watt-32 with DJGPP when the operating system is Windows NT.
With Windows NT always the Cygwin/MinGW auxiliary programs are assumed. But that
is a minor issue. At the end of the mail I have posted my current patch. May be
it is of some use/interest for you.
I have been using http://www.watt-32.net/watt32[b|s].zip for around 4 weeks now
and I have found some DJGPP and may be gcc specific issues. I have tried to
compile with gcc520 using the -O0 flag and the build fails like this:
[snip]
gcc -O0 -g -I../inc -W -Wall -Wno-strict-aliasing -DWATT32_BUILD -o djgpp/misc.o -c misc.c
In file included from misc.c:1855:0:
misc.h:914:23: error: redefinition of 'get_fs_reg'
W32_GCC_INLINE WORD get_fs_reg (void)
^
In file included from misc.c:52:0:
misc.h:914:23: note: previous definition of 'get_fs_reg' was here
W32_GCC_INLINE WORD get_fs_reg (void)
^
In file included from misc.c:1855:0:
misc.h:922:23: error: redefinition of 'get_gs_reg'
W32_GCC_INLINE WORD get_gs_reg (void)
^
In file included from misc.c:52:0:
misc.h:922:23: note: previous definition of 'get_gs_reg' was here
W32_GCC_INLINE WORD get_gs_reg (void)
^
In file included from misc.c:1855:0:
misc.h:930:23: error: redefinition of 'set_fs_reg'
W32_GCC_INLINE void set_fs_reg (WORD sel)
^
In file included from misc.c:52:0:
misc.h:930:23: note: previous definition of 'set_fs_reg' was here
W32_GCC_INLINE void set_fs_reg (WORD sel)
^
In file included from misc.c:1855:0:
misc.h:936:23: error: redefinition of 'set_gs_reg'
W32_GCC_INLINE void set_gs_reg (WORD sel)
^
In file included from misc.c:52:0:
misc.h:936:23: note: previous definition of 'set_gs_reg' was here
W32_GCC_INLINE void set_gs_reg (WORD sel)
^
djgpp.mak:143: recipe for target 'djgpp/misc.o' failed
make.exe: *** [djgpp/misc.o] Error 1
This can be inhibit by either supplying the -fgnu89-inline flag or by removing
!defined(__NO_INLINE__) from different headers. The use of the -fgnu89-inline
flag has the drawback that it will make the compilation fail for gcc420 and
minor that do not know about this flag. May be some better solution can be
figured out.
I have also tried to compile the test programs. Here I also got some failure
while compiling:
[snip]
gcc -O2 -g -W -Wall -Wno-strict-aliasing -DTEST_PROG -DWATT32 -DWATT32_STATIC -I.. -I../../inc -Wl,--print-map,--sort-common -o swap.exe swap.c ../../lib/libwatt.a > swap.map
swap.c:49:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'simple_cdecl_one'
static unsigned long __cdecl simple_cdecl_one (unsigned long x)
^
swap.c:89:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'naked_cdecl_one'
W32_GCC_INLINE unsigned long __cdecl naked_cdecl_one (unsigned long x)
^
swap.c: In function 'simple_cdecl_ntohl':
swap.c:117:7: warning: implicit declaration of function 'simple_cdecl_one' [-Wimplicit-function-declaration]
simple_cdecl_one (*val++);
^
swap.c: In function 'naked_cdecl_ntohl':
swap.c:126:7: warning: implicit declaration of function 'naked_cdecl_one' [-Wimplicit-function-declaration]
naked_cdecl_one (*val++);
^
swap.c: In function 'intrin_byteswap':
swap.c:141:12: warning: unused variable 'i' [-Wunused-variable]
size_t i;
^
swap.c:140:18: warning: unused variable 'val' [-Wunused-variable]
unsigned long *val = (unsigned long*)buf;
^
swap.c:138:47: warning: unused parameter 'max' [-Wunused-parameter]
void intrin_byteswap (const void *buf, size_t max)
^
swap.c: At top level:
swap.c:272:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'main'
int __cdecl main (int argc, char **argv)
^
djgpp.mak:94: recipe for target 'swap.exe' failed
make.exe: *** [swap.exe] Error 1
For some reason I have not investigated further, the DJGPP port gets a "__cdecl".
This seeems to make no sense.
But anyway all this does not explain why the build of wat3222sr5 (aka a patched
version of watt32s 2.2 dev.rel.10) produces that failure for the OP. Without
more input from the OP I cannot reproduce and fix the issue.
Regards,
Juan M. Guerrero
2015-12-28 Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
* watt/src/tests/configur.bat: Do never assume that the DJGPP build is
done on plain DOS only. This means allow to build on Windows OS too.
* watt/inc/netinet/in.h: Define new type sa_family_t as unsigned short.
Use sa_family_t instead of unsigned short in sockaddr_in and sockaddr_storage
structs.
* watt/src/get_ni.c (getnameinfo): Use sa_family_t.
* watt/src/btree.c [TEST_PROG, __DJGPP__]: Include conio.h to provide
getch() prototype.
2015-12-27 Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
* watt/inc/sys/socket.h: Define new type socklen_t as int.
Replace int by socklen_t in struct msghdr and in functions: accept,
bind, connect, getpeername, getsockname, getsockopt, recvfrom,
sendto and setsockopt.
* watt/inc/netdb.h: Replace int by socklen_t in functions: gethostbyaddr
and getnameinfo.
* watt/src/accept.c: Replace int by socklen_t in accept definition.
* watt/src/bind.c: Replace int by socklen_t in bind definition.
* watt/src/connect.c: Replace int by socklen_t in connect definition.
* watt/src/getname.c: Replace int by socklen_t in getsockname and
getpeername definition.
* watt/src/socket.c: Replace int by socklen_t in _sock_chk_sockaddr
definition.
* watt/src/sockopt.c: Replace int by socklen_t in getsockopt and
setsockopt definition.
* watt/src/receive.c: Replace int by socklen_t in recvfrom definition.
* watt/src/transmit.c: Replace int by socklen_t in sendto definition.
2015-12-20 Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
* watt/src/configur.bat: Do never assume that the DJGPP build is done
only on plain DOS. This means allow to build on Windows OS too.
diff -aprNU5 watt.orig/inc/netdb.h watt/inc/netdb.h
--- watt.orig/inc/netdb.h 2014-08-12 13:33:16 +0200
+++ watt/inc/netdb.h 2015-12-28 23:05:28 +0100
@@ -222,11 +222,11 @@ __BEGIN_DECLS
W32_FUNC void W32_CALL endhostent (void);
W32_FUNC void W32_CALL endhostent6 (void);
W32_FUNC void W32_CALL endnetent (void);
W32_FUNC void W32_CALL endprotoent (void);
W32_FUNC void W32_CALL endservent (void);
-W32_FUNC struct hostent * W32_CALL gethostbyaddr (const char *, int, int);
+W32_FUNC struct hostent * W32_CALL gethostbyaddr (const char *, socklen_t, int);
W32_FUNC struct hostent * W32_CALL gethostbyaddr6 (const void *);
W32_FUNC struct hostent * W32_CALL gethostbyname (const char *name);
W32_FUNC struct hostent * W32_CALL gethostbyname2 (const char *name, int af);
W32_FUNC struct hostent * W32_CALL gethostbyname6 (const char *name);
W32_FUNC struct hostent * W32_CALL gethostent (void);
@@ -248,13 +248,13 @@ W32_FUNC void W32_CALL seth
W32_FUNC void W32_CALL sethostent6 (int stayopen);
W32_FUNC void W32_CALL setnetent (int);
W32_FUNC void W32_CALL setprotoent (int);
W32_FUNC void W32_CALL setservent (int);
-W32_FUNC int W32_CALL getnameinfo (const struct sockaddr *sa, int salen,
- char *host, int hostlen,
- char *serv, int servlen, int flags);
+W32_FUNC int W32_CALL getnameinfo (const struct sockaddr *sa, socklen_t salen,
+ char *host, socklen_t hostlen,
+ char *serv, socklen_t servlen, int flags);
W32_FUNC int W32_CALL getaddrinfo (const char *hostname, const char *servname,
const struct addrinfo *hints,
struct addrinfo **res);
diff -aprNU5 watt.orig/inc/netinet/in.h watt/inc/netinet/in.h
--- watt.orig/inc/netinet/in.h 2009-08-02 11:22:06 +0200
+++ watt/inc/netinet/in.h 2015-12-28 23:44:36 +0100
@@ -138,10 +138,21 @@
* have a fit if we use.
*/
#define IPPORT_RESERVEDSTART 600
+#ifndef sa_family_t
+typedef unsigned short sa_family_t;
+#define sa_family_t sa_family_t
+#endif
+
+#ifdef _BSD_SA_FAMILY_T_
+typedef _BSD_SA_FAMILY_T_ sa_family_t;
+#undef _BSD_SA_FAMILY_T_
+#endif
+
+
/*
* Internet address (a structure for historical reasons)
*/
struct in_addr {
u_long s_addr;
@@ -220,11 +231,11 @@ W32_DATA const struct in6_addr in6addr_l
/*
* Socket address, internet style.
*/
struct sockaddr_in {
- u_short sin_family;
+ sa_family_t sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
@@ -241,15 +252,15 @@ struct sockaddr_in6 {
* Portable IPv6/IPv4 version of sockaddr.
* Uses padding to force 8 byte alignment
* and maximum size of 128 bytes
*/
struct sockaddr_storage {
- u_short ss_family;
- u_short ss_len; /* !! added for BSD progs, gv Nov-2003 */
- char __ss_pad1[6]; /* pad to 8 */
- long __ss_align1, __ssalign2; /* force alignment */
- char __ss_pad2[110]; /* pad to 128 */
+ sa_family_t ss_family;
+ u_short ss_len; /* !! added for BSD progs, gv Nov-2003 */
+ char __ss_pad1[6]; /* pad to 8 */
+ long __ss_align1, __ssalign2; /* force alignment */
+ char __ss_pad2[110]; /* pad to 128 */
};
/* IPv6 multicast request. */
struct ipv6_mreq {
diff -aprNU5 watt.orig/inc/sys/socket.h watt/inc/sys/socket.h
--- watt.orig/inc/sys/socket.h 2015-04-30 13:57:00 +0200
+++ watt/inc/sys/socket.h 2015-12-28 23:48:54 +0100
@@ -69,10 +69,36 @@
/*
* Definitions related to sockets: types, address families, options.
*/
+/* Not unsigned for backward compatibility. Keep #define for backward
+ compatibility. */
+#ifndef socklen_t
+typedef int socklen_t;
+#define socklen_t socklen_t
+#endif
+
+/*
+ * Data types.
+ */
+#ifndef sa_family_t
+typedef unsigned short sa_family_t;
+#define sa_family_t sa_family_t
+#endif
+
+#ifdef _BSD_SA_FAMILY_T_
+typedef _BSD_SA_FAMILY_T_ sa_family_t;
+#undef _BSD_SA_FAMILY_T_
+#endif
+
+#ifdef _BSD_SOCKLEN_T_
+typedef _BSD_SOCKLEN_T_ socklen_t;
+#undef _BSD_SOCKLEN_T_
+#endif
+
+
/*
* This is used instead of -1, since the socket type is signed.
*/
#define INVALID_SOCKET (int)(~0)
#define SOCKET_ERROR (-1)
@@ -166,12 +192,12 @@ struct linger {
* Structure used by kernel to store most
* addresses.
* is called struct osockaddr in 4.4BSD
*/
struct sockaddr {
- u_short sa_family; /* address family */
- char sa_data[14]; /* up to 14 bytes of direct address */
+ sa_family_t sa_family; /* address family */
+ char sa_data[14]; /* up to 14 bytes of direct address */
};
/*
* Structure used by kernel to pass protocol
* information in raw sockets.
@@ -243,11 +269,11 @@ struct cmsghdr {
/* followed by u_char cmsg_data[]; */
};
struct msghdr {
char *msg_name; /* Contains an optional address. */
- int msg_namelen; /* len of optional address */
+ socklen_t msg_namelen; /* len of optional address */
struct iovec *msg_iov; /* scatter/gather array. */
int msg_iovlen; /* number of elements in msg_iov */
char *msg_accrights; /* does not apply to IP - not changed */
int msg_accrightslen; /* does not apply to IP */
};
@@ -279,32 +305,32 @@ struct msghdr {
#include <sys/pack_off.h>
__BEGIN_DECLS
-W32_FUNC int W32_CALL accept (int, struct sockaddr *, int *);
-W32_FUNC int W32_CALL bind (int, const struct sockaddr *, int);
+W32_FUNC int W32_CALL accept (int, struct sockaddr *, socklen_t *);
+W32_FUNC int W32_CALL bind (int, const struct sockaddr *, socklen_t);
W32_FUNC int W32_CALL closesocket (int s);
-W32_FUNC int W32_CALL connect (int, const struct sockaddr *, int);
+W32_FUNC int W32_CALL connect (int, const struct sockaddr *, socklen_t);
W32_FUNC int W32_CALL ioctlsocket (int s, long cmd, char *argp);
W32_FUNC int MS_CDECL fcntlsocket (int s, int cmd, ...);
W32_FUNC int W32_CALL getdomainname (char *name, size_t len);
W32_FUNC int W32_CALL setdomainname (const char *name, size_t len);
-W32_FUNC int W32_CALL getpeername (int, struct sockaddr *, int *);
-W32_FUNC int W32_CALL getsockname (int, struct sockaddr *, int *);
-W32_FUNC int W32_CALL getsockopt (int, int, int, void *, int *);
+W32_FUNC int W32_CALL getpeername (int, struct sockaddr *, socklen_t *);
+W32_FUNC int W32_CALL getsockname (int, struct sockaddr *, socklen_t *);
+W32_FUNC int W32_CALL getsockopt (int, int, int, void *, socklen_t *);
W32_FUNC int W32_CALL listen (int, int);
W32_FUNC int W32_CALL recv (int, void *, int, int);
-W32_FUNC int W32_CALL recvfrom (int, void *, int, int, struct sockaddr *, int *);
+W32_FUNC int W32_CALL recvfrom (int, void *, int, int, struct sockaddr *, socklen_t *);
W32_FUNC int W32_CALL recvmsg (int, struct msghdr *, int);
W32_FUNC int W32_CALL send (int, const void *, int, int);
-W32_FUNC int W32_CALL sendto (int, const void *, int, int, const struct sockaddr *, int);
+W32_FUNC int W32_CALL sendto (int, const void *, int, int, const struct sockaddr *, socklen_t);
W32_FUNC int W32_CALL sendmsg (int, const struct msghdr *, int);
-W32_FUNC int W32_CALL setsockopt (int, int, int, const void *, int);
+W32_FUNC int W32_CALL setsockopt (int, int, int, const void *, socklen_t);
W32_FUNC int W32_CALL shutdown (int, int);
W32_FUNC int W32_CALL socket (int, int, int);
#ifdef __DJGPP__
W32_FUNC int W32_CALL gethostname (char *name, int len);
diff -aprNU5 watt.orig/src/accept.c watt/src/accept.c
--- watt.orig/src/accept.c 2014-01-03 13:20:30 +0100
+++ watt/src/accept.c 2015-12-28 23:05:28 +0100
@@ -54,11 +54,11 @@
static int dup_bind (Socket *socket, Socket **clone, int idx);
static int alloc_addr (Socket *socket, Socket *clone);
static void listen_free(Socket *socket, int idx);
-int W32_CALL accept (int s, struct sockaddr *addr, int *addrlen)
+int W32_CALL accept (int s, struct sockaddr *addr, socklen_t *addrlen)
{
Socket *socket, *clone = NULL;
volatile DWORD timeout;
volatile int newsock = -1;
volatile int que_idx;
@@ -99,12 +99,12 @@ int W32_CALL accept (int s, struct socka
return (-1);
}
if (addr && addrlen)
{
- int sa_len = is_ip6 ? sizeof(struct sockaddr_in6) :
- sizeof(struct sockaddr_in);
+ socklen_t sa_len = is_ip6 ? sizeof(struct sockaddr_in6) :
+ sizeof(struct sockaddr_in);
if (*addrlen < sa_len)
{
SOCK_DEBUGF ((", EFAULT"));
SOCK_ERRNO (EFAULT);
return (-1);
diff -aprNU5 watt.orig/src/bind.c watt/src/bind.c
--- watt.orig/src/bind.c 2015-06-22 20:03:02 +0200
+++ watt/src/bind.c 2015-12-28 23:05:28 +0100
@@ -58,11 +58,11 @@
* which queues up SOCK_DGRAM messages. This queue is polled (by
* 'sock_recv_from()') when we call 'receive()' on such a socket.
* Thus the '*from' address in 'receive()' will be correctly set to
* source address/port of peer.
*/
-int W32_CALL bind (int s, const struct sockaddr *myaddr, int namelen)
+int W32_CALL bind (int s, const struct sockaddr *myaddr, socklen_t namelen)
{
Socket *socket = _socklist_find (s);
struct sockaddr_in *addr = (struct sockaddr_in*) myaddr;
struct sockaddr_in6 *addr6 = (struct sockaddr_in6*) myaddr;
BOOL bind_any, is_bcast, is_mcast, our_addr;
diff -aprNU5 watt.orig/src/btree.c watt/src/btree.c
--- watt.orig/src/btree.c 2015-06-23 18:05:44 +0200
+++ watt/src/btree.c 2015-12-29 00:26:52 +0100
@@ -192,10 +192,14 @@ void tree_free (TreeNode *root)
#if defined(TEST_PROG)
/*
* Interactive tree test driver
*/
+#ifdef __DJGPP__
+# include <conio.h> /* Prototype for getch(). */
+#endif
+
#define KEYSIZE 80
typedef enum tree_order {
NO_ORDER, PRE_ORDER,
IN_ORDER, POST_ORDER
diff -aprNU5 watt.orig/src/configur.bat watt/src/configur.bat
--- watt.orig/src/configur.bat 2015-06-27 08:19:32 +0200
+++ watt/src/configur.bat 2015-12-28 23:05:28 +0100
@@ -10,10 +10,11 @@ if not exist %WATT_ROOT%\src\makefile.al
set MKMAKE=..\util\mkmake.exe
set MKDEP=..\util\mkdep.exe
set WC_ERR=..\util\wc_err.exe
if %OS%. ==. goto is_dos
+if %1.==djgpp. goto is_dos
set MKMAKE=..\util\win32\mkmake.exe
set MKDEP=..\util\win32\mkdep.exe
set WC_ERR=..\util\win32\wc_err.exe
diff -aprNU5 watt.orig/src/connect.c watt/src/connect.c
--- watt.orig/src/connect.c 2014-01-03 13:20:30 +0100
+++ watt/src/connect.c 2015-12-28 23:05:28 +0100
@@ -49,11 +49,11 @@ static int nblk_connect (Socket *socket)
* connect()
* "connect" will attempt to open a connection on a foreign IP address and
* foreign port address. This is achieved by specifying the foreign IP
* address and foreign port number in the "servaddr".
*/
-int W32_CALL connect (int s, const struct sockaddr *servaddr, int addrlen)
+int W32_CALL connect (int s, const struct sockaddr *servaddr, socklen_t addrlen)
{
struct sockaddr_in *addr = (struct sockaddr_in*) servaddr;
struct sockaddr_in6 *addr6 = (struct sockaddr_in6*) servaddr;
struct Socket *socket = _socklist_find (s);
volatile int rc, sa_len;
diff -aprNU5 watt.orig/src/getname.c watt/src/getname.c
--- watt.orig/src/getname.c 2014-01-03 13:20:30 +0100
+++ watt/src/getname.c 2015-12-28 23:05:28 +0100
@@ -38,14 +38,14 @@
#include "socket.h"
#if defined(USE_BSD_API)
-int W32_CALL getsockname (int s, struct sockaddr *name, int *namelen)
+int W32_CALL getsockname (int s, struct sockaddr *name, socklen_t *namelen)
{
Socket *socket = _socklist_find (s);
- int sa_len;
+ socklen_t sa_len;
SOCK_PROLOGUE (socket, "\ngetsockname:%d", s);
if (!socket)
goto einval;
@@ -92,14 +92,14 @@ einval:
ARGSUSED (la);
}
return (0);
}
-int W32_CALL getpeername (int s, struct sockaddr *name, int *namelen)
+int W32_CALL getpeername (int s, struct sockaddr *name, socklen_t *namelen)
{
Socket *socket = _socklist_find (s);
- int sa_len;
+ socklen_t sa_len;
SOCK_PROLOGUE (socket, "\ngetpeername:%d", s);
sa_len = (socket->so_family == AF_INET6) ? sizeof(struct sockaddr_in6) :
sizeof(struct sockaddr_in);
diff -aprNU5 watt.orig/src/get_ni.c watt/src/get_ni.c
--- watt.orig/src/get_ni.c 2015-06-22 20:35:16 +0200
+++ watt/src/get_ni.c 2015-12-28 23:20:14 +0100
@@ -113,12 +113,13 @@ static int gi_result (int err, const cha
int W32_CALL getnameinfo (const struct sockaddr *sa, int salen,
char *host, int hostlen,
char *serv, int servlen, int flags)
{
static BOOL init = FALSE;
- struct afd *afd;
- int i, family = -1;
+ struct afd *afd;
+ sa_family_t family = -1;
+ int i;
DWORD v4a;
WORD port;
char numserv[512];
char numaddr[512];
char *addr, *p;
diff -aprNU5 watt.orig/src/receive.c watt/src/receive.c
--- watt.orig/src/receive.c 2015-06-29 11:11:04 +0200
+++ watt/src/receive.c 2015-12-28 23:05:28 +0100
@@ -181,11 +181,11 @@ static int receive (const char *func, in
/*
* recvfrom(): receive from socket 's'. Address (src-ip/port) is put
* in 'from' (if non-NULL)
*/
int W32_CALL recvfrom (int s, void *buf, int len, int flags,
- struct sockaddr *from, int *fromlen)
+ struct sockaddr *from, socklen_t *fromlen)
{
return receive ("recvfrom", s, buf, len, flags, from, (size_t*)fromlen);
}
/*
diff -aprNU5 watt.orig/src/socket.c watt/src/socket.c
--- watt.orig/src/socket.c 2015-06-29 11:16:02 +0200
+++ watt/src/socket.c 2015-12-28 23:05:30 +0100
@@ -834,14 +834,14 @@ static void *sock_find_tcp (const _tcp_S
}
/**
* Check `sockaddr*' passed to bind/connect.
*/
-int _sock_chk_sockaddr (Socket *socket, const struct sockaddr *sa, int len)
+int _sock_chk_sockaddr (Socket *socket, const struct sockaddr *sa, socklen_t len)
{
- int sa_len = (socket->so_family == AF_INET6) ? sizeof(struct sockaddr_in6) :
- sizeof(struct sockaddr_in);
+ socklen_t sa_len = (socket->so_family == AF_INET6) ? sizeof(struct sockaddr_in6) :
+ sizeof(struct sockaddr_in);
if (!sa || len < sa_len)
{
SOCK_DEBUGF ((", EINVAL"));
SOCK_ERRNO (EINVAL);
return (-1);
diff -aprNU5 watt.orig/src/sockopt.c watt/src/sockopt.c
--- watt.orig/src/sockopt.c 2015-06-29 11:17:16 +0200
+++ watt/src/sockopt.c 2015-12-28 23:05:30 +0100
@@ -65,11 +65,11 @@ static int get_rx_lowat (const Socket *s
#if defined(USE_DEBUG)
static const char *sockopt_name (int level, int option);
#endif
-int W32_CALL setsockopt (int s, int level, int option, const void *optval, int optlen)
+int W32_CALL setsockopt (int s, int level, int option, const void *optval, socklen_t optlen)
{
Socket *socket = _socklist_find (s);
int rc;
SOCK_DEBUGF (("\nsetsockopt:%d, %s", s, sockopt_name(level,option)));
@@ -119,16 +119,16 @@ int W32_CALL setsockopt (int s, int leve
SOCK_DEBUGF ((", %s", short_strerror(_w32_errno)));
return (rc);
}
-int W32_CALL getsockopt (int s, int level, int option, void *optval, int *optlen)
+int W32_CALL getsockopt (int s, int level, int option, void *optval, socklen_t *optlen)
{
Socket *socket = _socklist_find (s);
int rc;
- SOCK_DEBUGF (("\ngetsockopt:%d, %s", s, sockopt_name(level,option)));
+ SOCK_DEBUGF (("\ngetsockopt:%d, %s", s, sockopt_name(level, option)));
if (!socket)
{
if (_sock_dos_fd(s))
{
diff -aprNU5 watt.orig/src/tests/configur.bat watt/src/tests/configur.bat
--- watt.orig/src/tests/configur.bat 2015-06-22 23:21:06 +0200
+++ watt/src/tests/configur.bat 2015-12-28 23:05:30 +0100
@@ -1,10 +1,11 @@
@echo off
::
:: configur.bat for the ./src/test/*.mak files.
::
set MKMAKE=..\..\util\mkmake.exe
+if %1.==djgpp. goto start
if %OS%. == Windows_NT. set MKMAKE=..\..\util\win32\mkmake.exe
:start
if %1.==mingw32. goto mingw32
if %1.==mingw64. goto mingw64
diff -aprNU5 watt.orig/src/transmit.c watt/src/transmit.c
--- watt.orig/src/transmit.c 2015-06-29 11:25:08 +0200
+++ watt/src/transmit.c 2015-12-28 23:05:30 +0100
@@ -48,11 +48,11 @@ static int setup_udp_raw (Socket *socket
static int transmit (const char *func, int s, const void *buf, unsigned len,
int flags, const struct sockaddr *to, int tolen,
BOOL have_remote_addr);
int W32_CALL sendto (int s, const void *buf, int len, int flags,
- const struct sockaddr *to, int tolen)
+ const struct sockaddr *to, socklen_t tolen)
{
return transmit ("sendto", s, buf, len, flags, to, tolen, TRUE);
}
int W32_CALL send (int s, const void *buf, int len, int flags)
- Raw text -