Subject: Re: new ntpd fails to compile on alpha...
To: None <ks@ub.uni-mainz.de>
From: Frank Kardel <kardel@netbsd.org>
List: current-users
Date: 07/29/2006 17:23:22
This is a multi-part message in MIME format.
--------------030605020902050809060504
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Kurt Schreiner wrote:
>Hi,
>
>the just checked in ntpd fails to compile on alpha with:
>[...]
>cc1: warnings being treated as errors
>/u/NetBSD/src/dist/ntp/ntpd/ntp_io.c: In function 'read_network_packet':
>/u/NetBSD/src/dist/ntp/ntpd/ntp_io.c:2249: warning: passing argument 6 of 'recvfrom' from incompatib
>le pointer type
>/u/NetBSD/src/dist/ntp/ntpd/ntp_io.c:2269: warning: passing argument 6 of 'recvfrom' from incompatib
>le pointer type
>/u/NetBSD/src/dist/ntp/ntpd/ntp_io.c: In function 'findlocalinterface':
>/u/NetBSD/src/dist/ntp/ntpd/ntp_io.c:2557: warning: passing argument 3 of 'getsockname' from incompa
>tible pointer type
>[...]
>
>With the following patches compiling is ok:
>
>
>--- /u/NetBSD/src/dist/ntp/ntpd/ntp_io.c 2006-07-29 14:28:14.000000000 +0200
>+++ /u/NetBSD/lsrc/dist/ntp/ntpd/ntp_io.c 2006-07-29 16:09:20.000000000 +0200
>@@ -2224,7 +2224,7 @@
> static inline int
> read_network_packet(SOCKET fd, struct interface *itf, l_fp ts)
> {
>- size_t fromlen;
>+ socklen_t fromlen;
> int buflen;
> register struct recvbuf *rb;
>
>@@ -2510,7 +2510,7 @@
> SOCKET s;
> int rtn, i, idx;
> struct sockaddr_storage saddr;
>- size_t saddrlen = SOCKLEN(addr);
>+ socklen_t saddrlen = SOCKLEN(addr);
> #ifdef DEBUG
> if (debug>2)
> printf("Finding interface for addr %s in list of addresses\n",
>
>
>
fixed with ntp_io.c:1.19 and above - thanks
>
>--- /u/NetBSD/src/dist/ntp/ntpd/refclock_oncore.c 2006-06-12 21:43:18.000000000 +0200
>+++ /u/NetBSD/lsrc/dist/ntp/ntpd/refclock_oncore.c 2006-07-29 16:16:02.000000000 +0200
>@@ -3318,7 +3318,7 @@
> /* and set time to time from Computer clock */
>
> gettimeofday(&tv, 0);
>- tm = gmtime((const time_t *) &tv.tv_sec);
>+ tm = gmtime((const time_t *)(long) &tv.tv_sec);
>
>
Why would we want to cast an address to a long? Granted,
struct timeval is severely broken by defining tv_sec as
as long in violation of the common standards.
This leads to strange constructs I think we need here again.
(there is another place - look for NetBSD in refclock_shm.c)
I think it is about time this basic problem in struct
timeval needs to be addressed...
Could you try attached patch before I commit that one?
Frank
--------------030605020902050809060504
Content-Type: text/plain;
name="t"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="t"
Index: refclock_oncore.c
===================================================================
RCS file: /cvsroot/src/dist/ntp/ntpd/refclock_oncore.c,v
retrieving revision 1.8
diff -u -r1.8 refclock_oncore.c
--- refclock_oncore.c 11 Jun 2006 19:34:12 -0000 1.8
+++ refclock_oncore.c 29 Jul 2006 15:19:55 -0000
@@ -3317,8 +3317,17 @@
/* and set time to time from Computer clock */
- gettimeofday(&tv, 0);
- tm = gmtime((const time_t *) &tv.tv_sec);
+ {
+ /*
+ * XXX NetBSD (20060729) defines tv_sec as a long
+ * -> non standard and doesn't even work within the system
+ * without kludges like the one below
+ */
+ time_t help;
+ gettimeofday(&tv, 0);
+ help = tv.tv_sec;
+ tm = gmtime((const time_t *) &help);
+ }
#if 1
{
char Msg[160];
--------------030605020902050809060504--