[LTP] [PATCH] syscalls/setrlimit03.c: read /proc/sys/fs/nr_open for RLIMIT_NOFILE limit

Tommi Rantala tt.rantala@gmail.com
Wed Jan 30 17:22:57 CET 2019


ke 30. tammik. 2019 klo 18.15 Cyril Hrubis (chrubis@suse.cz) kirjoitti:
> >  static void setup(void)
> >  {
> > +     if (tst_kvercmp(2, 6, 25) < 0) {
> > +             nr_open = NR_OPEN;
> > +     } else {
> > +             SAFE_FILE_SCANF("/proc/sys/fs/nr_open", "%u", &nr_open);
> > +     }
>
> Can we do here without the explicit kernel version check?
>
> What about:
>
> #define NR_OPEN_PATH "/proc/sys/fs/nr_open"
>
> ...
>
>         if (acess(NR_OPEN_PATH, F_OK))
>                 SAFE_FILE_SCANF(NR_OPEN_APTH, "%u", &nr_open);

Alright, that should work too. I'll send patch v2 tomorrow.

-Tommi


More information about the ltp mailing list