top(1): pull function declarations and externs into headers

This commit is contained in:
Eitan Adler 2018-05-21 01:16:26 +00:00
parent 4e33a6b507
commit fcfaa4734c
4 changed files with 13 additions and 45 deletions

View File

@ -35,11 +35,6 @@
#include "utils.h"
#include "machine.h"
extern char *copyright;
/* imported from screen.c */
extern int overstrike;
static int err_compar(const void *p1, const void *p2);
struct errs /* structure for a system-call error */

View File

@ -43,6 +43,7 @@
#include "top.h"
#include "machine.h"
#include "display.h"
#include "screen.h"
#include "utils.h"
#include "layout.h"
@ -52,7 +53,7 @@
#define UPUNAMELEN 15
extern struct process_select ps;
extern char* printable(char *);
extern struct timeval timeout;
static int smpmode;
enum displaymodes displaymode;
#ifdef TOP_USERNAME_LEN
@ -67,9 +68,6 @@ static int jidlength;
static int swaplength;
static int cmdlengthdelta;
/* Prototypes for top internals */
void quit(int);
/* get_process_info passes back a handle. This is what it looks like: */
struct handle {
@ -233,9 +231,6 @@ static int pageshift; /* log base 2 of the pagesize */
#define ki_swap(kip) \
((kip)->ki_swrss > (kip)->ki_rssize ? (kip)->ki_swrss - (kip)->ki_rssize : 0)
/* useful externals */
long percentages(int cnt, int *out, long *new, long *old, long *diffs);
/*
* Sorting orders. The first element is the default.
*/
@ -470,7 +465,6 @@ format_header(char *uname_field)
static int swappgsin = -1;
static int swappgsout = -1;
extern struct timeval timeout;
void

View File

@ -3,7 +3,6 @@ char *copyright =
/*
* Top users/processes display for Unix
* Version 3
*
* This program may be freely redistributed,
* but this entire comment MUST remain intact.
@ -16,23 +15,6 @@ char *copyright =
* $FreeBSD$
*/
/*
* See the file "Changes" for information on version-to-version changes.
*/
/*
* This file contains "main" and other high-level routines.
*/
/*
* The following preprocessor variables, when defined, are used to
* distinguish between different Unix implementations:
*
* SIGHOLD - use SVR4 sighold function when defined
* SIGRELSE - use SVR4 sigrelse function when defined
* FD_SET - macros FD_SET and FD_ZERO are used when defined
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/jail.h>
@ -48,7 +30,6 @@ char *copyright =
#include <string.h>
#include <unistd.h>
/* includes specific to top */
#include "commands.h"
#include "display.h" /* interface to display package */
#include "screen.h" /* interface to screen package */
@ -70,12 +51,6 @@ char stdoutbuf[Buffersize];
/* build Signal masks */
#define Smask(s) (1 << ((s) - 1))
/* for getopt: */
extern int optind;
extern char *optarg;
/* imported from screen.c */
extern int overstrike;
static int fmt_flags = 0;
int pcpu_stats = No;
@ -85,12 +60,9 @@ static sigret_t leave(int);
static sigret_t tstop(int);
static sigret_t top_winch(int);
volatile sig_atomic_t leaveflag;
volatile sig_atomic_t tstopflag;
volatile sig_atomic_t winchflag;
/* internal routines */
void quit(int);
static volatile sig_atomic_t leaveflag;
static volatile sig_atomic_t tstopflag;
static volatile sig_atomic_t winchflag;
/* values which need to be accessed by signal handlers */
static int max_topn; /* maximum displayable processes */
@ -102,7 +74,6 @@ jmp_buf jmp_int;
char *username(int);
extern int (*compares[])(const void*, const void*);
time_t time(time_t *tloc);
caddr_t get_process_info(struct system_info *si, struct process_select *sel,

View File

@ -44,10 +44,18 @@ enum displaymodes { DISP_CPU = 0, DISP_IO, DISP_MAX };
extern enum displaymodes displaymode;
extern int pcpu_stats;
extern int overstrike;
extern int (*compares[])(const void*, const void*);
char* kill_procs(char *);
char* renice_procs(char *);
extern char *copyright;
/* internal routines */
void quit(int);
/*
* The space command forces an immediate update. Sometimes, on loaded
* systems, this update will take a significant period of time (because all