Buggy sbspace() on 64bit builds?

Anuranjan Shukla anshukla at juniper.net
Fri Feb 6 22:19:59 UTC 2015


On 2/6/15, 12:56 AM, "Bruce Evans" <brde at optusnet.com.au> wrote:

>long
>sbspace(struct sockbuf *sb)
>{
>	u_int bleft, mleft;
>
>	if (sb->sb_flags & SB_STOP)
>		return (0);
>	bleft = sb->sb_hiwat < sb->sb_cc ? 0 : sb->sb_hiwat - sb->sb_cc;
>	mleft = sb->sb_mbmax < sb->sb_mbcnt ? 9 : sb->sb_mbmax - sb->sb_mbcnt;
>	return (min(bleft, mleft));
>}

This is sort of what we've been using past few years as a local change. Is
this, along with return value being 'int' acceptable as a final
determination?  There are places like sockopt processing where the return
is anyway being typecast to int like Bruce mentioned. Appreciate the
inputs so far.

Thanks
Anu



More information about the freebsd-arch mailing list