Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ prlimit --core=unlimited: --pid $$
- $ prlimit --core --pid $$
- RESOURCE DESCRIPTION SOFT HARD UNITS
- CORE max core file size unlimited unlimited blocks
- int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit);
- $ gdb -p $PID
- ...
- (gdb) set $rlim = &{0ll, 0ll}
- (gdb) print getrlimit(9, $rlim)
- $1 = 0
- (gdb) print *$rlim
- $2 = {-1, -1}
- (gdb) set *$rlim[0] = 1024*1024
- (gdb) print setrlimit(9, $rlim)
- $3 = 0
- # PID=966
- # grep 'open file' /proc/$PID/limits
- Max open files 1024 4096 files
- # python3 -c "import resource; resource.prlimit($PID, resource.RLIMIT_NOFILE, (2048, 12345))"
- # grep 'open file' /proc/$PID/limits
- Max open files 2048 12345 files
- # python3
- Python 3.4.3 (default, Nov 28 2017, 16:41:13)
- [GCC 4.8.4] on linux
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import resource
- >>> import os
- >>> resource.prlimit(os.getpid(), resource.RLIMIT_NOFILE)
- (1024, 4096)
- >>> resource.prlimit(os.getpid(), resource.RLIMIT_NOFILE, (1369, 9999))
- (1024, 4096)
- >>> resource.prlimit(os.getpid(), resource.RLIMIT_NOFILE)
- (1369, 9999)
- # grep 'open file' /proc/1472/limits
- Max open files 1369 9999 files
Add Comment
Please, Sign In to add comment