[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: newterm() returning NULL on serial console
From: |
Thomas Dickey |
Subject: |
Re: newterm() returning NULL on serial console |
Date: |
Sat, 02 Dec 2006 14:51:07 -0500 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On Tue, Nov 07, 2006 at 03:54:52AM -0500, Katarina Machalkova wrote:
> Hi there!
>
> I have the following code snippet:
>
> char * mytty = ttyname( 0 );
> if ( mytty ) {
> FILE * fdi = fopen( mytty, "r" );
> if (!fdi) {
> UIERR << "fdi: (" << errno << ") " << strerror(errno) << endl;
> }
> FILE * fdo = fopen( mytty, "w" );
> if (!fdo) {
> UIERR << "fdo: (" << errno << ") " << strerror(errno) << endl;
> }
> if ( fdi && fdo ) {
> theTerm = newterm( 0, fdo, fdi );
> if ( theTerm == NULL )
> throw NCursesError( "newterm() failed" );
> ....
>
> The problem is, that once 'console=ttyS0' parameter is passed to the kernel
> at
> boot (this is SUSE Linux Enterprise Server 10), newterm() function in this
> code keeps returning NULL pointer.
>
> What happens here is that:
> * ttyname() correctly returns '/dev/console' string
> * fopen() call succesfully opens /dev/console for reading and for writing
> (i.e. returns non-NULL pointers)
> * yet newterm() returns NULL once serial console is used, no matter what TERM
> environment variable is used. Without serial console, all works fine
>
> Any clue what might be going wrong in newterm() function ? Or what else
> should
> I check and who might be the possible culprit ?
I can only guess too. newterm can return a null for three different cases
(reading the code):
a) setupterm fails (usually because it cannot obtain the terminfo)
b) the apparent screensize is very large (so it cannot allocate memory)
c) possibly some problem setting terminal modes.
> Unfortunately, the machine on which the error can be reproduced is somewhere
> at the customer's site and I have neither physical nor network access to
> it :-( and I cannot easily debug it
> Yet I would be grateful for any ideas or suggestions ...
> Thanks
I'd suggest making a static executable built against the tracing version
of ncurses (so you don't have to redeliver libraries to get the test),
get the customer to run that, e.g., with NCURSES_TRACING=0xffff,
and looking to see whether I can see the failure in the "trace" file.
--
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net
signature.asc
Description: Digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: newterm() returning NULL on serial console,
Thomas Dickey <=