From owner-freebsd-arch@FreeBSD.ORG Sun Jan 4 22:27:04 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98D2D8B8; Sun, 4 Jan 2015 22:27:04 +0000 (UTC) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0114.outbound.protection.outlook.com [207.46.100.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0BA252CE5; Sun, 4 Jan 2015 22:27:03 +0000 (UTC) Received: from BY2PR05CA058.namprd05.prod.outlook.com (10.141.250.48) by CO1PR05MB442.namprd05.prod.outlook.com (10.141.73.146) with Microsoft SMTP Server (TLS) id 15.1.49.12; Sun, 4 Jan 2015 22:27:01 +0000 Received: from BY2FFO11FD060.protection.gbl (2a01:111:f400:7c0c::105) by BY2PR05CA058.outlook.office365.com (2a01:111:e400:2c5f::48) with Microsoft SMTP Server (TLS) id 15.1.49.12 via Frontend Transport; Sun, 4 Jan 2015 22:27:00 +0000 Received: from P-EMF02-SAC.jnpr.net (66.129.239.16) by BY2FFO11FD060.mail.protection.outlook.com (10.1.15.184) with Microsoft SMTP Server (TLS) id 15.1.49.13 via Frontend Transport; Sun, 4 Jan 2015 22:27:00 +0000 Received: from magenta.juniper.net (172.17.27.123) by P-EMF02-SAC.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.146.0; Sun, 4 Jan 2015 14:27:00 -0800 Received: from idle.juniper.net (idleski.juniper.net [172.25.4.26]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id t04MQwW33110; Sun, 4 Jan 2015 14:26:58 -0800 (PST) (envelope-from phil@juniper.net) Received: from idle.juniper.net (localhost [127.0.0.1]) by idle.juniper.net (8.14.4/8.14.3) with ESMTP id t04MQgfr085769; Sun, 4 Jan 2015 17:26:43 -0500 (EST) (envelope-from phil@idle.juniper.net) Message-ID: <201501042226.t04MQgfr085769@idle.juniper.net> To: Alfred Perlstein Subject: Re: Libxo bugs and fixes. In-Reply-To: <54A8CEDA.4020902@freebsd.org> Date: Sun, 4 Jan 2015 17:26:42 -0500 From: Phil Shafer MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.16 as permitted sender) Authentication-Results: spf=softfail (sender IP is 66.129.239.16) smtp.mailfrom=phil@juniper.net; X-Forefront-Antispam-Report: CIP:66.129.239.16; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(189002)(24454002)(377454003)(164054003)(479174004)(199003)(6806004)(50466002)(69596002)(46102003)(120916001)(99396003)(87936001)(2950100001)(48376002)(62966003)(77156002)(21056001)(54356999)(84676001)(77096005)(50986999)(76506005)(53416004)(97736003)(68736005)(110136001)(64706001)(20776003)(31966008)(47776003)(4396001)(107046002)(105596002)(81156004)(106466001)(86362001)(92566001); DIR:OUT; SFP:1102; SCL:1; SRVR:CO1PR05MB442; H:P-EMF02-SAC.jnpr.net; FPR:; SPF:SoftFail; MLV:sfv; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-DmarcAction: None X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(3005003);SRVR:CO1PR05MB442; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:CO1PR05MB442; X-Forefront-PRVS: 0446F0FCE1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:CO1PR05MB442; X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2015 22:27:00.5825 (UTC) X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.16] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR05MB442 Cc: Marcel Moolenaar , John-Mark Gurney , "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 22:27:04 -0000 Alfred Perlstein writes: >On 1/3/15 9:05 PM, Phil Shafer wrote: >> 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. We considering this: given that the caller knows when it wants to fflush(stdout) and libxo doesn't, it seems we'd be better served having the app do something like: for (;;) { xo_open_instance("foo"); ... xo_close_instance("foo"); xo_flush(); /* Flush data buffersd in libxo */ if (__flbf(stdout)) fflush(stdout); /* Flush data buffered in stdio */ } xo_flush flushes the data that libxo is buffering in the handle, which is used to avoid making malformed XML and JSON content. Then fflush can push that data out if needed. The XOF_FLUSH flushes data after every call from the xo handle to the underlaying opaque stream; putting a flush at that point would likely be overkill. >I think we just need a "cork/uncork" sort of api that will make it a >single line? I can make a flag to push container and list names as they are opened, so a function can close, add an inter-record string (a NL for NLDJSON), and reopen the tags. Since I have the keys, I could add those also. Thanks, Phil