I found hard limit value in /proc/{pid}/limits match the output of ulimit -Hn
while soft limit value doesn't
my example output:
tomcat@myLinux:/home/azhang$ ulimit -Sn
1024
tomcat@myLinux:/home/azhang$ ulimit -Hn
1048576
tomcat@myLinux:/home/azhang$ ulimit -n
1024
So soft limit is 1024
I have a tomcat running as tomcat user and i checked the limit of that process,
tomcat@myLinux:/home/azhang$ cat /proc/12257/limits
Limit Soft Limit Hard Limit Units
....
Max processes 31854 31854 processes
Max open files 1048576 1048576 files
Max locked memory 65536 65536 bytes
....
The soft limit of process 12257(tomcat) is 1048576, same as hard limit and not 1024
Is it a bug of /proc/{pid}/limits?