Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3004681pxm; Mon, 28 Feb 2022 10:07:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLh35gp6xuIT3BOogQqblYfijL/meTZjrsBrmmSqltyzs/zlapubZrwFTnYamrKDfrC85u X-Received: by 2002:a17:906:bb01:b0:6a7:df9:d67c with SMTP id jz1-20020a170906bb0100b006a70df9d67cmr15495043ejb.733.1646071641668; Mon, 28 Feb 2022 10:07:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646071641; cv=none; d=google.com; s=arc-20160816; b=Tq+4ferUffwDfhkNh21I+YjKNn66qoQhHsl+2mtYgQivn98oj7VMDQNgbJ1UgwDRDd 6LZFZQ988dIqMxaaVFP75gZhnxtA6qp2RIyDMEQyuMD78ioq/hpMilhVy/XId0nmr2BA VlNujcG/dYdQLqtT/GzvTXRGUidijYF8O+jRWlw+uJdaDHLHYqrFPI1LZm41Rdl0FbCV o8krnTRacGDckWZcUBwWgSkETL6tIjkmVS4YlZRMG2m9jEcRjbF79/1LQKULXaei422J MS61ZoABg6SrgNZqrgvNDLou3zZVotaMR/7eb+nsEIIOiHKVdXS0OEEVeRdA+0whXl2n K5vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=q0lUiFBPkbfEID4Pnb95BxFMJFmr8QJ/baBTvnTxUcU=; b=AZYebcDtz6S+mtiMqYnNPtsiYaNp8QbKAHw0xk8UJgghAnKiFxXmucleYmKPbI70ic uWr1EKJh96+xuYzyFKQdW8tefut/x0RrLv52L/2gxEfuNcOYmt/Q6QwFQb7FWt9QoLMU jkQ491pMQJHYJ2AyPbKaoOZda5GhVT+zOXwhQzyZ7MMAxCX8ZtQIEtZrjmc/tKpjt6pp tsymeY45M3jbcHWZNAPYcPeK7SRi4o6Xy/6yVSI0zIBWZx9yD7IvI2WXhpliFfRWl7v0 wUULsHxV0jFB8NLvxOkAtpEoUbmV+PN/3Yjg66pDl7qR9CnZFMwiF4t4q6zalFVod/bc D0HQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a170906150100b006cf572d830dsi5958682ejd.407.2022.02.28.10.06.59; Mon, 28 Feb 2022 10:07:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237436AbiB1PAq (ORCPT + 99 others); Mon, 28 Feb 2022 10:00:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234144AbiB1PAo (ORCPT ); Mon, 28 Feb 2022 10:00:44 -0500 Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B33950B03; Mon, 28 Feb 2022 07:00:04 -0800 (PST) Received: from sslproxy03.your-server.de ([88.198.220.132]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1nOhVK-0006vm-0T; Mon, 28 Feb 2022 16:00:02 +0100 Received: from [85.1.206.226] (helo=linux.home) by sslproxy03.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nOhVJ-0000iV-Kb; Mon, 28 Feb 2022 16:00:01 +0100 Subject: Re: [PATCH 1/1] libbpf: ensure F_DUPFD_CLOEXEC is defined To: James Hilliard , bpf@vger.kernel.org Cc: Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220227142551.2349805-1-james.hilliard1@gmail.com> From: Daniel Borkmann Message-ID: <6af1530a-a4bf-dccf-947d-78ce235a4414@iogearbox.net> Date: Mon, 28 Feb 2022 16:00:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20220227142551.2349805-1-james.hilliard1@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.5/26467/Mon Feb 28 10:24:05 2022) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 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 = 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_internal.h (given it defines F_DUPFD_CLOEXEC as well)? > --- > 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_internal.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