From nobody Sun Feb 8 16:30:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579188528; cv=none; d=zohomail.com; s=zohoarc; b=Jk8LFGt4HOj5OdkXen12ak8g6hve8CKW8k4vKwlf/HnuG/Tb7CJ40u7WVJ+ougB/rD1UeAh4XJ2Jwfx11UFOfpf9QTM+MCrgBSuGnDEQBka3u81zJdfM3ZBRcGkygJE1VTM0m4vYXMYKoF4ciPpE2MIig+F+A1lvC7VGHiqlBXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579188528; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=clSLuSCq0fXMFLFG8bNi8M0L9EQoYOE5lDJygmR70yE=; b=eBUvm4y5id+NQtOZuRTc/PW5i4gkWlTY2msiViqDB4bgjUMxarkRM+cuglJxTz7ZE7A4ifra9Mw3zT5LrcbP7Dlu1YL8reCdqF1+Vby1FtPzs85ca7s/a5JK622nTzECbDGlylJmiUZZa3u51XO61Fypd+Cr0n+7KuBgYJizAEc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1579188528380110.42093582792722; Thu, 16 Jan 2020 07:28:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194-ZOVKUw29MyiMI6HfeVx1SA-1; Thu, 16 Jan 2020 10:28:43 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CBDD8801E77; Thu, 16 Jan 2020 15:28:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4AED60F82; Thu, 16 Jan 2020 15:28:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 677C718034EB; Thu, 16 Jan 2020 15:28:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00GFRRD2025962 for ; Thu, 16 Jan 2020 10:27:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2693381207; Thu, 16 Jan 2020 15:27:27 +0000 (UTC) Received: from catbus.gsslab.fab.redhat.com (mustard.gsslab.fab.redhat.com [10.33.8.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67B4E81206; Thu, 16 Jan 2020 15:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579188527; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=clSLuSCq0fXMFLFG8bNi8M0L9EQoYOE5lDJygmR70yE=; b=QDQP6yjojlvyAhpmqXH6aDfEeXE5P1ZlXVrml3JdVf6EpimNaAcWg47xVc+WvfFZR+8c9U abptn9I3zr4/2QAgf8axrlBQUc4hh9wf4OgBxotZUvgFN4qW1o+x+p9fxepeQsKisVcilG K4mFIxiYW8uSyS3FXA2/x7BLs2FWzM8= From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 05/13] util: add detection of openpty function Date: Thu, 16 Jan 2020 15:24:40 +0000 Message-Id: <20200116152448.592267-6-berrange@redhat.com> In-Reply-To: <20200116152448.592267-1-berrange@redhat.com> References: <20200116152448.592267-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Pavel Hrdina X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: ZOVKUw29MyiMI6HfeVx1SA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" All UNIX platforms we care about have openpty() in the libutil library. Use of pty.h must also be made conditional, excluding Win32. Reviewed-by: Pavel Hrdina Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 3 +++ configure.ac | 4 ++++ src/util/Makefile.inc.am | 1 + src/util/virfile.c | 14 +++++++++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index 1fd11093d8..687a4ef368 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -2342,3 +2342,6 @@ exclude_file_name_regexp--sc_prohibit_strcmp =3D \ =20 exclude_file_name_regexp--sc_prohibit_backslash_alignment =3D \ ^build-aux/syntax-check\.mk$$ + +exclude_file_name_regexp--sc_prohibit_always_true_header_tests =3D \ + ^src/util/virfile\.c$$ diff --git a/configure.ac b/configure.ac index 8837928358..b28ed4a6dc 100644 --- a/configure.ac +++ b/configure.ac @@ -383,10 +383,13 @@ dnl Availability of various common headers (non-fatal= if missing). AC_CHECK_HEADERS([\ ifaddrs.h \ libtasn1.h \ + util.h \ + libutil.h \ linux/magic.h \ mntent.h \ net/ethernet.h \ netinet/tcp.h \ + pty.h \ pwd.h \ stdarg.h \ syslog.h \ @@ -430,6 +433,7 @@ dnl header could be found. AM_CONDITIONAL([HAVE_LIBTASN1], [test "x$ac_cv_header_libtasn1_h" =3D "xye= s"]) =20 AC_CHECK_LIB([intl],[gettext],[]) +AC_CHECK_LIB([util],[openpty],[]) =20 =20 dnl diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am index dfa8347853..23de4a6375 100644 --- a/src/util/Makefile.inc.am +++ b/src/util/Makefile.inc.am @@ -282,6 +282,7 @@ libvirt_util_la_CFLAGS =3D \ $(NULL) libvirt_util_la_LIBADD =3D \ -lm \ + $(OPENPTY_LIBS) \ $(CAPNG_LIBS) \ $(YAJL_LIBS) \ $(LIBNL_LIBS) \ diff --git a/src/util/virfile.c b/src/util/virfile.c index 6eaabf5371..8bd03f8176 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -27,7 +27,19 @@ =20 #include #include -#include +#include +#ifdef HAVE_PTY_H +/* Linux openpty */ +# include +#endif /* !HAVE_PTY_H */ +#ifdef HAVE_UTIL_H +/* macOS openpty */ +# include +#endif /* !HAVE_LIBUTIL_H */ +#ifdef HAVE_LIBUTIL_H +/* FreeBSD openpty */ +# include +#endif /* !HAVE_LIBUTIL_H */ #include #include #include --=20 2.24.1