Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

soft limits of open files from xinetd

140 views
Skip to first unread message

Guanglei

unread,
Nov 8, 2009, 10:27:35 PM11/8/09
to
Hi,
I found the soft ulimit of open files set by xinetd is always 1024.
I tried to modify /etc/security/limit.conf, but it only changed the
hard limit exported by xinetd. Is there a way to raise the soft limit
of open files of xinetd so that the services started by xinetd can
open more than 1024 files?
Thanks.

Lee Merrill

unread,
Nov 10, 2009, 12:12:57 PM11/10/09
to
You may be up against a fundamental limitation, the "ulimit -n"
description for "bash" says "-n: The maximum number of open file
descriptors (most systems do not allow this value to be set)".

Lee

Rainer Weikusat

unread,
Nov 10, 2009, 1:53:46 PM11/10/09
to

You may be looking at the wrong end here: xinetd uses select to wait
for connection requests (judging from a quick look at the sources) and
this means the limit you are really running into is FD_SETSIZE -- the
maximum number of file descriptors which can be specified in a
select-call.

Rainer Weikusat

unread,
Nov 11, 2009, 5:45:28 AM11/11/09
to

This obviously didn't quite make sense :-(. But assuming that the hard
limit is more than 1024, even unprivileged processes are supposed to
be able to raise the soft limit up to the hard limit and a small
experiment with the mini-program included below and the ulimit bash
builtin seems to confirm that this is actually possible (first raising
the hard limit as root, than raising the soft limit as unprivileged
user from a shell invoked via su - <username>, then running the
program).

------------------
#include <fcntl.h>
#include <stdio.h>

int main(void)
{
unsigned count;

count = 0;
while (open("/dev/zero", O_RDONLY, 0) > 0)
++count;

perror("open");
printf("%u\n", count);
return 0;
}
------------------

NB: There are also some system-wide limits which are supposed to be
configurable using the /proc-filesytem, in particular
/proc/sys/fs/file-max and /proc/sys/fs/nr_open.

Rainer Weikusat

unread,
Nov 11, 2009, 5:46:50 AM11/11/09
to

This obviously didn't quite make sense :-(. But assuming that the hard


limit is more than 1024, even unprivileged processes are supposed to

be able to raise the soft limit up to the hard limit with setrlimit

0 new messages