[LTP] [PATCH v2] unshare03: set nr_open with sizeof(long)*8
Cyril Hrubis
chrubis@suse.cz
Fri Apr 11 11:03:13 CEST 2025
Hi!
> >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.
>
> I'm using sizeof(long)*8 is because I was thinking only set
> filediscriptor >= BITS_PER_LONG and then set nr_open = BITS_PER_LONG
> could make EMFILE happen. Less than BITS_PER_LONG would trigger other
> error than EMFILE.
>
> Am I misunderstood Cyril?
The actual patch is fine. What they are asking for is a better
description. The patch description should tell _why_ the change is
needed.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list