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

Petr Vorel pvorel@suse.cz
Thu Feb 2 08:49:47 CET 2023


Hi Edward,

> 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.

Actually, looking into SLES kernel sources, we backported close_range() to SLES
15-SP3 (bsc#1179090), which was 5.3.18 based. Thus you actually did good work :).

@Li, @Jan out of curiosity, was this backported to RHEL kernel as well?
It'd be useful to note that (one day we will be able to remove it once kernels
which backported are EOL).

Kind regards,
Petr

> Thanks,
> Edward


More information about the ltp mailing list