[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb985a52-1f4e-0c48-9bb0-3ad91646ad2c@gmail.com>
Date: Fri, 11 Sep 2020 11:12:33 +0200
From: "Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
To: Alejandro Colomar <colomar.6.4.3@...il.com>
Cc: mtk.manpages@...il.com, linux-man@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 24/24] bpf.2: Add missing headers
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 <colomar.6.4.3@...il.com>
> ---
> 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 <assert.h>
> +#include <errno.h>
> +#include <stddef.h>
> +#include <stdio.h>
> +#include <string.h>
> +#include <sys/socket.h>
> +#include <unistd.h>
> +#include <linux/bpf.h>
> +#include <linux/if_ether.h>
> +#include <linux/in.h>
> +#include <linux/ip.h>
> +
> 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/
Powered by blists - more mailing lists