[{"id":1766495,"web_url":"http://patchwork.ozlabs.org/comment/1766495/","msgid":"<aae5b3ae-f158-a7a6-fb8c-7726c2a18cd0@gmx.com>","list_archive_url":null,"date":"2017-09-11T20:09:16","subject":"Re: [Qemu-devel] [Qemu-trivial] [PATCH v2] Discover openpty(3)\n\tdynamically in configure","submitter":{"id":11273,"url":"http://patchwork.ozlabs.org/api/people/11273/","name":"Kamil Rytarowski","email":"n54@gmx.com"},"content":"On 11.09.2017 19:16, Kamil Rytarowski wrote:\n> openpty(3) might:\n>  - exists in libc (OSX)\n>  - exists in libutil (GNU, BSD)\n>  - does not exist (SmartOS)\n> \n> Add a function to discover this function in the ./configure script.\n> Add new config types: CONFIG_OPENPTY_LIBC and CONFIG_OPENPTY_LIBUTIL,\n> respectively defined when openpts(3) links with -lc or -lutil.\n> \n> Replace the condition adding -lutil in tests (for openpty(3)) from\n> CONFIG_POSIX to CONFIG_OPENPTY_LIBUTIL.\n> \n> Replace the fallback openpty(3) impelementation comment from Solaris\n> to SmartOS. Solaris is EOL'ed and it's confirmed that it does not work\n> on Oracle Solaris.\n\nSigned-off-by: Kamil Rytarowski <n54@gmx.com>\n\n> ---\n>  configure              | 25 +++++++++++++++++++++++++\n>  tests/Makefile.include |  2 +-\n>  util/qemu-openpty.c    |  4 ++--\n>  3 files changed, 28 insertions(+), 3 deletions(-)\n> \n> diff --git a/configure b/configure\n> index fd7e3a5e81..a614adcd29 100755\n> --- a/configure\n> +++ b/configure\n> @@ -3819,6 +3819,25 @@ EOF\n>    fi\n>  fi\n>  \n> +##########################################\n> +# openpty probe\n> +openpty_libc=no\n> +openpty_libutil=no\n> +cat > $TMPC << EOF\n> +extern int openpty(int *amaster, int *aslave, char *name, void *termp, void *winp);\n> +\n> +int main(void)\n> +{\n> +    int master_fd, slave_fd;\n> +    return openpty(&master_fd, &slave_fd, 0, 0, 0) == 0;\n> +}\n> +EOF\n> +if compile_prog \"\" \"\" ; then\n> +  openpty_libc=yes\n> +elif compile_prog \"\" \"-lutil\" ; then\n> +  openpty_libutil=yes\n> +fi\n> +\n>  ##########################################\n>  # signalfd probe\n>  signalfd=\"no\"\n> @@ -5788,6 +5807,12 @@ fi\n>  if test \"$fdt\" = \"yes\" ; then\n>    echo \"CONFIG_FDT=y\" >> $config_host_mak\n>  fi\n> +if test \"$openpty_libc\" = \"yes\" ; then\n> +  echo \"CONFIG_OPENPTY_LIBC=y\" >> $config_host_mak\n> +fi\n> +if test \"$openpty_libutil\" = \"yes\" ; then\n> +  echo \"CONFIG_OPENPTY_LIBUTIL=y\" >> $config_host_mak\n> +fi\n>  if test \"$signalfd\" = \"yes\" ; then\n>    echo \"CONFIG_SIGNALFD=y\" >> $config_host_mak\n>  fi\n> diff --git a/tests/Makefile.include b/tests/Makefile.include\n> index fae5715e9c..e7e0bc2724 100644\n> --- a/tests/Makefile.include\n> +++ b/tests/Makefile.include\n> @@ -814,7 +814,7 @@ tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)\n>  \trm $(INITRD_WORK_DIR)/init\n>  \trmdir $(INITRD_WORK_DIR)\n>  \n> -ifeq ($(CONFIG_POSIX),y)\n> +ifeq ($(CONFIG_OPENPTY_LIBUTIL),y)\n>  LIBS += -lutil\n>  endif\n>  \n> diff --git a/util/qemu-openpty.c b/util/qemu-openpty.c\n> index 2e8b43bdf5..62c87e5563 100644\n> --- a/util/qemu-openpty.c\n> +++ b/util/qemu-openpty.c\n> @@ -51,8 +51,8 @@\n>  # include <termios.h>\n>  #endif\n>  \n> -#ifdef __sun__\n> -/* Once Solaris has openpty(), this is going to be removed. */\n> +/* The fallback implementation is needed at least on SmartOS. */\n> +#if !defined(CONFIG_OPENPTY_LIBC) && !defined(CONFIG_OPENPTY_LIBUTIL)\n>  static int openpty(int *amaster, int *aslave, char *name,\n>                     struct termios *termp, struct winsize *winp)\n>  {\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xrf9M6T7qz9sBZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 06:07:34 +1000 (AEST)","from localhost ([::1]:60290 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drUzU-00060x-CJ\n\tfor incoming@patchwork.ozlabs.org; Mon, 11 Sep 2017 16:07:32 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:45421)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from <n54@gmx.com>)\n\tid 1drUyz-0005zR-LN\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 16:07:02 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <n54@gmx.com>) id 1drUyv-00004y-MO\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 16:07:01 -0400","from mout.gmx.net ([212.227.15.19]:55690)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <n54@gmx.com>)\n\tid 1drUyv-0008Ur-9H; Mon, 11 Sep 2017 16:06:57 -0400","from [192.168.1.3] ([185.58.161.191]) by mail.gmx.com (mrgmx001\n\t[212.227.17.184]) with ESMTPSA (Nemesis) id 0Ln8Tl-1dF8x10mvF-00hJEB; \n\tMon, 11 Sep 2017 22:06:54 +0200"],"To":"qemu-trivial@nongnu.org","References":"<20170903164952.26760-1-n54@gmx.com>\n\t<20170911171639.22005-1-n54@gmx.com>","From":"Kamil Rytarowski <n54@gmx.com>","Message-ID":"<aae5b3ae-f158-a7a6-fb8c-7726c2a18cd0@gmx.com>","Date":"Mon, 11 Sep 2017 22:09:16 +0200","User-Agent":"Mozilla/5.0 (X11; NetBSD amd64; rv:52.0) Gecko/20100101\n\tThunderbird/52.1.0","MIME-Version":"1.0","In-Reply-To":"<20170911171639.22005-1-n54@gmx.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"iVnRK52EjSv8F66TTJwmnqoEGJS6hHnGC\"","X-Provags-ID":"V03:K0:DaXfU9Y8n3ugr23oAZeYxtsSAnNYZ5nhSSfNNgq/ASW7GJKWwbt\n\tLhE7JKfpu1ETMa8jzyHc9vL5bcww1+E5nyM1JM1oKVCuv0D/rAUvrzneeVyK8BdvzCxp+cP\n\tW3Xok/0t2/dYG03pRvrmNtpQPvUAL6Mfk/NQvcsBtmbbgTJsihocUZ6SOUGGnnKKwhu/MIc\n\tddRFsLV6J+rqW+RAYu69A==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:dfHQqZVteew=:y5hKyjbpvVRqG1Eh9aImxV\n\tb8NP5cawUsXr0CIa05yH4FYTGjIf3/Tga4wHd4owW1gXxeGFi8zm4afW/9664rcfjq/W4ZwAF\n\tk/i4tYOE2g3SIYoqeL1QWggucDUIJ5T65MyCZL5FN3PjKY7CC+7ovJkAQg12t5o233ApEhFOu\n\tZcFUGKCOf76deBk12oUmXJBPJ5xaVSKK/blMHO/58mzBVI6J0SqYiROhs/l+fNWnuRdGQTpF+\n\tPeSNjtRgL6cM0N9V0lDZBa9kc9oKbyfMChFsALimSv3IqKsXeJVSffXjRjYKWsVTW6PW6A7po\n\tbSeOwAtmOiwecVBqa5MR2ldZoK8qP+8FsdZoneCm0uSVC651nPXE7sbd6F4zUoEovUYQhep94\n\tJrlriPAuAV3cIrJFM/4RLU6KmpJ1ygPaIDPOgmgOAaoeTlOVo+NysB6yU9+a2cC6qb4HiQLO2\n\tW/CZ2auF6TO7iFCxR45+edR6WjKjwdSG3wA2VpkvW8Z8oiziH8PGe/5cDV5NDo1aCU7+8an3S\n\tLhrqhATISxsouhiueN7Zl9/h76fOyT9U2yuJMC/cSNOToFK+c3pxeFPeiJRc0NWVpC8fawj+m\n\tRsegNqrEDelx1O9l3YZD89VrsSp9qxrEPyEZqWVZCDPQMLtZ6pslkhFYN46sB4bDf9/qBWxT1\n\tAC055msBCgmOrW6oKaqUT4exFLOS5ELwxFCo4rbv+9yhe9UMBr0kFUv9XFhERw/AVjIOszxr+\n\tzLI7lb2XDJeK6b7HgF1H+rlST/0HNb9RCJin1nIt1cXp88poTAQgXZq4sd4j1ccrd3cCjY5lf\n\tGMvjdN5sOji8JFA0Av0uuGXUYmG5g==","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"212.227.15.19","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [Qemu-trivial] [PATCH v2] Discover openpty(3)\n\tdynamically in configure","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"peter.maydell@linaro.org, jperkin@joyent.com, qemu-devel@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768616,"web_url":"http://patchwork.ozlabs.org/comment/1768616/","msgid":"<CAFEAcA-wNp2T7BGih1O3-Tq1+OrYNnM1VqAneM3QfXrd5u9ZPg@mail.gmail.com>","list_archive_url":null,"date":"2017-09-14T13:52:23","subject":"Re: [Qemu-devel] [PATCH v2] Discover openpty(3) dynamically in\n\tconfigure","submitter":{"id":5111,"url":"http://patchwork.ozlabs.org/api/people/5111/","name":"Peter Maydell","email":"peter.maydell@linaro.org"},"content":"On 11 September 2017 at 18:16, Kamil Rytarowski <n54@gmx.com> wrote:\n> openpty(3) might:\n>  - exists in libc (OSX)\n>  - exists in libutil (GNU, BSD)\n>  - does not exist (SmartOS)\n>\n> Add a function to discover this function in the ./configure script.\n> Add new config types: CONFIG_OPENPTY_LIBC and CONFIG_OPENPTY_LIBUTIL,\n> respectively defined when openpts(3) links with -lc or -lutil.\n>\n> Replace the condition adding -lutil in tests (for openpty(3)) from\n> CONFIG_POSIX to CONFIG_OPENPTY_LIBUTIL.\n>\n> Replace the fallback openpty(3) impelementation comment from Solaris\n> to SmartOS. Solaris is EOL'ed and it's confirmed that it does not work\n> on Oracle Solaris.\n> ---\n>  configure              | 25 +++++++++++++++++++++++++\n>  tests/Makefile.include |  2 +-\n>  util/qemu-openpty.c    |  4 ++--\n>  3 files changed, 28 insertions(+), 3 deletions(-)\n>\n> diff --git a/configure b/configure\n> index fd7e3a5e81..a614adcd29 100755\n> --- a/configure\n> +++ b/configure\n> @@ -3819,6 +3819,25 @@ EOF\n>    fi\n>  fi\n>\n> +##########################################\n> +# openpty probe\n> +openpty_libc=no\n> +openpty_libutil=no\n> +cat > $TMPC << EOF\n> +extern int openpty(int *amaster, int *aslave, char *name, void *termp, void *winp);\n\nI think the need to provide a prototype here rather than\nusing the system header to define it is revealing that we\nalso need a configure test for\n * openpty() in <pty.h>\n * openpty() in <libutil.h>\n * openpty() in <util.h>\n\nSomething like this untested code ought to do:\n\ncat > $TMPC << EOF\n#if defined(CONFIG_OPENPTY_IN_PTY_H)\n#include <pty.h>\n#elif defined(CONFIG_OPENPTY_IN_LIBUTIL_H)\n#include <libutil.h>\n#elif defined(CONFIG_OPENPTY_IN_UTIL_H)\n#include <util.h>\n#endif\nint main(void) { return openpty(0, 0, 0, 0, 0); }\nEOF\n\n# Different platforms put openpty() in different headers,\n# and may or may not need us to link against -lutil\nif compile_prog -DCONFIG_OPENPTY_IN_PTY_H \"\"; then\n  openpty_in_pty_h=yes\nelif compile_prog -D_CONFIG_OPENPTY_IN_PTY_H -lutil; then\n  openpty_in_pty_h=yes\n  openpty_libutil=yes\nelif compile_object -DCONFIG_OPENPTY_IN_LIBUTIL_H; then\n  openpty_in_libutil_h=yes\nelif compile_prog -D_CONFIG_OPENPTY_IN_LIBUTIL_H -lutil; then\n  openpty_in_libutil_h=yes\n  openpty_libutil=yes\nelif compile_object -DCONFIG_OPENPTY_IN_UTIL_H; then\n  openpty_in_util_h=yes\nelif compile_prog -D_CONFIG_OPENPTY_IN_UTIL_H -lutil; then\n  openpty_in_util_h=yes\n  openpty_libutil=yes\nfi\n\nThen in qemu-openpty.c we can do\n\n#include <termios.h>\n\n#if defined(CONFIG_OPENPTY_IN_PTY_H)\n#include <pty.h>\n#elif defined(CONFIG_OPENPTY_IN_LIBUTIL_H)\n#include <libutil.h>\n#elif defined(CONFIG_OPENPTY_IN_UTIL_H)\n#include <util.h>\n#else\n/* sunos fallback code */\n#endif\n\n\n> +if test \"$openpty_libc\" = \"yes\" ; then\n> +  echo \"CONFIG_OPENPTY_LIBC=y\" >> $config_host_mak\n> +fi\n\n\nIf we use the CONFIG_OPENPTY_IN_*_H constants as above\nwe don't need CONFIG_OPENPTY_LIBC any more.\n\nthanks\n-- PMM","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"OYYpiXDx\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtKkD2q9Jz9sCZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 23:53:24 +1000 (AEST)","from localhost ([::1]:47940 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsUa2-0001BS-Fw\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 09:53:22 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:46792)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dsUZS-00013P-RM\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 09:52:48 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dsUZR-00020w-QS\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 09:52:46 -0400","from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:43518)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <peter.maydell@linaro.org>)\n\tid 1dsUZR-0001y9-J9\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 09:52:45 -0400","by mail-wr0-x234.google.com with SMTP id a43so6013976wrc.0\n\tfor <qemu-devel@nongnu.org>; Thu, 14 Sep 2017 06:52:45 -0700 (PDT)","by 10.223.139.215 with HTTP; Thu, 14 Sep 2017 06:52:23 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=IWG2zu+JCq/QcPDFycnWZ962/QcHlX9mmmjJypgoiIo=;\n\tb=OYYpiXDxQiSDnee+P4or4uP87cT9ygi2KvQcoaolP4BbFU7h++yKamQCxCvbKlCrQU\n\t7H9+1ICJF4Nd16fd9gszmgxlO6UA+/IhI5JO4yWTl4em7RsOcde5kQdbBuFcbmTRd9+Z\n\tfQ1Q6r7RS+bE/2mkA3lSDlI4XWzlzZ2gu7lPs=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=IWG2zu+JCq/QcPDFycnWZ962/QcHlX9mmmjJypgoiIo=;\n\tb=i5DTUx1pqEB+ckPYrCJeofRmF4iJ9t3m9nq/WHn6qev5VBN1zkVEiBljAXQILhX/7+\n\tuDoh/E+nI+vh7AjTPZDh7QlPS08OZYlHHoVcvuNv3OyU/onLrDhCfDpb6n/q8A4BamUX\n\t4T/9qo5IU0AU6d3UqbJF7CzjLVkAoJGMvNNQu4SjLs0VoNwzyfg4oLoo5iGhT+8zJhQ+\n\t22lXt9gGH4KlqYbPI8KVd82fDoda/WyOas5lmOl5C2TKKrbEiuDSlyaaEjWv20HRaP2O\n\tWhmtOvYkXmDFDr906HwpEYKP5bnu0sjH1hZkvM2JY2RIico/R4N9yu1MQYkzi6Z5CXi9\n\tgYZQ==","X-Gm-Message-State":"AHPjjUgehLduVK7B9l498TwEtbw/uGVX9W1Li8VkgaBiT24MbH6jM99i\n\t2+72p8sTlztQTzx4o6na08cGdE/uXhGpfhd4j2UCdg==","X-Google-Smtp-Source":"ADKCNb4EoYAvRUbzEd+GjbYqNLOuyXO9jFT6FrSFb1NCTDzx6DzdTyNWb/OZjBbCPW5tfMsziAaI8QpEgV+mCVSUtLc=","X-Received":"by 10.223.134.174 with SMTP id 43mr20287619wrx.173.1505397164320;\n\tThu, 14 Sep 2017 06:52:44 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<20170911171639.22005-1-n54@gmx.com>","References":"<20170903164952.26760-1-n54@gmx.com>\n\t<20170911171639.22005-1-n54@gmx.com>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Thu, 14 Sep 2017 14:52:23 +0100","Message-ID":"<CAFEAcA-wNp2T7BGih1O3-Tq1+OrYNnM1VqAneM3QfXrd5u9ZPg@mail.gmail.com>","To":"Kamil Rytarowski <n54@gmx.com>","Content-Type":"text/plain; charset=\"UTF-8\"","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c0c::234","Subject":"Re: [Qemu-devel] [PATCH v2] Discover openpty(3) dynamically in\n\tconfigure","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"QEMU Trivial <qemu-trivial@nongnu.org>,\n\tJonathan Perkin <jperkin@joyent.com>,\n\tQEMU Developers <qemu-devel@nongnu.org>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1795307,"web_url":"http://patchwork.ozlabs.org/comment/1795307/","msgid":"<d0aa7605-c262-273f-7fab-94e72f202aa7@gmx.com>","list_archive_url":null,"date":"2017-10-28T17:07:46","subject":"Re: [Qemu-devel] [PATCH v2] Discover openpty(3) dynamically in\n\tconfigure","submitter":{"id":11273,"url":"http://patchwork.ozlabs.org/api/people/11273/","name":"Kamil Rytarowski","email":"n54@gmx.com"},"content":"On 14.09.2017 15:52, Peter Maydell wrote:\n> On 11 September 2017 at 18:16, Kamil Rytarowski <n54@gmx.com> wrote:\n>> openpty(3) might:\n>>  - exists in libc (OSX)\n>>  - exists in libutil (GNU, BSD)\n>>  - does not exist (SmartOS)\n>>\n>> Add a function to discover this function in the ./configure script.\n>> Add new config types: CONFIG_OPENPTY_LIBC and CONFIG_OPENPTY_LIBUTIL,\n>> respectively defined when openpts(3) links with -lc or -lutil.\n>>\n>> Replace the condition adding -lutil in tests (for openpty(3)) from\n>> CONFIG_POSIX to CONFIG_OPENPTY_LIBUTIL.\n>>\n>> Replace the fallback openpty(3) impelementation comment from Solaris\n>> to SmartOS. Solaris is EOL'ed and it's confirmed that it does not work\n>> on Oracle Solaris.\n>> ---\n>>  configure              | 25 +++++++++++++++++++++++++\n>>  tests/Makefile.include |  2 +-\n>>  util/qemu-openpty.c    |  4 ++--\n>>  3 files changed, 28 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/configure b/configure\n>> index fd7e3a5e81..a614adcd29 100755\n>> --- a/configure\n>> +++ b/configure\n>> @@ -3819,6 +3819,25 @@ EOF\n>>    fi\n>>  fi\n>>\n>> +##########################################\n>> +# openpty probe\n>> +openpty_libc=no\n>> +openpty_libutil=no\n>> +cat > $TMPC << EOF\n>> +extern int openpty(int *amaster, int *aslave, char *name, void *termp, void *winp);\n> \n> I think the need to provide a prototype here rather than\n> using the system header to define it is revealing that we\n> also need a configure test for\n>  * openpty() in <pty.h>\n>  * openpty() in <libutil.h>\n>  * openpty() in <util.h>\n> \n> Something like this untested code ought to do:\n> \n> cat > $TMPC << EOF\n> #if defined(CONFIG_OPENPTY_IN_PTY_H)\n> #include <pty.h>\n> #elif defined(CONFIG_OPENPTY_IN_LIBUTIL_H)\n> #include <libutil.h>\n> #elif defined(CONFIG_OPENPTY_IN_UTIL_H)\n> #include <util.h>\n> #endif\n> int main(void) { return openpty(0, 0, 0, 0, 0); }\n> EOF\n> \n> # Different platforms put openpty() in different headers,\n> # and may or may not need us to link against -lutil\n> if compile_prog -DCONFIG_OPENPTY_IN_PTY_H \"\"; then\n>   openpty_in_pty_h=yes\n> elif compile_prog -D_CONFIG_OPENPTY_IN_PTY_H -lutil; then\n>   openpty_in_pty_h=yes\n>   openpty_libutil=yes\n> elif compile_object -DCONFIG_OPENPTY_IN_LIBUTIL_H; then\n>   openpty_in_libutil_h=yes\n> elif compile_prog -D_CONFIG_OPENPTY_IN_LIBUTIL_H -lutil; then\n>   openpty_in_libutil_h=yes\n>   openpty_libutil=yes\n> elif compile_object -DCONFIG_OPENPTY_IN_UTIL_H; then\n>   openpty_in_util_h=yes\n> elif compile_prog -D_CONFIG_OPENPTY_IN_UTIL_H -lutil; then\n>   openpty_in_util_h=yes\n>   openpty_libutil=yes\n> fi\n> \n> Then in qemu-openpty.c we can do\n> \n> #include <termios.h>\n> \n> #if defined(CONFIG_OPENPTY_IN_PTY_H)\n> #include <pty.h>\n> #elif defined(CONFIG_OPENPTY_IN_LIBUTIL_H)\n> #include <libutil.h>\n> #elif defined(CONFIG_OPENPTY_IN_UTIL_H)\n> #include <util.h>\n> #else\n> /* sunos fallback code */\n> #endif\n> \n> \n>> +if test \"$openpty_libc\" = \"yes\" ; then\n>> +  echo \"CONFIG_OPENPTY_LIBC=y\" >> $config_host_mak\n>> +fi\n> \n> \n> If we use the CONFIG_OPENPTY_IN_*_H constants as above\n> we don't need CONFIG_OPENPTY_LIBC any more.\n> \n> thanks\n> -- PMM\n> \nHello,\n\nI've naively expected that once a build on a certain OS will be fixed,\nit will be functional for longer period (at least few weeks). In one\nmonth qemu has been broken on DragonFly and SmartOS so they are not just\nbroken in tests, but also in the basic build.\n\nSmartOS has new compatibility problems with grep(1) invocations and tpm\nemulator fatal build failure. Few old problems with conflicts with\nsystem headers like conflicts with symbols CS and REG_SP.\n\nThere are certainly other small incompatibility problems, after the\nbreakage. Just a remind that SmartOS was not capable to execute tests\nbecause of incompatible diff(1) invocations and unclear gmake(1)\nmisbehavior. And this was just the beginning of the problems.\n\nDragonFlyBSD has problems with PAGE_SIZE, PAGE_MASK clash with headers\nin s390x code. PAGE_MASK, PAGE_SHIFT and PAGE_SIZE in nand. No single\nGTESTER invocation passes.\n\nBecause there is need to fix the SmartOS build in order to improve this\nopenpty(3) patch, I'm resigning from it. I also resign from helping\nDragonFly port.\n\nI will focus entirely on the bits that I registered as a maintainer.\n\nI leave the decisions and steps about support of these platforms to\nother volunteers and qemu core maintainers.\n\n+ CC Antonio and Peter","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yPRwM0MV6z9t3l\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 29 Oct 2017 04:06:09 +1100 (AEDT)","from localhost ([::1]:33478 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1e8UYh-0005b2-0h\n\tfor incoming@patchwork.ozlabs.org; Sat, 28 Oct 2017 13:06:07 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:41486)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from <n54@gmx.com>)\n\tid 1e8UY7-0005ZC-HR\n\tfor qemu-devel@nongnu.org; Sat, 28 Oct 2017 13:05:32 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <n54@gmx.com>) id 1e8UY6-0004g0-41\n\tfor qemu-devel@nongnu.org; Sat, 28 Oct 2017 13:05:31 -0400","from mout.gmx.net ([212.227.17.21]:64930)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <n54@gmx.com>)\n\tid 1e8UY0-0004ch-67; Sat, 28 Oct 2017 13:05:24 -0400","from [192.168.1.3] ([185.58.161.191]) by mail.gmx.com (mrgmx102\n\t[212.227.17.174]) with ESMTPSA (Nemesis) id 0MVsUW-1dftzB2tZo-00X25s; \n\tSat, 28 Oct 2017 19:05:17 +0200"],"To":"Peter Maydell <peter.maydell@linaro.org>","References":"<20170903164952.26760-1-n54@gmx.com>\n\t<20170911171639.22005-1-n54@gmx.com>\n\t<CAFEAcA-wNp2T7BGih1O3-Tq1+OrYNnM1VqAneM3QfXrd5u9ZPg@mail.gmail.com>","From":"Kamil Rytarowski <n54@gmx.com>","Message-ID":"<d0aa7605-c262-273f-7fab-94e72f202aa7@gmx.com>","Date":"Sat, 28 Oct 2017 19:07:46 +0200","User-Agent":"Mozilla/5.0 (X11; NetBSD amd64; rv:52.0) Gecko/20100101\n\tThunderbird/52.1.0","MIME-Version":"1.0","In-Reply-To":"<CAFEAcA-wNp2T7BGih1O3-Tq1+OrYNnM1VqAneM3QfXrd5u9ZPg@mail.gmail.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"kXKATRI3JJQ2qNrKdkG2iWIaJswGXAvbU\"","X-Provags-ID":"V03:K0:ojzD+Qx8T0Djw47FYCav2+d3bluw7v5CrWHvrNHqJ1P6Y3d8myE\n\tZCxhYjeUbw3lQddpR+QeE/d3GCAiYv4pgEMIPYiea6/jQer1CINlOEf8rMEHUAi/s706zid\n\tfvLBk2bewwHX0Y2o+3bDjBHK4GMaD37iBMrXraSi/Cu3MnfKfOROEiLFwVnAdIgADiRpFqS\n\t9jn+VGvqaHbWT6w4XouOg==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:toF96NxWyRw=:oH7OFNEGSoNXmwYiG2HzgN\n\tH+yFJFshC8Mna66zremPU/uth4rs6DpMeL6Od9pGjQQMQ7A0OaoqAodMF4IbHVYt5B6Yvnt42\n\teVejs12PKR2JiqAClZSTh/qlPy5YtZNw1W23QCEHFzXm8S+6mIlK9p5PILKfsoqu8G9aUDOM3\n\tXyxy2LJ/lve5l0lenpfOW0vPJOJSD6dfVMde9B3DxGbWKzB75VqY6ohXSDFMPiHepA0jyz3P1\n\tq/BKSb1xx9f29e7SZdvogj7t/llHlsiD191zSB1yMElZGaklBON0xsZ9iVa3FUnhwlsdc0KdR\n\tXRw1jg9ipgG0DebGwUgR0zGOylgxG+p8UNgcJXWkt6f15jN51aEiqWSgw96bpk1ekR5RSOmLO\n\t1NtoPu70ZOejPmxmdxgZRotDRMv+OqF110jTioVm/iMXKaud9hzAoBZ84kuEQw1d2z4maDYgU\n\t6Uidtw+oMie/8FeNZOTTXhUKz2tECL3s70GWCUDP+ledNG+PKpmN1GXDftIzlTefOWzndhIdy\n\tso/eO317ZTEtfKrC/0Ue81+f2s2M6VwjLgM4/KbHvlTdKsL8gijBiBzELfbSkBbCXUvxLF+uv\n\tH7Movilkla6J7tYxee+4rK9zpqhTiOKVR2hU+rMhu8rO62BuQphgyPg1zZjNPMFz0dzPdl9k1\n\t2B+BwOLdkWWvFTmjwAQ0v3p/Gd8NLjuTJj5rUQBEyvCnI3x6lz0gtlAfzpfLrKMqDhOQoyHLw\n\tqfnzA9M+vbeVrTrg3lOj49ooH68/q+2zjuDfPSDv2/oe/PL113S0qEOPEYVrW1S9R/AEdtfTX\n\tpd6fl01/8Z41OFZbdxTjbKHLvVcIw==","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"212.227.17.21","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v2] Discover openpty(3) dynamically in\n\tconfigure","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"QEMU Trivial <qemu-trivial@nongnu.org>, Peter Tribble\n\t<peter.tribble@gmail.com>, \tJonathan Perkin <jperkin@joyent.com>,\n\t=?utf-8?q?Antonio_Huete_Jim?= =?utf-8?b?w6luZXo=?=\n\t<tuxillo@quantumachine.net>, \tQEMU Developers <qemu-devel@nongnu.org>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1797986,"web_url":"http://patchwork.ozlabs.org/comment/1797986/","msgid":"<CAFEAcA-E9TEay9xbeE9tZCHFvSLrE8R4V2ZttzEwoQN8JQzX9Q@mail.gmail.com>","list_archive_url":null,"date":"2017-11-02T15:14:53","subject":"Re: [Qemu-devel] [PATCH v2] Discover openpty(3) dynamically in\n\tconfigure","submitter":{"id":5111,"url":"http://patchwork.ozlabs.org/api/people/5111/","name":"Peter Maydell","email":"peter.maydell@linaro.org"},"content":"On 28 October 2017 at 18:07, Kamil Rytarowski <n54@gmx.com> wrote:\n> I've naively expected that once a build on a certain OS will be fixed,\n> it will be functional for longer period (at least few weeks). In one\n> month qemu has been broken on DragonFly and SmartOS so they are not just\n> broken in tests, but also in the basic build.\n\nYep; things do break if they're not tested, which is why I think\nwe have to have a host system being in our regular build/test\nprocess in order to be able to call it supported.\n\n> Because there is need to fix the SmartOS build in order to improve this\n> openpty(3) patch, I'm resigning from it. I also resign from helping\n> DragonFly port.\n>\n> I will focus entirely on the bits that I registered as a maintainer.\n>\n> I leave the decisions and steps about support of these platforms to\n> other volunteers and qemu core maintainers.\n\nThanks for your efforts with the BSD porting work; we appreciate\nit.\n\nthanks\n-- PMM","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"de2242Ts\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3ySTFD4C31z9sNc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  3 Nov 2017 02:16:16 +1100 (AEDT)","from localhost ([::1]:60731 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1eAHE6-0000KA-Mj\n\tfor incoming@patchwork.ozlabs.org; Thu, 02 Nov 2017 11:16:14 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:50831)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1eAHDA-0008Kk-Jy\n\tfor qemu-devel@nongnu.org; Thu, 02 Nov 2017 11:15:22 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1eAHD9-0002Wg-Mc\n\tfor qemu-devel@nongnu.org; Thu, 02 Nov 2017 11:15:16 -0400","from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:54671)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <peter.maydell@linaro.org>)\n\tid 1eAHD9-0002Vn-Gv\n\tfor qemu-devel@nongnu.org; Thu, 02 Nov 2017 11:15:15 -0400","by mail-wr0-x241.google.com with SMTP id o44so5330471wrf.11\n\tfor <qemu-devel@nongnu.org>; Thu, 02 Nov 2017 08:15:15 -0700 (PDT)","by 10.223.161.5 with HTTP; Thu, 2 Nov 2017 08:14:53 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=pvnajjDwjsCnmpowPW8kzvvEecqqGNFAIGqe3wysGVk=;\n\tb=de2242Tsp3/UU6fYcFCnazlyP0lGm8GtJVHG7ja15dbtdWpChI/Q7iEzcMW6XGLCnW\n\tkqRnpGJ85Ow0qInnmqTbA9zTkCpdDC0swypIaA0Z9Y4foGLDnMdp8/xOenLXFFexLyiz\n\t+E3BiQnOJNjMnL9pw2fpPIrSHgkDCexbXnAAg=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=pvnajjDwjsCnmpowPW8kzvvEecqqGNFAIGqe3wysGVk=;\n\tb=UDvU6f27wD1VxWNSXAWpj+MCNingxkalmQe7nnrCZuOwF+oJkBKsZE5rTcyBuUanKT\n\t1IC6hz0DlAB95oxuAm4xjB2Sm++QedXYdhS/TvH7d7/zTdcsn1X/iXs1rTW/PRnvmhyL\n\tS7bZHsWsvzMjOxvmM0tb/f2ypYivjorM8FO/zc2EmW/PSUZUvTktxhu6RcNK81Qn/r90\n\t722UEmL/sYCiNyFSq0cWa0jWFR9X+GLVc8xdP7CNiYGnZXaBKv2fZbx9dxOo2Adoxbkj\n\t0Su55qrO42wGuRLe33WjC3NOLovNf8fdPslj3ds0ZY6hyz2j3jH9AVg1VLCuounUSncv\n\txD/g==","X-Gm-Message-State":"AMCzsaVFD5CQLa76XuaCFkJWpiNAqiSjikn6VbDqSCMxH1IxLDfQagls\n\t2D5OTiBKXYVSVwiSM/h7LotcNFnVpgjwMpMM+aBdcA==","X-Google-Smtp-Source":"ABhQp+Thc74sSNy2f34uoKuaoViQMBqDqcEj40LnIaDXY79Bxo5zPYKLfyD0Ckbj+sT2AUZkIny4uI9Vt8rOnsyTxWU=","X-Received":"by 10.223.157.11 with SMTP id k11mr3405367wre.281.1509635714393; \n\tThu, 02 Nov 2017 08:15:14 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<d0aa7605-c262-273f-7fab-94e72f202aa7@gmx.com>","References":"<20170903164952.26760-1-n54@gmx.com>\n\t<20170911171639.22005-1-n54@gmx.com>\n\t<CAFEAcA-wNp2T7BGih1O3-Tq1+OrYNnM1VqAneM3QfXrd5u9ZPg@mail.gmail.com>\n\t<d0aa7605-c262-273f-7fab-94e72f202aa7@gmx.com>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Thu, 2 Nov 2017 15:14:53 +0000","Message-ID":"<CAFEAcA-E9TEay9xbeE9tZCHFvSLrE8R4V2ZttzEwoQN8JQzX9Q@mail.gmail.com>","To":"Kamil Rytarowski <n54@gmx.com>","Content-Type":"text/plain; charset=\"UTF-8\"","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c0c::241","Subject":"Re: [Qemu-devel] [PATCH v2] Discover openpty(3) dynamically in\n\tconfigure","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"QEMU Trivial <qemu-trivial@nongnu.org>, Peter Tribble\n\t<peter.tribble@gmail.com>, \tJonathan Perkin <jperkin@joyent.com>,\n\t=?utf-8?q?Antonio_Huete_Jim?= =?utf-8?b?w6luZXo=?=\n\t<tuxillo@quantumachine.net>, \tQEMU Developers <qemu-devel@nongnu.org>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]