Re: [PATCH]: proc: export a processes resource limits via proc/<pid>

From: Valdis . Kletnieks
Date: Fri Aug 17 2007 - 04:10:53 EST


On Thu, 16 Aug 2007 08:35:38 EDT, Neil Horman said:
> Hey again-
> Andrew requested that I repost this cleanly, after running the patch
> through checkpatch. As requested here it is with the changelog.
>
> Currently, there exists no method for a process to query the resource
> limits of another process. They can be inferred via some mechanisms but they
> cannot be explicitly determined. Given that this information can be usefull
to
> know during the debugging of an application, I've written this patch which
> exports all of a processes limits via /proc/<pid>/limits.
>
> Tested successfully by myself on x86 on top of 2.6.23-rc2-mm1.

I had only one comment the first time around, and Neil addressed it.

I've also tested on x86_64 23-rc2-mm1, and it works here too. I saw where this
uses units of 'bytes' while the shell 'ulimit' uses 1024-byte units in some
places, but (a) this lists the units and (b) it's consistent with setrlimit().
Testing with values >4G show it's 64-bit clean as well.

One question: Is the units milliseconds, or seconds here:

+ [RLIMIT_CPU] = {"Max cpu time", "ms"},

Other than that, feel free to stick either/both of these on:

Reviewed-By: Valdis Kletnieks <valdis.kletnieks@xxxxxx>
Tested-By: Valdis Kletnieks <valdis.kletnieks@xxxxxx>

Attachment: pgp00000.pgp
Description: PGP signature