Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 03 Jan 2015 21:25:46 -0800
From:      Alfred Perlstein <alfred@freebsd.org>
To:        Phil Shafer <phil@juniper.net>
Cc:        Marcel Moolenaar <marcel@freebsd.org>, John-Mark Gurney <jmg@funkthat.com>, Alfred Perlstein <alfred@freebsd.org>, "Simon J. Gerraty" <sjg@juniper.net>, "arch@freebsd.org" <arch@freebsd.org>, Poul-Henning Kamp <phk@phk.freebsd.dk>, freebsd-arch <freebsd-arch@freebsd.org>, Konstantin Belousov <kostikbel@gmail.com>
Subject:   Re: Libxo bugs and fixes.
Message-ID:  <54A8CEDA.4020902@freebsd.org>
In-Reply-To: <201501040505.t0455dMr079659@idle.juniper.net>
References:  <201501040505.t0455dMr079659@idle.juniper.net>

next in thread | previous in thread | raw e-mail | index | archive | help


On 1/3/15 9:05 PM, Phil Shafer wrote:
> Alfred Perlstein writes:
>> Solaris and glibc have a private libc function to check if a stream is
>> line buffered called int __flbf (FILE *stream) which returns true/false
>> if the stream if line buffered or not.
>
> I dislike using a non-standard function like this.  I'd prefer the
> caller flag this information on the handle. There's already a flag
> one can set on a handle that will trigger a call to flush data
> buffered in the handle to the write function.  I'll add a function
> to set a custom flusher, which will be called at appropriate times.
> Apps like netstat will know if they need iterative output, and can
> decide to set the XOF_FLUSH flag with a flusher callback.  If needed,
> that callback can use __flbf.

It's not *that* non-standard since glibc and solaris support it. :) 
That's like saying that snprintf was a bad idea back before it was in 
the standards, but I digress.


>
>> One other topic, I talked to some webdevs and they suggested that we
>> have a "jsonLD" which stands for "json line delimited" that would be
>> useful for periodic output.  This would be halfway between a "pretty
>> format" and a compact stream format.  meaning that each line would be a
>> record, example:
>
> I can certainly add this, but the interesting issue would be how
> to form/reform the hierarchy surrounding the iterative output.
> Simplest case would be that the caller is resonsible for this, and
> the libxo just provides a flag to enable this and a function to say
> "this is a object".

I think we just need a "cork/uncork" sort of api that will make it a 
single line?

-Alfred



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54A8CEDA.4020902>