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

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

?? top.c

?? linux下獲取一些環境信息的代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* top.c - Source file:         show Linux processes *//* * Copyright (c) 2002, by:      James C. Warner *    All rights reserved.      8921 Hilloway Road *                              Eden Prairie, Minnesota 55347 USA *                             <warnerjc@worldnet.att.net> * * This file may be used subject to the terms and conditions of the * GNU Library General Public License Version 2, or any later version * at your option, as published by the Free Software Foundation. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU Library General Public License for more details. *  * For their contributions to this program, the author wishes to thank: *    Albert D. Cahalan, <albert@users.sf.net> *    Craig Small, <csmall@small.dropbear.id.au> * * Changes by Albert Cahalan, 2002-2004. */#include <sys/ioctl.h>#include <sys/resource.h>#include <sys/time.h>#include <sys/types.h>#include <sys/stat.h>#include <ctype.h>#include <curses.h>#include <errno.h>#include <fcntl.h>#include <signal.h>#include <stdarg.h>#include <stdio.h>#include <stdlib.h>#include <string.h>// Foul POS defines all sorts of stuff...#include <term.h>#undef tab#include <termios.h>#include <time.h>#include <unistd.h>#include <values.h>#include "proc/devname.h"#include "proc/wchan.h"#include "proc/procps.h"#include "proc/readproc.h"#include "proc/escape.h"#include "proc/sig.h"#include "proc/sysinfo.h"#include "proc/version.h"#include "proc/whattime.h"#include "top.h"/*######  Miscellaneous global stuff  ####################################*/        /* The original and new terminal attributes */static struct termios Savedtty,                      Rawtty;static int Ttychanged = 0;        /* Program name used in error messages and local 'rc' file name */static char *Myname;        /* Name of user config file (dynamically constructed) and our           'Current' rcfile contents, initialized with defaults but may be           overridden with the local rcfile (old or new-style) values */static char  Rc_name [OURPATHSZ];static RCF_t Rc = DEF_RCFILE;        /* The run-time acquired page size */static unsigned Page_size;static unsigned page_to_kb_shift;        /* SMP Irix/Solaris mode */static int  Cpu_tot;static double pcpu_max_value;  // usually 99.9, for %CPU display        /* assume no IO-wait stats, overridden if linux 2.5.41 */static const char *States_fmts = STATES_line2x4;        /* Specific process id monitoring support */static pid_t Monpids [MONPIDMAX] = { 0 };static int   Monpidsidx = 0;        /* A postponed error message */static char Msg_delayed [SMLBUFSIZ];static int  Msg_awaiting = 0;// This is the select() timeout. Clear it in sig handlers to avoid a race.// (signal happens just as we are about to select() and thus does not// break us out of the select(), causing us to delay until timeout)static volatile struct timeval tv;#define ZAP_TIMEOUT do{tv.tv_usec=0; tv.tv_sec=0;}while(0);        /* Configurable Display support ##################################*/        /* Current screen dimensions.           note: the number of processes displayed is tracked on a per window                 basis (see the WIN_t).  Max_lines is the total number of                 screen rows after deducting summary information overhead. */        /* Current terminal screen size. */static int Screen_cols, Screen_rows, Max_lines;// set to 1 if writing to the last column would be troublesome// (we don't distinguish the lowermost row from the other rows)static int avoid_last_column;        /* This is really the number of lines needed to display the summary           information (0 - nn), but is used as the relative row where we           stick the cursor between frames. */static int Msg_row;        /* Global/Non-windows mode stuff that is NOT persistent */static int No_ksyms = -1,       // set to '0' if ksym avail, '1' otherwise           PSDBopen = 0,        // set to '1' if psdb opened (now postponed)           Batch = 0,           // batch mode, collect no input, dumb output           Loops = -1,          // number of iterations, -1 loops forever           Secure_mode = 0;     // set if some functionality restricted        /* Some cap's stuff to reduce runtime calls --           to accomodate 'Batch' mode, they begin life as empty strings */static char  Cap_clr_eol    [CAPBUFSIZ],             Cap_clr_eos    [CAPBUFSIZ],             Cap_clr_scr    [CAPBUFSIZ],             Cap_rmam       [CAPBUFSIZ],             Cap_smam       [CAPBUFSIZ],             Cap_curs_norm  [CAPBUFSIZ],             Cap_curs_huge  [CAPBUFSIZ],             Cap_home       [CAPBUFSIZ],             Cap_norm       [CAPBUFSIZ],             Cap_reverse    [CAPBUFSIZ],             Caps_off       [CAPBUFSIZ];static int   Cap_can_goto = 0;        /* Some optimization stuff, to reduce output demands...           The Pseudo_ guys are managed by wins_resize and frame_make.  They           are exploited in a macro and represent 90% of our optimization.           The Stdout_buf is transparent to our code and regardless of whose           buffer is used, stdout is flushed at frame end or if interactive. */static char *Pseudo_scrn;static int   Pseudo_row, Pseudo_cols, Pseudo_size;#ifndef STDOUT_IOLBF        // less than stdout's normal buffer but with luck mostly '\n' anywaystatic char  Stdout_buf[2048];#endif        /* ////////////////////////////////////////////////////////////// */        /* Special Section: multiple windows/field groups  ---------------*/        /* The pointers to our four WIN_t's, and which of those is considered           the 'current' window (ie. which window is associated with any summ           info displayed and to which window commands are directed) */static WIN_t Winstk [GROUPSMAX],             *Curwin;        /* Frame oriented stuff that can't remain local to any 1 function           and/or that would be too cumbersome managed as parms,           and/or that are simply more efficiently handled as globals           (first 2 persist beyond a single frame, changed infrequently) */static int       Frames_libflags;       // PROC_FILLxxx flags (0 = need new)//atic int       Frames_maxcmdln;       // the largest from the 4 windowsstatic unsigned  Frame_maxtask;         // last known number of active tasks                                        // ie. current 'size' of proc tablestatic unsigned  Frame_running,         // state categories for this frame                 Frame_sleepin,                 Frame_stopped,                 Frame_zombied;static float     Frame_tscale;          // so we can '*' vs. '/' WHEN 'pcpu'static int       Frame_srtflg,          // the subject window's sort direction                 Frame_ctimes,          // the subject window's ctimes flag                 Frame_cmdlin;          // the subject window's cmdlin flag        /* ////////////////////////////////////////////////////////////// *//*######  Sort callbacks  ################################################*/        /*         * These happen to be coded in the same order as the enum 'pflag'         * values.  Note that 2 of these routines serve double duty --         * 2 columns each.         */SCB_NUMx(P_PID, XXXID)SCB_NUMx(P_PPD, ppid)SCB_STRx(P_URR, ruser)SCB_NUMx(P_UID, euid)SCB_STRx(P_URE, euser)SCB_STRx(P_GRP, egroup)SCB_NUMx(P_TTY, tty)SCB_NUMx(P_PRI, priority)SCB_NUMx(P_NCE, nice)SCB_NUMx(P_CPN, processor)SCB_NUM1(P_CPU, pcpu)                                        // also serves P_TM2 !static int sort_P_TME (const proc_t **P, const proc_t **Q){   if (Frame_ctimes) {      if ( ((*P)->cutime + (*P)->cstime + (*P)->utime + (*P)->stime)        < ((*Q)->cutime + (*Q)->cstime + (*Q)->utime + (*Q)->stime) )           return SORT_lt;      if ( ((*P)->cutime + (*P)->cstime + (*P)->utime + (*P)->stime)        > ((*Q)->cutime + (*Q)->cstime + (*Q)->utime + (*Q)->stime) )           return SORT_gt;   } else {      if ( ((*P)->utime + (*P)->stime) < ((*Q)->utime + (*Q)->stime))         return SORT_lt;      if ( ((*P)->utime + (*P)->stime) > ((*Q)->utime + (*Q)->stime))         return SORT_gt;   }   return SORT_eq;}SCB_NUM1(P_VRT, size)SCB_NUM2(P_SWP, size, resident)SCB_NUM1(P_RES, resident)               // also serves P_MEM !SCB_NUM1(P_COD, trs)SCB_NUM1(P_DAT, drs)SCB_NUM1(P_SHR, share)SCB_NUM1(P_FLT, maj_flt)SCB_NUM1(P_DRT, dt)SCB_NUMx(P_STA, state)static int sort_P_CMD (const proc_t **P, const proc_t **Q){   /* if a process doesn't have a cmdline, we'll consider it a kernel thread      -- since displayed tasks are given special treatment, we must too */   if (Frame_cmdlin && ((*P)->cmdline || (*Q)->cmdline)) {      if (!(*Q)->cmdline) return Frame_srtflg * -1;      if (!(*P)->cmdline) return Frame_srtflg;      return Frame_srtflg *         strncmp((*Q)->cmdline[0], (*P)->cmdline[0], (unsigned)Curwin->maxcmdln);   }   // this part also handles the compare if both are kernel threads   return Frame_srtflg * strcmp((*Q)->cmd, (*P)->cmd);}SCB_NUM1(P_WCH, wchan)SCB_NUM1(P_FLG, flags)        /* ///////////////////////////////// special sort for prochlp() ! */static int sort_HST_t (const HST_t *P, const HST_t *Q){   return P->pid - Q->pid;}/*######  Tiny useful routine(s)  ########################################*/        /*         * This routine isolates ALL user INPUT and ensures that we         * wont be mixing I/O from stdio and low-level read() requests */static int chin (int ech, char *buf, unsigned cnt){   int rc;   fflush(stdout);   if (!ech)      rc = read(STDIN_FILENO, buf, cnt);   else {      tcsetattr(STDIN_FILENO, TCSAFLUSH, &Savedtty);      rc = read(STDIN_FILENO, buf, cnt);      tcsetattr(STDIN_FILENO, TCSAFLUSH, &Rawtty);   }   // may be the beginning of a lengthy escape sequence   tcflush(STDIN_FILENO, TCIFLUSH);   return rc;                   // note: we do NOT produce a vaid 'string'}// This routine simply formats whatever the caller wants and// returns a pointer to the resulting 'const char' string...static const char *fmtmk (const char *fmts, ...) __attribute__((format(printf,1,2)));static const char *fmtmk (const char *fmts, ...){   static char buf[BIGBUFSIZ];          // with help stuff, our buffer   va_list va;                          // requirements exceed 1k   va_start(va, fmts);   vsnprintf(buf, sizeof(buf), fmts, va);   va_end(va);   return (const char *)buf;}// This guy is just our way of avoiding the overhead of the standard// strcat function (should the caller choose to participate)static inline char *scat (char *restrict dst, const char *restrict src){   while (*dst) dst++;   while ((*(dst++) = *(src++)));   return --dst;}// Trim the rc file lines and any 'open_psdb_message' result which arrives// with an inappropriate newline (thanks to 'sysmap_mmap')static char *strim_0 (char *str){   static const char ws[] = "\b\e\f\n\r\t\v\x9b";  // 0x9b is an escape   char *p;   if ((p = strpbrk(str, ws))) *p = 0;   return str;}// This guy just facilitates Batch and protects against dumb ttys// -- we'd 'inline' him but he's only called twice per frame,// yet used in many other locations.static const char *tg2 (int x, int y){   return Cap_can_goto ? tgoto(cursor_address, x, y) : "";}/*######  Exit/Interrput routines  #######################################*/// The usual program end -- called only by functions in this section.static void bye_bye (FILE *fp, int eno, const char *str) NORETURN;static void bye_bye (FILE *fp, int eno, const char *str){   if (!Batch)      tcsetattr(STDIN_FILENO, TCSAFLUSH, &Savedtty);   putp(tg2(0, Screen_rows));   putp(Cap_curs_norm);   putp(Cap_smam);   putp("\n");   fflush(stdout);//#define ATEOJ_REPORT#ifdef ATEOJ_REPORT   fprintf(fp,      "\n\tTerminal: %s"      "\n\t   device = %s, ncurses = v%s"      "\n\t   max_colors = %d, max_pairs = %d"      "\n\t   Cap_can_goto = %s"      "\n\t   Screen_cols = %d, Screen_rows = %d"      "\n\t   Max_lines = %d, most recent Pseudo_size = %d"      "\n"#ifdef PRETENDNOCAP      , "dumb"#else      , termname()#endif      , ttyname(STDOUT_FILENO), NCURSES_VERSION      , max_colors, max_pairs      , Cap_can_goto ? "yes" : "No!"      , Screen_cols, Screen_rows      , Max_lines, Pseudo_size      );   fprintf(fp,#ifndef STDOUT_IOLBF      "\n\t   Stdout_buf = %d, BUFSIZ = %u"#endif      "\n\tWindows and Curwin->"      "\n\t   sizeof(WIN_t) = %u, GROUPSMAX = %d"      "\n\t   rc.winname = %s, grpname = %s"      "\n\t   rc.winflags = %08x, maxpflgs = %d"      "\n\t   rc.fieldscur = %s"      "\n\t   winlines  = %d, rc.maxtasks = %d, maxcmdln = %d"      "\n\t   rc.sortindx  = %d"      "\n"#ifndef STDOUT_IOLBF      , sizeof(Stdout_buf), (unsigned)BUFSIZ#endif      , sizeof(WIN_t), GROUPSMAX      , Curwin->rc.winname, Curwin->grpname      , Curwin->rc.winflags, Curwin->maxpflgs      , Curwin->rc.fieldscur      , Curwin->winlines, Curwin->rc.maxtasks, Curwin->maxcmdln      , Curwin->rc.sortindx      );

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二区三区四区不卡| www.亚洲色图.com| 婷婷六月综合网| 亚洲成av人综合在线观看| 亚洲综合一区二区| 亚洲国产视频网站| 日本午夜精品视频在线观看| 三级久久三级久久| 久久超级碰视频| 亚洲大片精品永久免费| 天天色图综合网| 丁香另类激情小说| 欧美三区免费完整视频在线观看| 日韩精品一区二区三区在线播放| 国产日韩精品一区二区浪潮av| 亚洲欧美色一区| 日本欧美加勒比视频| 色哟哟日韩精品| 久久久久久久久蜜桃| 日韩中文字幕91| 成人sese在线| 色婷婷一区二区三区四区| 中文字幕av一区 二区| 美女诱惑一区二区| 欧美电影免费提供在线观看| 亚洲欧洲在线观看av| 国产精品99久久久久久有的能看| 91精品国产91综合久久蜜臀| 亚洲国产精品欧美一二99| 色噜噜狠狠色综合中国| 国产精品久久久久久久久图文区 | 91视频国产观看| 欧美国产日韩在线观看| 韩国av一区二区三区在线观看| 狠狠色丁香婷婷综合| www.亚洲人| 欧美亚洲日本国产| 亚洲在线成人精品| 成人午夜免费av| 宅男噜噜噜66一区二区66| 久久久久一区二区三区四区| 亚洲欧美激情小说另类| 国产电影一区在线| 91精品免费在线观看| 亚洲国产精品国自产拍av| 免费成人在线观看视频| 成人爽a毛片一区二区免费| 欧美不卡一区二区| 亚洲一区二区三区四区的| 97精品视频在线观看自产线路二| 国产亚洲一区二区在线观看| 洋洋av久久久久久久一区| av欧美精品.com| 亚洲精品久久久久久国产精华液| 国产91精品一区二区麻豆亚洲| 日韩三级av在线播放| 婷婷六月综合亚洲| 欧美大片在线观看| 26uuu色噜噜精品一区| 91麻豆福利精品推荐| 午夜国产精品影院在线观看| 欧美一级日韩不卡播放免费| 麻豆精品在线视频| 国产人久久人人人人爽| 成人激情校园春色| 亚瑟在线精品视频| 国内成人精品2018免费看| 91亚洲午夜精品久久久久久| 亚洲一区二区在线播放相泽 | 成人一区在线看| 欧美精品自拍偷拍动漫精品| 成人91在线观看| 五月天久久比比资源色| 久久老女人爱爱| 色综合久久中文字幕| 秋霞午夜av一区二区三区| 久久精品在线观看| 欧美三级欧美一级| 国产欧美日韩不卡| 精品国产91乱码一区二区三区| 99久久精品国产观看| 蜜臀精品久久久久久蜜臀 | 亚洲成人免费电影| 国产亚洲女人久久久久毛片| 一本久道中文字幕精品亚洲嫩| 国产+成+人+亚洲欧洲自线| 日本欧美韩国一区三区| 亚洲欧洲中文日韩久久av乱码| 日韩精品一区二区三区视频播放 | 国产成人自拍高清视频在线免费播放| 亚洲香肠在线观看| 免费看日韩a级影片| 亚洲大片一区二区三区| 国产精品久久久久9999吃药| 日韩精品中午字幕| 正在播放一区二区| 国产一区二区三区四| 91丨porny丨国产| 色综合久久88色综合天天| 捆绑变态av一区二区三区| 亚洲一区二区三区四区在线观看| 中文字幕不卡在线| 日韩欧美一区在线| 日本一区二区三级电影在线观看 | 国产精品无人区| 国产亚洲欧洲一区高清在线观看| 日韩视频免费观看高清完整版| 一本到不卡精品视频在线观看| 韩国理伦片一区二区三区在线播放| 亚洲午夜电影在线| 久久成人久久鬼色| 欧美伊人精品成人久久综合97| 欧美亚洲愉拍一区二区| 制服丝袜中文字幕一区| 久久在线免费观看| 亚洲午夜影视影院在线观看| 国产日产欧美精品一区二区三区| 午夜亚洲国产au精品一区二区| 久久99热国产| 色婷婷综合久久久中文一区二区| 91精品国产免费久久综合| 国产日韩精品一区二区三区在线| 中文字幕av一区二区三区高 | 亚洲成人先锋电影| 亚洲精品国产a久久久久久| 99精品一区二区三区| 国产三级欧美三级| 亚洲成人免费影院| www.在线欧美| 欧美激情在线免费观看| 日产精品久久久久久久性色| 国产曰批免费观看久久久| 欧美精品一区二区高清在线观看 | 久久99久久久久| 这里只有精品99re| 亚洲一二三区视频在线观看| 国产麻豆精品在线观看| 成人午夜碰碰视频| 国产精品乱人伦| 成人av网站免费观看| 久久久国际精品| 国产麻豆视频精品| 欧美高清性hdvideosex| 韩国v欧美v亚洲v日本v| 亚洲精品一区二区三区香蕉| 国内精品久久久久影院色 | 国产视频视频一区| 高清成人在线观看| 亚洲欧洲一区二区在线播放| 欧美视频在线一区| 日韩成人免费看| 精品久久国产字幕高潮| 成人小视频在线| 亚洲黄色性网站| 色久优优欧美色久优优| 中文字幕av一区二区三区免费看| 麻豆国产精品一区二区三区| 欧美精品少妇一区二区三区| 激情小说亚洲一区| 中文字幕一区在线观看视频| 欧美午夜视频网站| 国产综合色在线视频区| 日韩理论片在线| 欧美精品三级在线观看| 国产成人免费在线| 亚洲国产成人tv| 日韩精品一区二区三区视频播放| 国产精品一区免费在线观看| 亚洲综合激情小说| 日本一区免费视频| 精品成人免费观看| 欧美日韩国产综合一区二区| 蜜桃视频在线一区| 亚洲午夜日本在线观看| 国产精品亲子伦对白| 99久久久久免费精品国产| 不卡视频免费播放| 国产成人午夜精品影院观看视频| 亚洲va欧美va人人爽| 中文字幕在线观看一区二区| 国产调教视频一区| 一区二区免费视频| 综合电影一区二区三区| 国产精品天美传媒| 国产亚洲成aⅴ人片在线观看 | 午夜一区二区三区视频| 精品欧美黑人一区二区三区| 国产偷国产偷亚洲高清人白洁| 欧美大度的电影原声| 精品粉嫩超白一线天av| 日韩美女一区二区三区四区| 日韩精品中午字幕| 国产精品人成在线观看免费| 欧美国产国产综合| 亚洲一区视频在线观看视频| 亚洲尤物视频在线| 国产精品水嫩水嫩| 自拍偷拍亚洲欧美日韩| 婷婷中文字幕一区三区| 91亚洲精华国产精华精华液|