Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2531159pxp; Mon, 7 Mar 2022 18:04:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzw8rqJ9sFJ14P3AaUr65XYpZwSkzTAevm2WZtL3tbvyGvk/c9GtaTbhshTvxNPDcsX48pN X-Received: by 2002:a17:90b:4a44:b0:1bf:8deb:9435 with SMTP id lb4-20020a17090b4a4400b001bf8deb9435mr15149pjb.16.1646705048456; Mon, 07 Mar 2022 18:04:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646705048; cv=none; d=google.com; s=arc-20160816; b=HkDO0bDSlB7OBKnYDX2vVo+vkpr0FkF7E1qhewajS613vRLkXJ9hgBhNBRuQMeSHhA 5HfpEHTh4bk2yyLHhr4zWtnvSdyEJPIqF/Hu0FemPjGQ3+8nu0n9Rl8gCOsOVzg1lQWr QtvoMs1poduGShR6OJM3Fup9OkwGqhJ9l1XiaMDSHu+ss52ckK3KgxBJbuGL4o73clgY 9l/tC0RiGhfau6hPRCoUJaTyPs6E/AzltKN/LpLlaZuFlbJH5aFlqs8xYs1pQruIYYkV IlX8uXrKvk5jX1mTIWNdNJObvz8oVXgLgqw29bGzGijdabjts7xLOeJz2N+I47VxBzvJ 8m6w== 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=GTL3hRdSnZee6BzFesghhjKeBSLzF5i+4W5RqXw7Zkg=; b=iNJTWwQw/U44YYvebz4oXgSENcKIZl1i1CWh6IPeeCYZ6Nv44q3W6HttC5NiQwe/Fe lHibYRxIUBbkdsZ2kl4Cn6xfwPnzFx7ChgHfUrVwLgs54p9neXRawGn/AECSBVRXQa92 h8CXBkXijs9/31lm0khnSgXGezlIElTcqnrQLGGmQBopE7gKdBUESBGSgWud8VP2GmbG qD/XJLDMmXEQNPQEodAHvH01Ka5dJ7nbzLxzrsXD+9IF+lC1bTdV3FeJ6Q8yUQErxihs fVXPoJ2Bn+QGQG4y4Lgp2YCUz22E6pXebhv9GlBJZ+03Ap0vZFFHtSR90YUDjdut9tn1 RHhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=p41SMB3+; 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 32-20020a631460000000b0036c42338354si14051084pgu.26.2022.03.07.18.03.50; Mon, 07 Mar 2022 18:04:08 -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=p41SMB3+; 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 S244439AbiCHBg1 (ORCPT + 99 others); Mon, 7 Mar 2022 20:36:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231329AbiCHBg0 (ORCPT ); Mon, 7 Mar 2022 20:36:26 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 001F12DD4E; Mon, 7 Mar 2022 17:35:30 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id r2so2127852iod.9; Mon, 07 Mar 2022 17:35:30 -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=GTL3hRdSnZee6BzFesghhjKeBSLzF5i+4W5RqXw7Zkg=; b=p41SMB3+qRRalMx3T7yDG23jzpjVDwf5lrQvOphsFv+oK99smM7BJs/BbWrnhPXTSw A9c3di/T9o86/qQ7oz926EmZx85glqgKRgyVt89e1zlLPBvcCpw9glDJztXThWcW7Tbz 2qjoARzp+lb6h5UkRUljQlq95WFKznrlJDoeOGfYFIUA84rv3poeOCBHGDEBSfrXsV3I uo3BtM61qV2AXr3pNsAPp7ESz03xoCHBrPCr4m+kc/Mz9nAOoLU5OaPz/WLeaunSj/+S NG/eimppi/mUKW1KMD59jzYmW1YNs0MrTKOlKM/xUoZGYFXDMcviSdIXlviCOuxhbona JiAQ== 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=GTL3hRdSnZee6BzFesghhjKeBSLzF5i+4W5RqXw7Zkg=; b=vxsMcHZBjoabz2406kaUwob17uqMp5KY2/BxCWkr963KPzNMfvvqXyPod0oXfwJOIJ TEmPQqnWYA/UkpPWW5OI2XkqClCCpPU57czb4A5XeZmv1M7jm/CcfW/lTQ6+cI4ALSY2 OQMGVVwU6eUEISMfzzwxx3yhRzfThhJPlSSyyKRtkExzvrRnNv26cGUdISHGV2xcFooz kKxsvgUbcQSBLztPeWqpvu97m1Bj2RYafevIl9BfQM/Z72pueaonwpgqM4Y4ZvpvjvHC Sx+SO3rqUCLJtOacTFgObWlWD5d8sP7TU6/w+NPYk8DC0/3ZTyIeO7m6ulxMNCx94doX p2vw== X-Gm-Message-State: AOAM533ecvqWF7HhEUvBagQ+Qt/zxUctXDgtb3IrzDks6VSQGnrAka01 wuPexEtOODiDgM0/StYNn1NFQqzjU/FNzPylju0= X-Received: by 2002:a05:6602:1605:b0:644:d491:1bec with SMTP id x5-20020a056602160500b00644d4911becmr12539919iow.63.1646703330317; Mon, 07 Mar 2022 17:35:30 -0800 (PST) MIME-Version: 1.0 References: <20220227142551.2349805-1-james.hilliard1@gmail.com> <6af1530a-a4bf-dccf-947d-78ce235a4414@iogearbox.net> In-Reply-To: From: Andrii Nakryiko Date: Mon, 7 Mar 2022 17:35:19 -0800 Message-ID: Subject: Re: [PATCH 1/1] libbpf: ensure F_DUPFD_CLOEXEC is defined To: James Hilliard Cc: Daniel Borkmann , bpf , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Networking , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Sat, Mar 5, 2022 at 1:54 AM James Hilliard w= rote: > > On Mon, Feb 28, 2022 at 8:00 AM Daniel Borkmann wr= ote: > > > > 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 = use 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_= CLOEXEC > > was added back in 2.6.24 kernel. When did libc add it? > > > > Should we instead just add an include for to libbpf_int= ernal.h > > (given it defines F_DUPFD_CLOEXEC as well)? > > That seems to cause a conflict: error: redefinition of =E2=80=98struct fl= ock=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_i= nternal.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 Let's just do this then (assuming the value of F_DUPFD_CLOEXEC is architecture-independent) > > > + > > > #ifndef R_BPF_64_64 > > > #define R_BPF_64_64 1 > > > #endif > > > > > > > Thanks, > > Daniel