From owner-freebsd-standards Wed Nov 28 11:42:50 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id CBBC437B41D for ; Wed, 28 Nov 2001 11:42:48 -0800 (PST) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) id fASJgjw01025; Wed, 28 Nov 2001 14:42:45 -0500 (EST) (envelope-from wollman) Date: Wed, 28 Nov 2001 14:42:45 -0500 (EST) From: Garrett Wollman Message-Id: <200111281942.fASJgjw01025@khavrinen.lcs.mit.edu> To: Bill Fenner Cc: freebsd-standards@bostonradio.org Subject: printf review In-Reply-To: <200111280742.fAS7g9609778@stash.attlabs.att.com> References: <200111280742.fAS7g9609778@stash.attlabs.att.com> Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG < said: > Here's another printf patch for review. I'd particularly like people > to look at the text in the man page for %a, %lc and %ls. I think > I addressed all of bde's issues in vfprintf.c but I'd appreciate > another check. Looks good. I thought of one more issue: are we certain that the buffer used to hold numbers being formatted is long enough when the ' modifier is used? -GAWollman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Nov 28 16:13:17 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 9A44E37B419 for ; Wed, 28 Nov 2001 16:13:15 -0800 (PST) Received: from vagabond.auriga.ru (vagabond.auriga.ru [213.24.253.246]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fAT0DEG03890 for ; Wed, 28 Nov 2001 19:13:14 -0500 (EST) (envelope-from avn@vagabond.auriga.ru) Received: from localhost (localhost [[UNIX: localhost]]) by vagabond.auriga.ru (8.11.2/8.11.2) id fAT0D7s04342 for freebsd-standards@bostonradio.org; Thu, 29 Nov 2001 03:13:07 +0300 Content-Type: text/plain; charset="koi8-r" From: "Alexey V. Neyman" To: freebsd-standards@bostonradio.org Subject: waitid() support Date: Thu, 29 Nov 2001 03:13:06 +0300 X-Mailer: KMail [version 1.2] MIME-Version: 1.0 Message-Id: <01112903130607.01355@vagabond.auriga.ru> Content-Transfer-Encoding: 8bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello there! Are there plans to support waitid() function? As far as I can tell this would require introducing new system call. Regards, Alexey. PS. Are there mail archives available for this list? -- <-------------------------> ) May the Sun and Water ( Regards, Alexey V. Neyman ) always fall upon you! ( mailto:alex.neyman@auriga.ru <-------------------------> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Nov 28 19: 8:51 2001 Delivered-To: freebsd-standards@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id 99A3737B405 for ; Wed, 28 Nov 2001 19:08:49 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id fAT380P20917; Wed, 28 Nov 2001 22:08:00 -0500 (EST) (envelope-from mike) Date: Wed, 28 Nov 2001 22:08:00 -0500 From: Mike Barcroft To: "Alexey V. Neyman" Cc: standards@FreeBSD.org Subject: Re: waitid() support Message-ID: <20011128220800.E15672@espresso.q9media.com> References: <01112903130607.01355@vagabond.auriga.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01112903130607.01355@vagabond.auriga.ru>; from alex.neyman@auriga.ru on Thu, Nov 29, 2001 at 03:13:06AM +0300 Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Alexey V. Neyman writes: > Are there plans to support waitid() function? As far as I can tell this would > require introducing new system call. The plan is to implement all of POSIX.1-200x. No one has volunteered to implement this yet, so it may be some time before you see any progress in this area. > PS. Are there mail archives available for this list? This list was just recently moved to FreeBSD.org, so we're in a bit of a transition at the moment. Hopefully all of the original posts to the @bostonradio.org list will soon be available at the usual place on the FreeBSD web site. Currently, web archived versions are available at: http://marc.theaimsgroup.com/?l=freebsd-standards Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Wed Nov 28 19:43: 8 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id E81D737B405 for ; Wed, 28 Nov 2001 19:43:04 -0800 (PST) Received: from softweyr.com (bd3d417249646c6e63098496112347fd@softweyr.com [65.88.244.127]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fAT3h3G05564 for ; Wed, 28 Nov 2001 22:43:03 -0500 (EST) (envelope-from wes@softweyr.com) Received: from homer.softweyr.com ([204.68.178.39] helo=softweyr.com) by softweyr.com with esmtp (Exim 3.33 #1) id 169IjG-0004Wh-00; Wed, 28 Nov 2001 21:23:18 -0700 Message-ID: <3C05BE3A.1DF1A539@softweyr.com> Date: Wed, 28 Nov 2001 21:48:58 -0700 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Bill Fenner Cc: mike@FreeBSD.org, freebsd-standards@bostonradio.org Subject: Re: strerror_r() implementation References: <20011125014216.A84711@espresso.q9media.com> <3C00A43B.9929E9C7@softweyr.com> <200111281854.KAA13574@windsor.research.att.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bill Fenner wrote: > > I'm still confused by why you need ERR_LEN; strerror() does: > > if (uerr < sys_nerr) > return (char *)sys_errlist[uerr]; > > so the only possible return value from strerror_r() is stored in > strerror_r()'s tmp[40] -- so strerror() can stick with ebuf[40]. No. The array tmp[] is used only to collect the ASCII version of the errno *in reverse*. The strlcpy seeds strerrbuf with the string "Unknown error: ". The loop following strlcpy un-reverses the ascii error number onto the end of the string. Ah, I see the confusion. The size of ebuf in strerror doesn't need to be big enough to hold messages from sys_errlist, it only needs to be large enough to hold "Unknown error: " plus the length of a 64-bit number in ascii. How does this look? --- strerror.c.nxt Wed Nov 28 20:32:54 2001 +++ strerror.c Wed Nov 28 20:39:30 2001 @@ -86,18 +86,17 @@ } -/* - * NOTE: the following length should be enough to hold the longest defined - * error message in sys_errlist, defined in ../gen/errlst.c. This is a WAG - * that is better than the previous value. - */ -#define ERR_LEN 64 - char * strerror(num) int num; { unsigned int uerr; + + /* + * NOTE: the following length should be enough to hold the + * longest "Unknown error: " message above. + */ +#define ERR_LEN 55 static char ebuf[ERR_LEN]; uerr = num; /* convert to unsigned */ @@ -106,7 +105,7 @@ /* strerror can't fail so handle truncation semi-elegantly */ if (strerror_r(num, ebuf, (size_t) ERR_LEN) != 0) - ebuf[ERR_LEN - 1] = '\0'; + ebuf[ERR_LEN - 1] = '\0'; return ebuf; } The last change is a whitespace error. Mustn't have any style(9) nits, right? ;^) -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Nov 29 1:19: 2 2001 Delivered-To: freebsd-standards@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id 6E9D637B430; Thu, 29 Nov 2001 01:18:58 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id fAT9HZ123027; Thu, 29 Nov 2001 04:17:35 -0500 (EST) (envelope-from mike) Date: Thu, 29 Nov 2001 04:17:35 -0500 From: Mike Barcroft To: Wes Peters Cc: Bruce Evans , standards@FreeBSD.org Subject: Re: cvs commit: src/include string.h Message-ID: <20011129041735.F15672@espresso.q9media.com> References: <200111281902.fASJ21x89181@freefall.freebsd.org> <3C05F40D.15370F5A@softweyr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3C05F40D.15370F5A@softweyr.com>; from wes@softweyr.com on Thu, Nov 29, 2001 at 01:38:37AM -0700 Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [Wes Peters asked a question about Bruce's recent commit to in a private e-mail. The question basicly asked why Bruce moved it into the somewhat miscorrectly labeled "Nonstandard routines" section. I thought my reply would be useful to a larger audience.] The problem is that we don't want to pollute older environments with new functions. For instance, if one specifies that they want to compile using an older POSIX or C standard, the system can't pollute the namespace with functions that comply with newer standards. As Bruce's commit message suggests, this is only temporary. I think we need something along the lines of: #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) #if _POSIX_C_SOURCE >= 200111L /* XXX */ ... #endif #endif ...to properly protect new POSIX functions. Broken down, this means something like "only prototype this function if we aren't using C90, POSIX.1, POSIX.1-88, POSIX.1-90, or POSIX.1-96". I'm unsure whether we care if POSIX.1-200x functions leak into C99. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Nov 29 2:57: 3 2001 Delivered-To: freebsd-standards@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 00BC637B425; Thu, 29 Nov 2001 02:56:59 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id VAA23458; Thu, 29 Nov 2001 21:56:55 +1100 Date: Thu, 29 Nov 2001 21:56:58 +1100 (EST) From: Bruce Evans X-X-Sender: To: Mike Barcroft Cc: Wes Peters , Bruce Evans , Subject: Re: cvs commit: src/include string.h In-Reply-To: <20011129041735.F15672@espresso.q9media.com> Message-ID: <20011129213259.D1261-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 29 Nov 2001, Mike Barcroft wrote: [moving declaration of strerror_r() to the "nonsstandard" section] > As Bruce's commit message suggests, this is only temporary. I think > we need something along the lines of: > > #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) > #if _POSIX_C_SOURCE >= 200111L /* XXX */ > ... > #endif > #endif > > ...to properly protect new POSIX functions. Broken down, this means > something like "only prototype this function if we aren't using C90, > POSIX.1, POSIX.1-88, POSIX.1-90, or POSIX.1-96". I'm unsure whether > we care if POSIX.1-200x functions leak into C99. I care a bit. The above ifdef should probably be changed to something like #if _POSIX_VISIBLE >= 200111 ... #endif where _POSIX_VISIBLE is define according to the settings of _POSIX_C_SOURCE, _ANSI_SOURCE, _POSIX_SOURCE and other "feature test" (enable, disable, or actually test) macros. See wollman's old patches. Note that it is the application's responsibility to set _POSIX_C_SOURCE. Setting it is supposed to give precisely the interfaces specified by the POSIX standard of the given data, modulo other feature test mac(this is usually a restriction). Not setting it should give everything if no other feature disable macros are set. There is no standard macro like _POSIX_C_SOURCE for C99. We would need a new macro like _ANSI_SOURCE to support restriction to C99 features. Name it something like _C99_SOURCE (it's hard to think of a name as non-descriptive as _ANSI_SOURCE). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Nov 29 3:13:28 2001 Delivered-To: freebsd-standards@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 7549237B42C; Thu, 29 Nov 2001 03:13:13 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id fATAnGu07639; Thu, 29 Nov 2001 12:49:16 +0200 (EET) (envelope-from ru) Date: Thu, 29 Nov 2001 12:49:16 +0200 From: Ruslan Ermilov To: Mike Barcroft Cc: "Crist J. Clark" , standards@freebsd.org Subject: POSIX texts (was: Re: cvs commit: src/lib/libc/net inet.3) Message-ID: <20011129124916.K77679@sunbay.com> References: <200111290056.fAT0ujR48719@freefall.freebsd.org> <20011129104151.D77679@sunbay.com> <20011129042451.A23064@espresso.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20011129042451.A23064@espresso.q9media.com> User-Agent: Mutt/1.3.23i Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [Redirected to -standards] On Thu, Nov 29, 2001 at 04:24:51AM -0500, Mike Barcroft wrote: > Ruslan Ermilov writes: > > As I already said in another thread, this is a duplicate of what > > is already documented under the STANDARDS section of the manpage. > > If you want a clearer wording, could you please consult with the > > POSIX.1-200x drats, and probably adopt their text for inclusion > > into the FreeBSD manpage? > > I don't think we're allowed to copy it word for word, but it can be > used as a reference when writing documentation. > That's what I meant, exactly. The funny thing is that "they" used BSD manuals as the source, obviously. :-) Interesting, would it be possible for someone to receive (or at least try to) a permission for inclusion of POSIX texts intact into FreeBSD manpages? Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Nov 29 10: 1:36 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id C3D3D37B405; Thu, 29 Nov 2001 10:01:34 -0800 (PST) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) id fATI1Xu12840; Thu, 29 Nov 2001 13:01:33 -0500 (EST) (envelope-from wollman) Date: Thu, 29 Nov 2001 13:01:33 -0500 (EST) From: Garrett Wollman Message-Id: <200111291801.fATI1Xu12840@khavrinen.lcs.mit.edu> To: Mike Barcroft Cc: standards@FreeBSD.ORG Subject: Re: cvs commit: src/include string.h In-Reply-To: <20011129041735.F15672@espresso.q9media.com> References: <200111281902.fASJ21x89181@freefall.freebsd.org> <3C05F40D.15370F5A@softweyr.com> <20011129041735.F15672@espresso.q9media.com> Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG < said: > #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) > #if _POSIX_C_SOURCE >= 200111L /* XXX */ > ... > #endif > #endif Actually, it's pretty simple: #if __POSIX_VISIBLE >= xxxxxx ... #endif ...as shown in my header file megapatch from last January. (I still haven't gotten that machine up-to-current or I would have generated a new patch.) See the archives for details. Note that in my version I did not go to any effort to hide identifiers that POSIX says implementations are always allowed to define. BDE disagrees with this approach, and I don't feel particularly strongly about it one way or the other, until and unless it significantly impinges on the cleanliness of the implementation. -GAWollman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Nov 29 20:54:58 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 8033537B405 for ; Thu, 29 Nov 2001 20:54:55 -0800 (PST) Received: from mail-blue.research.att.com (H-135-207-30-102.research.att.com [135.207.30.102]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fAU4ssG20580 for ; Thu, 29 Nov 2001 23:54:54 -0500 (EST) (envelope-from fenner@research.att.com) Received: from alliance.research.att.com (alliance.research.att.com [135.207.26.26]) by mail-blue.research.att.com (Postfix) with ESMTP id 91B2A4CE40; Thu, 29 Nov 2001 23:54:53 -0500 (EST) Received: from windsor.research.att.com (windsor.research.att.com [135.207.26.46]) by alliance.research.att.com (8.8.7/8.8.7) with ESMTP id XAA08134; Thu, 29 Nov 2001 23:54:47 -0500 (EST) From: Bill Fenner Received: (from fenner@localhost) by windsor.research.att.com (8.8.8+Sun/8.8.5) id UAA06333; Thu, 29 Nov 2001 20:54:47 -0800 (PST) Message-Id: <200111300454.UAA06333@windsor.research.att.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII To: wes@softweyr.com Subject: Re: strerror_r() implementation Cc: mike@FreeBSD.org, freebsd-standards@bostonradio.org References: <20011125014216.A84711@espresso.q9media.com> <3C00A43B.9929E9C7@softweyr.com> <200111281854.KAA13574@windsor.research.att.com> <3C05BE3A.1DF1A539@softweyr.com> Date: Thu, 29 Nov 2001 20:54:46 -0800 Versions: dmail (solaris) 2.2j/makemail 2.9b Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >Ah, I see the confusion. The size of ebuf in strerror doesn't need to >be big enough to hold messages from sys_errlist, it only needs to be >large enough to hold "Unknown error: " plus the length of a 64-bit >number in ascii. Right. 40 was enough for this in rev 1.4; I dunno why it has to be 55 now. I don't feel particularly strongly about the details of this, though. Bill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Nov 29 21:20:22 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 3045237B417 for ; Thu, 29 Nov 2001 21:20:20 -0800 (PST) Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fAU5KIG20841 for ; Fri, 30 Nov 2001 00:20:18 -0500 (EST) (envelope-from mike@espresso.q9media.com) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id fAU5JAV27192; Fri, 30 Nov 2001 00:19:10 -0500 (EST) (envelope-from mike) Date: Fri, 30 Nov 2001 00:19:10 -0500 From: Mike Barcroft To: Bill Fenner Cc: wes@softweyr.com, freebsd-standards@bostonradio.org Subject: Re: strerror_r() implementation Message-ID: <20011130001910.C23064@espresso.q9media.com> References: <20011125014216.A84711@espresso.q9media.com> <3C00A43B.9929E9C7@softweyr.com> <200111281854.KAA13574@windsor.research.att.com> <3C05BE3A.1DF1A539@softweyr.com> <200111300454.UAA06333@windsor.research.att.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200111300454.UAA06333@windsor.research.att.com>; from fenner@research.att.com on Thu, Nov 29, 2001 at 08:54:46PM -0800 Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bill Fenner writes: > >Ah, I see the confusion. The size of ebuf in strerror doesn't need to > >be big enough to hold messages from sys_errlist, it only needs to be > >large enough to hold "Unknown error: " plus the length of a 64-bit > >number in ascii. > > Right. 40 was enough for this in rev 1.4; I dunno why it has to be > 55 now. I don't feel particularly strongly about the details of this, > though. Room for a 128-bit number "+ slop"? Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Nov 30 0:39:10 2001 Delivered-To: freebsd-standards@freebsd.org Received: from vagabond.auriga.ru (vagabond.auriga.ru [213.24.253.246]) by hub.freebsd.org (Postfix) with ESMTP id 9988837B405 for ; Fri, 30 Nov 2001 00:39:07 -0800 (PST) Received: from localhost (localhost [[UNIX: localhost]]) by vagabond.auriga.ru (8.11.2/8.11.2) id fAU8d6K22349 for freebsd-standards@freebsd.org; Fri, 30 Nov 2001 11:39:06 +0300 Content-Type: text/plain; charset="koi8-r" From: "Alexey V. Neyman" To: freebsd-standards@freebsd.org Subject: waitid() Date: Fri, 30 Nov 2001 11:39:04 +0300 X-Mailer: KMail [version 1.2] MIME-Version: 1.0 Message-Id: <0111301139040K.01351@vagabond.auriga.ru> Content-Transfer-Encoding: 8bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello there! I'm trying to implement aforementioned function, and met with the following: First, how it should be? I guess it has to be a new syscall, I'd suggest the following prototype: int waitid5(idtype_t idtype, id_t id, siginfo_t *infop, int options, struct rusage *rusage); This way all waitXX() syscalls (I mean, wait() and wait4()) could have the same backend. A question arises, should it substitute wait4() call (to make wait4() a libc wrapper around it) or should a new one be introduced? And some implementation questions: Are there any contras if a process is created with P_WAITED in p_flag? This would allow to implement WCONTINUED predicate to waitid() more easily. As far as I've dug in process subsystem, this is the state of process if it was stopped and later continued. Thus if a process state is neither SSTOP nor SZOMB and P_WAITED is not set, the process has continued its execution after being stopped. Posix requires WSTOPPED to be defined as a bit flag for waitid() function; we have it in defined to _WSTOPPED. Luckily, `grep -r src` shows that there are only 3 files where WSTOPPED is used: contrib/sendmail/src/conf.h contrib/tcsh/tc.wait.h usr.sbin/lpr/lpd/printjob.c The former two seem to not actually use this (sendmail uses it if defined(sequent) and tcsh uses it if !defined(POSIX), both statements are not true on FreeBSD). The latter is not a vendor-imported software to my best knowledge and thus can be easily teached to use _WSTOPPED instead. Also, what's the rationale behind leaving higher 16 bits of status return by wait() family of functions blank? If there is one what's the best way to implement WIFCONTINUED() macro? I can imagine something like (_WSTOPPED|WCOREFLAG), though it seems a bit ugly. And at last, Posix requires SIGCHLD to be sent in case of child process continuing after being stopped (base definitions, signal.h description). This is not done now and I can imagine consequences of such a change scattered all around the source tree. Comments? Regards, Alexey. -- <-------------------------> ) May the Sun and Water ( Regards, Alexey V. Neyman ) always fall upon you! ( mailto:alex.neyman@auriga.ru <-------------------------> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Nov 30 2:41:22 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 3711737B416 for ; Fri, 30 Nov 2001 02:41:15 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fAUAfCG24153 for ; Fri, 30 Nov 2001 05:41:13 -0500 (EST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id VAA21782; Fri, 30 Nov 2001 21:40:57 +1100 Date: Fri, 30 Nov 2001 21:41:04 +1100 (EST) From: Bruce Evans X-X-Sender: To: Wes Peters Cc: Bill Fenner , , Subject: Re: strerror_r() implementation In-Reply-To: <3C05BE3A.1DF1A539@softweyr.com> Message-ID: <20011130210640.X752-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 28 Nov 2001, Wes Peters wrote: > Ah, I see the confusion. The size of ebuf in strerror doesn't need to > be big enough to hold messages from sys_errlist, it only needs to be > large enough to hold "Unknown error: " plus the length of a 64-bit > number in ascii. > > How does this look? > > --- strerror.c.nxt Wed Nov 28 20:32:54 2001 > +++ strerror.c Wed Nov 28 20:39:30 2001 > @@ -86,18 +86,17 @@ > } > > > -/* > - * NOTE: the following length should be enough to hold the longest defined > - * error message in sys_errlist, defined in ../gen/errlst.c. This is a WAG > - * that is better than the previous value. > - */ > -#define ERR_LEN 64 > - > char * > strerror(num) > int num; > { > unsigned int uerr; > + > + /* > + * NOTE: the following length should be enough to hold the > + * longest "Unknown error: " message above. > + */ > +#define ERR_LEN 55 > static char ebuf[ERR_LEN]; > > uerr = num; /* convert to unsigned */ > @@ -106,7 +105,7 @@ > > /* strerror can't fail so handle truncation semi-elegantly */ > if (strerror_r(num, ebuf, (size_t) ERR_LEN) != 0) > - ebuf[ERR_LEN - 1] = '\0'; > + ebuf[ERR_LEN - 1] = '\0'; > > return ebuf; > } I prefer the version enclosed at the end. It has the following additional non-formatting changes: - parametrize the buffer size according to the sizes in strerror_r() - unobfuscate uerr (don't use an unsigned variable just to hand-optimize for 20-year-old compilers). - remove redundant code (the strerror_r() can't fail unless we used the wrong buffer size, and we should get this right by not hard-coding the size of tmp[]) `tmp' should have a better name now that it is more global. I didn't change it because that would require large changes in strerror_r(). > The last change is a whitespace error. Mustn't have any style(9) nits, > right? ;^) I agree, so about 10 more of them in strerror() alone ;^). They were in the following classes: (1) missing parens around return values (2) comments not English sentences (3) excessive vertical whitespace (KNF uses indent -sob) (4) excessive indentation for comments at the right of code (32 is normal). The comment fixes might not be obvious because the comments just went away. All of these bugs except (4) were not in rev.1.4. %%% Index: strerror.c =================================================================== RCS file: /home/ncvs/src/lib/libc/string/strerror.c,v retrieving revision 1.5 diff -u -2 -r1.5 strerror.c --- strerror.c 27 Nov 2001 07:39:46 -0000 1.5 +++ strerror.c 30 Nov 2001 10:08:58 -0000 @@ -42,12 +42,13 @@ #include +#define UPREFIX "Unknown error: " + +static char tmp[40]; /* 64-bit number + slop */ int strerror_r(int errnum, char *strerrbuf, size_t buflen) { -#define UPREFIX "Unknown error: " unsigned int uerr; char *p, *t; - char tmp[40]; /* 64-bit number + slop */ int len; @@ -84,30 +85,15 @@ } - -/* - * NOTE: the following length should be enough to hold the longest defined - * error message in sys_errlist, defined in ../gen/errlst.c. This is a WAG - * that is better than the previous value. - */ -#define ERR_LEN 64 - char * strerror(num) int num; { - unsigned int uerr; - static char ebuf[ERR_LEN]; + static char ebuf[sizeof(UPREFIX) - 1 + sizeof(tmp)]; - uerr = num; /* convert to unsigned */ - if (uerr < sys_nerr) - return (char *)sys_errlist[uerr]; - - /* strerror can't fail so handle truncation semi-elegantly */ - if (strerror_r(num, ebuf, (size_t) ERR_LEN) != 0) - ebuf[ERR_LEN - 1] = '\0'; - - return ebuf; + if (num >= 0 && num < sys_nerr) + return ((char *)sys_errlist[num]); + (void)strerror_r(num, ebuf, sizeof(ebuf)); + return (ebuf); } - #ifdef STANDALONE_TEST %%% This has not been tested. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Nov 30 5: 9:33 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 7820837B41C for ; Fri, 30 Nov 2001 05:09:27 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fAUD9OG25195 for ; Fri, 30 Nov 2001 08:09:25 -0500 (EST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id AAA09817; Sat, 1 Dec 2001 00:09:18 +1100 Date: Sat, 1 Dec 2001 00:09:25 +1100 (EST) From: Bruce Evans X-X-Sender: To: Mike Barcroft Cc: Subject: Re: string.diff for review In-Reply-To: <20011128024424.E14652@espresso.q9media.com> Message-ID: <20011130235621.W1251-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 28 Nov 2001, Mike Barcroft wrote: > Mike Barcroft writes: > > Patch attached; comments appreciated. > > This patch has some issues. It is missing the removal of the asm > versions of bzero() and others. I also don't think the tree is ready > for macro versions of these functions just yet, so I'm going to > separate the replacement of bzero and others from the other changes > and generate a new patch. I think it is a mistake to replace any of the functions (that are already implemented as functions) by macros. The recommendation in the standard to replace bzero() by a macro that calls memset() is for applications, not implementations. > Index: include/strings.h POSIX standardized too many SysV mistakes :-(. > +#define bcmp(b1, b2, len) memcpy((b1), (b2), (size_t)(len)) Should use memcmp() and translate the return code if the macro version is kept (see sys/libkern.h to how not to do the reverse of this implementation. memcmp() can't be implemented using bcmp() because bcmp() doesn't return a trinary value). I'll wait for the patch without any changes to bzero() and others before reviewing this any more. The patch should be much smaller :-). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Nov 30 5:38:56 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id C6CCC37B41B for ; Fri, 30 Nov 2001 05:38:52 -0800 (PST) Received: from vagabond.auriga.ru (vagabond.auriga.ru [213.24.253.246]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fAUDcpG25382 for ; Fri, 30 Nov 2001 08:38:51 -0500 (EST) (envelope-from avn@vagabond.auriga.ru) Received: from localhost (localhost [[UNIX: localhost]]) by vagabond.auriga.ru (8.11.2/8.11.2) id fAUDcmb05605 for freebsd-standards@bostonradio.org; Fri, 30 Nov 2001 16:38:48 +0300 Content-Type: text/plain; charset="koi8-r" X-KMail-Redirect-From: Alexey V. Neyman Subject: waitid() From: "Alexey V. Neyman" (by way of Alexey V. Neyman ) Date: Fri, 30 Nov 2001 16:38:46 +0300 To: freebsd-standards@bostonradio.org MIME-Version: 1.0 Message-Id: <0111301638460L.01351@vagabond.auriga.ru> Content-Transfer-Encoding: 8bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello there! I'm trying to implement aforementioned function, and met with the following: First, how it should be? I guess it has to be a new syscall, I'd suggest the following prototype: int waitid5(idtype_t idtype, id_t id, siginfo_t *infop, int options, struct rusage *rusage); This way all waitXX() syscalls (I mean, wait() and wait4()) could have the same backend. A question arises, should it substitute wait4() call (to make wait4() a libc wrapper around it) or should a new one be introduced? And some implementation questions: Are there any contras if a process is created with P_WAITED in p_flag? This would allow to implement WCONTINUED predicate to waitid() more easily. As far as I've dug in process subsystem, this is the state of process if it was stopped and later continued. Thus if a process state is neither SSTOP nor SZOMB and P_WAITED is not set, the process has continued its execution after being stopped. Posix requires WSTOPPED to be defined as a bit flag for waitid() function; we have it in defined to _WSTOPPED. Luckily, `grep -r src` shows that there are only 3 files where WSTOPPED is used: contrib/sendmail/src/conf.h contrib/tcsh/tc.wait.h usr.sbin/lpr/lpd/printjob.c The former two seem to not actually use this (sendmail uses it if defined(sequent) and tcsh uses it if !defined(POSIX), both statements are not true on FreeBSD). The latter is not a vendor-imported software to my best knowledge and thus can be easily teached to use _WSTOPPED instead. Also, what's the rationale behind leaving higher 16 bits of status return by wait() family of functions blank? If there is one what's the best way to implement WIFCONTINUED() macro? I can imagine something like (_WSTOPPED|WCOREFLAG), though it seems a bit ugly. And at last, Posix requires SIGCHLD to be sent in case of child process continuing after being stopped (base definitions, signal.h description). This is not done now and I can imagine consequences of such a change scattered all around the source tree. Comments? Regards, Alexey. -- <-------------------------> ) May the Sun and Water ( Regards, Alexey V. Neyman ) always fall upon you! ( mailto:alex.neyman@auriga.ru <-------------------------> -- <-------------------------> ) May the Sun and Water ( Regards, Alexey V. Neyman ) always fall upon you! ( mailto:alex.neyman@auriga.ru <-------------------------> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Nov 30 5:56:41 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id EAEDB37B419 for ; Fri, 30 Nov 2001 05:56:38 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fAUDuaG25579 for ; Fri, 30 Nov 2001 08:56:37 -0500 (EST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id AAA14723; Sat, 1 Dec 2001 00:56:31 +1100 Date: Sat, 1 Dec 2001 00:56:38 +1100 (EST) From: Bruce Evans X-X-Sender: To: Bill Fenner Cc: Subject: Re: printf review In-Reply-To: <200111280742.fAS7g9609778@stash.attlabs.att.com> Message-ID: <20011201005518.E1439-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 27 Nov 2001, Bill Fenner wrote: > Here's another printf patch for review. I'd particularly like people > to look at the text in the man page for %a, %lc and %ls. I think > I addressed all of bde's issues in vfprintf.c but I'd appreciate > another check. I see you committed it. It is done too well for me to check the details :-). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Nov 30 22: 3:38 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id AFC5337B417 for ; Fri, 30 Nov 2001 22:03:31 -0800 (PST) Received: from softweyr.com (6d9e8e1b91dfe39888b94466b6751fc5@softweyr.com [65.88.244.127]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fB163TG37208 for ; Sat, 1 Dec 2001 01:03:30 -0500 (EST) (envelope-from wes@softweyr.com) Received: from homer.softweyr.com ([204.68.178.39] helo=softweyr.com) by softweyr.com with esmtp (Exim 3.33 #1) id 16A3t8-000788-00; Fri, 30 Nov 2001 23:44:38 -0700 Message-ID: <3C0881FE.9CA0DD90@softweyr.com> Date: Sat, 01 Dec 2001 00:08:46 -0700 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Bruce Evans Cc: Bill Fenner , mike@FreeBSD.org, freebsd-standards@bostonradio.org Subject: Re: strerror_r() implementation References: <20011130210640.X752-100000@gamplex.bde.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Bruce Evans wrote: > > I prefer the version enclosed at the end. It has the following additional > non-formatting changes: > - parametrize the buffer size according to the sizes in strerror_r() ...but do it in a way that doesn't break the function. > - unobfuscate uerr (don't use an unsigned variable just to hand-optimize > for 20-year-old compilers). When did "don't change code that is known to work" get thrown out? uerr is used because the simplistic ASCII conversion doesn't really grok signedness. It does do quite a nice job in very little code. > - remove redundant code (the strerror_r() can't fail unless we used the > wrong buffer size, and we should get this right by not hard-coding the > size of tmp[]) > `tmp' should have a better name now that it is more global. I didn't > change it because that would require large changes in strerror_r(). It's a throw-away character buffer and making it more global is an error. > > The last change is a whitespace error. Mustn't have any style(9) nits, > > right? ;^) > > I agree, so about 10 more of them in strerror() alone ;^). They were in > the following classes: > (1) missing parens around return values style(9) remains silent on this subject. Until required to do so by style(9) I will not submit to this barbarism. A quick check of other routines in libc/string showed about 50% usage of return (foo) vs. return foo. > (2) comments not English sentences Mine were. Existing ones often were not. > (3) excessive vertical whitespace (KNF uses indent -sob) This would be much more understandable if style(9) spelled out what is "acceptable" or "required" vertical whitespace. As it currently stands, there is no mention of the word "vertical" anywhere, and no mention of "blank line" after the description of include files. Again, existing usage in the libc/string directory is all over the map, and style(9) is completely opaque on the subject. > (4) excessive indentation for comments at the right of code (32 is normal). The only mention of right-comments in style(9) simply says "Try to align the comments". style(9) would be much easier to adhere to if it were actually documented in style(9), rather than being the unagreed-upon figment of the imagination of several dozen different people. > The comment fixes might not be obvious because the comments just went away. > All of these bugs except (4) were not in rev.1.4. > %%% > Index: strerror.c > =================================================================== > RCS file: /home/ncvs/src/lib/libc/string/strerror.c,v > retrieving revision 1.5 > diff -u -2 -r1.5 strerror.c > --- strerror.c 27 Nov 2001 07:39:46 -0000 1.5 > +++ strerror.c 30 Nov 2001 10:08:58 -0000 > @@ -42,12 +42,13 @@ > #include > > +#define UPREFIX "Unknown error: " > + > +static char tmp[40]; /* 64-bit number + slop */ Uh, no, you can't promote this from auto to file-static without breaking the function. Making the function style(9) compliant but non-functional isn't really going to help. Recall that the _r means "reentrant" and this function no longer is. > > int > strerror_r(int errnum, char *strerrbuf, size_t buflen) > { > -#define UPREFIX "Unknown error: " > unsigned int uerr; > char *p, *t; > - char tmp[40]; /* 64-bit number + slop */ > int len; > > @@ -84,30 +85,15 @@ > } > > - > -/* > - * NOTE: the following length should be enough to hold the longest defined > - * error message in sys_errlist, defined in ../gen/errlst.c. This is a WAG > - * that is better than the previous value. > - */ > -#define ERR_LEN 64 > - > char * > strerror(num) > int num; > { > - unsigned int uerr; > - static char ebuf[ERR_LEN]; > + static char ebuf[sizeof(UPREFIX) - 1 + sizeof(tmp)]; Again, this will not work, since (tmp) cannot be file-static. Obviously a #define size is warranted here. > - uerr = num; /* convert to unsigned */ > - if (uerr < sys_nerr) > - return (char *)sys_errlist[uerr]; > - > - /* strerror can't fail so handle truncation semi-elegantly */ > - if (strerror_r(num, ebuf, (size_t) ERR_LEN) != 0) > - ebuf[ERR_LEN - 1] = '\0'; > - > - return ebuf; > + if (num >= 0 && num < sys_nerr) > + return ((char *)sys_errlist[num]); > + (void)strerror_r(num, ebuf, sizeof(ebuf)); > + return (ebuf); > } > - > > #ifdef STANDALONE_TEST > %%% > > This has not been tested. Please clarify this comment? -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Fri Nov 30 22: 5:53 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 383FE37B405 for ; Fri, 30 Nov 2001 22:05:51 -0800 (PST) Received: from softweyr.com (30b58bfdcadc49ebc43e9d7dd4078aa3@softweyr.com [65.88.244.127]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fB165oG37224 for ; Sat, 1 Dec 2001 01:05:50 -0500 (EST) (envelope-from wes@softweyr.com) Received: from homer.softweyr.com ([204.68.178.39] helo=softweyr.com) by softweyr.com with esmtp (Exim 3.33 #1) id 16A3vd-00078H-00; Fri, 30 Nov 2001 23:47:13 -0700 Message-ID: <3C0882A9.EF07073@softweyr.com> Date: Sat, 01 Dec 2001 00:11:37 -0700 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Mike Barcroft Cc: Bill Fenner , freebsd-standards@bostonradio.org Subject: Re: strerror_r() implementation References: <20011125014216.A84711@espresso.q9media.com> <3C00A43B.9929E9C7@softweyr.com> <200111281854.KAA13574@windsor.research.att.com> <3C05BE3A.1DF1A539@softweyr.com> <200111300454.UAA06333@windsor.research.att.com> <20011130001910.C23064@espresso.q9media.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Mike Barcroft wrote: > > Bill Fenner writes: > > >Ah, I see the confusion. The size of ebuf in strerror doesn't need to > > >be big enough to hold messages from sys_errlist, it only needs to be > > >large enough to hold "Unknown error: " plus the length of a 64-bit > > >number in ascii. > > > > Right. 40 was enough for this in rev 1.4; I dunno why it has to be > > 55 now. I don't feel particularly strongly about the details of this, > > though. > > Room for a 128-bit number "+ slop"? Room for the 40 characters for the number + 13 characters of message plus a trailing null plus 1 byte in case somebody miscounted? Is anyone here actually reading the freaking CODE? -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Dec 1 0: 0:11 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 8E93C37B405 for ; Sat, 1 Dec 2001 00:00:06 -0800 (PST) Received: from mail-green.research.att.com (H-135-207-30-103.research.att.com [135.207.30.103]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fB1805G38079 for ; Sat, 1 Dec 2001 03:00:05 -0500 (EST) (envelope-from fenner@research.att.com) Received: from alliance.research.att.com (alliance.research.att.com [135.207.26.26]) by mail-green.research.att.com (Postfix) with ESMTP id 863C71E016; Sat, 1 Dec 2001 03:00:02 -0500 (EST) Received: from windsor.research.att.com (windsor.research.att.com [135.207.26.46]) by alliance.research.att.com (8.8.7/8.8.7) with ESMTP id CAA28793; Sat, 1 Dec 2001 02:59:57 -0500 (EST) From: Bill Fenner Received: (from fenner@localhost) by windsor.research.att.com (8.8.8+Sun/8.8.5) id XAA22865; Fri, 30 Nov 2001 23:59:57 -0800 (PST) Message-Id: <200112010759.XAA22865@windsor.research.att.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII To: wes@softweyr.com Subject: Re: strerror_r() implementation Cc: mike@FreeBSD.org, freebsd-standards@bostonradio.org References: <20011125014216.A84711@espresso.q9media.com> <3C00A43B.9929E9C7@softweyr.com> <200111281854.KAA13574@windsor.research.att.com> <3C05BE3A.1DF1A539@softweyr.com> <200111300454.UAA06333@windsor.research.att.com> <20011130001910.C23064@espresso.q9media.com> <3C0882A9.EF07073@softweyr.com> Date: Fri, 30 Nov 2001 23:59:56 -0800 Versions: dmail (solaris) 2.2j/makemail 2.9b Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >Room for the 40 characters for the number + 13 characters of message >plus a trailing null plus 1 byte in case somebody miscounted? Is >anyone here actually reading the freaking CODE? Yeah, I even read the freaking previous version. The freaking previous version used 40 freaking characters for the 13 characters of message plus the freaking converted freaking error number, and I was wondering why the freaking new version needed 15 more freaking bytes than the old freaking version. Bill To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Dec 1 0:36:51 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 63E6437B416 for ; Sat, 1 Dec 2001 00:36:49 -0800 (PST) Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fB18alG39014 for ; Sat, 1 Dec 2001 03:36:48 -0500 (EST) (envelope-from mike@espresso.q9media.com) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id fB18ZUK36920; Sat, 1 Dec 2001 03:35:30 -0500 (EST) (envelope-from mike) Date: Sat, 1 Dec 2001 03:35:30 -0500 From: Mike Barcroft To: Wes Peters Cc: Bill Fenner , freebsd-standards@bostonradio.org Subject: Re: strerror_r() implementation Message-ID: <20011201033530.A35631@espresso.q9media.com> References: <20011125014216.A84711@espresso.q9media.com> <3C00A43B.9929E9C7@softweyr.com> <200111281854.KAA13574@windsor.research.att.com> <3C05BE3A.1DF1A539@softweyr.com> <200111300454.UAA06333@windsor.research.att.com> <20011130001910.C23064@espresso.q9media.com> <3C0882A9.EF07073@softweyr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3C0882A9.EF07073@softweyr.com>; from wes@softweyr.com on Sat, Dec 01, 2001 at 12:11:37AM -0700 Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Wes Peters writes: > Room for the 40 characters for the number + 13 characters of message > plus a trailing null plus 1 byte in case somebody miscounted? Is > anyone here actually reading the freaking CODE? Assuming the number is a 64-bit signed integer the maximum number of characters that is would require is 19. The string "Unknown error: " takes up 15 characters and 1 character for the terminating NUL. 19 + 15 + 1 = 35 Did I miss something? Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Dec 1 6:52:39 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 6BED437B405 for ; Sat, 1 Dec 2001 06:52:29 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fB1EqQG44364 for ; Sat, 1 Dec 2001 09:52:27 -0500 (EST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id BAA12694; Sun, 2 Dec 2001 01:51:53 +1100 Date: Sun, 2 Dec 2001 01:52:04 +1100 (EST) From: Bruce Evans X-X-Sender: To: Wes Peters Cc: Bill Fenner , , Subject: Re: strerror_r() implementation In-Reply-To: <3C0881FE.9CA0DD90@softweyr.com> Message-ID: <20011202011045.F5026-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, 1 Dec 2001, Wes Peters wrote: > Bruce Evans wrote: > > > > I prefer the version enclosed at the end. It has the following additional > > non-formatting changes: > > - parametrize the buffer size according to the sizes in strerror_r() > > ...but do it in a way that doesn't break the function. I've tested it a bit and have only found one cosmetic bug, an old one: the prefix for strerror(0) is "Undefined error: " (from sys_errlist[0]), but the prefix for other unusual errors is "Unknown error: " (from the function). One more cosmetic bug turned up in this thread, a not so old one: adding the length of the prefix to the size of the temporary buffer is bogus. > > - unobfuscate uerr (don't use an unsigned variable just to hand-optimize > > for 20-year-old compilers). > > When did "don't change code that is known to work" get thrown out? > uerr is used because the simplistic ASCII conversion doesn't really > grok signedness. It does do quite a nice job in very little code. When it's badly written. uerr is used in strerror() because it was copied from strerror_r(). strerror() doesn't do any integer to string conversions, so using uerr in it is just an obfuscation. > > - remove redundant code (the strerror_r() can't fail unless we used the > > wrong buffer size, and we should get this right by not hard-coding the > > size of tmp[]) > > `tmp' should have a better name now that it is more global. I didn't > > change it because that would require large changes in strerror_r(). > > It's a throw-away character buffer and making it more global is an error. Either it or its size needs to be more global so that knowledge of its size doesn't need to be hard-coded into strerror(). > > > The last change is a whitespace error. Mustn't have any style(9) nits, > > > right? ;^) > > > > I agree, so about 10 more of them in strerror() alone ;^). They were in > > the following classes: > > (1) missing parens around return values > > style(9) remains silent on this subject. Until required to do so by It is not silent, but not very verbose. All of the examples of returning a value in style(9) use "return (foo)". There is a whole one such example. It apparently didn't occur to the origianal author of style(9) that this needed an explicit rule. > style(9) I will not submit to this barbarism. A quick check of other > routines in libc/string showed about 50% usage of return (foo) vs. > return foo. libc/string might not be a good example. The best examples are: sys/kern (CSRG version), libc/stdio (CSRG version), and contrib/vi for a slightly more modern version, or even the CSRG version of libc/string. > > (2) comments not English sentences > > Mine were. Existing ones often were not. Except for: /* strerror can't fail so handle truncation semi-elegantly */ > > (3) excessive vertical whitespace (KNF uses indent -sob) > > This would be much more understandable if style(9) spelled out what is > "acceptable" or "required" vertical whitespace. As it currently stands, > there is no mention of the word "vertical" anywhere, and no mention of > "blank line" after the description of include files. Again, existing > usage in the libc/string directory is all over the map, and style(9) > is completely opaque on the subject. You have to look at some KNF code. The old version of strerror.c is a good enough example here. It uses doesn't use any blank lines except before the block of code begun by a comment. This was intentional. > > (4) excessive indentation for comments at the right of code (32 is normal). > > The only mention of right-comments in style(9) simply says "Try to align > the comments". > > style(9) would be much easier to adhere to if it were actually documented > in style(9), rather than being the unagreed-upon figment of the imagination > of several dozen different people. It might be simpler to fix indent(1) and filter commits through it. > > %%% > > Index: strerror.c > > ... > > This has not been tested. > > Please clarify this comment? "I rebuilt libc to check that this compiles, but have not installed libc or done any runtime tests". I tested it a bit more and found a bug in the test code: the test of a short buffer returns an unterminated string (as expected), and printing this non-string using %s gives garbage. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Dec 1 19: 2:22 2001 Delivered-To: freebsd-standards@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id AB68137B405; Sat, 1 Dec 2001 19:02:19 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id fB231NQ47095; Sat, 1 Dec 2001 22:01:23 -0500 (EST) (envelope-from mike) Date: Sat, 1 Dec 2001 22:01:23 -0500 From: Mike Barcroft To: Ruslan Ermilov Cc: "Crist J. Clark" , standards@freebsd.org Subject: Re: POSIX texts (was: Re: cvs commit: src/lib/libc/net inet.3) Message-ID: <20011201220123.B46242@espresso.q9media.com> References: <200111290056.fAT0ujR48719@freefall.freebsd.org> <20011129104151.D77679@sunbay.com> <20011129042451.A23064@espresso.q9media.com> <20011129124916.K77679@sunbay.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20011129124916.K77679@sunbay.com>; from ru@freebsd.org on Thu, Nov 29, 2001 at 12:49:16PM +0200 Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Ruslan Ermilov writes: > That's what I meant, exactly. The funny thing is that "they" used > BSD manuals as the source, obviously. :-) Are you suggesting they're violating the BSD license? I normally look at unimplemented features, so I can't speak to this. > Interesting, would it be possible for someone to receive (or at > least try to) a permission for inclusion of POSIX texts intact > into FreeBSD manpages? If you're interested, you could pursue this on your own. I found a FAQ which would probably be a good starting point: http://standards.ieee.org/faqs/copyrightFAQ.html Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sat Dec 1 20:48:31 2001 Delivered-To: freebsd-standards@freebsd.org Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by hub.freebsd.org (Postfix) with ESMTP id 6ABCE37B405 for ; Sat, 1 Dec 2001 20:48:27 -0800 (PST) Received: from mail.rpi.edu (root@mail.rpi.edu [128.113.22.40]) by khavrinen.lcs.mit.edu (8.11.4/8.11.4) with ESMTP id fB24mQG51046 for ; Sat, 1 Dec 2001 23:48:26 -0500 (EST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id fB24ltM62174; Sat, 1 Dec 2001 23:47:55 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20011202011045.F5026-100000@gamplex.bde.org> References: <20011202011045.F5026-100000@gamplex.bde.org> Date: Sat, 1 Dec 2001 23:47:52 -0500 To: Bruce Evans , Wes Peters From: Garance A Drosihn Subject: Re: strerror_r() implementation Cc: Bill Fenner , , Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 1:52 AM +1100 12/2/01, Bruce Evans wrote: > > > > The last change is a whitespace error. Mustn't have any style(9) > > > > nits, right? ;^) > > > > > > I agree, so about 10 more of them in strerror() alone ;^). They > > > were in the following classes: > > > (1) missing parens around return values >> >> style(9) remains silent on this subject. Until required to do so by > >It is not silent, but not very verbose. All of the examples of returning >a value in style(9) use "return (foo)". There is a whole one such example. >It apparently didn't occur to the origianal author of style(9) that this >needed an explicit rule. In the argumentative half of my message (this here message...), I will note that style(9) also says that parenthesis should not be added unless they are necessary, and previous discussions have indicated that parentheses are not in fact necessary in C on return statements... The more I have thought about this, the more I have felt that it is better to NOT use parentheses on 'return' statements, as that makes it absolutely clear that the return statement is not a function call. And, when there are no parentheses, then it is much easier to remember to put a blank between 'return' and the value being returned ... :-) >I tested it a bit more and found a bug in the test code: the test of a >short buffer returns an unterminated string (as expected), and printing >this non-string using %s gives garbage. Hmm. I do not have the standards document for strerror_r(), but I am surprised that a short buffer is expected to return a string which is not null-terminated. Note that I am not arguing the point, I'm just surprised. That means all callers to strerror_r() should never treat the result as a null-terminated string, even though it usually will be null-terminated. Seems to me that is asking for trouble. I need to order a copy of the latest standards, obviously... The most modern one I have is SingleUnix v2, and that doesn't even mention strerror_r()! -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message