亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? machine.c

?? Ho Chi Minh City University of Technology Computer Science Department Distributed Computing E
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * top - a top users display for Unix * * SYNOPSIS:  Any Sun running SunOS 5.x (Solaris 2.x) * * DESCRIPTION: * This is the machine-dependent module for SunOS 5.x (Solaris 2). * There is some support for MP architectures. * This makes top work on the following systems: *         SunOS 5.0 (not tested) *         SunOS 5.1 *         SunOS 5.2 *         SunOS 5.3 *         SunOS 5.4 *         SunOS 5.5 *         SunOS 5.6 *         SunOS 5.7 (beta) * *     Tested on a SPARCclassic with SunOS 5.1, using gcc-2.3.3, and *     SPARCsystem 600 with SunOS 5.2, using Sun C * * LIBS: -lelf -lkvm -lkstat * * CFLAGS: -DHAVE_GETOPT -DORDER -DHAVE_STRERROR * * * AUTHORS:      Torsten Kasch 		<torsten@techfak.uni-bielefeld.de> *               Robert Boucher		<boucher@sofkin.ca> * CONTRIBUTORS: Marc Cohen 		<marc@aai.com> *               Charles Hedrick 	<hedrick@geneva.rutgers.edu> *	         William L. Jones 	<jones@chpc> *               Petri Kutvonen         <kutvonen@cs.helsinki.fi> *	         Casper Dik             <casper.dik@sun.com> *               Tim Pugh               <tpugh@oce.orst.edu> */#define _KMEMUSER#if (OSREV >= 54)#define SOLARIS24#endif#if (OSREV == 551)#undef OSREV#define OSREV 55#endif#define USE_NEW_PROC#if defined(USE_NEW_PROC) && OSREV >= 56#define _STRUCTURED_PROC 1#define prpsinfo psinfo#include <sys/procfs.h>#define pr_fill pr_nlwp/* These require an ANSI C compiler "Reisser cpp" doesn't like this */#define pr_state pr_lwp.pr_state#define pr_oldpri pr_lwp.pr_oldpri#define pr_nice pr_lwp.pr_nice#define pr_pri pr_lwp.pr_pri#define pr_onpro pr_lwp.pr_onpro#define ZOMBIE(p)	((p)->pr_nlwp == 0)#define SIZE_K(p)	((p)->pr_size)#define RSS_K(p)	((p)->pr_rssize)#else#undef USE_NEW_PROC#define ZOMBIE(p)	((p)->pr_zomb)#define SIZE_K(p)	((p)->pr_bysize/1024)#define RSS_K(p)	((p)->pr_byrssize/1024)#define pr_onpro 	pr_filler[5]#endif#include "top.h"#include "machine.h"#include "utils.h"#include <stdio.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h>#include <errno.h>#include <dirent.h>#include <nlist.h>#include <string.h>#include <kvm.h>#include <sys/types.h>#include <sys/param.h>#include <sys/signal.h>#include <sys/fault.h>#include <sys/sysinfo.h>#include <sys/sysmacros.h>#include <sys/syscall.h>#include <sys/user.h>#include <sys/proc.h>#include <sys/procfs.h>#include <sys/vm.h>#include <sys/var.h>#include <sys/cpuvar.h>#include <sys/file.h>#include <sys/time.h>#include <sys/priocntl.h>#include <sys/tspriocntl.h>#include <sys/processor.h>#include <sys/swap.h>#include <vm/anon.h>#include <math.h>#if OSREV >= 53#define USE_KSTAT#endif#ifdef USE_KSTAT#include <kstat.h>/* * Some kstats are fixed at 32 bits, these will be specified as ui32; some * are "natural" size (32 bit on 32 bit Solaris, 64 on 64 bit Solaris * we'll make those unsigned long) * Older Solaris doesn't define KSTAT_DATA_UINT32, those are always 32 bit. */# ifndef KSTAT_DATA_UINT32#  define ui32 ul# endif#endif#define UNIX "/dev/ksyms"#define KMEM "/dev/kmem"#define PROCFS "/proc"#define CPUSTATES     5#ifndef PRIO_MIN#define PRIO_MIN	-20#endif#ifndef PRIO_MAX#define PRIO_MAX	20#endif#ifndef FSCALE#define FSHIFT  8		/* bits to right of fixed binary point */#define FSCALE  (1<<FSHIFT)#endif /* FSCALE */#define loaddouble(la) ((double)(la) / FSCALE)#define dbl_align(x)	(((unsigned long)(x)+(sizeof(double)-1)) & \						~(sizeof(double)-1))#ifdef SOLARIS24    /*     * snarfed from <sys/procfs.h>:     * The following percent numbers are 16-bit binary     * fractions [0 .. 1] with the binary point to the     * right of the high-order bit (one == 0x8000)     */#define percent_cpu(pp) (((double)pp->pr_pctcpu)/0x8000*100)#define weighted_cpu(pp) (*(double *)dbl_align(pp->pr_filler))#else#define percent_cpu(pp) (*(double *)dbl_align(&pp->pr_filler[0]))#define weighted_cpu(pp) (*(double *)dbl_align(&pp->pr_filler[2]))#endif/* definitions for indices in the nlist array */#define X_V			 0#define X_MPID			 1#define X_ANONINFO		 2#define X_MAXMEM		 3#define X_SWAPFS_MINFREE	 4#define X_FREEMEM		 5#define X_AVAILRMEM		 6#define X_AVENRUN		 7#define X_CPU			 8#define X_NPROC			 9#define X_NCPUS		   	10static struct nlist nlst[] ={  {"v"},			/* 0 */	/* replaced by dynamic allocation */  {"mpid"},			/* 1 */#if OSREV >= 56  /* this structure really has some extra fields, but the first three match */  {"k_anoninfo"},		/* 2 */#else  {"anoninfo"},			/* 2 */#endif  {"maxmem"},			/* 3 */ /* use sysconf */  {"swapfs_minfree"},		/* 4 */	/* used only w/ USE_ANONINFO */  {"freemem"},			/* 5 */	/* available from kstat >= 2.5 */  {"availrmem"},		/* 6 */	/* available from kstat >= 2.5 */  {"avenrun"},			/* 7 */ /* available from kstat */  {"cpu"},			/* 8 */ /* available from kstat */  {"nproc"},			/* 9 */ /* available from kstat */  {"ncpus"},			/* 10 */ /* available from kstat */  {0}};static unsigned long avenrun_offset;static unsigned long mpid_offset;#ifdef USE_KSTAT#define NO_NPROCstatic kstat_ctl_t *kc = NULL;static kstat_t **cpu_ks;static cpu_stat_t *cpu_stat;#elsestatic unsigned long *cpu_offset;#endifstatic unsigned long nproc_offset;static unsigned long freemem_offset;static unsigned long maxmem_offset;static unsigned long availrmem_offset;static unsigned long swapfs_minfree_offset;static unsigned long anoninfo_offset;static void reallocproc(int n);static int maxprocs;/* get_process_info passes back a handle.  This is what it looks like: */struct handle  {    struct prpsinfo **next_proc;/* points to next valid proc pointer */    int remaining;		/* number of pointers remaining */  };/* * Structure for keeping track of CPU times from last time around * the program.  We keep these things in a hash table, which is * recreated at every cycle. */struct oldproc  {    pid_t oldpid;    double oldtime;    double oldpct;  };int oldprocs;			/* size of table */#define HASH(x) ((x << 1) % oldprocs)/* * GCC assumes that all doubles are aligned.  Unfortunately it * doesn't round up the structure size to be a multiple of 8. * Thus we'll get a coredump when going through array.  The * following is a size rounded up to 8. */#define PRPSINFOSIZE dbl_align(sizeof(struct prpsinfo))/* *  These definitions control the format of the per-process area */static char header[] ="  PID X        THR PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND";/* 0123456   -- field to fill in starts at header+6 */#define UNAME_START 6#define Proc_format \        "%5d %-8.8s %3d %3d %4d %5s %5s %-5s %6s %5.2f%% %s"/* process state names for the "STATE" column of the display *//* the extra nulls in the string "run" are for adding a slash and   the processor number when needed */char *state_abbrev[] ={"", "sleep", "run", "zombie", "stop", "start", "cpu", "swap"};int process_states[8];char *procstatenames[] ={  "", " sleeping, ", " running, ", " zombie, ", " stopped, ",  " starting, ", " on cpu, ", " swapped, ",  NULL};int cpu_states[CPUSTATES];char *cpustatenames[] ={"idle", "user", "kernel", "iowait", "swap", NULL};#define CPUSTATE_IOWAIT 3#define CPUSTATE_SWAP   4/* these are for detailing the memory statistics */int memory_stats[5];char *memorynames[] ={"K real, ", "K active, ", "K free, ", "K swap in use, ", "K swap free", NULL};/* these are names given to allowed sorting orders -- first is default */char *ordernames[] = {"cpu", "size", "res", "time", NULL};/* forward definitions for comparison functions */int compare_cpu();int compare_size();int compare_res();int compare_time();int (*proc_compares[])() = {    compare_cpu,    compare_size,    compare_res,    compare_time,    NULL };kvm_t *kd;static DIR *procdir;static int nproc;static int ncpus;/* these are for keeping track of the proc array */static int bytes;static struct prpsinfo *pbase;static struct prpsinfo **pref;static struct oldproc *oldbase;/* pagetok function is really a pointer to an appropriate function */static int pageshift;static int (*p_pagetok) ();#define pagetok(size) ((*p_pagetok)(size))/* useful externals */extern char *myname;extern int check_nlist ();extern int gettimeofday ();extern int getkval ();extern void perror ();extern void getptable ();extern void quit ();extern int nlist ();int pagetok_none(int size){    return(size);}int pagetok_left(int size){    return(size << pageshift);}int pagetok_right(int size){    return(size >> pageshift);}intmachine_init (struct statics *statics){    static struct var v;    struct oldproc *op, *endbase;    int i;#ifndef USE_KSTAT    int offset;#endif    /* perform the kvm_open */    kd = kvm_open (NULL, NULL, NULL, O_RDONLY, "top");    /*     * turn off super group/user privs - but beware; we might     * want the privs back later and we still have a fd to     * /dev/kmem open so we can't use setgid()/setuid() as that     * would allow a debugger to attach to this process. CD     */    setegid(getgid());    seteuid(getuid()); /* super user not needed for NEW_PROC */    /* fill in the statics information */    statics->procstate_names = procstatenames;    statics->cpustate_names = cpustatenames;    statics->memory_names = memorynames;    statics->order_names = ordernames;    /* test kvm_open return value */    if (kd == NULL)      {	perror ("kvm_open");#ifndef USE_KSTAT	return (-1);#endif      }    if (kd)      {      if (kvm_nlist (kd, nlst) < 0)        {	  perror ("kvm_nlist");	  return (-1);        }      if (check_nlist (nlst) != 0)        return (-1);      }#ifndef NO_NPROC    /* NPROC Tuning parameter for max number of processes */    (void) getkval (nlst[X_V].n_value, &v, sizeof (struct var), nlst[X_V].n_name);    nproc = v.v_proc;    reallocproc(nproc);#endif    /* stash away certain offsets for later use */    mpid_offset = nlst[X_MPID].n_value;    nproc_offset = nlst[X_NPROC].n_value;    avenrun_offset = nlst[X_AVENRUN].n_value;    anoninfo_offset = nlst[X_ANONINFO].n_value;    freemem_offset = nlst[X_FREEMEM].n_value;    maxmem_offset = nlst[X_MAXMEM].n_value;    availrmem_offset = nlst[X_AVAILRMEM].n_value;    swapfs_minfree_offset = nlst[X_SWAPFS_MINFREE].n_value;#ifndef USE_KSTAT    (void) getkval (nlst[X_NCPUS].n_value, (int *) (&ncpus),		    sizeof (ncpus), "ncpus");    cpu_offset = (unsigned long *) malloc (ncpus * sizeof (unsigned long));    for (i = offset = 0; i < ncpus; offset += sizeof(unsigned long)) {        (void) getkval (nlst[X_CPU].n_value + offset,                        &cpu_offset[i], sizeof (unsigned long),                        nlst[X_CPU].n_name );        if (cpu_offset[i] != 0)            i++;    }#endif    /* calculate pageshift value */    i = sysconf(_SC_PAGESIZE);    pageshift = 0;    while ((i >>= 1) > 0)    {	pageshift++;    }    /* calculate an amount to shift to K values */    /* remember that log base 2 of 1024 is 10 (i.e.: 2^10 = 1024) */    pageshift -= 10;    /* now determine which pageshift function is appropriate for the        result (have to because x << y is undefined for y < 0) */    if (pageshift > 0)    {	/* this is the most likely */	p_pagetok = pagetok_left;    }    else if (pageshift == 0)    {	p_pagetok = pagetok_none;    }    else    {	p_pagetok = pagetok_right;	pageshift = -pageshift;    }    if (!(procdir = opendir (PROCFS)))      {	(void) fprintf (stderr, "Unable to open %s\n", PROCFS);	return (-1);      }    if (chdir (PROCFS))      {				/* handy for later on when we're reading it */	(void) fprintf (stderr, "Unable to chdir to %s\n", PROCFS);	return (-1);      }    /* all done! */    return (0);  }char *format_header (register char *uname_field){  register char *ptr;  ptr = header + UNAME_START;  while (*uname_field != '\0')    *ptr++ = *uname_field++;  return (header);}#ifdef USE_KSTAT#define UPDKCID(nk,ok) \if (nk == -1) { \  perror("kstat_read "); \  quit(1); \} \if (nk != ok)\

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品自拍一区| 久久婷婷国产综合国色天香| 亚洲成av人片在线| 91在线观看成人| 日本欧美韩国一区三区| 久久久精品人体av艺术| 欧美在线视频日韩| 国产成人精品免费视频网站| 夜夜嗨av一区二区三区中文字幕| 欧美一级黄色片| 国产精品1区2区| 日本亚洲欧美天堂免费| 国产精品久久久久久久久久久免费看| 欧美日韩在线三区| 国产成人自拍高清视频在线免费播放| 日日夜夜免费精品| 国产精品蜜臀av| 日韩欧美一级精品久久| 国产成a人亚洲精品| 久久精品国产久精国产爱| 综合网在线视频| 欧美v日韩v国产v| www.日韩av| 成人一区二区三区在线观看| 一区二区三区四区高清精品免费观看| 欧美日韩国产一级| 欧洲av一区二区嗯嗯嗯啊| 国产成人午夜99999| 奇米在线7777在线精品| 亚洲成人黄色影院| 中文字幕一区免费在线观看 | 国产伦精品一区二区三区视频青涩 | 精品久久久久久综合日本欧美| 日本精品视频一区二区| 亚洲欧美在线视频观看| 日本道免费精品一区二区三区| 午夜精品一区二区三区免费视频| 国产精品一区二区久久不卡 | 亚洲一区二区三区四区不卡| 色综合久久天天| 国产乱国产乱300精品| 久久久欧美精品sm网站| 欧美人伦禁忌dvd放荡欲情| 97精品国产97久久久久久久久久久久 | www.66久久| 成人高清av在线| 日韩综合一区二区| 亚洲国产wwwccc36天堂| 亚洲一区二区欧美日韩 | 91在线视频观看| 国产高清精品久久久久| 成人精品小蝌蚪| 国产成人免费av在线| 国模套图日韩精品一区二区| 麻豆成人综合网| 国产麻豆成人精品| 福利电影一区二区| 粉嫩13p一区二区三区| 丁香一区二区三区| 91在线云播放| 色哟哟一区二区| 欧美性猛交xxxxxxxx| 欧美精品成人一区二区三区四区| 欧美日韩国产精品成人| 在线综合视频播放| 日韩一区二区三区电影在线观看 | 亚洲高清免费视频| 亚洲你懂的在线视频| 自拍偷拍亚洲激情| 亚洲国产美女搞黄色| 天天综合天天做天天综合| 欧美a一区二区| 国产精品亚洲第一| 成人精品免费视频| 91女神在线视频| 91精品一区二区三区在线观看| 日韩欧美国产一区二区在线播放| 日韩一卡二卡三卡四卡| 久久免费电影网| 久久―日本道色综合久久| 日本一区二区在线不卡| 国产精品99久| 国内外成人在线| 欧美日韩中文国产| 亚洲摸摸操操av| ㊣最新国产の精品bt伙计久久| 国产亚洲一区二区三区| 中文字幕免费一区| 亚洲免费观看高清完整| 一区二区三区精品视频| 亚洲午夜免费电影| 国产一区二区影院| 91麻豆6部合集magnet| 久久久99久久| 中文字幕在线免费不卡| 一区二区在线免费观看| 秋霞电影网一区二区| 国产91丝袜在线观看| 91成人国产精品| 精品奇米国产一区二区三区| 亚洲国产精品二十页| 亚洲综合一区在线| 日韩黄色一级片| 成人黄色在线视频| 欧美精品三级日韩久久| 国产精品青草久久| 日韩精品一级中文字幕精品视频免费观看 | 伊人婷婷欧美激情| 久久不见久久见免费视频7| 国产精品中文字幕欧美| 在线观看一区日韩| 国产视频一区不卡| 午夜婷婷国产麻豆精品| 成人一区二区三区| 26uuu色噜噜精品一区| 亚洲永久免费视频| 国产美女久久久久| 91精品在线观看入口| 亚洲mv在线观看| 97精品久久久久中文字幕| 精品国产1区二区| 怡红院av一区二区三区| 99精品欧美一区| 国产欧美一区在线| 精品中文字幕一区二区小辣椒| 91精品1区2区| 国产精品久久久久婷婷二区次| 国产一区二区在线观看视频| 日韩视频免费观看高清在线视频| 午夜精品一区在线观看| 欧美三级欧美一级| 亚洲国产精品影院| 欧美日韩视频在线第一区| 亚洲美女电影在线| 91久久线看在观草草青青| 亚洲欧洲一区二区三区| 一本色道综合亚洲| 国产日韩三级在线| 日韩美女视频在线| 色婷婷av一区二区三区软件| 色综合久久综合网97色综合| 五月综合激情网| 国产亚洲va综合人人澡精品 | 国产亚洲精品免费| 成人97人人超碰人人99| 亚洲美女精品一区| 久久日韩粉嫩一区二区三区| 99精品视频在线观看| 老司机午夜精品99久久| 精品无码三级在线观看视频| 久久久久久久久蜜桃| 国产成人在线视频播放| 国产精品午夜久久| 91黄色免费网站| 日韩成人免费看| 精品久久久久一区二区国产| 国产精品一级片在线观看| 国产精品护士白丝一区av| 一本色道久久综合精品竹菊| 亚洲国产一区二区a毛片| 日韩精品中文字幕在线不卡尤物| 国模冰冰炮一区二区| 国产精品久久久久影院亚瑟| 欧美亚洲尤物久久| 美女在线一区二区| 国产精品毛片大码女人| 色av一区二区| 另类的小说在线视频另类成人小视频在线| 精品va天堂亚洲国产| 99re这里只有精品首页| 午夜精品久久久久久| 久久综合一区二区| 色国产精品一区在线观看| 日韩成人免费看| 欧美国产综合色视频| 欧美午夜精品久久久久久孕妇| 精品中文字幕一区二区| 有坂深雪av一区二区精品| 日韩一区二区三区高清免费看看| 成人av网站免费观看| 日精品一区二区| 成人免费在线观看入口| 欧美一级高清片在线观看| 不卡av免费在线观看| 蜜桃视频一区二区三区在线观看| 亚洲四区在线观看| 日韩欧美中文字幕公布| 色综合天天综合色综合av| 男人的天堂亚洲一区| 亚洲伦理在线精品| 欧美videos大乳护士334| 91福利国产成人精品照片| 九色综合国产一区二区三区| 亚洲最新在线观看| 亚洲国产精品99久久久久久久久| 91精品久久久久久蜜臀| 一本一道久久a久久精品| 国产精选一区二区三区| 日韩和欧美一区二区| 亚洲精品成a人|