From 7c828af8586fcbbf6d4bad4817c5476cd6536a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 9 Jan 2020 13:18:50 +0000 Subject: [PATCH] src: conditionally exclude cfmakeraw/termios.h on WIN32 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GNULIB termios module ensures termios.h exists (but is none the less empty) when building for Windows. We already exclude usage of the functions that would exist in a real termios.h, so having an empty termios.h is not especially useful. It is simpler to just put all use of termios.h related functions behind a "#ifndef WIN32" conditional. Reviewed-by: Pavel Hrdina Signed-off-by: Daniel P. Berrangé --- configure.ac | 1 - src/util/virfdstream.c | 10 ++++++---- src/util/virfile.c | 4 +++- src/util/virutil.c | 1 - tools/virsh.h | 1 - tools/vsh.c | 15 --------------- tools/vsh.h | 4 +++- 7 files changed, 12 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index b28ed4a6dc..7d69b8bcb4 100644 --- a/configure.ac +++ b/configure.ac @@ -353,7 +353,6 @@ AC_CHECK_SIZEOF([long]) dnl Availability of various common functions (non-fatal if missing), dnl and various less common threadsafe functions AC_CHECK_FUNCS_ONCE([\ - cfmakeraw \ fallocate \ geteuid \ getgid \ diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c index 719185d992..a903107afb 100644 --- a/src/util/virfdstream.c +++ b/src/util/virfdstream.c @@ -31,7 +31,9 @@ # include #endif #include -#include +#ifndef WIN32 +# include +#endif #include "virfdstream.h" #include "virerror.h" @@ -1361,7 +1363,7 @@ int virFDStreamCreateFile(virStreamPtr st, false, false); } -#ifdef HAVE_CFMAKERAW +#ifndef WIN32 int virFDStreamOpenPTY(virStreamPtr st, const char *path, unsigned long long offset, @@ -1401,7 +1403,7 @@ int virFDStreamOpenPTY(virStreamPtr st, virFDStreamClose(st); return -1; } -#else /* !HAVE_CFMAKERAW */ +#else /* WIN32 */ int virFDStreamOpenPTY(virStreamPtr st, const char *path, unsigned long long offset, @@ -1413,7 +1415,7 @@ int virFDStreamOpenPTY(virStreamPtr st, oflags | O_CREAT, 0, false, false); } -#endif /* !HAVE_CFMAKERAW */ +#endif /* WIN32 */ int virFDStreamOpenBlockDevice(virStreamPtr st, const char *path, diff --git a/src/util/virfile.c b/src/util/virfile.c index 8bd03f8176..b3a63fa2ea 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -27,7 +27,9 @@ #include #include -#include +#ifndef WIN32 +# include +#endif /* !WIN32 */ #ifdef HAVE_PTY_H /* Linux openpty */ # include diff --git a/src/util/virutil.c b/src/util/virutil.c index c14c02a8c4..7c2c5a78f6 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -35,7 +35,6 @@ #endif #include -#include #if WITH_DEVMAPPER # include diff --git a/tools/virsh.h b/tools/virsh.h index 903a2e53b6..fa9e54b1d1 100644 --- a/tools/virsh.h +++ b/tools/virsh.h @@ -23,7 +23,6 @@ #include #include #include -#include #include "internal.h" #include "virerror.h" diff --git a/tools/vsh.c b/tools/vsh.c index a36b6bfe23..5c8908f240 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1928,21 +1928,6 @@ vshTTYRestore(vshControl *ctl G_GNUC_UNUSED) } -#if !defined(WIN32) && !defined(HAVE_CFMAKERAW) -/* provide fallback in case cfmakeraw isn't available */ -static void -cfmakeraw(struct termios *attr) -{ - attr->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP - | INLCR | IGNCR | ICRNL | IXON); - attr->c_oflag &= ~OPOST; - attr->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); - attr->c_cflag &= ~(CSIZE | PARENB); - attr->c_cflag |= CS8; -} -#endif /* !WIN32 && !HAVE_CFMAKERAW */ - - int vshTTYMakeRaw(vshControl *ctl G_GNUC_UNUSED, bool report_errors G_GNUC_UNUSED) diff --git a/tools/vsh.h b/tools/vsh.h index 960cae8df0..174116b369 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -23,7 +23,9 @@ #include #include #include -#include +#ifndef WIN32 +# include +#endif #include "internal.h" #include "virerror.h"