On Mon, Oct 21, 2024 at 3:51 PM Jason Xing <kerneljasonxing@xxxxxxxxx> wrote: > > On Mon, Oct 21, 2024 at 3:41 PM Jiri Olsa <olsajiri@xxxxxxxxx> wrote: > > > > On Mon, Oct 21, 2024 at 01:07:06PM +0800, Jason Xing wrote: > > > From: Jason Xing <kernelxing@xxxxxxxxxxx> > > > > > > When I compiled the tools/testing/selftests/bpf, the following error > > > pops out: > > > uprobe_multi.c: In function ‘trigger_uprobe’: > > > uprobe_multi.c:109:26: error: ‘MADV_PAGEOUT’ undeclared (first use in this function); did you mean ‘MADV_RANDOM’? > > > madvise(addr, page_sz, MADV_PAGEOUT); > > > ^~~~~~~~~~~~ > > > MADV_RANDOM > > > > > > Including the <linux/linux/mman.h> header file solves this compilation error. > > > > hi, > > strange, uprobe_multi.c even has: > > > > #ifndef MADV_PAGEOUT > > #define MADV_PAGEOUT 21 > > #endif > > > > and '#include <sys/mman.h>' should be all that's needed > > > > could you please share more details (extra flags) on how you compile? > > OMG, thanks for reminding me. The net-next branch that I compiled > doesn't have those three lines. Now I can see them in bpf-next. So I > think the issue has been fixed already :) Link is https://lore.kernel.org/bpf/d9846ceb-b758-4c17-82d1-e5504122a50a@xxxxxxxxxx/ The previous comment is not that right. Making sure to include <sys/mman.h> first solves the issue so there are no complaints when compiling. No need to define MADV_PAGEOUT, I think.