ulimit and lsof

, par  Pierluigi Vernetto , popularité : 3%

PID of WLS is 29518

to count how many file descriptors are held by a process :

ls /proc/29518/fd | wc -l

666

funnily this doesn’t match the count reported by lsof ( one day I will discover why) :

lsof -p 29518 | wc -l

1288

to know the limit for the specific process :

cat /proc/29518/limits

Limit Soft Limit Hard Limit Units

Max cpu time unlimited unlimited seconds

Max file size unlimited unlimited bytes

Max data size unlimited unlimited bytes

Max stack size 10485760 unlimited bytes

Max core file size 0 0 bytes

Max resident set unlimited unlimited bytes

Max processes 32000 32000 processes

Max open files 1024 1024 files

Max locked memory 65536 65536 bytes

Max address space unlimited unlimited bytes

Max file locks unlimited unlimited locks

Max pending signals 515304 515304 signals

Max msgqueue size 819200 819200 bytes

Max nice priority 0 0

Max realtime priority 0 0

Max realtime timeout unlimited unlimited us

which is different for the limit set by default for a user :

ulimit -a

core file size (blocks, -c) 0

data seg size (kbytes, -d) unlimited

scheduling priority (-e) 0

file size (blocks, -f) unlimited

pending signals (-i) 515304

max locked memory (kbytes, -l) 64

max memory size (kbytes, -m) unlimited

open files (-n) 8192

pipe size (512 bytes, -p) 8

POSIX message queues (bytes, -q) 819200

real-time priority (-r) 0

stack size (kbytes, -s) 10240

cpu time (seconds, -t) unlimited

max user processes (-u) 1024

virtual memory (kbytes, -v) unlimited

file locks (-x) unlimited

To set the limit for a process open by the current shell :

ulimit -n MAX_FD_PER_PROCESS

In Linux, this is a PER-PROCESS limit ! You cannot directly limit the number of Files opened by a User ! You can only set a max-processes-per-user with ulimit -u MAX .

Voir en ligne : http://www.javamonamour.org/2015/10...

Sites favoris Tous les sites

84 sites référencés dans ce secteur