mirror of https://gitee.com/openkylin/libvirt.git
src: conditionally exclude cfmakeraw/termios.h on WIN32
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>
This commit is contained in:
parent
fa434739a0
commit
7c828af858
|
@ -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 \
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
# include <sys/un.h>
|
||||
#endif
|
||||
#include <netinet/in.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,
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
|
||||
#include <passfd.h>
|
||||
#include <fcntl.h>
|
||||
#ifndef WIN32
|
||||
# include <termios.h>
|
||||
#endif /* !WIN32 */
|
||||
#ifdef HAVE_PTY_H
|
||||
/* Linux openpty */
|
||||
# include <pty.h>
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
|
||||
#if WITH_DEVMAPPER
|
||||
# include <libdevmapper.h>
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "virerror.h"
|
||||
|
|
15
tools/vsh.c
15
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)
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef WIN32
|
||||
# include <termios.h>
|
||||
#endif
|
||||
|
||||
#include "internal.h"
|
||||
#include "virerror.h"
|
||||
|
|
Loading…
Reference in New Issue