Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp124584pxk; Fri, 11 Sep 2020 02:13:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/OLgnRdD82kVko9FZCgSiiXwQ/WPTpToVeQyJIWsfzGbPvXiqDyVTjOa30dbnIBu9OKWL X-Received: by 2002:a17:906:4bd7:: with SMTP id x23mr1092902ejv.92.1599815617799; Fri, 11 Sep 2020 02:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599815617; cv=none; d=google.com; s=arc-20160816; b=sp65QgCcoGzGoWxOO9QaEVFxysEu93kmwFwbc26+DkNAgmzDZd1mly8YlopwHBXJHk UTaeb9OovMI4YkbmMK806hSREznWRkD/Tjk/DjTpj0V5agL4T8noqweTX5ZiDuwhkY3K uAiFEmX9TZGiBhbBZABXPbMkZZ6CKJjGD+eMECjcZaMXYoHKEztblB0dRGysrPn7RgJR wWJQK6OZbLn7zl4fJvWLbh+W4N3Yr0LFndk5UZDgfXhM8uulFpcijYlj8VOlbEKGUpXT N2pcCVW8R3Xitx/7zeEvWEEbq4dsolwtnGZd7sWbnef5yBRmh9wLrGqZTKEu+z5lSLxf +BfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc:dkim-signature; bh=iVuZbTVcQSrrVEPpwKsg24X5Ol39bwWfizZYHRTRwPE=; b=vfLBS9z0TbkYddrdEuCBgAkQm2L6YKEuMNW345o61OihYHziOKWL6JFza/RYrPqVo7 3GT6TBRCquEbxa9Gwn1KWLQo6sXGs6hte3e08R3i6pmqnXYes5rRY6XZAk9wbNsoNL85 EBkHRAESWmeYAulg8zHEbqE2dIeK2TloFPX9vq3rdEdxACN62rfRxmm6BiS8mmwWPydV 8ACNeTLoIBqhdvJTxz2UlJVzMChF/ZkIch3lvlM10dQj1JS5iy6Qxz5I6t0SNLp0bc2L 7xhO32WZvpWsIhz4XOwdkV1NxEeMO93WEUuUhxmFnLezR5cG8VqKzbdz8lQ7WQK9YImo Xuag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GmK/pO17"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o62si836119edd.494.2020.09.11.02.13.14; Fri, 11 Sep 2020 02:13:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GmK/pO17"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1725805AbgIKJMj (ORCPT + 99 others); Fri, 11 Sep 2020 05:12:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbgIKJMh (ORCPT ); Fri, 11 Sep 2020 05:12:37 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA75DC061573; Fri, 11 Sep 2020 02:12:36 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id q9so3729329wmj.2; Fri, 11 Sep 2020 02:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=cc:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=iVuZbTVcQSrrVEPpwKsg24X5Ol39bwWfizZYHRTRwPE=; b=GmK/pO173Z7r1u4+xT3311cYlKHzLPAiztBWYn5MYKwfwG0bz/LvKT88CQ/Gh7xb4O IpBKgdHzLrkwpf9kQRsMY1W/Xyl4NF7o5OBZxOx5Tb811QphL1xcxgI2iYkScbk+rgCI Eoxvn2Db6tb7dytYTIlUUpDVu7xxU9DJVeBX3fR2QL3D3bvT88cZQ4Sj+F5y/tH4dtVJ W+1NwmRsa9bLvM9OyoIIElKUmBc+F88awwiIWreR6oTm4y5T6MeIkgheBkwU8KYqdtUY +9pOX4wV7SrpCy/sTJW1fmznzt1vKJii9TKLmV9qAxYZy/WWS6ZfjShGnMC79N08exGt A6yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:cc:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=iVuZbTVcQSrrVEPpwKsg24X5Ol39bwWfizZYHRTRwPE=; b=mfZrH55W7LwobMmpvwDBl47DMJoVnNvb852yJ3wMvELyg4HuxoSZllFZNbpKF/5KRL ae238QF+iHklyVPKd+4VkVGHOzmggsmjE32v5l2ht4f/agHmwp3sAUvAsgz+piYwoY3i HqJEfp/Gf+v0C2a6LEipRkd9f47aAcbfWwDmUSSvxOCa9wMvIbTxHNE2CvcEhRVMfJNC qJ01fLOuP45rFBSGZxaCSI0AgAah+btfF8W62a/uTnwK6kYccVLAs2cgjfiItqi4HnU1 LPt2UM30JMmn8IWaHs9cT8i/fSxRtA6VbBEAHwl4AtQpc7hK1Cw5EqvbWToEFN1lSJ64 bFUg== X-Gm-Message-State: AOAM530mPOktggTeW4eK8obGwrkDVMpbVGXHU0NyM3zuHnJ9DYWlXSfl 0WL+SnqxV5bezMQpTaYFiqrkAX4BuAk= X-Received: by 2002:a1c:2983:: with SMTP id p125mr1201608wmp.21.1599815555072; Fri, 11 Sep 2020 02:12:35 -0700 (PDT) Received: from ?IPv6:2001:a61:2479:6801:d8fe:4132:9f23:7e8f? ([2001:a61:2479:6801:d8fe:4132:9f23:7e8f]) by smtp.gmail.com with ESMTPSA id i3sm3307338wrs.4.2020.09.11.02.12.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Sep 2020 02:12:34 -0700 (PDT) Cc: mtk.manpages@gmail.com, linux-man@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 24/24] bpf.2: Add missing headers To: Alejandro Colomar References: <20200910211344.3562-1-colomar.6.4.3@gmail.com> <20200910211344.3562-25-colomar.6.4.3@gmail.com> From: "Michael Kerrisk (man-pages)" Message-ID: Date: Fri, 11 Sep 2020 11:12:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200910211344.3562-25-colomar.6.4.3@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, On 9/10/20 11:13 PM, Alejandro Colomar wrote: > I added some headers to reduce the number of warnings. > I found the needed headers by using grep, but maybe some of them > shouldn't be included directly. > > The example still has many problems to compile. Yes, there are so many problems there, I'm not sure it's really worth adding the header files. It increases the impression that this is somehow a complete program, when it's not. I agree this is a bit of a mess, but I think it's probably best to leave the example as is. As the manual page says: Some complete working code can be found in the samples/bpf direcā€ tory in the kernel source tree. Thanks, Michael > > Signed-off-by: Alejandro Colomar > --- > man2/bpf.2 | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/man2/bpf.2 b/man2/bpf.2 > index b45acde76..d26d6a43d 100644 > --- a/man2/bpf.2 > +++ b/man2/bpf.2 > @@ -981,6 +981,18 @@ ioctl(event_fd, PERF_EVENT_IOC_SET_BPF, prog_fd); > * 3. attach prog_fd to raw socket via setsockopt() > * 4. print number of received TCP/UDP packets every second > */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > int > main(int argc, char **argv) > { > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/