Libxo bugs and fixes.

Alfred Perlstein alfred at freebsd.org
Sun Jan 4 05:25:04 UTC 2015



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


More information about the freebsd-arch mailing list