From owner-cvs-all Sun Sep 2 20:22:27 2001 Delivered-To: cvs-all@freebsd.org Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by hub.freebsd.org (Postfix) with ESMTP id 17DC637B403; Sun, 2 Sep 2001 20:22:21 -0700 (PDT) Received: (from ache@localhost) by nagual.pp.ru (8.11.6/8.11.6) id f833MIx97745; Mon, 3 Sep 2001 07:22:18 +0400 (MSD) (envelope-from ache) Date: Mon, 3 Sep 2001 07:22:16 +0400 From: "Andrey A. Chernov" To: Alfred Perlstein Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libc/stdio setvbuf.c Message-ID: <20010903072215.B97368@nagual.pp.ru> References: <200109030235.f832ZAg46853@freefall.freebsd.org> <20010902214528.J81307@elvis.mu.org> <20010903070334.A97368@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20010903070334.A97368@nagual.pp.ru> User-Agent: Mutt/1.3.21i Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Sep 03, 2001 at 07:03:37 +0400, Andrey A. Chernov wrote: > > > What are you validating these changes against? POSIX? Solaris? Linux? > > Stdio try to optimize seeks internally to keep file offset in memory > without additional fp->_seek, commonly lseek call (and use __SOFF for it). > It can be done correctly only for regular files and when fp->_seek not > changed to non-standard function. Character devices (f.e. normal stdio) > often move pointer by themselfs, so keeping offset in memory for them > leads to incorrect offset. Stdio try to detect regular files with fp->seek > set to standard __seek and set __SOPT flag for them. It means that file > can be optimized. __SOFF is one sort of optimizations, it means we have > valid file offset in memory. When setvbuf.c clears __SOPT, no > optimizations allowed including __SOFF, so __SOFF must be removed too. IMHO, there is no needs to keep offset in memory at all, it only cause problems. lseek is very light-weighted syscall, so avoiding it in some cases (like sequental reading) gains almost nothing. But if BSD stdio developers choose to keep it, lets do it, but do it correctly. -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message