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.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
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 <sys/un.h>
#endif
#include <netinet/in.h>
-#include <termios.h>
+#ifndef WIN32
+# include <termios.h>
+#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 <passfd.h>
#include <fcntl.h>
-#include <termios.h>
+#ifndef WIN32
+# include <termios.h>
+#endif /* !WIN32 */
#ifdef HAVE_PTY_H
/* Linux openpty */
# include <pty.h>
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 <sys/types.h>
-#include <termios.h>
#if WITH_DEVMAPPER
# include <libdevmapper.h>
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 <stdarg.h>
#include <unistd.h>
#include <sys/stat.h>
-#include <termios.h>
#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 <stdarg.h>
#include <unistd.h>
#include <sys/stat.h>
-#include <termios.h>
+#ifndef WIN32
+# include <termios.h>
+#endif
#include "internal.h"
#include "virerror.h"
--
2.24.1