From owner-freebsd-bugs Wed Oct 6 3:28:14 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from relay.ucb.crimea.ua (relay.ucb.crimea.ua [212.110.138.1]) by hub.freebsd.org (Postfix) with ESMTP id 5401A1506C for ; Wed, 6 Oct 1999 03:27:23 -0700 (PDT) (envelope-from ru@ucb.crimea.ua) Received: (from ru@localhost) by relay.ucb.crimea.ua (8.9.3/8.9.3/UCB) id NAA97784; Wed, 6 Oct 1999 13:26:13 +0300 (EEST) (envelope-from ru) Date: Wed, 6 Oct 1999 13:26:13 +0300 From: Ruslan Ermilov To: Brian Somers Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: misc/14150: /usr/binlast does not accept input from stdin nor does it process .gz files Message-ID: <19991006132613.C82096@relay.ucb.crimea.ua> Mail-Followup-To: Brian Somers , freebsd-bugs@FreeBSD.ORG References: <199910060730.AAA33069@freefall.freebsd.org> <199910060943.KAA00971@hak.lan.Awfulhak.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: <199910060943.KAA00971@hak.lan.Awfulhak.org>; from Brian Somers on Wed, Oct 06, 1999 at 10:43:55AM +0100 X-Operating-System: FreeBSD 3.3-STABLE i386 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Wed, Oct 06, 1999 at 10:43:55AM +0100, Brian Somers wrote: > [.....] > > > So, why is this a problem? After all, there is the -f option, right? > > > > > Right :-) > > > > `/usr/bin/last -f /dev/stdin < wtmp-format-file' will do the trick. > > Well, no. last(1) tries to seek and fails. > Only if it deals with pipe/socket/FIFO; my example will work. Anyway, it is nonsense, since it is equivalent to just: # /usr/bin/last -f wtmp-format-file As for the problem, last(1) processes wtmp file in reverse order and it uses lseek(2) for that. Lseek(2) will fail with ESPIPE if used with pipe, socket or fifo. Changing last(1) to not use lseek(2) would require an almost complete rework of last(1) and will impact on performace. -- Ruslan Ermilov Sysadmin and DBA of the ru@ucb.crimea.ua United Commercial Bank, ru@FreeBSD.org FreeBSD committer, +380.652.247.647 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message