portability: pty.h is glibc-specific
PATCH 1/1 portability: pty.h is glibc-specific
This should fix building the GTK+ front-end on BSDs.
--- include/qemu-common.h | 12 ++++++++++++ qemu-char.c | 10 ---------- ui/gtk.c | 1 - 3 files changed, 12 insertions(+), 11 deletions(-)
include/qemu-common.h +12 -0
@@ -42,6 +42,18 @@#include <signal.h> #include "glib-compat.h" +#if defined(__GLIBC__) +# include <pty.h> +#elif definedCONFIG_BSD +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +# include <libutil.h> +# else +# include <util.h> +# endif +#elif definedCONFIG_SOLARIS +# include <stropts.h> +#endif +#ifdef _WIN32#include "sysemu/os-win32.h" #endif
qemu-char.c +0 -10
@@ -53,13 +53,6 @@#include <sys/select.h> #ifdef CONFIG_BSD #include <sys/stat.h> -#if defined(__GLIBC__) -#include <pty.h> -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -#include <libutil.h> -#else -#include <util.h> -#endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)#include <dev/ppbus/ppi.h> #include <dev/ppbus/ppbconf.h>
@@ -69,8 +62,6 @@#endif #else #ifdef __linux__ -#include <pty.h> -#include <linux/ppdev.h> #include <linux/parport.h> #endif
@@ -87,7 +78,6 @@#include <netinet/tcp.h> #include <net/if.h> #include <syslog.h> -#include <stropts.h> #endif #endif #endif
ui/gtk.c +0 -1
@@ -55,7 +55,6 @@#include <sys/socket.h> #include <sys/un.h> #include <sys/wait.h> -#include <pty.h> #include <math.h> #include "ui/console.h"
Signature · 1 line
1.8.2.1
Anthony Liguori
AppliedApplied. Thanks.
Regards,
Anthony Liguori
Quoted 5 lines · Anthony Liguori
Applied. Thanks.
Regards,
Anthony Liguori
The patch was not updated to take into consideration my comment from bug 1177774 so what was commited is just as broken as before the patch.
Signature · 3 lines
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Quoted 9 lines · Brad Smith
Quoted 5 lines · Anthony Liguori
Applied. Thanks.
Regards,
Anthony Liguori
The patch was not updated to take into consideration my comment from bug 1177774 so what was commited is just as broken as before the patch.
If a patch doesn't solve a problem, respond on the mailing list to the patch itself.
Regards,
Anthony Liguori
Quoted 5 lines
Signature · 4 lines
-- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Il 14/05/2013 18:15, Brad Smith ha scritto:
Quoted 9 lines · Anthony Liguori
Quoted 5 lines
Applied. Thanks.
Regards,
Anthony Liguori
The patch was not updated to take into consideration my comment from bug 1177774 so what was commited is just as broken as before the patch.
Just send a followup yourself. You and Blue Swirl are the only users of QEMU on OpenBSD as far as we know, so anything that you do not do yourself is just best-effort.
Paolo
Quoted 6 lines · Paolo Bonzini
Il 14/05/2013 18:15, Brad Smith ha scritto:
Quoted 5 lines · Anthony Liguori
Quoted 4 lines
Applied. Thanks.
Regards,
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Anthony Liguori
The patch was not updated to take into consideration my comment from bug 1177774 so what was commited is just as broken as before the patch.
Just send a followup yourself. You and Blue Swirl are the only users of QEMU on OpenBSD as far as we know, so anything that you do not do yourself is just best-effort.
Not to argue with this, just a general note: most of whatever is portable from the terminal IO interfaces belongs into <termios.h> indeed.
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html
Traditionally nonportable stuff related to pty allocation and master-slave pairing has been "recently" standardized as well (as in, SUSv3 / UNIX 03):
http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_openpt.html
(+grantpt, ptsname, unlockpt; they seem to date back to SUSv1 / UNIX 95)
CC'ing Eric for the obligatory POSIX sanity check... :)
Laszlo
Quoted 9 lines · Laszlo Ersek
Not to argue with this, just a general note: most of whatever is portable from the terminal IO interfaces belongs into <
termios.h> indeed.http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html
Traditionally nonportable stuff related to pty allocation and master-slave pairing has been "recently" standardized as well (as in, SUSv3 / UNIX 03):
Quoted 5 lines
http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_openpt.html
(+grantpt, ptsname, unlockpt; they seem to date back to SUSv1 / UNIX 95)
CC'ing Eric for the obligatory POSIX sanity check... :)
Looks accurate.
Still missing from POSIX is ptsname_r, although it might appear in the next revision ("Issue 8") in a few years:
http://austingroupbugs.net/view.php?id=508
which means right now, POSIX has no thread-safe mechanism for determining the slave name after opening a master pty.
Personally, I find the high-level BSD openpty() interface a lot nicer to use than the POSIX posix_openpt()/grantpt()/unlockpt()/ptsname() sequence, but it may come with its own pitfalls since it is not standardized (yet).
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 8 lines · Paolo Bonzini
This should fix building the GTK+ front-end on BSDs.
Signed-off-by Paolo Bonzini <[email protected]>--- include/qemu-common.h | 12 ++++++++++++ qemu-char.c | 10 ---------- ui/gtk.c | 1 - 3 files changed, 12 insertions(+), 11 deletions(-)
This actually fixes the build on *BSD and OS X systems.
include/qemu-common.h +1 -0
@@ -45,6 +45,7 @@#if defined(__GLIBC__)# include <pty.h> #elif definedCONFIG_BSD +# include <termios.h> # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)# include <libutil.h> # else
Signature · 3 lines
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
Quoted 19 lines · Brad Smith
Quoted 8 lines · Paolo Bonzini
This should fix building the GTK+ front-end on BSDs.
Signed-off-by Paolo Bonzini <[email protected]>--- include/qemu-common.h | 12 ++++++++++++ qemu-char.c | 10 ---------- ui/gtk.c | 1 - 3 files changed, 12 insertions(+), 11 deletions(-)This actually fixes the build on *BSD and OS X systems.
include/qemu-common.h +0
-0
include/qemu-common.h line 51
Quoted 7 lines
include/qemu-common.h +1
-0@@ -45,6 +45,7 @@#if defined(__GLIBC__)# include <pty.h> #elif definedCONFIG_BSD +# include <termios.h> # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)# include <libutil.h> # else
This is going to need a Signed-off-by: if you want it to be applied (and ideally to be a properly formatted git patch that can be automatically applied, with a "for-1.5" tag and cc'ing Anthony).
(I can't test it myself because my MacOSX system doesn't have GTK so I don't build the GTK frontend anyway; it doesn't actively break the MacOSX build, at least.)
thanks
-- PMM
Quoted 3 lines · Paolo Bonzini
This should fix building the GTK+ front-end on BSDs.
Signed-off-by Paolo Bonzini <[email protected]>
Hi. This patch breaks the build on MacOSX:
manooth$ make block/vdi.o
CHK version_gen.h
CC block/vdi.oblock/vdi.c:124:20: error: static declaration of 'uuid_generate' follows non-static declaration
static inline void uuid_generate(uuid_t out)
^
/usr/include/uuid/uuid.h:63:6: note: previous declaration is here
void uuid_generate(uuid_t out);
^
block/vdi.c:129:19: error: static declaration of 'uuid_is_null'
follows non-static declaration
static inline int uuid_is_null(const uuid_t uu)
^
/usr/include/uuid/uuid.h:67:5: note: previous declaration is here
int uuid_is_null(const uuid_t uu);
^
block/vdi.c:135:20: error: static declaration of 'uuid_unparse'
follows non-static declaration
static inline void uuid_unparse(const uuid_t uu, char *out)
^
/usr/include/uuid/uuid.h:71:6: note: previous declaration is here
void uuid_unparse(const uuid_t uu, uuid_string_t out);
^3 errors generated.
make: *** [block/vdi.o] Error 1
Quoted 7 lines
include/qemu-common.h +1
-0@@ -42,6 +42,18 @@#include <signal.h> #include "glib-compat.h" +#if defined(__GLIBC__)
include/qemu-common.h line 55
Quoted 10 lines
include/qemu-common.h +10
-0+# include <pty.h> +#elif definedCONFIG_BSD +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +# include <libutil.h> +# else +# include <util.h> +# endif +#elif definedCONFIG_SOLARIS +# include <stropts.h> +#endif
On MacOSX, util.h includes pwd.h which includes uuid/uuid.h (all system headers). The system uuid.h defines then conflict with QEMU's.
(configure's test for libuuid has failed, so CONFIG_UUID isn't defined. This is because on MacOS you don't need '-luuid' and including it on the command line makes the compile-test fail because of a nonexistent library.)
thanks
-- PMM