[sheepdog] [PATCH v1] try to set RLIMIT_NOFILE ro recommended value

Alexander Guy alexander at andern.org
Mon Mar 16 18:19:00 CET 2015


On Mon, Mar 16, 2015 at 07:23:59PM +0300, Vasiliy Tolstov wrote:
> I don't want setrlimit because it sets values to global space.

Hi Vasiliy,
    Are you sure about that?  I'm pretty sure setrlimit(RLIMIT_NOFILE, ...)
applies to the calling process, just like prlimit(0, RLIMIT_NOFILE, ...) would.

> 2015-03-16 19:30 GMT+03:00 Vasiliy Tolstov <v.tolstov at selfip.ru>:
> > Signed-off-by: Vasiliy Tolstov <v.tolstov at selfip.ru>
> > ---
> >  sheep/sheep.c | 63 +++++++++++++++++++++++++++++++++++++++--------------------
> >  1 file changed, 42 insertions(+), 21 deletions(-)
> >
> > diff --git a/sheep/sheep.c b/sheep/sheep.c
> > index a1028a2..13cc927 100644
> > --- a/sheep/sheep.c
> > +++ b/sheep/sheep.c
> > @@ -561,26 +561,47 @@ static int create_work_queues(void)
> >
[cut]
> > +    len = asprintf(&buf, "%lu", new.rlim_max);
> > +    if (len > 0) {
> > +      fd = open("/proc/sys/fs/nr_open", O_WRONLY);

The distribution and system administrator already have control over this by sysctl.
I don't think sheepdog should be modifying the kernel's limits.  It's too much magic.

Thanks.


Alexander




More information about the sheepdog mailing list