From owner-svn-src-all@FreeBSD.ORG Tue Jul 22 17:08:18 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 48EEE52F for ; Tue, 22 Jul 2014 17:08:18 +0000 (UTC) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C2E5C2D26 for ; Tue, 22 Jul 2014 17:08:17 +0000 (UTC) Received: by mail-lb0-f178.google.com with SMTP id c11so5359507lbj.37 for ; Tue, 22 Jul 2014 10:08:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=H7y5JUzll25UFuY4vrxkYp/iwWUzSSyPh3K1yLYiBQ0=; b=j8RcNlk4Vrfhc6XOzumzhZz9wi6xX07r+KfAdz8THfbdSK+jchLFEWXMrcdCHOvtTT LQlWQ3RUooyQul5j74DHZQ5PJjUrTX/aeIlYIJj6i2DwceqNLSdmNpSrKtBR/PdOt2KL 8AQD5JdNB/0jT6hsi+q4ejfvSYAnzgptshbyB7eqHyYT4D4lTuRRRiqJcstrg12w62AA csQ+OLbeAx3DypT5fZcHB1Dl7xEjQpFDa4/9qo+C5RBELlkAJxZH5iwuyje+bewceLUa y95S7pKUY0TmLvrRdc7WE6C05cWNti4eVDFaRIydAEJkiQkJDrvBj1E1Cg1jgAPC/cUo Ei+w== X-Gm-Message-State: ALoCoQmIc/Jen6HddofVZRT71IhkIrfdaJKP2JBSj/TIMXhUT7SfT5qfX8cJhlCr1iPw1vOpjsDJ X-Received: by 10.112.157.68 with SMTP id wk4mr13378712lbb.85.1406048895509; Tue, 22 Jul 2014 10:08:15 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id c7sm1349742lbd.37.2014.07.22.10.08.14 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Jul 2014 10:08:14 -0700 (PDT) Message-ID: <53CE9A77.4060000@freebsd.org> Date: Tue, 22 Jul 2014 21:08:07 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r268984 - head/lib/libc/stdio References: <201407221619.s6MGJ10G068003@svn.freebsd.org> <53CE94F6.3090003@freebsd.org> In-Reply-To: <53CE94F6.3090003@freebsd.org> Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jul 2014 17:08:18 -0000 On 22.07.2014 20:44, Andrey Chernov wrote: > Producing physical writes on ftell cause great performance degradation. > You should check for __SAPP flag before calling sflush to do this only > for append-mode files. BTW, I believe that sflush() should be completely eliminated even for _SAPP case. Something like that instead: if (fp->_flags & __SAPP) { pos = _sseek(fp, (fpos_t)0, SEEK_END); if (pos == -1) return (1); } else if (fp->_flags & __SOFF) pos = fp->_offset; else { pos = _sseek(fp, (fpos_t)0, SEEK_CUR); if (pos == -1) return (1); } > > On 22.07.2014 20:19, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Tue Jul 22 16:19:01 2014 >> New Revision: 268984 >> URL: http://svnweb.freebsd.org/changeset/base/268984 >> >> Log: >> ftello: return 1 when seeking offset on an append stream. >> >> Obtained from: Apple Inc. (Libc 997.90.3) >> Phabric: D442 >> MFC after: 2 weeks >> >> Modified: >> head/lib/libc/stdio/ftell.c >> >> Modified: head/lib/libc/stdio/ftell.c >> ============================================================================== >> --- head/lib/libc/stdio/ftell.c Tue Jul 22 16:10:56 2014 (r268983) >> +++ head/lib/libc/stdio/ftell.c Tue Jul 22 16:19:01 2014 (r268984) >> @@ -97,6 +97,8 @@ _ftello(FILE *fp, fpos_t *offset) >> * Find offset of underlying I/O object, then >> * adjust for buffered bytes. >> */ >> + if (__sflush(fp)) /* may adjust seek offset on append stream */ >> + return (1); >> if (fp->_flags & __SOFF) >> pos = fp->_offset; >> else { >> > > -- http://ache.vniz.net/