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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? top.c

?? linux下獲取一些環(huán)境信息的代碼
?? C
?? 第 1 頁 / 共 5 頁
字號(hào):
/* 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      );

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区三区四区| 五月天视频一区| 国产女人18水真多18精品一级做| 欧美电视剧在线看免费| 欧美一区二区三区影视| 欧美高清一级片在线| 欧美日韩久久久久久| 欧美日韩国产高清一区二区三区| 欧美视频一区在线| 欧美裸体一区二区三区| 91精品视频网| 欧美一二三区在线| 欧美成人vps| 久久精品日韩一区二区三区| 久久精品人人做| 国产欧美日韩卡一| 亚洲三级理论片| 一区二区国产视频| 日韩激情在线观看| 麻豆精品一区二区综合av| 国产真实乱对白精彩久久| 国产成人亚洲综合a∨婷婷图片| 国产·精品毛片| 色综合天天综合网国产成人综合天| 色视频一区二区| 欧美日韩国产另类一区| 欧美一区二区在线播放| 久久久久99精品国产片| 国产精品第13页| 亚洲午夜久久久| 韩国v欧美v亚洲v日本v| 成人网在线免费视频| 色吊一区二区三区| 日韩精品在线一区二区| 国产精品毛片无遮挡高清| 一区二区三区色| 毛片一区二区三区| 成人激情视频网站| 欧美日本一区二区| 2019国产精品| 一区二区三区高清不卡| 久久精品国产亚洲5555| 91猫先生在线| 欧美成人精品3d动漫h| 国产精品美女一区二区在线观看| 亚洲小少妇裸体bbw| 久久精品国产免费| 色综合中文字幕| 欧美精品一区二区久久久| 中文字幕在线播放不卡一区| 日本不卡不码高清免费观看| 懂色中文一区二区在线播放| 欧美日韩国产色站一区二区三区| 久久色中文字幕| 亚洲一区二区黄色| 国产99久久精品| 91精品在线观看入口| 中文字幕一区二区三| 免费成人av在线| 色老综合老女人久久久| 亚洲精品一区二区三区蜜桃下载| 一区二区三区四区视频精品免费| 国产中文字幕精品| 在线不卡a资源高清| ...av二区三区久久精品| 美女网站在线免费欧美精品| 91久久精品网| 久久久电影一区二区三区| 丝袜诱惑亚洲看片| 91久久一区二区| 欧美极品另类videosde| 久久se精品一区二区| 欧美日韩一卡二卡| 亚洲欧美偷拍卡通变态| 国产乱码精品1区2区3区| 4438成人网| 亚洲一区在线观看视频| 99re视频这里只有精品| 久久夜色精品一区| 日本免费新一区视频| 欧洲人成人精品| 亚洲男人的天堂在线观看| 丰满岳乱妇一区二区三区| 日韩欧美一区中文| 五月天国产精品| 日本高清成人免费播放| 国产精品久久久久久久久果冻传媒| 久久精品99国产国产精| 欧美精品免费视频| 亚洲一区二区在线视频| 99re热这里只有精品视频| 国产欧美精品一区二区三区四区| 久久99国产乱子伦精品免费| 在线综合+亚洲+欧美中文字幕| 亚洲一二三专区| 91免费观看视频在线| 中文字幕一区二区三区色视频| 国产成人免费av在线| 久久精品一区蜜桃臀影院| 韩国精品主播一区二区在线观看| 日韩欧美国产三级| 久久99国产精品免费网站| 欧美成人三级在线| 精品一区二区三区蜜桃| 欧美电影免费提供在线观看| 七七婷婷婷婷精品国产| 欧美一级高清片| 久久国产乱子精品免费女| 日韩欧美www| 韩国精品主播一区二区在线观看 | 国产精品88av| 久久综合国产精品| 国产河南妇女毛片精品久久久| 国产亚洲一区二区三区在线观看| 国产成人av福利| 国产精品日韩成人| 色哟哟在线观看一区二区三区| 一区二区三区不卡在线观看 | 91在线观看污| 亚洲黄网站在线观看| 91传媒视频在线播放| 午夜精品久久久久| 日韩欧美黄色影院| 国产宾馆实践打屁股91| 国产精品成人免费精品自在线观看 | 午夜视频在线观看一区二区 | 欧美大片一区二区| 国产成人一级电影| 亚洲精品免费在线观看| 777午夜精品视频在线播放| 久久91精品久久久久久秒播| 国产日韩欧美精品综合| 色呦呦日韩精品| 免费不卡在线视频| 国产精品久久久爽爽爽麻豆色哟哟| 91九色02白丝porn| 蜜桃视频第一区免费观看| 欧美极品少妇xxxxⅹ高跟鞋| 在线亚洲欧美专区二区| 精品亚洲国内自在自线福利| 中日韩免费视频中文字幕| 欧美日韩一级片网站| 精品一区二区三区蜜桃| 亚洲蜜臀av乱码久久精品蜜桃| 欧美喷水一区二区| 丰满少妇在线播放bd日韩电影| 一区二区三区四区视频精品免费 | 国产精品美日韩| 7777精品伊人久久久大香线蕉经典版下载 | 国产精选一区二区三区| 亚洲欧美偷拍卡通变态| 精品免费国产一区二区三区四区| 成av人片一区二区| 美女脱光内衣内裤视频久久网站| 国产精品伦一区| 欧美丰满高潮xxxx喷水动漫| 成人免费福利片| 轻轻草成人在线| 中文字幕va一区二区三区| 欧美一区二区三区在线观看| 成人免费黄色在线| 免费看日韩a级影片| 亚洲三级电影全部在线观看高清| 欧美一级在线免费| 91免费视频观看| 国产精品66部| 日本sm残虐另类| 亚洲你懂的在线视频| 久久久久国产精品人| 欧美肥胖老妇做爰| 91久久香蕉国产日韩欧美9色| 国产一区二区三区黄视频 | 久久精品视频在线看| 678五月天丁香亚洲综合网| 92精品国产成人观看免费| 国模无码大尺度一区二区三区| 亚洲高清在线视频| 专区另类欧美日韩| 国产欧美日韩精品a在线观看| 日韩欧美亚洲一区二区| 欧美肥妇毛茸茸| 欧美午夜不卡在线观看免费| 91视频国产观看| 国产aⅴ精品一区二区三区色成熟| 免费成人av在线| 日韩不卡一二三区| 亚洲综合男人的天堂| 亚洲视频在线一区| 国产精品不卡在线| 国产色综合一区| 久久蜜桃av一区精品变态类天堂 | 日韩一区二区在线看片| 在线视频国产一区| 色老综合老女人久久久| 99精品国产99久久久久久白柏| 成人免费视频一区二区| 国产98色在线|日韩| 国产99久久久久久免费看农村| 国产一区二区三区国产| 国产一区二区剧情av在线|