Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Oct 2004 12:57:05 +0930
From:      Malcolm Kay <malcolm.kay@internode.on.net>
To:        ceo@l-i-e.com, freebsd-questions@freebsd.org
Subject:   Re: stdout/stderr/???
Message-ID:  <200410101257.05494.malcolm.kay@internode.on.net>
In-Reply-To: <1315.67.167.52.21.1097357022.squirrel@www.l-i-e.com>
References:  <1315.67.167.52.21.1097357022.squirrel@www.l-i-e.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410101257.05494.malcolm.kay>