[PATCH] chardev: Add macOS to list of OSes that support -chardev serial

Mikhail Gusarov posted 1 patch 5 years, 7 months ago
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test checkpatch passed
Test FreeBSD passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200426210956.17324-1-dottedmag@dottedmag.net
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>
chardev/char-serial.c | 2 +-
include/qemu/osdep.h  | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[PATCH] chardev: Add macOS to list of OSes that support -chardev serial
Posted by Mikhail Gusarov 5 years, 7 months ago
macOS API for dealing with serial ports/ttys is identical to BSDs.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
---

Note that the same file has a line
> #endif /* linux || sun */
that is severely out of date.

 chardev/char-serial.c | 2 +-
 include/qemu/osdep.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/chardev/char-serial.c b/chardev/char-serial.c
index 5b833ea077..7c3d84ae24 100644
--- a/chardev/char-serial.c
+++ b/chardev/char-serial.c
@@ -53,7 +53,7 @@ static void qmp_chardev_open_serial(Chardev *chr,
 
 #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)      \
     || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
-    || defined(__GLIBC__)
+    || defined(__GLIBC__) || defined(__APPLE__)
 
 static void tty_serial_init(int fd, int speed,
                             int parity, int data_bits, int stop_bits)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 20f5c5f197..ff7c17b857 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -379,7 +379,7 @@ void qemu_anon_ram_free(void *ptr, size_t size);
 #define HAVE_CHARDEV_SERIAL 1
 #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)    \
     || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
-    || defined(__GLIBC__)
+    || defined(__GLIBC__) || defined(__APPLE__)
 #define HAVE_CHARDEV_SERIAL 1
 #endif
 
-- 
2.19.1


Re: [PATCH] chardev: Add macOS to list of OSes that support -chardev serial
Posted by Philippe Mathieu-Daudé 5 years, 7 months ago
On 4/26/20 11:09 PM, Mikhail Gusarov wrote:
> macOS API for dealing with serial ports/ttys is identical to BSDs.
> 
> Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
> ---
> 
> Note that the same file has a line
>> #endif /* linux || sun */
> that is severely out of date.
> 
>  chardev/char-serial.c | 2 +-
>  include/qemu/osdep.h  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/chardev/char-serial.c b/chardev/char-serial.c
> index 5b833ea077..7c3d84ae24 100644
> --- a/chardev/char-serial.c
> +++ b/chardev/char-serial.c
> @@ -53,7 +53,7 @@ static void qmp_chardev_open_serial(Chardev *chr,
>  
>  #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)      \
>      || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
> -    || defined(__GLIBC__)
> +    || defined(__GLIBC__) || defined(__APPLE__)
>  
>  static void tty_serial_init(int fd, int speed,
>                              int parity, int data_bits, int stop_bits)
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 20f5c5f197..ff7c17b857 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -379,7 +379,7 @@ void qemu_anon_ram_free(void *ptr, size_t size);
>  #define HAVE_CHARDEV_SERIAL 1
>  #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)    \
>      || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
> -    || defined(__GLIBC__)
> +    || defined(__GLIBC__) || defined(__APPLE__)
>  #define HAVE_CHARDEV_SERIAL 1
>  #endif
>  
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Re: [PATCH] chardev: Add macOS to list of OSes that support -chardev serial
Posted by Laurent Vivier 5 years, 7 months ago
Le 26/04/2020 à 23:09, Mikhail Gusarov a écrit :
> macOS API for dealing with serial ports/ttys is identical to BSDs.
> 
> Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
> ---
> 
> Note that the same file has a line
>> #endif /* linux || sun */
> that is severely out of date.
> 
>  chardev/char-serial.c | 2 +-
>  include/qemu/osdep.h  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/chardev/char-serial.c b/chardev/char-serial.c
> index 5b833ea077..7c3d84ae24 100644
> --- a/chardev/char-serial.c
> +++ b/chardev/char-serial.c
> @@ -53,7 +53,7 @@ static void qmp_chardev_open_serial(Chardev *chr,
>  
>  #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)      \
>      || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
> -    || defined(__GLIBC__)
> +    || defined(__GLIBC__) || defined(__APPLE__)
>  
>  static void tty_serial_init(int fd, int speed,
>                              int parity, int data_bits, int stop_bits)
> diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> index 20f5c5f197..ff7c17b857 100644
> --- a/include/qemu/osdep.h
> +++ b/include/qemu/osdep.h
> @@ -379,7 +379,7 @@ void qemu_anon_ram_free(void *ptr, size_t size);
>  #define HAVE_CHARDEV_SERIAL 1
>  #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)    \
>      || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
> -    || defined(__GLIBC__)
> +    || defined(__GLIBC__) || defined(__APPLE__)
>  #define HAVE_CHARDEV_SERIAL 1
>  #endif
>  
> 

Applied to my trivial-patches branch.

Thanks,
Laurent