views:

29

answers:

2

Hello all.

Is it possible to increase "Max open files" parameter for working process ? I mean this parameter:

cat /proc/<pid>/limits | grep files

Thanks for your advices

+2  A: 

This link details how to change this system wide or per user.

Brian Agnew
Thanks for a link. But I've found it before asking :-) But the problem is to change parameter without stopping process (on runtime) and for process-wide.
wako
@wako: It can't be done from outside the process (unless you're running one of the very latest development kernels, which is unlikely)
caf
@caf: Thanks. This is exactly that I've wanted to hear.
wako
+1  A: 

As a system administrator: The /etc/security/limits.conf file controls this on most Linux installations; it allows you to set per-user limits. You'll want a line like myuser - nofile 1000.

Within a process: The getrlimit and setrlimit calls control most per-process resource allocation limits. RLIMIT_NOFILE controls the maximum number of file descriptors. You will need appropriate permissions to call it.

Joe
It seems that this is what I need. Can I set "setrlimit(RLIMIT_NOFILE,...)" for some outside process?
wako
I don't know of any. If there is, I suspect you'll find it buried deep in some Linux-specific programming guide, because I can't fathom where else standard POSIX would put it.
Joe