Hello Karel, On Wed, 26 Mar 2008 21:37:45, Karel Zak wrote: >>> Why we cannot use standard /usr/include/termios.h? >> It doesn't provide the definition for termios2 I need. > You need to rename the struct. Try: > > diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c > index a696e88..d8ecc9b 100644 > --- a/sys-utils/ldattach.c > +++ b/sys-utils/ldattach.c > @@ -21,7 +21,7 @@ > #include <fcntl.h> > #include <sys/ioctl.h> > #include <errno.h> > -#include <asm/termbits.h> > +#include <termios.h> > #include <unistd.h> > #include <err.h> > > @@ -82,13 +82,14 @@ static int lookup_ld(const char *s) > > /* some archs don't have separate struct termios2 */ > #ifndef TCGETS2 > -#define termios2 termios > #define TCGETS2 TCGETS > #define TCSETS2 TCSETS > #define TCSETSW2 TCSETSW > #define TCSETSF2 TCSETSF > #endif > > +#define termios2 termios > + > static int tcgetattr2(int fd, struct termios2 *pts) > { > return ioctl(fd, TCGETS2, pts); > > > it compiles without any error. It compiles alright, but it doesn't work: ts@xenon:~/util-linux-ng/sys-utils> ./ldattach -s 9600 M101 /dev/ttyS0 ldattach: cannot get terminal attributes for /dev/ttyS0: Invalid argument I guess this is because of: ts@xenon:~/util-linux-ng/sys-utils> fgrep -r "define NCCS" /usr/include /usr/include/asm-x86_64/termbits.h:#define NCCS 19 /usr/include/asm-parisc/termbits.h:#define NCCS 19 /usr/include/asm-ia64/termbits.h:#define NCCS 19 /usr/include/asm-arm/termbits.h:#define NCCS 19 /usr/include/asm-powerpc/termbits.h:#define NCCS 19 /usr/include/asm-i386/termbits.h:#define NCCS 19 /usr/include/asm-s390/termbits.h:#define NCCS 19 /usr/include/bits/termios.h:#define NCCS 32 So #include <termios.h> defines the c_cc array in struct termios with the wrong size. What's more, it does not define BOTHER, so the whole termios2 exercise is in vain. I'm not sure how to solve this: - Drop the entire idea of supporting arbitrary bitrates portably? I've got half a mind to do that by now. - Find a way of working around the redefinition issue on ppc64 (and possibly others)? Where is the first definition coming from anyway? Unfortunately I do not have a ppc64 system to test it. Ideas welcome. Thanks, Tilman
Attachment:
signature.asc
Description: OpenPGP digital signature