Re: [PATCH bpf-next 02/14] libbpf: add bpf() syscall wrapper into public API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 1, 2021 at 9:22 AM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> On Fri, Oct 29, 2021 at 09:59:29PM -0700, Andrii Nakryiko wrote:
> > Move internal sys_bpf() helper into bpf.h and expose as public API.
> > __NR_bpf definition logic is also moved. Renamed sys_bpf() into bpf() to
> > follow libbpf naming conventions. Adapt internal uses accordingly.
> ...
> > -static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
> > -                       unsigned int size)
> > -{
> > -     return syscall(__NR_bpf, cmd, attr, size);
> > -}
> > -
> ...
> > +static inline long bpf(enum bpf_cmd cmd, union bpf_attr *attr, unsigned int size)
> > +{
> > +     return syscall(__NR_bpf, cmd, attr, size);
> > +}
>
> I think it will conflict with glibc.
> It will also conflict with systemd that uses bpf() from glibc or does:
>
> #if !HAVE_BPF
> static inline int missing_bpf(int cmd, union bpf_attr *attr, size_t size) {
> #ifdef __NR_bpf
>         return (int) syscall(__NR_bpf, cmd, attr, size);
> #else
>         errno = ENOSYS;
>         return -1;
> #endif
> }
>
> #  define bpf missing_bpf
>
> why take a risk of renaming?

I actually didn't realize that glibc does provide this wrapper. I'll
just drop this patch for now, it's not really required for any other
changes in the patch set.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux