[ELDK] Discrepancy in Denx PowerPC termios.h header

Ryan_D_Phillips at Dell.com Ryan_D_Phillips at Dell.com
Sat Aug 15 07:38:47 CEST 2009


Wolfgang,

Thanks for the response... I'll try to make clear a few observations. 

We are using a very old 1.0 version of Busybox in a legacy system (with a newer 2.6.25.5 kernel) using the PPC architecture of the kernel (not the powerpc architecture, if it makes a difference). The bug we are trying to fix is on line 710 of the stty utility [1]. The memory compare fails and the "unable to perform all requested operations" error is displayed.

There have been two proposed solutions:

 1. Change the toolchain header file... I'm opposed to doing this, since toolchains usually either work or they don't
 2. Modify the kernel to support the modified structure... I dislike placing dependencies on things we just don't understand.

Within a stock 2.6.25.5 kernel I find this structure (linux-2.6.25.5/include/asm-powerpc/termbits.h)

#define NCCS 19
struct termios {
    tcflag_t c_iflag;       /* input mode flags */
    tcflag_t c_oflag;       /* output mode flags */
    tcflag_t c_cflag;       /* control mode flags */
    tcflag_t c_lflag;       /* local mode flags */
    cc_t c_cc[NCCS];        /* control characters */
    cc_t c_line;            /* line discipline (== c_cc[19]) */
    speed_t c_ispeed;       /* input speed */
    speed_t c_ospeed;       /* output speed */
};

Within the ELDK/ppc_4xx/usr/include/bits/termios.h I find:

#define NCCS 32
struct termios {
    tcflag_t c_iflag;       /* input mode flags */
    tcflag_t c_oflag;       /* output mode flags */
    tcflag_t c_cflag;       /* control mode flags */
    tcflag_t c_lflag;       /* local mode flags */
    cc_t c_line;            /* line discipline (== c_cc[19]) */
    cc_t c_cc[NCCS];        /* control characters */
    speed_t c_ispeed;       /* input speed */
    speed_t c_ospeed;       /* output speed */
#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
};

Note the c_line variable is swapped with c_cc[NCCS].

Does this look like a toolchain issue, kernel issue, or userland issue? Or are we going down the wrong path?

Regards,
Ryan

[1] http://git.busybox.net/busybox/tree/coreutils/stty.c?h=1_00_stable#n710  

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Fri 8/14/2009 5:34 PM
To: Phillips, Ryan D
Cc: eldk at lists.denx.de
Subject: Re: [ELDK] Discrepancy in Denx PowerPC termios.h header
 
Dear Ryan,

in message <C602DB4CB80BF54194816250C56A2C11024060CC at ausx3mpc112.aus.amer.dell.com> you wrote:
> 
> The {ELDK_ROOT}/ppc_4xx/usr/include/bits/termios.h includes
> 
>   #define NCCS 32

ELDK is based on the Fedora distribution, so we inherit what Fedora is
doing. Let's see:

Fedora 10 on i686:

-> uname -a
Linux gemini.denx.de 2.6.27.29-170.2.78.fc10.i686 #1 SMP Fri Jul 31 04:40:15 EDT 2009 i686 i686 i386 GNU/Linux
-> grep 'define NCCS' /usr/include/bits/termios.h
#define NCCS 32

Fedora 10 on ppc64:

-> uname -a
Linux titan.denx.de 2.6.27.25-170.2.72.fc10.ppc64 #1 SMP Sun Jun 21 18:32:32 EDT 2009 ppc64 ppc64 ppc64 GNU/Linux
-> grep 'define NCCS' /usr/include/bits/termios.h
#define NCCS 32


As you can see, the ELDK is at least consistent with what  Fedora  is
doing.

> But in recent and old 2.6 kernels NCCS is defined as 19. 

Ummm... that's in arch/*/include/asm/termbits.h, not in
arch/*/include/asm/termios.h, and the value is not always 19, but
also 17 (sparc) or 23 (mips).

> In addition, the c_line variable within the termios structure is located
> below the c_cc[NCCS] variable within the kernel, but not in this glibc
> header file.
>
> It seems like the private glibc header file (bits/termios) is for a
> completely different architecture. This came up with us trying to track
> down a bug in our Busybox stty.c which was doing a memcmp on old and new
> termios settings and failing.

Is this the Busybox as included with the ELDK, or something you built
yourself?

> Any explanation or help would be appreciated.

Fedora's bugzilla seems to know nothing about such a problem.
It might be useful to file a bug report there.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There was no difference between  the  behavior  of  a  god  and  the
operations of pure chance..."   - Thomas Pynchon, _Gravity's Rainbow_



More information about the eldk mailing list