File: status.c

package info (click to toggle)
lavaps 1.9-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 692 kB
  • ctags: 698
  • sloc: ansic: 2,390; cpp: 2,089; sh: 1,993; tcl: 542; makefile: 229; perl: 182
file content (29 lines) | stat: -rw-r--r-- 806 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/***********************************************************************\
*   Copyright (C) 1992-1998 by Michael K. Johnson, johnsonm@redhat.com	*
*									*
*	This file is placed under the conditions of the GNU Library	*
*	General Public License, version 2, or any later version.	*
*	See file ../COPYING.LIB	for information on distribution		*
*	conditions.							*
\***********************************************************************/

#include "proc/ps.h"
#include "proc/readproc.h"

char * status(proc_t* task) {
    static char buf[4] = "   ";

    buf[0] = task->state;
    if (task->rss == 0 && task->state != 'Z')
        buf[1] = 'W';
    else
        buf[1] = ' ';
    if (task->nice < 0)
	buf[2] = '<';
    else if (task->nice > 0)
	buf[2] = 'N';
    else
	buf[2] = ' ';

    return(buf);
}