Guest User

Untitled

a guest
Jun 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. $ prlimit --core=unlimited: --pid $$
  2. $ prlimit --core --pid $$
  3. RESOURCE DESCRIPTION SOFT HARD UNITS
  4. CORE max core file size unlimited unlimited blocks
  5.  
  6. int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit);
  7.  
  8. $ gdb -p $PID
  9. ...
  10. (gdb) set $rlim = &{0ll, 0ll}
  11. (gdb) print getrlimit(9, $rlim)
  12. $1 = 0
  13. (gdb) print *$rlim
  14. $2 = {-1, -1}
  15. (gdb) set *$rlim[0] = 1024*1024
  16. (gdb) print setrlimit(9, $rlim)
  17. $3 = 0
  18.  
  19. # PID=966
  20. # grep 'open file' /proc/$PID/limits
  21. Max open files 1024 4096 files
  22. # python3 -c "import resource; resource.prlimit($PID, resource.RLIMIT_NOFILE, (2048, 12345))"
  23. # grep 'open file' /proc/$PID/limits
  24. Max open files 2048 12345 files
  25.  
  26. # python3
  27. Python 3.4.3 (default, Nov 28 2017, 16:41:13)
  28. [GCC 4.8.4] on linux
  29. Type "help", "copyright", "credits" or "license" for more information.
  30. >>> import resource
  31. >>> import os
  32. >>> resource.prlimit(os.getpid(), resource.RLIMIT_NOFILE)
  33. (1024, 4096)
  34. >>> resource.prlimit(os.getpid(), resource.RLIMIT_NOFILE, (1369, 9999))
  35. (1024, 4096)
  36. >>> resource.prlimit(os.getpid(), resource.RLIMIT_NOFILE)
  37. (1369, 9999)
  38.  
  39. # grep 'open file' /proc/1472/limits
  40. Max open files 1369 9999 files
Add Comment
Please, Sign In to add comment