Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rump and htonl() in constants



On Sat, Feb 28, 2015 at 04:08:34PM +0000, Christos Zoulas wrote:
> In article <CAK4o1Wwm2tXKpdO_Dhdmw-Wxii_nLf+dYPZc6TurtDmZ+-53nw%mail.gmail.com@localhost>,
> Justin Cormack  <justin%specialbusservice.com@localhost> wrote:
> >On 28 February 2015 at 11:17, Patrick Welche <prlw1%cam.ac.uk@localhost> wrote:
> >> The surprise is that when building rump, gcc complains with:
> >>
> >>
> >> /usr/src/sys/rump/net/lib/libnet/../../../../net/route.c:1010:21:
> >error: initializer element is not constant
> >>  static const struct in_addr inmask32 = {.s_addr = INADDR_BROADCAST};
> >>                      ^
> >> /usr/src/sys/rump/net/lib/libnet/../../../../net/route.c:1010:21:
> >error: (near initialization for 'inmask32.s_addr')
> >>
> >>
> >> which certainly looks constant. Problem is that INADDR_BROADCAST may
> >> contain a call to htonl(), e.g. try
> >
> >> Given that 0xffffffff is the same in either order, there is an obvious
> >> kludge, but any thoughts on an elegant solution?
> >
> >Hmm, I hadnt seen that. Maybe define an HTONL macro that uses shifts
> >and masks ifdef little endian so it is all done at compile time?
> 
> Are you trying to compile without optimization?

Yes - I have DBG=-g -O0 in Makefile.rump

I thought that would help trying to step through a rump kernel in gdb - not
a good idea? (removing now)

I suppose that is why no one else is seeing this...


Cheers,

Patrick


Home | Main Index | Thread Index | Old Index