top.c (265250) | top.c (300395) |
---|---|
1char *copyright = 2 "Copyright (c) 1984 through 1996, William LeFebvre"; 3 4/* 5 * Top users/processes display for Unix 6 * Version 3 7 * 8 * This program may be freely redistributed, 9 * but this entire comment MUST remain intact. 10 * 11 * Copyright (c) 1984, 1989, William LeFebvre, Rice University 12 * Copyright (c) 1989 - 1994, William LeFebvre, Northwestern University 13 * Copyright (c) 1994, 1995, William LeFebvre, Argonne National Laboratory 14 * Copyright (c) 1996, William LeFebvre, Group sys Consulting 15 * | 1char *copyright = 2 "Copyright (c) 1984 through 1996, William LeFebvre"; 3 4/* 5 * Top users/processes display for Unix 6 * Version 3 7 * 8 * This program may be freely redistributed, 9 * but this entire comment MUST remain intact. 10 * 11 * Copyright (c) 1984, 1989, William LeFebvre, Rice University 12 * Copyright (c) 1989 - 1994, William LeFebvre, Northwestern University 13 * Copyright (c) 1994, 1995, William LeFebvre, Argonne National Laboratory 14 * Copyright (c) 1996, William LeFebvre, Group sys Consulting 15 * |
16 * $FreeBSD: head/contrib/top/top.c 265250 2014-05-02 23:32:44Z bdrewery $ | 16 * $FreeBSD: head/contrib/top/top.c 300395 2016-05-22 04:17:00Z ngie $ |
17 */ 18 19/* 20 * See the file "Changes" for information on version-to-version changes. 21 */ 22 23/* 24 * This file contains "main" and other high-level routines. --- 4 unchanged lines hidden (view full) --- 29 * distinguish between different Unix implementations: 30 * 31 * SIGHOLD - use SVR4 sighold function when defined 32 * SIGRELSE - use SVR4 sigrelse function when defined 33 * FD_SET - macros FD_SET and FD_ZERO are used when defined 34 */ 35 36#include "os.h" | 17 */ 18 19/* 20 * See the file "Changes" for information on version-to-version changes. 21 */ 22 23/* 24 * This file contains "main" and other high-level routines. --- 4 unchanged lines hidden (view full) --- 29 * distinguish between different Unix implementations: 30 * 31 * SIGHOLD - use SVR4 sighold function when defined 32 * SIGRELSE - use SVR4 sigrelse function when defined 33 * FD_SET - macros FD_SET and FD_ZERO are used when defined 34 */ 35 36#include "os.h" |
37#include <errno.h> 38#include <signal.h> 39#include <setjmp.h> 40#include <ctype.h> | 37 |
41#include <sys/jail.h> 42#include <sys/time.h> | 38#include <sys/jail.h> 39#include <sys/time.h> |
40 41#include <ctype.h> 42#include <errno.h> |
|
43#include <jail.h> | 43#include <jail.h> |
44#include <setjmp.h> 45#include <signal.h> 46#include <unistd.h> |
|
44 45/* includes specific to top */ | 47 48/* includes specific to top */ |
49#include "commands.h" |
|
46#include "display.h" /* interface to display package */ 47#include "screen.h" /* interface to screen package */ 48#include "top.h" 49#include "top.local.h" 50#include "boolean.h" 51#include "machine.h" 52#include "utils.h" | 50#include "display.h" /* interface to display package */ 51#include "screen.h" /* interface to screen package */ 52#include "top.h" 53#include "top.local.h" 54#include "boolean.h" 55#include "machine.h" 56#include "utils.h" |
57#include "username.h" |
|
53 54/* Size of the stdio buffer given to stdout */ 55#define Buffersize 2048 56 57/* The buffer that stdio will use */ 58char stdoutbuf[Buffersize]; 59 60/* build Signal masks */ --- 48 unchanged lines hidden (view full) --- 109 110caddr_t get_process_info(); 111 112/* different routines for displaying the user's identification */ 113/* (values assigned to get_userid) */ 114char *username(); 115char *itoa7(); 116 | 58 59/* Size of the stdio buffer given to stdout */ 60#define Buffersize 2048 61 62/* The buffer that stdio will use */ 63char stdoutbuf[Buffersize]; 64 65/* build Signal masks */ --- 48 unchanged lines hidden (view full) --- 114 115caddr_t get_process_info(); 116 117/* different routines for displaying the user's identification */ 118/* (values assigned to get_userid) */ 119char *username(); 120char *itoa7(); 121 |
117/* display routines that need to be predeclared */ 118int i_loadave(); 119int u_loadave(); 120int i_procstates(); 121int u_procstates(); 122int i_cpustates(); 123int u_cpustates(); 124int i_memory(); 125int u_memory(); 126int i_arc(); 127int u_arc(); 128int i_swap(); 129int u_swap(); 130int i_message(); 131int u_message(); 132int i_header(); 133int u_header(); 134int i_process(); 135int u_process(); 136 | |
137/* pointers to display routines */ | 122/* pointers to display routines */ |
138int (*d_loadave)() = i_loadave; 139int (*d_procstates)() = i_procstates; 140int (*d_cpustates)() = i_cpustates; 141int (*d_memory)() = i_memory; 142int (*d_arc)() = i_arc; 143int (*d_swap)() = i_swap; 144int (*d_message)() = i_message; 145int (*d_header)() = i_header; 146int (*d_process)() = i_process; | 123void (*d_loadave)() = i_loadave; 124void (*d_procstates)() = i_procstates; 125void (*d_cpustates)() = i_cpustates; 126void (*d_memory)() = i_memory; 127void (*d_arc)() = i_arc; 128void (*d_swap)() = i_swap; 129void (*d_message)() = i_message; 130void (*d_header)() = i_header; 131void (*d_process)() = i_process; |
147 | 132 |
133void reset_display(void); |
|
148 | 134 |
135 136int |
|
149main(argc, argv) 150 151int argc; 152char *argv[]; 153 154{ 155 register int i; 156 register int active_procs; --- 1016 unchanged lines hidden (view full) --- 1173 /*NOTREACHED*/ 1174} 1175 1176/* 1177 * reset_display() - reset all the display routine pointers so that entire 1178 * screen will get redrawn. 1179 */ 1180 | 137main(argc, argv) 138 139int argc; 140char *argv[]; 141 142{ 143 register int i; 144 register int active_procs; --- 1016 unchanged lines hidden (view full) --- 1161 /*NOTREACHED*/ 1162} 1163 1164/* 1165 * reset_display() - reset all the display routine pointers so that entire 1166 * screen will get redrawn. 1167 */ 1168 |
1169void |
|
1181reset_display() 1182 1183{ 1184 d_loadave = i_loadave; 1185 d_procstates = i_procstates; 1186 d_cpustates = i_cpustates; 1187 d_memory = i_memory; 1188 d_arc = i_arc; --- 43 unchanged lines hidden --- | 1170reset_display() 1171 1172{ 1173 d_loadave = i_loadave; 1174 d_procstates = i_procstates; 1175 d_cpustates = i_cpustates; 1176 d_memory = i_memory; 1177 d_arc = i_arc; --- 43 unchanged lines hidden --- |