status.c

来自「Linux下进程监控相关源代码」· C语言 代码 · 共 30 行

C
30
字号
/***********************************************************************\*   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 for information on distribution conditions.    *\***********************************************************************/#include "proc/procps.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);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?