Re: ldattach: struct termios

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 26, 2008 at 09:17:11PM +0100, Tilman Schmidt wrote:
> Hello Karel,
> 
> thanks for your feedback.
> 
> On Wed, 26 Mar 2008 15:17:47, Karel Zak wrote:
> > 1/ I cannot compile ldattach on ppc64, kernel-headers-2.6.24 (asm-powerpc/):
> > 
> >     In file included from ldattach.c:24:
> >     /usr/include/asm/termbits.h:22: error: redefinition of 'struct termios'
> 
> Oh dear. #include hell.
> 
> >   Why we cannot use standard /usr/include/termios.h?
> 
> It doesn't provide the definition for termios2 I need. On my development

 linux asm/*/termbits.h:

struct termios2 {
	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 */
	cc_t c_cc[NCCS];		/* control characters */
	speed_t c_ispeed;		/* input speed */
	speed_t c_ospeed;		/* output speed */
};

 glibc bits/termios.h:

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 */
    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
  };

> machine (openSUSE 10.3, x86 32 bit userland),
> 24 #include <termios.h>

 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.

    Karel



-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux