Skip to contentSkip to conversation

char-pty: remove unnecessary #ifdef

PATCH In review Paolo Bonzini 2 participants 4 messages Aug 22, 2018 – Aug 30, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 char-pty: remove unnecessary #ifdef

For some reason __APPLE__ was not checked in pty code. However, the #ifdef is redundant: this file is already compiled only if CONFIG_POSIX, same as util/qemu-openpty.c which it uses.

---
 chardev/char-pty.c | 6 ------
 1 file changed, 6 deletions(-)
chardev/char-pty.c +0 -6
index 68fd4e20c3..e8d9a53476 100644
@@ -31,10 +31,6 @@
 
 #include "chardev/char-io.h"
 
-#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)      \
-    || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
-    || defined(__GLIBC__)
-
 typedef struct {
     Chardev parent;
     QIOChannel *ioc;
@@ -299,5 +295,3 @@ static void register_types(void)
 }
 
 type_init(register_types);
-
-#endif
Signature · 1 line
2.17.1
#1 lore raw
Quoted 4 lines · Paolo Bonzini

For some reason __APPLE__ was not checked in pty code. However, the #ifdef is redundant: this file is already compiled only if CONFIG_POSIX, same as util/qemu-openpty.c which it uses.

Thanks Paolo!

FWIW, qemu_openpty_raw and qemu_pipe are declared for all operating systems except _WIN32 in qemu-common.h. For sake of symmetry, should the declarations be available only for CONFIG_POSIX?

--
Roman

#2 lore raw
Quoted 11 lines · Roman Bolshakov
Quoted 4 lines · Paolo Bonzini

For some reason __APPLE__ was not checked in pty code. However, the #ifdef is redundant: this file is already compiled only if CONFIG_POSIX, same as util/qemu-openpty.c which it uses.

Thanks Paolo!

FWIW, qemu_openpty_raw and qemu_pipe are declared for all operating systems except _WIN32 in qemu-common.h. For sake of symmetry, should the declarations be available only for CONFIG_POSIX?

I would even move them out of qemu-common.h to a separate qemu/openpty.h file...

Paolo

#3 lore raw
In reply to Paolo Bonzini
Quoted 4 lines · Paolo Bonzini

For some reason __APPLE__ was not checked in pty code. However, the #ifdef is redundant: this file is already compiled only if CONFIG_POSIX, same as util/qemu-openpty.c which it uses.

Hi Paolo,

Is it possible to apply the patch for master and 3.1 branch?

I'm trying to bring up qemu + libvirt on macOS. If it goes to 3.1, then libvirt 4.7.0 and QEMU 3.1 are going to be a working solution for virtualization on macOS.

Lack of pty devices prevents a user from using valid domain xml with serial console and virsh console command.

--
Thank you,
Roman