From owner-freebsd-arch@FreeBSD.ORG Sun Jan 4 05:25:04 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 065C1124; Sun, 4 Jan 2015 05:25:04 +0000 (UTC) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 302AD645CC; Sun, 4 Jan 2015 05:25:03 +0000 (UTC) Received: from AlfredMacbookAir.local (c-76-21-10-192.hsd1.ca.comcast.net [76.21.10.192]) by elvis.mu.org (Postfix) with ESMTPSA id 4CB13341F874; Sat, 3 Jan 2015 21:25:02 -0800 (PST) Message-ID: <54A8CEDA.4020902@freebsd.org> Date: Sat, 03 Jan 2015 21:25:46 -0800 From: Alfred Perlstein Organization: FreeBSD User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Phil Shafer Subject: Re: Libxo bugs and fixes. References: <201501040505.t0455dMr079659@idle.juniper.net> In-Reply-To: <201501040505.t0455dMr079659@idle.juniper.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcel Moolenaar , John-Mark Gurney , Alfred Perlstein , "Simon J. Gerraty" , "arch@freebsd.org" , Poul-Henning Kamp , freebsd-arch , Konstantin Belousov X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Jan 2015 05:25:04 -0000 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