From mboxrd@z Thu Jan 1 00:00:00 1970 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 DC876C433F5 for ; Mon, 28 Feb 2022 15:00:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237438AbiB1PAr (ORCPT ); Mon, 28 Feb 2022 10:00:47 -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) 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