From nobody Wed Jul 9 23:32:46 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15124046411968.231844872307875; Mon, 4 Dec 2017 08:24:01 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D7E534ACBB; Mon, 4 Dec 2017 16:23:59 +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 B087B5DA6D; Mon, 4 Dec 2017 16:23:59 +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 1DC6C1800BDF; Mon, 4 Dec 2017 16:23:59 +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 vB4GNvSC019446 for ; Mon, 4 Dec 2017 11:23:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id F02D66F44E; Mon, 4 Dec 2017 16:23:57 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.40.205.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1348C600CC for ; Mon, 4 Dec 2017 16:23:56 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 4 Dec 2017 17:23:45 +0100 Message-Id: <20171204162347.8183-2-abologna@redhat.com> In-Reply-To: <20171204162347.8183-1-abologna@redhat.com> References: <20171204162347.8183-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] util: gettid() is Linux-specific 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 04 Dec 2017 16:24:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The manual page clearly states that gettid() is Linux-specific and should not be used in programs that are intended to be portable. Unfortunately, it looks like macOS implemented the functionality and defined SYS_gettid accordingly, only to deprecate syscall() altogether with 10.12 (Sierra), released last late year. To avoid compilation errors, call gettid() on Linux only. Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrange --- src/util/virthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virthread.c b/src/util/virthread.c index 6c495158f..05b5572f5 100644 --- a/src/util/virthread.c +++ b/src/util/virthread.c @@ -268,7 +268,7 @@ bool virThreadIsSelf(virThreadPtr thread) * the pthread_self() id on Linux. */ unsigned long long virThreadSelfID(void) { -#if defined(HAVE_SYS_SYSCALL_H) && defined(SYS_gettid) +#if defined(HAVE_SYS_SYSCALL_H) && defined(SYS_gettid) && defined(__linux_= _) pid_t tid =3D syscall(SYS_gettid); return tid; #else --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list