From owner-freebsd-questions@FreeBSD.ORG Sun Oct 10 03:27:10 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 57F0116A4CE for ; Sun, 10 Oct 2004 03:27:10 +0000 (GMT) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A55043D3F for ; Sun, 10 Oct 2004 03:27:09 +0000 (GMT) (envelope-from malcolm.kay@internode.on.net) Received: from beta.home (ppp139-240.lns1.adl2.internode.on.net [150.101.139.240])i9A3R64Y061797; Sun, 10 Oct 2004 12:57:07 +0930 (CST) From: Malcolm Kay Organization: at home To: ceo@l-i-e.com, freebsd-questions@freebsd.org Date: Sun, 10 Oct 2004 12:57:05 +0930 User-Agent: KMail/1.5.4 References: <1315.67.167.52.21.1097357022.squirrel@www.l-i-e.com> In-Reply-To: <1315.67.167.52.21.1097357022.squirrel@www.l-i-e.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200410101257.05494.malcolm.kay@internode.on.net> Subject: Re: stdout/stderr/??? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Oct 2004 03:27:10 -0000 On Sun, 10 Oct 2004 06:53 am, Richard Lynch wrote: > I have a situation where NIC code printf's out stuff. > > I'd *LIKE* to collect that output. > > Under Linux, I'd use 2&>1 I think (hope) you mean 2>&1 > > I read somewhere that under FreeBSD, I could do: > (xxx > log.out) &> log.err And here: ( xxx > log.out ) >& log.err The difference is not Linux vs FreeBSD but a question of the shell you are using -- I assume 'bash' under Linux and 'csh' (or tcsh) under FreeBSD. You could install 'bash on FreeBSD and set this as your default shell -- or you could nominate 'sh' as your default shell which, in this respect, behaves the same as 'bash'. > > This works fine for xxx == make buildkernel > > If fails miserably for xxx == ifconfig, however. Can't see why it should work differently for 'ifconfig' unless maybe this time you have the '&' in the wrong place. In any case I would not expect massive amounts of output from ifconfig. > > I can sorta get what I want by starting X-Windows, and using a > terminal/shell to do the command. Then the messages I desire to log are > A) suppressed from by shell (which is BAD) but B) logged into > /var/log/messages (which is close enough to what I want) > I don't understand what you are saying here. X-windows (of itself) should not process the commands differently. I suspect you have some fancy desktop program with options set that interfere. > Alas, the real problem comes when my driver code sends the machine into an > infinite loop, spewing out messages so fast I can't even read them, and > the only way out is to forcibly power-off the laptop by removing battery > and power cord. > What driver code? Are you trying to write your own? for what device? An infinite loop while running or compiling the driver code? If when the driver code is installed and run then you are fiddling will kernel mode, and if you mess up all bets are off. You have tried Cntrl-Z and Cntrl-Alt-F2 ? > Upon re-boot, the additions I would expect in /var/log/messages (or the > bziped older logs) do not contain the messages I need to see. > > I have also tried: > ktrace xxx > > Again, for the case where the machine is not in an infinite loop, it works > real nifty; But when I'm forced to chop power, I get nothing. > > Is there something that will: > A) copy (or re-direct) all output somewhere, *AND* > B) force it to be synchronous and unbuffered and whatever else has to > occur to get the file to be saved? > > Any other suggestions for how to get this process to not lock up the > machine? control-C ineffective > CTRL-ALT-F2 followed by CTRL-ALT-DELETE can sometimes get me to another > tty, but that tty does not accept input Are you sure? The CTRL-ALT-F2 hopefully gets you a character mode tty with a login prompt. But you'll need to login to proceed. CTRL-ALT-DELETE at this stage should cause a reboot. > > Hmmmm. Perhaps I should try to cron a "killall ifconfig" for shortly > after the command I'm about to type... Or something like: > > ifconfig ...&; sleep 3; killall ifconfig > > Any other ideas? > > Please cc me, I'm so far behind on reading -questions that I've > unsubscribed until I catch up...