]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
src: conditionally exclude cfmakeraw/termios.h on WIN32
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 9 Jan 2020 13:18:50 +0000 (13:18 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 17 Jan 2020 10:02:01 +0000 (10:02 +0000)
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 <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
configure.ac
src/util/virfdstream.c
src/util/virfile.c
src/util/virutil.c
tools/virsh.h
tools/vsh.c
tools/vsh.h

index b28ed4a6dcd5c091ba86a7cf3b05c0c5e3834da4..7d69b8bcb488a5b7b4cd2856257a00fa2a71b109 100644 (file)
@@ -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 \
index 719185d99285a9e8ef190dba1e179fdab8401fa1..a903107afbb4fe88a2c3bcb18d782761f492e04a 100644 (file)
@@ -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,
index 8bd03f8176be2a579f2b9472163b749b530a65ee..b3a63fa2eaa99d93df375700e870af6e9ffb37c6 100644 (file)
@@ -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>
index c14c02a8c4dd0a0268fb95fecc55de7f217d974d..7c2c5a78f663e026405985675881b5154d8d9893 100644 (file)
@@ -35,7 +35,6 @@
 #endif
 
 #include <sys/types.h>
-#include <termios.h>
 
 #if WITH_DEVMAPPER
 # include <libdevmapper.h>
index 903a2e53b6aacab640519390f028a590f697f2ae..fa9e54b1d1f18761d4386138781f19f1312ac7ae 100644 (file)
@@ -23,7 +23,6 @@
 #include <stdarg.h>
 #include <unistd.h>
 #include <sys/stat.h>
-#include <termios.h>
 
 #include "internal.h"
 #include "virerror.h"
index a36b6bfe232552f03da553951e07669d0419201e..5c8908f2409114ae036ce8d47d2ed82f3ce5f361 100644 (file)
@@ -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)
index 960cae8df08682a2e216c82734ed3295bf65855d..174116b36910172cd9e5bc6db48dc54487707a92 100644 (file)
@@ -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"