luigimarmo / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

setrlimit not available on os x #480

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
psutil.setrlimit is not available on os x, but resource.setrlimit is.
I'm guessing psutil proxies the similar methods on resource?

Original issue reported on code.google.com by l...@hupfeldtit.dk on 16 Feb 2014 at 5:13

GoogleCodeExporter commented 8 years ago
stdlib resource.getrlimit() and resource.setrlimit() are implemented by using 
getrlimit() and setrlimit() POSIX syscalls which let you set/get resource 
limits *for the current process only*:
http://linux.die.net/man/2/getrlimit

psutil implementation uses prlimit() syscall, which lets you set resource 
limits for *any process PID* (not only os.getpid()).
prlimit() syscall is Linux-specific, so that is why psutil exposes it on Linux 
only as psutil.Process.rlimit().

Thanks for the suggestion though, it was very clever.
Please keep suggesting similar things! =)

Original comment by g.rodola on 16 Feb 2014 at 5:41