All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kamil Rytarowski <n54@gmx.com>
To: qemu-trivial@nongnu.org
Cc: peter.maydell@linaro.org, jperkin@joyent.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH v2] Discover openpty(3) dynamically in configure
Date: Mon, 11 Sep 2017 22:09:16 +0200	[thread overview]
Message-ID: <aae5b3ae-f158-a7a6-fb8c-7726c2a18cd0@gmx.com> (raw)
In-Reply-To: <20170911171639.22005-1-n54@gmx.com>

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

On 11.09.2017 19:16, Kamil Rytarowski wrote:
> openpty(3) might:
>  - exists in libc (OSX)
>  - exists in libutil (GNU, BSD)
>  - does not exist (SmartOS)
> 
> Add a function to discover this function in the ./configure script.
> Add new config types: CONFIG_OPENPTY_LIBC and CONFIG_OPENPTY_LIBUTIL,
> respectively defined when openpts(3) links with -lc or -lutil.
> 
> Replace the condition adding -lutil in tests (for openpty(3)) from
> CONFIG_POSIX to CONFIG_OPENPTY_LIBUTIL.
> 
> Replace the fallback openpty(3) impelementation comment from Solaris
> to SmartOS. Solaris is EOL'ed and it's confirmed that it does not work
> on Oracle Solaris.

Signed-off-by: Kamil Rytarowski <n54@gmx.com>

> ---
>  configure              | 25 +++++++++++++++++++++++++
>  tests/Makefile.include |  2 +-
>  util/qemu-openpty.c    |  4 ++--
>  3 files changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index fd7e3a5e81..a614adcd29 100755
> --- a/configure
> +++ b/configure
> @@ -3819,6 +3819,25 @@ EOF
>    fi
>  fi
>  
> +##########################################
> +# openpty probe
> +openpty_libc=no
> +openpty_libutil=no
> +cat > $TMPC << EOF
> +extern int openpty(int *amaster, int *aslave, char *name, void *termp, void *winp);
> +
> +int main(void)
> +{
> +    int master_fd, slave_fd;
> +    return openpty(&master_fd, &slave_fd, 0, 0, 0) == 0;
> +}
> +EOF
> +if compile_prog "" "" ; then
> +  openpty_libc=yes
> +elif compile_prog "" "-lutil" ; then
> +  openpty_libutil=yes
> +fi
> +
>  ##########################################
>  # signalfd probe
>  signalfd="no"
> @@ -5788,6 +5807,12 @@ fi
>  if test "$fdt" = "yes" ; then
>    echo "CONFIG_FDT=y" >> $config_host_mak
>  fi
> +if test "$openpty_libc" = "yes" ; then
> +  echo "CONFIG_OPENPTY_LIBC=y" >> $config_host_mak
> +fi
> +if test "$openpty_libutil" = "yes" ; then
> +  echo "CONFIG_OPENPTY_LIBUTIL=y" >> $config_host_mak
> +fi
>  if test "$signalfd" = "yes" ; then
>    echo "CONFIG_SIGNALFD=y" >> $config_host_mak
>  fi
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index fae5715e9c..e7e0bc2724 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -814,7 +814,7 @@ tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
>  	rm $(INITRD_WORK_DIR)/init
>  	rmdir $(INITRD_WORK_DIR)
>  
> -ifeq ($(CONFIG_POSIX),y)
> +ifeq ($(CONFIG_OPENPTY_LIBUTIL),y)
>  LIBS += -lutil
>  endif
>  
> diff --git a/util/qemu-openpty.c b/util/qemu-openpty.c
> index 2e8b43bdf5..62c87e5563 100644
> --- a/util/qemu-openpty.c
> +++ b/util/qemu-openpty.c
> @@ -51,8 +51,8 @@
>  # include <termios.h>
>  #endif
>  
> -#ifdef __sun__
> -/* Once Solaris has openpty(), this is going to be removed. */
> +/* The fallback implementation is needed at least on SmartOS. */
> +#if !defined(CONFIG_OPENPTY_LIBC) && !defined(CONFIG_OPENPTY_LIBUTIL)
>  static int openpty(int *amaster, int *aslave, char *name,
>                     struct termios *termp, struct winsize *winp)
>  {
> 



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

  reply	other threads:[~2017-09-11 20:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-03 16:49 [Qemu-devel] [PATCH] tests: Do not include lutil on SunOS Kamil Rytarowski
2017-09-04  9:32 ` Peter Maydell
2017-09-04 23:46   ` Kamil Rytarowski
2017-09-05  9:16     ` Peter Maydell
2017-09-11 17:16 ` [Qemu-devel] [PATCH v2] Discover openpty(3) dynamically in configure Kamil Rytarowski
2017-09-11 20:09   ` Kamil Rytarowski [this message]
2017-09-14 13:52   ` Peter Maydell
2017-10-28 17:07     ` Kamil Rytarowski
2017-11-02 15:14       ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aae5b3ae-f158-a7a6-fb8c-7726c2a18cd0@gmx.com \
    --to=n54@gmx.com \
    --cc=jperkin@joyent.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.