Date: Tue, 10 Apr 2012 14:00:16 GMT From: John Baldwin <jhb@freebsd.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/166660: [libc] [patch] New util/shlib to change per-fd default stdio buffering mode Message-ID: <201204101400.q3AE0GXS091030@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/166660; it has been noted by GNATS. From: John Baldwin <jhb@freebsd.org> To: Jeremie Le Hen <jeremie@le-hen.org> Cc: bug-followup@freebsd.org Subject: Re: bin/166660: [libc] [patch] New util/shlib to change per-fd default stdio buffering mode Date: Tue, 10 Apr 2012 09:43:16 -0400 On Monday, April 09, 2012 5:21:03 pm Jeremie Le Hen wrote: > Hi John, > > On Mon, Apr 09, 2012 at 11:30:08AM -0400, John Baldwin wrote: > > I think it would be fine to do this in libc directly rather than via > > LD_PRELOAD. That would let it work for static binaries as well as > > dynamic libraries. My understanding is that this is how stdbuf works on > > Linux (glibc honors the relevant magic environment variables). To that > > end, I think it would be ok to move this into libc directly. > > I thought it would be too expensive to check for three (actually up to > six, see below) in such a critical path. Moreover, this would have > lowered a lot my chances to see this committed simply because very few > committers would have taken the responsibility for this and the time to > handle the debates that would have sprouted. > > Your point for static binaries is very valid but aren't you afraid of > the performance impact? I'll try to spare some time this week to move > libstdbuf code into libc and do some benchmarks. Hmm, I hadn't considered the performance impact, but to be honest, this is stdio. :) If it only happens once when stdio is first used then I think this is fine to do in libc. > > One more question, do you use the same environment variable as glibc for > > this, or do you use a different scheme? > > I didn't like the GNU variable names (_STDBUF_I, _STDBUF_O and > _STDBUF_E) so I used STDBUF_0, STDBUF_1 and STDBUF_2 instead. But the > former are supported for obvious compatibility reasons. To be honest I > don't really care about the names, we can use the GNU ones if you think > it's better to avoid doing to much strcmp(3), especially if we but the > code in the libc startup path. If the variable values have the same semantics, then I think it is best to simply use the same names as glibc. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204101400.q3AE0GXS091030>