* [PATCH] Add rlimits to /proc/<PID>/status
@ 2008-05-30 20:11 Clifford Wolf
2008-05-30 21:35 ` Hugh Dickins
2008-05-30 21:46 ` Peter Zijlstra
0 siblings, 2 replies; 4+ messages in thread
From: Clifford Wolf @ 2008-05-30 20:11 UTC (permalink / raw)
To: lkml
Signed-off-by: Clifford Wolf <clifford@clifford.at>
---
fs/proc/array.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 9e3b8c3..3cb2ad3 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -242,6 +242,62 @@ static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign,
}
}
+static const char *rlim_names[RLIM_NLIMITS] = {
+ [RLIMIT_CPU] = "CPU",
+ [RLIMIT_FSIZE] = "FSize",
+ [RLIMIT_DATA] = "Data",
+ [RLIMIT_STACK] = "Stack",
+ [RLIMIT_CORE] = "Core",
+ [RLIMIT_RSS] = "RSS",
+ [RLIMIT_NPROC] = "NProc",
+ [RLIMIT_NOFILE] = "NoFile",
+ [RLIMIT_MEMLOCK] = "MemLock",
+ [RLIMIT_AS] = "AddrSpace",
+ [RLIMIT_LOCKS] = "Locks",
+ [RLIMIT_SIGPENDING] = "SigPending",
+ [RLIMIT_MSGQUEUE] = "MsgQueue",
+ [RLIMIT_NICE] = "Nice",
+ [RLIMIT_RTPRIO] = "RTPrio",
+ [RLIMIT_RTTIME] = "RTTime"
+};
+
+#if RLIM_NLIMITS != 16
+# error Value of RLIM_NLIMITS changed. \
+ Please update rlim_names in fs/proc/array.c
+#endif
+
+static inline void task_rlim(struct seq_file *m, struct task_struct *p)
+{
+ unsigned long flags;
+ struct rlimit rlim[RLIM_NLIMITS];
+ int i;
+
+ for (i=0; i<RLIM_NLIMITS; i++) {
+ rlim[i].rlim_cur = 0;
+ rlim[i].rlim_max = 0;
+ }
+
+ rcu_read_lock();
+ if (lock_task_sighand(p, &flags)) {
+ for (i=0; i<RLIM_NLIMITS; i++)
+ rlim[i] = p->signal->rlim[i];
+ unlock_task_sighand(p, &flags);
+ }
+ rcu_read_unlock();
+
+ for (i=0; i<RLIM_NLIMITS; i++) {
+ seq_printf(m, "Rlim%s:\t", rlim_names[i]);
+ if (rlim[i].rlim_cur != RLIM_INFINITY)
+ seq_printf(m, "%lu\t", rlim[i].rlim_cur);
+ else
+ seq_printf(m, "inf\t");
+ if (rlim[i].rlim_max != RLIM_INFINITY)
+ seq_printf(m, "%lu\n", rlim[i].rlim_max);
+ else
+ seq_printf(m, "inf\n");
+ }
+}
+
static inline void task_sig(struct seq_file *m, struct task_struct *p)
{
unsigned long flags;
@@ -322,6 +378,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
task_mem(m, mm);
mmput(mm);
}
+ task_rlim(m, task);
task_sig(m, task);
task_cap(m, task);
cpuset_task_status_allowed(m, task);
--
1.5.5.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add rlimits to /proc/<PID>/status
2008-05-30 20:11 [PATCH] Add rlimits to /proc/<PID>/status Clifford Wolf
@ 2008-05-30 21:35 ` Hugh Dickins
2008-05-30 22:50 ` Clifford Wolf
2008-05-30 21:46 ` Peter Zijlstra
1 sibling, 1 reply; 4+ messages in thread
From: Hugh Dickins @ 2008-05-30 21:35 UTC (permalink / raw)
To: Clifford Wolf; +Cc: lkml
Aren't they better staying in /proc/<PID>/limits?
Hugh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add rlimits to /proc/<PID>/status
2008-05-30 20:11 [PATCH] Add rlimits to /proc/<PID>/status Clifford Wolf
2008-05-30 21:35 ` Hugh Dickins
@ 2008-05-30 21:46 ` Peter Zijlstra
1 sibling, 0 replies; 4+ messages in thread
From: Peter Zijlstra @ 2008-05-30 21:46 UTC (permalink / raw)
To: Clifford Wolf; +Cc: lkml
On Fri, 2008-05-30 at 22:11 +0200, Clifford Wolf wrote:
> Signed-off-by: Clifford Wolf <clifford@clifford.at>
> ---
> fs/proc/array.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 57 insertions(+), 0 deletions(-)
>
> diff --git a/fs/proc/array.c b/fs/proc/array.c
> index 9e3b8c3..3cb2ad3 100644
> --- a/fs/proc/array.c
> +++ b/fs/proc/array.c
> @@ -242,6 +242,62 @@ static void collect_sigign_sigcatch(struct task_struct *p, sigset_t *ign,
> }
> }
>
> +static const char *rlim_names[RLIM_NLIMITS] = {
> + [RLIMIT_CPU] = "CPU",
> + [RLIMIT_FSIZE] = "FSize",
> + [RLIMIT_DATA] = "Data",
> + [RLIMIT_STACK] = "Stack",
> + [RLIMIT_CORE] = "Core",
> + [RLIMIT_RSS] = "RSS",
> + [RLIMIT_NPROC] = "NProc",
> + [RLIMIT_NOFILE] = "NoFile",
> + [RLIMIT_MEMLOCK] = "MemLock",
> + [RLIMIT_AS] = "AddrSpace",
> + [RLIMIT_LOCKS] = "Locks",
> + [RLIMIT_SIGPENDING] = "SigPending",
> + [RLIMIT_MSGQUEUE] = "MsgQueue",
> + [RLIMIT_NICE] = "Nice",
> + [RLIMIT_RTPRIO] = "RTPrio",
> + [RLIMIT_RTTIME] = "RTTime"
> +};
fs/proc/base.c already has an array with strings in it
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add rlimits to /proc/<PID>/status
2008-05-30 21:35 ` Hugh Dickins
@ 2008-05-30 22:50 ` Clifford Wolf
0 siblings, 0 replies; 4+ messages in thread
From: Clifford Wolf @ 2008-05-30 22:50 UTC (permalink / raw)
To: Hugh Dickins; +Cc: lkml
Hi,
On Fri, May 30, 2008 at 10:35:27PM +0100, Hugh Dickins wrote:
> Aren't they better staying in /proc/<PID>/limits?
this was a cleanup of a patch I've sent to lkml about 6 months ago
when there was no yet-released (non-rc) kernel with /proc/<PID>/limits ...
my patch is a more or less duplicate of commit d85f50d5. oops.
please simply ignore it.. ;-)
yours,
- clifford
--
A byte walks into a bar and orders a pint. Bartender asks him "What's wrong?"
Byte says "Parity error." Bartender nods and says "Yeah, I thought you looked
a bit off."
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-30 23:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-30 20:11 [PATCH] Add rlimits to /proc/<PID>/status Clifford Wolf
2008-05-30 21:35 ` Hugh Dickins
2008-05-30 22:50 ` Clifford Wolf
2008-05-30 21:46 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®