[LTP] [PATCH] close_range: check for kernel support below 5.9

Edward Liaw edliaw@google.com
Wed Feb 1 19:31:54 CET 2023


Hi Petr,

> > +++ b/include/lapi/close_range.h
> > @@ -25,4 +25,17 @@ static inline int close_range(unsigned int fd, unsigned int max_fd,
> >       return tst_syscall(__NR_close_range, fd, max_fd, flags);
> >  }
> >  # endif
> > +
> > +static inline void close_range_supported_by_kernel(void)
> > +{
> > +     long ret;
> > +
> > +     if ((tst_kvercmp(5, 9, 0)) < 0) {
> > +             /* Check if the syscall is backported on an older kernel */
> BTW what particular use case this fixed? Is it backported to some android
> kernel? Or to some enterprise distro? Because I don't think kernel stable trees
> accept new functionality, just fixes.

Oops, should I use .min_kver instead?  It isn't backported on Android;
I just wasn't sure what the right approach was.

Thanks,
Edward


More information about the ltp mailing list