Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp577744pxp; Sat, 5 Mar 2022 11:58:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXGf3emmGJ++TA8c1MzW87NDWIMVNt+nuXzjuq8RZ6jSvJkhoBt3j/x7kAtDRpXeVuECes X-Received: by 2002:a17:907:6d1d:b0:6d8:9fc8:b1e1 with SMTP id sa29-20020a1709076d1d00b006d89fc8b1e1mr3624125ejc.466.1646510335895; Sat, 05 Mar 2022 11:58:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646510335; cv=none; d=google.com; s=arc-20160816; b=AeoHRcbQ10DSHdDNH2vgALoNKVaRamiAb3WWLlefck5U+tB7If6e6wc0G/CswXfVM6 WpNwDd/OtqcCQDvjCq74I1tvDHFy7HaLD37gcwFX+YOIq0mT7GPp+TD+844K8DiyFRz+ PRn3fADnNFXYG4brzISiQER/6pD1LoIdaWgqh6nUxRdZjARc3I5PD6BKPsO/q796QzoT pjwxnRwy+Wa/uJn5a6EI20zZoUWdf7w77Jk0azJ+D/DKdjafPtYifk2r6SVIulGXE72h lQ3tztDmDxVKhRM9oO9hh/SRy4s9JICuYrk9wKXhXbe2qGosjHMlP6yGpj3c5hN0xIFy c0TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=nLa4Cpd6Xd8qLrAmRhbVrWhN1Lu5pmble/aRSf36KTE=; b=OIKioSegzX04bcR2Y8Vn44Pb/d+ykzQgtYNvqUa/H/qSGSVgJLTkW2Tb+brN6jz7j0 +STCZFpJnZFvHd9n1+UUFlPvNomY3PIAq00QNfUCWcLA4kjTuWnYZz37NM7blne3gR3Y kPKj9ySCWXV863iQjS59+v5UmYHxoI92lttNonxEYjWxz6cS3ijVvhdwIM/dx/PXA1V8 vifkAsefe+8d6h47Mcx92O+8DoXj4e8LqUdQ+01ehT6sIDQHzWZ+4PgavR4c5beAW6Dx Dbe8IHBI+K3Noqi64WZ1bRjiXHB4+6jFaoxEbBLA5y+ZtfWCaElXoH9vafeWGxyR/zm4 EFrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CKhBgN8O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec16-20020a170906b6d000b006b0d08d0dbasi5206194ejb.846.2022.03.05.11.58.31; Sat, 05 Mar 2022 11:58:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CKhBgN8O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231217AbiCEJzm (ORCPT + 99 others); Sat, 5 Mar 2022 04:55:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230077AbiCEJzm (ORCPT ); Sat, 5 Mar 2022 04:55:42 -0500 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB09357143; Sat, 5 Mar 2022 01:54:52 -0800 (PST) Received: by mail-oi1-x231.google.com with SMTP id z8so6995414oix.3; Sat, 05 Mar 2022 01:54:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=nLa4Cpd6Xd8qLrAmRhbVrWhN1Lu5pmble/aRSf36KTE=; b=CKhBgN8Od9ZbW7JxeJRyxUI27hWxrvhyWv3lj4zpjleUIxL/LxTr1VyHR9lgL6ia55 9M/xIDy3uP6t4/jsmMpPMw/FFP+0XSEHGuLRV3XuHJ/4hU80umxifaHhljXdQx6+NSA7 7cZTxxAyhjuiRnfvVrtztKtVyBg3PpQM8qDm1X0GwoN3pFZw41mHAtlwUOSD0qrADfRw lyf3lZrhabJz/g2bowqISwAd/Lp5WU05d47Ki160GMIgXeDdqE+8obsm0NRF3PiYvNc8 OJ68zBTRFxa0ovXwR9yYCx2XOKhWY+vui5WUImVRpLUcqQV3oLCNiFh3/+mjz4rgov/u qnXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=nLa4Cpd6Xd8qLrAmRhbVrWhN1Lu5pmble/aRSf36KTE=; b=m7laIspBloAXE4zkjlHtsk5g8x0r91/o4n2ajwUSmLDMndwxxNIi9gm3RBEJETYGk2 lXV/mPIl541Se11x9O918mFe6TYMEz4qNxTd26hpWG7UPJJF9btE2JBlwQzvhJTRIYTM fv8AiDt0Uh0bekKrJ545MrbEVwZvlht3wDo5S5Rs9Ul13469PsAkSQPIhNoHEK7VI6z8 vpZCtaLLt70xqyRkV598CVod2GL8uYuY7wZjgPYtXR6pcVNyeYsNhrGD5RcmlvkMR6xF htXX3iNLFJEYra3bmalXy5HDYSfAseqpdgVziOtdfiibBbQsLx1lBq+jzdMLEMpezQTu xjWQ== X-Gm-Message-State: AOAM53252cayekWPeyJtFcoLXSgliMm3ozLv5952MMVW/k2ZRVF6IPJZ oSxxcMlqPnniv4gTWzVTTtU7iZ0+j3CsSR3jsSU= X-Received: by 2002:a05:6808:bce:b0:2d9:a01a:487d with SMTP id o14-20020a0568080bce00b002d9a01a487dmr1833093oik.200.1646474092109; Sat, 05 Mar 2022 01:54:52 -0800 (PST) MIME-Version: 1.0 References: <20220227142551.2349805-1-james.hilliard1@gmail.com> <6af1530a-a4bf-dccf-947d-78ce235a4414@iogearbox.net> In-Reply-To: <6af1530a-a4bf-dccf-947d-78ce235a4414@iogearbox.net> From: James Hilliard Date: Sat, 5 Mar 2022 02:54:41 -0700 Message-ID: Subject: Re: [PATCH 1/1] libbpf: ensure F_DUPFD_CLOEXEC is defined To: Daniel Borkmann Cc: bpf@vger.kernel.org, Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 28, 2022 at 8:00 AM Daniel Borkmann wrot= e: > > Hi James, > > On 2/27/22 3:25 PM, James Hilliard wrote: > > This definition seems to be missing from some older toolchains. > > > > Note that the fcntl.h in libbpf_internal.h is not a kernel header > > but rather a toolchain libc header. > > > > Fixes: > > libbpf_internal.h:521:18: error: 'F_DUPFD_CLOEXEC' undeclared (first us= e in this function); did you mean 'FD_CLOEXEC'? > > fd =3D fcntl(fd, F_DUPFD_CLOEXEC, 3); > > ^~~~~~~~~~~~~~~ > > FD_CLOEXEC > > > > Signed-off-by: James Hilliard > > Do you have some more info on your env (e.g. libc)? Looks like F_DUPFD_CL= OEXEC > was added back in 2.6.24 kernel. When did libc add it? > > Should we instead just add an include for to libbpf_inter= nal.h > (given it defines F_DUPFD_CLOEXEC as well)? That seems to cause a conflict: error: redefinition of =E2=80=98struct floc= k=E2=80=99 > > > --- > > tools/lib/bpf/libbpf_internal.h | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_int= ernal.h > > index 4fda8bdf0a0d..d2a86b5a457a 100644 > > --- a/tools/lib/bpf/libbpf_internal.h > > +++ b/tools/lib/bpf/libbpf_internal.h > > @@ -31,6 +31,10 @@ > > #define EM_BPF 247 > > #endif > > > > +#ifndef F_DUPFD_CLOEXEC > > +#define F_DUPFD_CLOEXEC 1030 > > +#endif > > + > > #ifndef R_BPF_64_64 > > #define R_BPF_64_64 1 > > #endif > > > > Thanks, > Daniel