From patchwork Thu Oct 20 12:36:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Quentin Monnet X-Patchwork-Id: 13013392 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC525C433FE for ; Thu, 20 Oct 2022 12:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229874AbiJTMhY (ORCPT ); Thu, 20 Oct 2022 08:37:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbiJTMhW (ORCPT ); Thu, 20 Oct 2022 08:37:22 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E776F13D19 for ; Thu, 20 Oct 2022 05:37:20 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id v11so4812129wmd.1 for ; Thu, 20 Oct 2022 05:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=isovalent-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DJc2WTeQ79aN7lw9j3ViprJPP9RDB1+5PaPrZJopgzo=; b=jchz0dVKbvRcD+RevPINYGXa69CHh5VGIHdmd+IHrWx/dxqHNVTAFQgvMSO2X82i7o qCa6RqnAbWXAcnR16P1HtZDsYruPrF5QFzbuz3R+NHpLpD7LUUdnNc5OMdkgTq+BZBof LmyxRCfPRhcdceD8tr/4LA0OnAnl4QjtjngfMghEmi7UbLG6CW3zFdr2rLrYyG8Yjsq8 3d3rxqp3gUZetLscfWZo401bRBbyot2C68AIx6GjvJ/3lUiseXmMkHFQLEJMmlENAKj8 WikoXkVPuHmF05EyRhgKwXkSWhxeIEgMsMxZv1QSCR2sUfWKft7i7OpVLkDfCQJfcxuq OEDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DJc2WTeQ79aN7lw9j3ViprJPP9RDB1+5PaPrZJopgzo=; b=WWgPTb9cY2omF3YsIy2fl/FnhQGXzvfPukmB/rT1jWJN5ZS+ECsDqCGVcvWzFdu8pR KX/FKNAmO1p0iRvfRftvjMmHRBQgs/rfO8U1VWl5anOYM0snKImmEpuRZ0DcXEioiIfB TBGsmqU31AW9OjzNBl7F4tItvevjgl3W1euUEmWtcywWJQZFIpI4ZEqfltfpEPiagRnX fFr+DlJhmfM8Ob9QWo8PDM7/yjqZjZkVTqg8DbEjKjeYGZ8Cm2gW87VFCWc78oreGZfE wlZYH2ApbISet+9FUxbHnbRjiwFQIZVSN8KydacRICz09onW++G6OzEFYtFvUArjifjl 2qMQ== X-Gm-Message-State: ACrzQf2X5cJ2kIaCewbBJGrmAhtWOYQg5a6cx8QV7coTGKNVQx/XXi+r bhyu2h54OO93oEztTlGAXQPmaUA6tE7naFLq X-Google-Smtp-Source: AMsMyM5miSJidwxoHhTghzhHpYYBtis7zszr6XqNG4KQ8DYXk1Crs4FZ6MEJgU8KxH4gbJyZ9NwFmg== X-Received: by 2002:a05:600c:6885:b0:3bd:d782:623c with SMTP id fn5-20020a05600c688500b003bdd782623cmr9091693wmb.102.1666269439485; Thu, 20 Oct 2022 05:37:19 -0700 (PDT) Received: from harfang.fritz.box ([51.155.200.13]) by smtp.gmail.com with ESMTPSA id h10-20020a5d504a000000b0022a9246c853sm16329581wrt.41.2022.10.20.05.37.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 05:37:18 -0700 (PDT) From: Quentin Monnet To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= , Simon Horman , Quentin Monnet , Song Liu Subject: [PATCH bpf-next v3 1/8] bpftool: Define _GNU_SOURCE only once Date: Thu, 20 Oct 2022 13:36:57 +0100 Message-Id: <20221020123704.91203-2-quentin@isovalent.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221020123704.91203-1-quentin@isovalent.com> References: <20221020123704.91203-1-quentin@isovalent.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net _GNU_SOURCE is defined in several source files for bpftool, but only one of them takes the precaution of checking whether the value is already defined. Add #ifndef for other occurrences too. This is in preparation for the support of disassembling JIT-ed programs with LLVM, with $(llvm-config --cflags) passing -D_GNU_SOURCE as a compilation argument. Signed-off-by: Quentin Monnet Tested-by: Niklas Söderlund Acked-by: Song Liu --- tools/bpf/bpftool/common.c | 2 ++ tools/bpf/bpftool/iter.c | 2 ++ tools/bpf/bpftool/jit_disasm.c | 2 ++ tools/bpf/bpftool/net.c | 2 ++ tools/bpf/bpftool/perf.c | 2 ++ tools/bpf/bpftool/prog.c | 2 ++ tools/bpf/bpftool/xlated_dumper.c | 2 ++ 7 files changed, 14 insertions(+) diff --git a/tools/bpf/bpftool/common.c b/tools/bpf/bpftool/common.c index 8727765add88..4c2e909a2d67 100644 --- a/tools/bpf/bpftool/common.c +++ b/tools/bpf/bpftool/common.c @@ -1,7 +1,9 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* Copyright (C) 2017-2018 Netronome Systems, Inc. */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include #include diff --git a/tools/bpf/bpftool/iter.c b/tools/bpf/bpftool/iter.c index f88fdc820d23..a3e6b167153d 100644 --- a/tools/bpf/bpftool/iter.c +++ b/tools/bpf/bpftool/iter.c @@ -1,7 +1,9 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) // Copyright (C) 2020 Facebook +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include #include diff --git a/tools/bpf/bpftool/jit_disasm.c b/tools/bpf/bpftool/jit_disasm.c index aaf99a0168c9..71cb258ab0ee 100644 --- a/tools/bpf/bpftool/jit_disasm.c +++ b/tools/bpf/bpftool/jit_disasm.c @@ -11,7 +11,9 @@ * Licensed under the GNU General Public License, version 2.0 (GPLv2) */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include #include diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c index 526a332c48e6..c40e44c938ae 100644 --- a/tools/bpf/bpftool/net.c +++ b/tools/bpf/bpftool/net.c @@ -1,7 +1,9 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) // Copyright (C) 2018 Facebook +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include #include diff --git a/tools/bpf/bpftool/perf.c b/tools/bpf/bpftool/perf.c index 226ec2c39052..91743445e4c7 100644 --- a/tools/bpf/bpftool/perf.c +++ b/tools/bpf/bpftool/perf.c @@ -2,7 +2,9 @@ // Copyright (C) 2018 Facebook // Author: Yonghong Song +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include #include diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index c81362a001ba..a31ae9f0c307 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c @@ -1,7 +1,9 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* Copyright (C) 2017-2018 Netronome Systems, Inc. */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include #include diff --git a/tools/bpf/bpftool/xlated_dumper.c b/tools/bpf/bpftool/xlated_dumper.c index 2d9cd6a7b3c8..6fe3134ae45d 100644 --- a/tools/bpf/bpftool/xlated_dumper.c +++ b/tools/bpf/bpftool/xlated_dumper.c @@ -1,7 +1,9 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* Copyright (C) 2018 Netronome Systems, Inc. */ +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #include #include #include