[LTP] [PATCH] unshare03: using soft limit of NOFILE
Cyril Hrubis
chrubis@suse.cz
Tue Apr 1 15:55:45 CEST 2025
Hi!
> IMHO file descriptor will be 3, fd - 2 == 1. And trying to set 1 to
> /rpoc/sys/fs/nr_open leads to EINVAL. You probably mean something different.
Ah, we cannot set nr_open to anything that is smaller than BITS_PER_LONG:
...
unsigned int sysctl_nr_open __read_mostly = 1024*1024;
unsigned int sysctl_nr_open_min = BITS_PER_LONG;
/* our min() is unusable in constant expressions ;-/ */
#define __const_min(x, y) ((x) < (y) ? (x) : (y))
unsigned int sysctl_nr_open_max =
__const_min(INT_MAX, ~(size_t)0/sizeof(void *)) & -BITS_PER_LONG;
...
Then we need a filedescriptor that is >= 64 and set the nr_open to 64.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list