/***************************************************************************/ /* Includes */ /***************************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include /***************************************************************************/ /* Defines */ /***************************************************************************/ /* * Process states * */ #define SLEEP "sleep" #define WAIT "wait" #define RUN "run" #define IDLE "idle" #define ZOMBIE "defunct" #define STOP "stop" #define UWAIT "uwait" #define ACTIVE "active" /*****************************************************************************/ /* Copyright (c) 1998, David Paquet. All rights reserved. */ /* This file is free software; you can redistribute it and/or modify it */ /* under the same terms as Perl itself. */ /*****************************************************************************/ /* * Arbitrary constants * */ /* Grab the maximum argument length */ #include #define MAX_PROCS 1024 /* Pretty overloaded isn't it ? */ #define MAXARGLN ARG_MAX /* * Some landmarks ... * */ #define F_STAT 9 #define F_TTY 27 #define F_PRM 32 #define F_COMM 33 #define F_FLAST 33 /***************************************************************************/ /* Globals */ /***************************************************************************/ static unsigned long long Sysmem; static int PageSize; static int ProcessNumber; static char Fullformat[] = "llllllllsslsllllllllllllllllllllsss"; static char Zombformat[] = "lllllllllslslllllll"; static char* ZombFields[] = { "pid", "ppid", "sess", "pgrp", "uid", "suid", "priority", "nice", "pctcpu", "stat", "flags", "wchan", "wtype", "adspace", "majflt", "minflt", "utime", "stime", "size" }; static char* FullFields[] = { "pid", "ppid", "sess", "pgrp", "uid", "suid", "priority", "nice", "pctcpu", "stat", "flags", "wchan", "wtype", "adspace", "majflt", "minflt", /* "utime", */ /* field valid for zombies only, see */ /* "stime", */ /* field valid for zombies only, see */ "size", "luid", "euid", "gid", "start", "utime", "stime", "cutime", "cstime", "tsize", "ttyp", "ttynum", "ttympx", "drss", "trss", "dvm", "pctmem", "comm", "cmndline" };