From owner-svn-src-all@FreeBSD.ORG Sun Jun 23 00:44:40 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 252949A5; Sun, 23 Jun 2013 00:44:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id D90C116F5; Sun, 23 Jun 2013 00:44:39 +0000 (UTC) Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 81F154207DF; Sun, 23 Jun 2013 10:44:32 +1000 (EST) Date: Sun, 23 Jun 2013 10:44:28 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Garrett Cooper Subject: Re: svn commit: r252074 - head/sys/fs/nfsclient In-Reply-To: <337C6949-87B6-442A-ADD6-9F12766E9919@gmail.com> Message-ID: <20130623093034.A923@besplex.bde.org> References: <201306212246.r5LMkHBY070137@svn.freebsd.org><20130622042219.GC1888@glenbarber.us> <28B87860D4194B3DA2E6A992537142B1@multiplay.co.uk> <337C6949-87B6-442A-ADD6-9F12766E9919@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=Q6eKePKa c=1 sm=1 a=q5jKLduKGBcA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=jQqfA_MDNRQA:10 a=1NWOV8S6UX2bKiEduA0A:9 a=CjuIK1q_8ugA:10 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 Cc: src-committers , svn-src-all , Hiroki Sato , hiren panchasara , Glen Barber , Steven Hartland , svn-src-head , Rick Macklem X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Jun 2013 00:44:40 -0000 On Sat, 22 Jun 2013, Garrett Cooper wrote: > On Jun 22, 2013, at 11:22 AM, Steven Hartland wrote: > >> I thought the use of PRIu64 was frowned on? > > It is in FreeBSD, unlike Linux (for better or for worse). It should be cast with either intmax_t or uintmax_t and use %jd or %ju. Do you mean that this mistake is not even possible in Linux (the kernel)? Linux-2.6.10 has no references to PRI* or SCN*. It doesn't even have stdint.h. The PRI* and SCN* bugs are in inttypes.h. In C99, is a historical wrapper for that adds these bugs and prototypes for strtoimax() and friends. In the kernel, these files really shouldn't be used. Even in FreeBSD, it takes extra work to get these bugs. is standard pollution in , but inttypes.h has to be included directly about 30 files in /sys include it under any name. Almost half of these are userland applications so they have the excuse that is a Standard header. Some of the includes, not counted in the 30, are in comments. 1 of the 30 is is an include of the nonstandard header . This file doesn't exist in FreeBSD. Including it only defeats simple greps. It doesn't break the build since the include is in code ifdefed for NetBSD and OpenBSD. sys/inttypes.h existed in FreeBSD until 2001. It was removed then as part of implementing the C99 headers and . I think was the old name, and exists now mainly to hold historical mistakes, while is a C99 invention to clean up some of the mistakes, but unfortunately it wasn't possible to clean them all. Before 2001, FreeBSD used only the older name inttypes.h, but only had the important parts of in it, and of course didn't have PRI* or SCN*. The part of was created essentially by renaming sys/inttypes.h to sys/stdint.h in 2001. This means that there is no supported kernel include file containing the PRI* and SCN* mistakes. But all arches have a for exporting these mistakes to userland. 15 of the 30 files are chummy with this implemntation detail and include directly, presumably so that they can have more style bugs by using PRI*. All 15 of these files are relatively new. was not referenced in the kernel for several years after it was created. Bruce