From nobody Mon May 6 12:20:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1573885847; cv=none; d=zoho.com; s=zohoarc; b=g+4mgT8WLVMy7OE5K1wC6qhyqJbDdiNNygHQRNQdObcdW5C2R0rE6Q8di2E5GnaABfa7+bj/x2kPYGZ0qOmBi2T7rJF1npzjgFXlwyAp6fnTI2DizBL7/8x0AzKgY9a4dAEik0YD7u95Yn1rL1H4J4qC3Tu3BEVTFMkC8fCsHKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573885847; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=5apz1YWXo7gkGE0NzmKojL5I52xAV++sj84P5ivJ++c=; b=izIMoDACVEyXMDoZFt8xvuWMdefEgSTF7lUNDbnc/6u9UOKFTTxvXQRUEh2Luo7DlguDUAvqVy9+qBRd4BAlguMH+LvE9hyqsxWwEogdeVfi/PLaICJSEs+jlDoIyGDMWxdKgaYCnYraW+Cs4tJc0IBco/6vLW5Crjy0MG61J+0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573885847424439.73087880202183; Fri, 15 Nov 2019 22:30:47 -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-348-Vma9oh-bM-ipl4oEpiXjGg-1; Sat, 16 Nov 2019 01:30:36 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA0051802CE1; Sat, 16 Nov 2019 06:30:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C61B21036C81; Sat, 16 Nov 2019 06:30:27 +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 202EA4BB78; Sat, 16 Nov 2019 06:30:22 +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 xAG6ULmv024987 for ; Sat, 16 Nov 2019 01:30:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id B7A2A60132; Sat, 16 Nov 2019 06:30:21 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A3CA6055E for ; Sat, 16 Nov 2019 06:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573885846; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5apz1YWXo7gkGE0NzmKojL5I52xAV++sj84P5ivJ++c=; b=Z3t8WqFGxcamTS6yHT63yy8tsqe1zASSZapP68GLT98iPpXIgl9NPcvKPOIJ9yElonzKgr 4tqiUjaD/+X70I8EunTA73Hc1LAf8ZeTTVCbLGgDPIxFNLba1AjCdw8aG25vTKNgafJiXH LXnxnJcJ3ctf5w0Imk411/qpE0rQ/VA= From: Michal Privoznik To: libvir-list@redhat.com Date: Sat, 16 Nov 2019 07:30:15 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] virbpf: Check if syscall() is available 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.84 on 10.5.11.22 X-MC-Unique: Vma9oh-bM-ipl4oEpiXjGg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" There are some OSes which don't have syscall() nor . We already check for the header file in configure phase, so we just need to add check for HAVE_SYS_SYSCALL_H to HAVE_DECL_BPF_PROG_QUERY. While I'm at it, some header files we are including are not needed, so their includes can be safely dropped. Signed-off-by: Michal Privoznik --- Pushed under build breaker rule. src/util/virbpf.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/util/virbpf.c b/src/util/virbpf.c index cb5562540b..44f13fb485 100644 --- a/src/util/virbpf.c +++ b/src/util/virbpf.c @@ -17,22 +17,19 @@ */ #include =20 -#include - -#include "internal.h" - -#include "viralloc.h" -#include "virbpf.h" -#include "virerror.h" -#include "virfile.h" #include "virlog.h" -#include "virstring.h" +#include "virerror.h" +#include "virbpf.h" =20 VIR_LOG_INIT("util.bpf"); =20 #define VIR_FROM_THIS VIR_FROM_BPF =20 -#if HAVE_DECL_BPF_PROG_QUERY +#if HAVE_SYS_SYSCALL_H && HAVE_DECL_BPF_PROG_QUERY +# include +# include + + int virBPFCreateMap(unsigned int mapType, unsigned int keySize, @@ -294,7 +291,11 @@ virBPFDeleteElem(int mapfd, =20 return syscall(SYS_bpf, BPF_MAP_DELETE_ELEM, &attr, sizeof(attr)); } -#else /* HAVE_DECL_BPF_PROG_QUERY */ + + +#else /* !HAVE_SYS_SYSCALL_H || !HAVE_DECL_BPF_PROG_QUERY */ + + int virBPFCreateMap(unsigned int mapType G_GNUC_UNUSED, unsigned int keySize G_GNUC_UNUSED, @@ -433,4 +434,4 @@ virBPFDeleteElem(int mapfd G_GNUC_UNUSED, _("BPF not supported with this kernel")); return -1; } -#endif /* HAVE_DECL_BPF_PROG_QUERY */ +#endif /* !HAVE_SYS_SYSCALL_H || !HAVE_DECL_BPF_PROG_QUERY */ --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list