#include <xinu.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
◆ xsh_ps()
shellcmd xsh_ps |
( |
int |
nargs, |
|
|
char * |
args[] |
|
) |
| |
Definition at line 11 of file xsh_ps.c.
References fprintf(), NPROC, PR_FREE, printf(), procent::prname, proctab, procent::prparent, procent::prprio, procent::prstate, procent::prstkbase, procent::prstklen, procent::prstkptr, stderr, and strncmp().
16 "free ",
"curr ",
"ready",
"recv ",
"sleep",
"susp ",
21 if (nargs == 2 &&
strncmp(args[1],
"--help", 7) == 0) {
22 printf(
"Use: %s\n\n", args[0]);
24 printf(
"\tDisplays information about running processes\n");
26 printf(
"\t--help\t display this help and exit\n");
41 printf(
"%3s %-16s %5s %4s %4s %10s %-10s %10s\n",
42 "Pid",
"Name",
"State",
"Prio",
"Ppid",
"Stack Base",
43 "Stack Ptr",
"Stack Size");
45 printf(
"%3s %-16s %5s %4s %4s %10s %-10s %10s\n",
46 "---",
"----------------",
"-----",
"----",
"----",
47 "----------",
"----------",
"----------");
51 for (i = 0; i <
NPROC; i++) {
56 printf(
"%3d %-16s %s %4d %4d 0x%08X 0x%08X %8d\n",
pid32 prparent
このプロセスを作成したプロセスID(親プロセスID)。
int32 strncmp(const char *, const char *, int32)
int32 printf(const char *,...)
uint32 prstklen
Bytesで表されたスタックの長さ(最大値。Byte)。
pri16 prprio
プロセスのスケジューリング優先度。
char prname[PNMLEN]
プロセス名。
char * prstkbase
ランタイムスタックの基点(メモリ領域で最上位のアドレス)。
int int32
符号あり32ビット整数(int)
uint16 prstate
プロセス状態(PR_CURR, ..., etc)。
#define PR_FREE
プロセステーブルエントリが使用されていない状態。
struct procent proctab[]
プロセステーブル。
int32 fprintf(int, char *,...)
char * prstkptr
保存されたスタックポインタ。