qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific
@ 2013-05-14 12:05 Paolo Bonzini
  2013-05-14 16:10 ` Anthony Liguori
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Paolo Bonzini @ 2013-05-14 12:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: brad

This should fix building the GTK+ front-end on BSDs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu-common.h | 12 ++++++++++++
 qemu-char.c           | 10 ----------
 ui/gtk.c              |  1 -
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index b399d85..af769f5 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -42,6 +42,18 @@
 #include <signal.h>
 #include "glib-compat.h"
 
+#if defined(__GLIBC__)
+# include <pty.h>
+#elif defined CONFIG_BSD
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+#  include <libutil.h>
+# else
+#  include <util.h>
+# endif
+#elif defined CONFIG_SOLARIS
+# include <stropts.h>
+#endif
+
 #ifdef _WIN32
 #include "sysemu/os-win32.h"
 #endif
diff --git a/qemu-char.c b/qemu-char.c
index 64e824d..30a2ddf 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -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
diff --git a/ui/gtk.c b/ui/gtk.c
index e12f228..7b2d2ac 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -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"
-- 
1.8.2.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific
  2013-05-14 12:05 [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific Paolo Bonzini
@ 2013-05-14 16:10 ` Anthony Liguori
  2013-05-14 16:15   ` Brad Smith
  2013-05-14 18:30 ` Brad Smith
  2013-05-14 19:34 ` Peter Maydell
  2 siblings, 1 reply; 10+ messages in thread
From: Anthony Liguori @ 2013-05-14 16:10 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: brad

Applied.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific
  2013-05-14 16:10 ` Anthony Liguori
@ 2013-05-14 16:15   ` Brad Smith
  2013-05-14 16:28     ` Anthony Liguori
  2013-05-14 16:35     ` Paolo Bonzini
  0 siblings, 2 replies; 10+ messages in thread
From: Brad Smith @ 2013-05-14 16:15 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Paolo Bonzini, qemu-devel

On Tue, May 14, 2013 at 04:10:56PM -0000, Anthony Liguori wrote:
> 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.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific
  2013-05-14 16:15   ` Brad Smith
@ 2013-05-14 16:28     ` Anthony Liguori
  2013-05-14 16:35     ` Paolo Bonzini
  1 sibling, 0 replies; 10+ messages in thread
From: Anthony Liguori @ 2013-05-14 16:28 UTC (permalink / raw)
  To: Brad Smith; +Cc: Paolo Bonzini, qemu-devel

Brad Smith <brad@comstyle.com> writes:

> On Tue, May 14, 2013 at 04:10:56PM -0000, Anthony Liguori wrote:
>> 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

>
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific
  2013-05-14 16:15   ` Brad Smith
  2013-05-14 16:28     ` Anthony Liguori
@ 2013-05-14 16:35     ` Paolo Bonzini
  2013-05-14 19:28       ` Laszlo Ersek
  1 sibling, 1 reply; 10+ messages in thread
From: Paolo Bonzini @ 2013-05-14 16:35 UTC (permalink / raw)
  To: Brad Smith; +Cc: Anthony Liguori, qemu-devel

Il 14/05/2013 18:15, Brad Smith ha scritto:
> On Tue, May 14, 2013 at 04:10:56PM -0000, Anthony Liguori wrote:
>> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific
  2013-05-14 12:05 [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific Paolo Bonzini
  2013-05-14 16:10 ` Anthony Liguori
@ 2013-05-14 18:30 ` Brad Smith
  2013-05-14 21:06   ` Peter Maydell
  2013-05-14 19:34 ` Peter Maydell
  2 siblings, 1 reply; 10+ messages in thread
From: Brad Smith @ 2013-05-14 18:30 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On Tue, May 14, 2013 at 02:05:21PM +0200, Paolo Bonzini wrote:
> This should fix building the GTK+ front-end on BSDs.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  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.


diff --git a/include/qemu-common.h b/include/qemu-common.h
index af769f5..c944bb7 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -45,6 +45,7 @@
 #if defined(__GLIBC__)
 # include <pty.h>
 #elif defined CONFIG_BSD
+# include <termios.h>
 # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
 #  include <libutil.h>
 # else

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific
  2013-05-14 16:35     ` Paolo Bonzini
@ 2013-05-14 19:28       ` Laszlo Ersek
  2013-05-14 19:59         ` Eric Blake
  0 siblings, 1 reply; 10+ messages in thread
From: Laszlo Ersek @ 2013-05-14 19:28 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Anthony Liguori, qemu-devel, Brad Smith

On 05/14/13 18:35, Paolo Bonzini wrote:
> Il 14/05/2013 18:15, Brad Smith ha scritto:
>> On Tue, May 14, 2013 at 04:10:56PM -0000, Anthony Liguori wrote:
>>> 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.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific
  2013-05-14 12:05 [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific Paolo Bonzini
  2013-05-14 16:10 ` Anthony Liguori
  2013-05-14 18:30 ` Brad Smith
@ 2013-05-14 19:34 ` Peter Maydell
  2 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2013-05-14 19:34 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Anthony Liguori, qemu-devel, brad

On 14 May 2013 13:05, Paolo Bonzini <pbonzini@redhat.com> wrote:
> This should fix building the GTK+ front-end on BSDs.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Hi. This patch breaks the build on MacOSX:

manooth$ make block/vdi.o
	CHK version_gen.h
  CC    block/vdi.o
block/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


> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -42,6 +42,18 @@
>  #include <signal.h>
>  #include "glib-compat.h"
>
> +#if defined(__GLIBC__)
> +# include <pty.h>
> +#elif defined CONFIG_BSD
> +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
> +#  include <libutil.h>
> +# else
> +#  include <util.h>
> +# endif
> +#elif defined CONFIG_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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific
  2013-05-14 19:28       ` Laszlo Ersek
@ 2013-05-14 19:59         ` Eric Blake
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Blake @ 2013-05-14 19:59 UTC (permalink / raw)
  To: Laszlo Ersek; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel, Brad Smith

[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]

On 05/14/2013 01:28 PM, Laszlo Ersek wrote:

> 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... :)

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).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific
  2013-05-14 18:30 ` Brad Smith
@ 2013-05-14 21:06   ` Peter Maydell
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2013-05-14 21:06 UTC (permalink / raw)
  To: Brad Smith; +Cc: Paolo Bonzini, Anthony Liguori, qemu-devel

On 14 May 2013 19:30, Brad Smith <brad@comstyle.com> wrote:
> On Tue, May 14, 2013 at 02:05:21PM +0200, Paolo Bonzini wrote:
>> This should fix building the GTK+ front-end on BSDs.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  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.
>
>
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index af769f5..c944bb7 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -45,6 +45,7 @@
>  #if defined(__GLIBC__)
>  # include <pty.h>
>  #elif defined CONFIG_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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-05-14 21:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-14 12:05 [Qemu-devel] [PATCH for-1.5] portability: pty.h is glibc-specific Paolo Bonzini
2013-05-14 16:10 ` Anthony Liguori
2013-05-14 16:15   ` Brad Smith
2013-05-14 16:28     ` Anthony Liguori
2013-05-14 16:35     ` Paolo Bonzini
2013-05-14 19:28       ` Laszlo Ersek
2013-05-14 19:59         ` Eric Blake
2013-05-14 18:30 ` Brad Smith
2013-05-14 21:06   ` Peter Maydell
2013-05-14 19:34 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).