From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 11 17:23:56 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CFC8B16A403 for ; Mon, 11 Dec 2006 17:23:56 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 959AA43CBB for ; Mon, 11 Dec 2006 17:22:38 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.6/8.13.8) id kBBHNtES086708; Mon, 11 Dec 2006 11:23:55 -0600 (CST) (envelope-from dan) Date: Mon, 11 Dec 2006 11:23:55 -0600 From: Dan Nelson To: c0re dumped Message-ID: <20061211172354.GE69299@dan.emsphone.com> References: <6dd8736a0612110908q2cdb99a0rf3b8da3f5e4bdfee@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6dd8736a0612110908q2cdb99a0rf3b8da3f5e4bdfee@mail.gmail.com> X-OS: FreeBSD 6.2-PRERELEASE X-message-flag: Outlook Error User-Agent: Mutt/1.5.13 (2006-08-11) Cc: freebsd-hackers@freebsd.org Subject: Re: Reading in real time from a file without pipes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Dec 2006 17:23:56 -0000 In the last episode (Dec 11), c0re dumped said: > I wonder if is possible to read data from a certain file without > using a pipe. > > Let me explain: > > I have a process already writing messages to a logfile. I want to > read all written data (without neither stop nor interfere normal log > process) from another process in real time. > > How can I achieve it ? Take a look at how the tail command does it. You can either stat the file periodically then read the new data if you see the timestamp or size change (portable), or use a kqueue to get notified immediately of any updates (not portable). -- Dan Nelson dnelson@allantgroup.com