diff options
author | Martin Baulig <martin@src.gnome.org> | 1999-03-31 17:38:53 +0000 |
---|---|---|
committer | Martin Baulig <martin@src.gnome.org> | 1999-03-31 17:38:53 +0000 |
commit | 84407de2aa150b5ab221dab48c8e9bfdd970940c (patch) | |
tree | 318fb637aabd262e12fc0a960da396bf879f3aaf /kernel/sysctl | |
parent | 7011b04cb2472500d3a9e48b738817c5bedc5f2b (diff) | |
download | libgtop-84407de2aa150b5ab221dab48c8e9bfdd970940c.tar.gz |
*** empty log message ***
Diffstat (limited to 'kernel/sysctl')
-rw-r--r-- | kernel/sysctl/libgtop.c | 23 | ||||
-rw-r--r-- | kernel/sysctl/libgtop.h | 16 |
2 files changed, 35 insertions, 4 deletions
diff --git a/kernel/sysctl/libgtop.c b/kernel/sysctl/libgtop.c index d770f8a3..cf82d3df 100644 --- a/kernel/sysctl/libgtop.c +++ b/kernel/sysctl/libgtop.c @@ -665,9 +665,7 @@ libgtop_sysctl_proc (ctl_table *table, int nlen, int *name, libgtop_proc_segment_t *proc_segment; libgtop_proc_signal_t *proc_signal; libgtop_proc_mem_t *proc_mem; -#ifdef __SMP__ int i; -#endif switch (table->ctl_name) { case LIBGTOP_PROC_STATE: @@ -676,7 +674,6 @@ libgtop_sysctl_proc (ctl_table *table, int nlen, int *name, proc_state->uid = tsk->uid; proc_state->gid = tsk->gid; - proc_state->state = tsk->state; proc_state->flags = tsk->flags; memcpy (proc_state->comm, tsk->comm, sizeof (proc_state->comm)); proc_state->uid = tsk->uid; @@ -762,6 +759,26 @@ libgtop_sysctl_proc (ctl_table *table, int nlen, int *name, } proc_state->rlim = tsk->rlim ? tsk->rlim[RLIMIT_RSS].rlim_cur : 0; + + proc_state->ngroups = tsk->ngroups; + for (i = 0; i < min (tsk->ngroups, LIBGTOP_MAX_GROUPS); i++) + proc_state->groups [i] = tsk->groups [i]; + + if (tsk->state & TASK_INTERRUPTIBLE) + proc_state->state |= LIBGTOP_TASK_INTERRUPTIBLE; + if (tsk->state & TASK_UNINTERRUPTIBLE) + proc_state->state |= LIBGTOP_TASK_UNINTERRUPTIBLE; + if (tsk->state & TASK_ZOMBIE) + proc_state->state |= LIBGTOP_TASK_ZOMBIE; + if (tsk->state & TASK_STOPPED) + proc_state->state |= LIBGTOP_TASK_STOPPED; + if (tsk->state & TASK_SWAPPING) + proc_state->state |= LIBGTOP_TASK_SWAPPING; + + if (!(tsk->state & (TASK_RUNNING | TASK_INTERRUPTIBLE | + TASK_UNINTERRUPTIBLE | TASK_ZOMBIE | + TASK_STOPPED | TASK_SWAPPING))) + proc_state->state |= LIBGTOP_TASK_RUNNING; break; case LIBGTOP_PROC_KERNEL: proc_kernel = table->data; diff --git a/kernel/sysctl/libgtop.h b/kernel/sysctl/libgtop.h index 01867c96..9ca512ff 100644 --- a/kernel/sysctl/libgtop.h +++ b/kernel/sysctl/libgtop.h @@ -30,12 +30,24 @@ enum { #define LIBGTOP_NSIG 4 -#define LIBGTOP_PROCLIST_MASK 15 +#define LIBGTOP_PROCLIST_MASK 15 +#define LIBGTOP_MAX_GROUPS 32 #define LIBGTOP_EXCLUDE_IDLE 0x1000 #define LIBGTOP_EXCLUDE_SYSTEM 0x2000 #define LIBGTOP_EXCLUDE_NOTTY 0x4000 +#define LIBGTOP_TASK_RUNNING 1 +#define LIBGTOP_TASK_INTERRUPTIBLE 2 +#define LIBGTOP_TASK_UNINTERRUPTIBLE 4 +#define LIBGTOP_TASK_ZOMBIE 8 +#define LIBGTOP_TASK_STOPPED 16 +#define LIBGTOP_TASK_SWAPPING 32 + +#ifndef min +#define min(a,b) ((a < b) ? a : b) +#endif + typedef struct libgtop_stat libgtop_stat_t; typedef struct libgtop_cpu libgtop_cpu_t; @@ -123,6 +135,8 @@ struct libgtop_proc_state unsigned long keip, kesp; unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; unsigned long nswap, cnswap; + + int ngroups, groups [LIBGTOP_MAX_GROUPS]; }; struct libgtop_proc_kernel |