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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <dirent.h>
#include <string.h>
#include <sys/resource.h>
#include <unistd.h>
#include <sys/procfs.h>
#include <sys/statvfs.h>
#include <sys/types.h>
#include <sys/fault.h>
#include <sys/syscall.h>
#include <sys/param.h>
/****************************************/
/* Process state strings that we return */
/****************************************/
#define SLEEP "sleep"
#define WAIT "wait"
#define RUN "run"
#define IDLE "idle"
#define STOP "stop"
#define ONPROC "onprocessor"
/* Solaris is an all-or-nothing deal, all this stuff comes out of
one structure, so we don't need to dick around with the format much */
static char Format[] = "iiiiiiiilllllllslsis";
/* Mapping of field to type */
static char* Fields[] = {
"uid",
"gid",
"pid",
"ppid",
"pgrp",
"sess",
"priority",
"nice",
"ttynum",
"flags",
"time",
"timensec",
"size",
"rss",
"wchan",
"fname",
"start",
"state",
"onpro",
"cmndline"
};
|