[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Console/terminal mixup with bb-1.13
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2008-11-25 2:03:09
Message-ID: 200811250303.09482.vda.linux () googlemail ! com
[Download RAW message or body]

On Monday 24 November 2008 09:32, Roy Marples wrote:
> On Sun, 2008-11-23 at 20:46 +0100, Harald Küthe wrote:
> > >        /* Make sure init can't be blocked by writing to stderr */
> > >        fcntl(STDERR_FILENO, F_SETFL, fcntl(STDERR_FILENO, F_GETFL) | O_NONBLOCK);
> > 
> > >Can you confirm that just removing these lines from 1.13.0
> > >makes it work? If yes, please describe what device
> > >do you use as a console? Is it serial? What speed? Etc...
> > 
> > Yes after I removed the fcntl call the terminal seems to behave as before.
> > It still does not print the closing bracket of
> > //> init started: BusyBox v1.13.0 (2008-11-12 20:52:59 CET
> > //but besides that it is working afterwards.
> > 
> > the system is a ppc823, with linux-2.4.36
> > the kernel command line includes "console=ttyS0,9600"
> > which is mapped to the SMC1
> 
> It could be because the second fcntl is wrong. It should be like this
> 
> int flags;
> if ((flags = fcntl(STDERR_FILENO, F_GETFL, 0)) != -1)
> 	fcntl(STDERR_FILENO, F_SETFL, flags | O_NONBLOCK);

If F_GETFL fails (which it does basically only if you pass it a bad fd),
F_SETFL will fail too. What's the point in checking it?

Passing 3rd arg to F_GETFL is a waste of stack and instructions.
--
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic