svn commit: r340617 - head/sys/netgraph

Ian Lepore ian at freebsd.org
Mon Nov 26 23:35:58 UTC 2018


On Tue, 2018-11-27 at 06:29 +0700, Eugene Grosbein wrote:
> 27.11.2018 4:26, John Baldwin wrote:
> 
> > 
> > > 
> > >  /* Parse type for timeval */
> > >  static const struct ng_parse_struct_field
> > > ng_source_timeval_type_fields[] = {
> > > +#ifdef __LP64__
> > > +	{ "tv_sec",		&ng_parse_int64_type	}
> > > ,
> > > +	{ "tv_usec",		&ng_parse_int64_type	
> > > },
> > > +#else
> > >  	{ "tv_sec",		&ng_parse_int32_type	}
> > > ,
> > >  	{ "tv_usec",		&ng_parse_int32_type	
> > > },
> > > +#endif
> > >  	{ NULL }
> > time_t (and thus tv_sec) is 64 bits on all but i386 now.  tv_usec
> > is still a
> > long, so follows LP64 though.  If this is trying to match an actual
> > struct
> > timeval then you might want something like this:
> > 
> > #ifdef __i386__
> >     { "tv_sec",         &ng_parse_int32_type },
> > #else
> >     { "tv_sec",         &ng_parse_int64_type },
> > #endif
> > #ifdef __LP64__
> >     { "tv_usec",        &ng_parse_int32_type },
> > #else
> >     { "tv_usec",        &ng_parse_int64_type },
> > #endif
> I'm not sure I get it right: do you mean there is a difference for
> some platform we have?

I think there's a typo there... it makes more sense if the second test
is #ifndef __LP64__ (or swap the 32 and 64 in the true/false legs of
the test as shown).

-- Ian


More information about the svn-src-head mailing list