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 5FFE5C4332F for ; Fri, 4 Mar 2022 21:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbiCDVz5 (ORCPT ); Fri, 4 Mar 2022 16:55:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbiCDVzz (ORCPT ); Fri, 4 Mar 2022 16:55:55 -0500 Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82B7426D579; Fri, 4 Mar 2022 13:54:58 -0800 (PST) Received: from sslproxy01.your-server.de ([78.46.139.224]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1nQFt1-000G6t-Qi; Fri, 04 Mar 2022 22:54:55 +0100 Received: from [85.1.206.226] (helo=linux.home) by sslproxy01.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nQFt1-000A9c-G3; Fri, 04 Mar 2022 22:54:55 +0100 Subject: Re: [PATCH 1/1] libbpf: ensure F_DUPFD_CLOEXEC is defined To: James Hilliard Cc: Andrii Nakryiko , bpf , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Networking , open list References: <20220227142551.2349805-1-james.hilliard1@gmail.com> <6af1530a-a4bf-dccf-947d-78ce235a4414@iogearbox.net> From: Daniel Borkmann Message-ID: Date: Fri, 4 Mar 2022 22:54:54 +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: 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/26471/Fri Mar 4 10:24:47 2022) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/4/22 8:01 PM, Andrii Nakryiko wrote: > On Mon, Feb 28, 2022 at 7:00 AM Daniel Borkmann wrote: >> 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? > > It seems like it's guarded by __USE_XOPEN2K8 in glibc (from a quick > glance at glibc code). But it's been there since 2010 or so, at the > very least. > >> Should we instead just add an include for to libbpf_internal.h >> (given it defines F_DUPFD_CLOEXEC as well)? > > yep, this is UAPI header so we can use it easily (we'll need to sync > it into Github repo, but that's not a problem) Sgtm, James, could you respin with using the include? Thanks, Daniel