From owner-freebsd-standards Sun Feb 9 2:42:39 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 674F437B401 for ; Sun, 9 Feb 2003 02:42:38 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4B5B343F93 for ; Sun, 9 Feb 2003 02:42:37 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id VAA16671; Sun, 9 Feb 2003 21:42:19 +1100 Date: Sun, 9 Feb 2003 21:42:23 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: David Schultz Cc: Lukas Ertl , Subject: Re: C99 floating point macros In-Reply-To: <20030209003350.GA20683@HAL9000.homeunix.com> Message-ID: <20030209200824.R24643-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, 8 Feb 2003, David Schultz wrote: > Thus spake Lukas Ertl : > > Ok, please review the following patch. I hope I didn't take it too easy. > > Hmm...why not just use some macros, like this? > > #define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y)) > #define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y)) > #define isless(x, y) (!isunordered((x), (y)) && (x) < (y)) > #define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y)) > #define islessgreater(x, y) (!isunordered((x), (y)) && \ > ((x) > (y) || (y) > (x))) > #define isunordered(x, y) (isnan(x) || isnan(y)) If there were no signaling NaNs, then the even simpler macros: #define isgreater(x, y) ((x) > (y)) etc., would work on i386's at least, since gcc generates comparison instructions (fucom, not fcom) which don't raise the invalid exception (IE) for quiet NaNs. However, not raising IE for signaling NaNs seems to be necessary (to support C99's interpretation of IEC 60559:1989). At least on i386's, this is handled by isunordered() above provided we unbreak isnan() so that just calling it doesn't raise IE for float and long double signaling NaNs. (isnan() needs to be a macro since converting its arg to a common type doesn't work if the arg is a signaling NaN although it works in all other cases. Even on i386's it is not clear that args can be and are always passed to isnan() without invoking the FPU in a way that would raise IE for signaling NaNs. Similarly for fpclassify().) Very old versions of gcc on i386's generated fcom instead of fucom. Since fucom works a little differently on signaling NaNs and there are now standard comparison macros, it is not clear that generating fucom is actually better. It is also not clear that the comparison and classification macros are specified correctly (or that I interpreted the spec correctly) for signaling NaNs. C99 seems to either overspecify or underspecify the behaviour for signaling NaNs by not distinguishing them from quiet NaNs. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Feb 9 3:38:47 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2C26E37B401 for ; Sun, 9 Feb 2003 03:38:46 -0800 (PST) Received: from HAL9000.homeunix.com (12-233-57-224.client.attbi.com [12.233.57.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 82B4643FA3 for ; Sun, 9 Feb 2003 03:38:45 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id h19BcioH001267; Sun, 9 Feb 2003 03:38:45 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id h19BciB4001266; Sun, 9 Feb 2003 03:38:44 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Sun, 9 Feb 2003 03:38:44 -0800 From: David Schultz To: Bruce Evans Cc: Lukas Ertl , standards@FreeBSD.ORG Subject: Re: C99 floating point macros Message-ID: <20030209113844.GA535@HAL9000.homeunix.com> Mail-Followup-To: Bruce Evans , Lukas Ertl , standards@FreeBSD.ORG References: <20030209003350.GA20683@HAL9000.homeunix.com> <20030209200824.R24643-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030209200824.R24643-100000@gamplex.bde.org> 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 Thus spake Bruce Evans : > On Sat, 8 Feb 2003, David Schultz wrote: > > > Thus spake Lukas Ertl : > > > Ok, please review the following patch. I hope I didn't take it too easy. > > > > Hmm...why not just use some macros, like this? > > > > #define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y)) > > #define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y)) > > #define isless(x, y) (!isunordered((x), (y)) && (x) < (y)) > > #define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y)) > > #define islessgreater(x, y) (!isunordered((x), (y)) && \ > > ((x) > (y) || (y) > (x))) > > #define isunordered(x, y) (isnan(x) || isnan(y)) > > If there were no signaling NaNs, then the even simpler macros: > > #define isgreater(x, y) ((x) > (y)) > > etc., would work on i386's at least, since gcc generates comparison > instructions (fucom, not fcom) which don't raise the invalid exception > (IE) for quiet NaNs. > > However, not raising IE for signaling NaNs seems to be necessary (to > support C99's interpretation of IEC 60559:1989). At least on i386's, > this is handled by isunordered() above provided we unbreak isnan() so > that just calling it doesn't raise IE for float and long double signaling > NaNs. (isnan() needs to be a macro since converting its arg to a > common type doesn't work if the arg is a signaling NaN although it > works in all other cases. Even on i386's it is not clear that args > can be and are always passed to isnan() without invoking the FPU in a > way that would raise IE for signaling NaNs. Similarly for fpclassify().) In the patches I sent Mike a few hours ago, I used the above code and additionally reimplemented isnan(), isinf() and friends as macros that call fpclassify(). The slightly defective function versions would be retained in libc until FreeBSD 6.0 for binary compatibility. I'm not sure whether it's worthwhile to optimize the comparison routines, but I would be willing to write the i386 versions in assembly with MI fallbacks for other architectures if someone thinks that it is important. For the classification routines (is{nan,inf,finite,normal}), there seems to be less reason to optimize; fpclassify() costs at most one or two masks and comparisons more than we would otherwise pay. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Feb 9 15:54:47 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 08DBD37B401 for ; Sun, 9 Feb 2003 15:54:47 -0800 (PST) Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4EE9943F3F for ; Sun, 9 Feb 2003 15:54:46 -0800 (PST) (envelope-from des@ofug.org) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 52460536E; Mon, 10 Feb 2003 00:54:43 +0100 (CET) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: David Schultz Cc: Lukas Ertl , standards@FreeBSD.ORG Subject: Re: C99 floating point macros From: Dag-Erling Smorgrav Date: Mon, 10 Feb 2003 00:54:43 +0100 In-Reply-To: <20030209003350.GA20683@HAL9000.homeunix.com> (David Schultz's message of "Sat, 8 Feb 2003 16:33:50 -0800") Message-ID: User-Agent: Gnus/5.090014 (Oort Gnus v0.14) Emacs/21.2 (i386--freebsd) References: <20030207194848.N353@leelou.in.tern> <20030208112619.GA15718@HAL9000.homeunix.com> <20030208130529.C355@leelou.in.tern> <20030209003350.GA20683@HAL9000.homeunix.com> 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 David Schultz writes: > Hmm...why not just use some macros, like this? Macros behave strangely when invoked with arguments which have side effects. DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Feb 9 18: 3: 2 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8FA9D37B401 for ; Sun, 9 Feb 2003 18:03:01 -0800 (PST) Received: from HAL9000.homeunix.com (12-233-57-224.client.attbi.com [12.233.57.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id B47F143F93 for ; Sun, 9 Feb 2003 18:03:00 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id h1A22xoH004139; Sun, 9 Feb 2003 18:02:59 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id h1A22x7Y004138; Sun, 9 Feb 2003 18:02:59 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Sun, 9 Feb 2003 18:02:59 -0800 From: David Schultz To: Dag-Erling Smorgrav Cc: Lukas Ertl , standards@FreeBSD.ORG Subject: Re: C99 floating point macros Message-ID: <20030210020259.GA4103@HAL9000.homeunix.com> Mail-Followup-To: Dag-Erling Smorgrav , Lukas Ertl , standards@FreeBSD.ORG References: <20030207194848.N353@leelou.in.tern> <20030208112619.GA15718@HAL9000.homeunix.com> <20030208130529.C355@leelou.in.tern> <20030209003350.GA20683@HAL9000.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thus spake Dag-Erling Smorgrav : > David Schultz writes: > > Hmm...why not just use some macros, like this? > > Macros behave strangely when invoked with arguments which have side > effects. Doh! I should have seen that. I'll wrap them in a do...while(0) with a local variable. Thanks for the catch! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Feb 9 18:29:34 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 34C9137B401 for ; Sun, 9 Feb 2003 18:29:33 -0800 (PST) Received: from smtpout.mac.com (A17-250-248-89.apple.com [17.250.248.89]) by mx1.FreeBSD.org (Postfix) with ESMTP id ADC1643FB1 for ; Sun, 9 Feb 2003 18:29:32 -0800 (PST) (envelope-from leimy2k@mac.com) Received: from asmtp01.mac.com (asmtp01-qfe3 [10.13.10.65]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id h1A2TWfN017329 for ; Sun, 9 Feb 2003 18:29:32 -0800 (PST) Received: from mac.com ([66.156.162.95]) by asmtp01.mac.com (Netscape Messaging Server 4.15) with ESMTP id HA2MX700.L3I for ; Sun, 9 Feb 2003 18:29:31 -0800 Date: Sun, 9 Feb 2003 20:29:31 -0600 Mime-Version: 1.0 (Apple Message framework v551) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: thread safety From: David Leimbach To: freebsd-standards@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <7C2EF94D-3C9F-11D7-8E7D-0003937E39E0@mac.com> X-Mailer: Apple Mail (2.551) 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 Everyone, I got to spend a few hours digging through some libc code and have been trying to evaluate the situation trying to implement getpwnam_r and possibly other related functions. It seems like there are more utility functions that aren't inherently thread safe through their usage of "stateful" static variables. One such function is const ns_dbt * _nsdbget(const char * name); This function has a time_t value which is static. I don't think this function, the way it appears to be designed, can easily be made thread safe as a result. In fact now that I look at it again there is a global state stored in _nsmap that must be protected from race conditions once threads get involved. It appears that I have quite a bit of a task ahead of me. I would appreciate any support I can get... old "almost" code, pep-squad etc. :) Just letting you know it may be a while before I get a patch together as I will sure be breaking tons of stuff in the process of making this code less thread-o-phobic. Take it easy! Dave Leimbach To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Feb 9 19:20:34 2003 Delivered-To: freebsd-standards@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 931) id B878D37B401; Sun, 9 Feb 2003 19:20:33 -0800 (PST) Date: Sun, 9 Feb 2003 21:20:33 -0600 From: Juli Mallett To: David Leimbach Cc: freebsd-standards@freebsd.org Subject: Re: thread safety Message-ID: <20030209212033.A23910@FreeBSD.org> References: <7C2EF94D-3C9F-11D7-8E7D-0003937E39E0@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <7C2EF94D-3C9F-11D7-8E7D-0003937E39E0@mac.com>; from leimy2k@mac.com on Sun, Feb 09, 2003 at 08:29:31PM -0600 Organisation: The FreeBSD Project X-Alternate-Addresses: , , , , X-Towel: Yes X-LiveJournal: flata, jmallett X-Negacore: Yes 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 * De: David Leimbach [ Data: 2003-02-09 ] [ Subjecte: thread safety ] > This function has a time_t value which is static. I don't think this > function, the > way it appears to be designed, can easily be made thread safe as a > result. Passing in pointers to storage that used to be static (and then making the original a wrapper that passes in the static storage) is OK? -- Juli Mallett AIM: BSDFlata -- IRC: juli on EFnet OpenDarwin, Mono, FreeBSD Developer ircd-hybrid Developer, EFnet addict FreeBSD on MIPS-Anything on FreeBSD To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Sun Feb 9 19:33: 8 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 92B3A37B401; Sun, 9 Feb 2003 19:33:06 -0800 (PST) Received: from smtpout.mac.com (A17-250-248-85.apple.com [17.250.248.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id CBDEF43FE3; Sun, 9 Feb 2003 19:30:52 -0800 (PST) (envelope-from leimy2k@mac.com) Received: from asmtp01.mac.com (asmtp01-qfe3 [10.13.10.65]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id h1A3UqBV017296; Sun, 9 Feb 2003 19:30:52 -0800 (PST) Received: from mac.com ([66.156.162.95]) by asmtp01.mac.com (Netscape Messaging Server 4.15) with ESMTP id HA2PRF00.26G; Sun, 9 Feb 2003 19:30:51 -0800 Date: Sun, 9 Feb 2003 21:30:50 -0600 Subject: Re: thread safety Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v551) Cc: freebsd-standards@FreeBSD.ORG To: Juli Mallett From: David Leimbach In-Reply-To: <20030209212033.A23910@FreeBSD.org> Message-Id: <0D6B31A1-3CA8-11D7-8E7D-0003937E39E0@mac.com> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.551) 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 Sunday, February 9, 2003, at 09:20 PM, Juli Mallett wrote: > * De: David Leimbach [ Data: 2003-02-09 ] > [ Subjecte: thread safety ] >> This function has a time_t value which is static. I don't think this >> function, the >> way it appears to be designed, can easily be made thread safe as a >> result. > > Passing in pointers to storage that used to be static (and then making > the original a wrapper that passes in the static storage) is OK? Hey Juli! :) That would work... In fact in Darwin they take the extra user parameters from getpwnam_r for the user pointer and pass it all the way down to the actual db lookup functions. Unfortunately there is global data in the nsdispatch.c file as well that is used to show state of the various functions contained in that file... Luckily this data is static and not exposed to other CUs. I was just thinking... if we rewrote all of libc to be re-entrant and thread safe the thread unsafe versions can easily be wrappers around the thread safe ones. void foo_r (char * data) { //do something and put it in data } void foo () { static char byte_array[BIGSIZE]; foo_r(byte_array); ... } Etc. That would make the performance of the unsafe functions suck potentially but its easier to go back and re-write those IMO than to develop an execution path that is fully thread safe as an afterthought. *sigh* :) Its a good challenge anyway. All thread safe functions should be in libc_r? I don't see too much in there is why I ask. Dave > -- > Juli Mallett > AIM: BSDFlata -- IRC: juli on EFnet > OpenDarwin, Mono, FreeBSD Developer > ircd-hybrid Developer, EFnet addict > FreeBSD on MIPS-Anything on FreeBSD > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-standards" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Feb 10 5:18:12 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5049237B401 for ; Mon, 10 Feb 2003 05:18:11 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F50443F75 for ; Mon, 10 Feb 2003 05:18:09 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id AAA06856; Tue, 11 Feb 2003 00:17:42 +1100 Date: Tue, 11 Feb 2003 00:17:44 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: David Schultz Cc: Dag-Erling Smorgrav , Lukas Ertl , Subject: Re: C99 floating point macros In-Reply-To: <20030210020259.GA4103@HAL9000.homeunix.com> Message-ID: <20030210234147.B890-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 Sun, 9 Feb 2003, David Schultz wrote: > Thus spake Dag-Erling Smorgrav : > > David Schultz writes: > > > Hmm...why not just use some macros, like this? > > > > Macros behave strangely when invoked with arguments which have side > > effects. This would be a programmer error, since these interfaces are specified to be macros. > Doh! I should have seen that. I'll wrap them in a do...while(0) > with a local variable. Thanks for the catch! I thought that you saw it. Implementing these interfaces using local a local variable would be very messy and/or unportable. To begin with, do...while(0) doesn't work because it cannot return a value. A not very messy but very unportable version could use gcc statement-expressions and __typeof. Portable versions seem to require combinatorial explosion (3 * 3 cases): #define isgreater(x, y) ( \ sizeof(x) == 4 && sizeof(y) == 4 ? isgreaterff((x), (y)) : \ sizeof(x) == 4 && sizeof(y) == 8 ? isgreaterfd((x), (y)) : \ sizeof(x) == 4 && sizeof(y) > 8 ? isgreaterfld((x), (y)) : \ sizeof(x) == 8 && sizeof(y) == 4 ? isgreaterdf((x), (y)) : \ sizeof(x) == 8 && sizeof(y) == 8 ? isgreaterdd((x), (y)) : \ sizeof(x) == 8 && sizeof(y) > 8 ? isgreaterdld((x), (y)) : \ sizeof(x) > 8 && sizeof(y) == 4 ? isgreaterldf((x), (y)) : \ sizeof(x) > 8 && sizeof(y) == 8 ? isgreaterldd((x), (y)) : \ sizeof(x) > 8 && sizeof(y) > 8 ? isgreaterldld((x), (y)) : \ (abort(), 0)) /* * The final step seems to require functions to avoid side effects * (unless we use expression-statements). The above just avoids using * __typeof (using a not completely portable sizeof() hack). */ int isgreaterff(float x, float y); ... I think your simpler macros are better. Why protect the programmer more than for getc_unlocked (was: getc())? Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Feb 10 7: 7: 5 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9395E37B401 for ; Mon, 10 Feb 2003 07:07:04 -0800 (PST) Received: from HAL9000.homeunix.com (12-233-57-224.client.attbi.com [12.233.57.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id D8FDE43FBF for ; Mon, 10 Feb 2003 07:07:03 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.6/8.12.5) with ESMTP id h1AF6mVA000484; Mon, 10 Feb 2003 07:06:48 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.6/8.12.5/Submit) id h1AF6hk1000483; Mon, 10 Feb 2003 07:06:43 -0800 (PST) (envelope-from dschultz@uclink.Berkeley.EDU) Date: Mon, 10 Feb 2003 07:06:43 -0800 From: David Schultz To: Bruce Evans Cc: Dag-Erling Smorgrav , Lukas Ertl , standards@FreeBSD.ORG Subject: Re: C99 floating point macros Message-ID: <20030210150643.GA383@HAL9000.homeunix.com> Mail-Followup-To: Bruce Evans , Dag-Erling Smorgrav , Lukas Ertl , standards@FreeBSD.ORG References: <20030210020259.GA4103@HAL9000.homeunix.com> <20030210234147.B890-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030210234147.B890-100000@gamplex.bde.org> 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 Thus spake Bruce Evans : > On Sun, 9 Feb 2003, David Schultz wrote: > > > Thus spake Dag-Erling Smorgrav : > > > David Schultz writes: > > > > Hmm...why not just use some macros, like this? > > > > > > Macros behave strangely when invoked with arguments which have side > > > effects. > > This would be a programmer error, since these interfaces are specified > to be macros. > > > Doh! I should have seen that. I'll wrap them in a do...while(0) > > with a local variable. Thanks for the catch! > > I thought that you saw it. Bah, I did when I wrote them. Then I had a knee-jerk reaction to des's complaint and forgot. You *can't* actually get it right if you want the routines to be function-like as described in section 7.1.4 of the C99 standard. In order to do so, you would be required to provide a function prototype in addition to the macro, and you can't do that for the overloaded floating-point classification macros. \me sulks off to the corner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Mon Feb 10 9:47:18 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9DE1F37B401 for ; Mon, 10 Feb 2003 09:47:17 -0800 (PST) Received: from espresso.q9media.com (espresso.q9media.com [65.39.129.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 290EE43FB1 for ; Mon, 10 Feb 2003 09:47:17 -0800 (PST) (envelope-from mike@espresso.q9media.com) Received: by espresso.q9media.com (Postfix, from userid 1002) id 604F29C4A; Mon, 10 Feb 2003 12:35:10 -0500 (EST) Date: Mon, 10 Feb 2003 12:35:10 -0500 From: Mike Barcroft To: standards@FreeBSD.org Cc: Bruce Evans Subject: signbit() implementation question Message-ID: <20030210123510.B40864@espresso.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 I'm wondering if any casts from float->double or long double->double will cause the sign-bit to change. In my implementation I just have the macro pass its argument to a function that takes a double for its argument. In the tests I've done the sign-bit never changes with these casts, but I don't know if this is guaranteed to work for all values or whether this is completely portable. 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 Mon Feb 10 11:25:26 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5F58537B406; Mon, 10 Feb 2003 11:25:25 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id DE42B43FDD; Mon, 10 Feb 2003 11:25:21 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id GAA29842; Tue, 11 Feb 2003 06:25:18 +1100 Date: Tue, 11 Feb 2003 06:25:21 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Mike Barcroft Cc: standards@FreeBSD.ORG Subject: Re: signbit() implementation question In-Reply-To: <20030210123510.B40864@espresso.q9media.com> Message-ID: <20030211055050.Q2485-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 Mon, 10 Feb 2003, Mike Barcroft wrote: > I'm wondering if any casts from float->double or long double->double > will cause the sign-bit to change. In my implementation I just have > the macro pass its argument to a function that takes a double for its > argument. In the tests I've done the sign-bit never changes with > these casts, but I don't know if this is guaranteed to work for all > values or whether this is completely portable. Preserving the sign bit in conversions and rounding, etc. is required by at least ieee854 (section 6.3), so I think all reasonable hardware preserves it. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Feb 11 17:37:37 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E389537B401; Tue, 11 Feb 2003 17:37:35 -0800 (PST) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3901D43FBF; Tue, 11 Feb 2003 17:37:35 -0800 (PST) (envelope-from leimy2k@mac.com) Received: from asmtp01.mac.com (asmtp01-qfe3 [10.13.10.65]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id h1C1bZJ4024483; Tue, 11 Feb 2003 17:37:35 -0800 (PST) Received: from mac.com ([66.156.161.135]) by asmtp01.mac.com (Netscape Messaging Server 4.15) with ESMTP id HA69UM00.JAG; Tue, 11 Feb 2003 17:37:34 -0800 Date: Tue, 11 Feb 2003 19:37:31 -0600 Subject: error in nsdispatch.c Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v551) Cc: freebsd-current@freebsd.org To: freebsd-standards@freebsd.org From: David Leimbach Content-Transfer-Encoding: 7bit Message-Id: <8D9D58E8-3E2A-11D7-8396-0003937E39E0@mac.com> X-Mailer: Apple Mail (2.551) 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 There is a potential bug in src/lib/libc/net/nsdispatch.c in the function const ns_dbt * _nsdbtget(const char * name). The static variable static time_t confmod; is not initialized to anything. It may have some random value the first time this function is called and if you look at the program logic its the first value tested as well and it controls a lot of deallocation via "free". Bug? I have been having trouble writing to standards... sending to current. Dave To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Feb 11 17:53: 0 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8F39C37B401; Tue, 11 Feb 2003 17:52:59 -0800 (PST) Received: from mail.nsu.ru (mx.nsu.ru [193.124.215.71]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1FAFC43FAF; Tue, 11 Feb 2003 17:52:58 -0800 (PST) (envelope-from fjoe@iclub.nsu.ru) Received: from drweb by mail.nsu.ru with drweb-scanned (Exim 3.20 #1) id 18im4k-0007XD-00; Wed, 12 Feb 2003 07:52:38 +0600 Received: from iclub.nsu.ru ([193.124.215.97] ident=root) by mail.nsu.ru with esmtp (Exim 3.20 #1) id 18im4D-0007LF-00; Wed, 12 Feb 2003 07:52:05 +0600 Received: from iclub.nsu.ru (fjoe@localhost [127.0.0.1]) by iclub.nsu.ru (8.12.6/8.12.6) with ESMTP id h1C1pnRV020615; Wed, 12 Feb 2003 07:51:49 +0600 (NS) (envelope-from fjoe@iclub.nsu.ru) Received: (from fjoe@localhost) by iclub.nsu.ru (8.12.6/8.12.6/Submit) id h1C1pmYU020613; Wed, 12 Feb 2003 07:51:48 +0600 (NS) Date: Wed, 12 Feb 2003 07:51:48 +0600 From: Max Khon To: David Leimbach Cc: freebsd-standards@freebsd.org, freebsd-current@freebsd.org Subject: Re: error in nsdispatch.c Message-ID: <20030212075148.A20509@iclub.nsu.ru> References: <8D9D58E8-3E2A-11D7-8396-0003937E39E0@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <8D9D58E8-3E2A-11D7-8396-0003937E39E0@mac.com>; from leimy2k@mac.com on Tue, Feb 11, 2003 at 07:37:31PM -0600 X-Spam-Status: No, hits=-2.2 required=5.0 tests=IN_REP_TO,REFERENCES,SPAM_PHRASE_00_01,USER_AGENT, USER_AGENT_MUTT version=2.43 X-Envelope-To: leimy2k@mac.com, freebsd-standards@freebsd.org, freebsd-current@freebsd.org 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 hi, there! On Tue, Feb 11, 2003 at 07:37:31PM -0600, David Leimbach wrote: > There is a potential bug in src/lib/libc/net/nsdispatch.c > > in the function > const ns_dbt * _nsdbtget(const char * name). > > The static variable > > static time_t confmod; > > is not initialized to anything. > > It may have some random value the first time this function is called and > if you look at the program logic its the first value tested as well and > it controls a lot of deallocation via "free". > > Bug? no. static variables are initialized with all-zeroes. /fjoe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Tue Feb 11 18: 7:12 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7BB8D37B401; Tue, 11 Feb 2003 18:07:11 -0800 (PST) Received: from smtpout.mac.com (A17-250-248-85.apple.com [17.250.248.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id A838B43F93; Tue, 11 Feb 2003 18:07:10 -0800 (PST) (envelope-from leimy2k@mac.com) Received: from asmtp02.mac.com (asmtp02-qfe3 [10.13.10.66]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id h1C27Amu004679; Tue, 11 Feb 2003 18:07:10 -0800 (PST) Received: from mac.com ([66.156.161.135]) by asmtp02.mac.com (Netscape Messaging Server 4.15) with ESMTP id HA6B7Y00.CNJ; Tue, 11 Feb 2003 18:07:10 -0800 Date: Tue, 11 Feb 2003 20:07:08 -0600 Subject: Re: error in nsdispatch.c Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v551) Cc: freebsd-standards@freebsd.org, freebsd-current@freebsd.org To: Max Khon From: David Leimbach In-Reply-To: <20030212075148.A20509@iclub.nsu.ru> Message-Id: Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.551) 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 >> >> Bug? > > no. static variables are initialized with all-zeroes. > Groovy... /me goes to buy electronic ANSI C standard :P Dave > /fjoe > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Feb 13 11:15: 3 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2E5BB37B401 for ; Thu, 13 Feb 2003 11:15:02 -0800 (PST) Received: from mailbox.univie.ac.at (mailbox.univie.ac.at [131.130.1.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id A837B43FCB for ; Thu, 13 Feb 2003 11:15:00 -0800 (PST) (envelope-from l.ertl@univie.ac.at) Received: from adslle.cc.univie.ac.at (adslle.cc.univie.ac.at [131.130.102.11]) by mailbox.univie.ac.at (8.12.2/8.12.2) with ESMTP id h1DJEpLE096112 for ; Thu, 13 Feb 2003 20:14:55 +0100 Date: Thu, 13 Feb 2003 20:14:51 +0100 (CET) From: Lukas Ertl To: freebsd-standards@freebsd.org Subject: ftw.h Message-ID: <20030213201249.T337@leelou.in.tern> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-DCC-ZID-Univie-Metrics: unet 4261; Body=1 Fuz1=1 Fuz2=1 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 Hi, how is the progress on ftw.h and related functions going? The status board lists Kyle Martin from 16 August 2002 as halfway done. I currently have some spare cycles so could take a lot at it or help out. regards, le --=20 Lukas Ertl eMail: l.ertl@univie.ac.at UNIX-Systemadministrator Tel.: (+43 1) 4277-14073 Zentraler Informatikdienst (ZID) Fax.: (+43 1) 4277-9140 der Universit=E4t Wien http://mailbox.univie.ac.at/~le/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message From owner-freebsd-standards Thu Feb 13 11:32:20 2003 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6630737B401 for ; Thu, 13 Feb 2003 11:32:19 -0800 (PST) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 46C5343F75 for ; Thu, 13 Feb 2003 11:32:18 -0800 (PST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: from khavrinen.lcs.mit.edu (localhost [IPv6:::1]) by khavrinen.lcs.mit.edu (8.12.6/8.12.6) with ESMTP id h1DJWHbs037986 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Thu, 13 Feb 2003 14:32:17 -0500 (EST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.12.6/8.12.6/Submit) id h1DJWGWc037983; Thu, 13 Feb 2003 14:32:16 -0500 (EST) (envelope-from wollman) Date: Thu, 13 Feb 2003 14:32:16 -0500 (EST) From: Garrett Wollman Message-Id: <200302131932.h1DJWGWc037983@khavrinen.lcs.mit.edu> To: Lukas Ertl Cc: freebsd-standards@FreeBSD.ORG Subject: ftw.h In-Reply-To: <20030213201249.T337@leelou.in.tern> References: <20030213201249.T337@leelou.in.tern> 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: > how is the progress on ftw.h and related functions going? The status board > lists Kyle Martin from 16 August 2002 as halfway done. I currently have > some spare cycles so could take a lot at it or help out. I'm hoping that some changes made a few months ago to fts(3) will make it easier to implement an ftw() veneer. -GAWollman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message