[LTP] [PATCH 2/3] swapon03: Try to swapon() as many files until it fails

Petr Vorel pvorel@suse.cz
Thu Nov 6 10:07:59 CET 2025


Hi Li,

...
> >  /*\
> > - * This test case checks whether swapon(2) system call returns:
> > + * Test checks whether :man2:`swapon` system call returns EPERM when the
> > maximum
> > + * number of swap files are already in use.
> >   *
> > - *  - EPERM when there are more than MAX_SWAPFILES already in use.
> > + * NOTE: test does not try to calculate MAX_SWAPFILES from the internal
> > + * kernel implementation (which is currently <23, 29> depending on kernel
> > + * configuration). Instead test exptect that at least 15 swap files minus
> > + * currently used swap can be created.
> >   */

> >  #include <stdio.h>
> > @@ -20,49 +24,54 @@
> >  #include "lapi/syscalls.h"
> >  #include "libswap.h"

> > +#define NUM_SWAP_FILES 15


> Does the number 15 have a specific meaning?

No. I wanted something high enough but reasonably smaller than the current
minimum 23, because it can get even smaller in the future.

Should I move/add some of the docs from docparse doc (the note) to this
definition?

> Anyway, the whole patch set looks good to me:
> Reviewed-by: Li Wang <liwang@redhat.com>

Thanks!

Kind regards,
Petr


More information about the ltp mailing list