From owner-freebsd-arch@FreeBSD.ORG Fri Feb 6 22:19:59 2015 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 072F47BE for ; Fri, 6 Feb 2015 22:19:59 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0111.outbound.protection.outlook.com [157.56.110.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BF98757 for ; Fri, 6 Feb 2015 22:19:58 +0000 (UTC) Received: from BLUPR0501MB1060.namprd05.prod.outlook.com (25.160.36.150) by CY1PR0501MB1547.namprd05.prod.outlook.com (25.161.161.145) with Microsoft SMTP Server (TLS) id 15.1.75.20; Fri, 6 Feb 2015 22:19:49 +0000 Received: from BLUPR0501MB1060.namprd05.prod.outlook.com ([25.160.36.150]) by BLUPR0501MB1060.namprd05.prod.outlook.com ([25.160.36.150]) with mapi id 15.01.0075.002; Fri, 6 Feb 2015 22:19:49 +0000 From: Anuranjan Shukla To: Bruce Evans Subject: Re: Buggy sbspace() on 64bit builds? Thread-Topic: Buggy sbspace() on 64bit builds? Thread-Index: AQHQQa9oYD6vE33IJEufQkyrNnicWZzjUieAgABadwA= Date: Fri, 6 Feb 2015 22:19:48 +0000 Message-ID: References: <20150206183036.S1246@besplex.bde.org> In-Reply-To: <20150206183036.S1246@besplex.bde.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.4.7.141117 x-originating-ip: [66.129.241.11] authentication-results: optusnet.com.au; dkim=none (message not signed) header.d=none; x-microsoft-antispam: BCL:0;PCL:0;RULEID:;SRVR:CY1PR0501MB1547; x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:; SRVR:CY1PR0501MB1547; x-forefront-prvs: 047999FF16 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(24454002)(479174004)(51704005)(377454003)(76176999)(54356999)(50986999)(62966003)(106116001)(36756003)(77156002)(92566002)(102836002)(2900100001)(19580395003)(2950100001)(87936001)(19580405001)(66066001)(86362001)(40100003)(99286002)(110136001)(122556002)(46102003)(2656002)(83506001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0501MB1547; H:BLUPR0501MB1060.namprd05.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; Content-Type: text/plain; charset="us-ascii" Content-ID: <6B811B18F3770D4EABF4F3AC1F3DA6B2@namprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Feb 2015 22:19:48.7492 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0501MB1547 Cc: Simon Gerraty , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Feb 2015 22:19:59 -0000 On 2/6/15, 12:56 AM, "Bruce Evans" wrote: >long >sbspace(struct sockbuf *sb) >{ > u_int bleft, mleft; > > if (sb->sb_flags & SB_STOP) > return (0); > bleft =3D sb->sb_hiwat < sb->sb_cc ? 0 : sb->sb_hiwat - sb->sb_cc; > mleft =3D 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