CodingStyle left out of tarball. Tweak top. Leftovers?

This commit is contained in:
albert 2004-02-23 18:47:42 +00:00
parent 4ab5a6c8c3
commit cb8bd84b21
7 changed files with 44 additions and 35 deletions

View File

@ -60,7 +60,7 @@ MANFILES := $(man1)uptime.1 $(man1)tload.1 $(man1)free.1 $(man1)w.1 \
$(man1)slabtop.1
TARFILES := AUTHORS BUGS NEWS README TODO COPYING COPYING.LIB \
Makefile procps.lsm procps.spec v t README.top \
Makefile procps.lsm procps.spec v t README.top CodingStyle \
minimal.c $(notdir $(MANFILES)) dummy.c \
uptime.c tload.c free.c w.c top.c vmstat.c watch.c skill.c \
sysctl.c pgrep.c top.h pmap.c slabtop.c

4
NEWS
View File

@ -1,12 +1,14 @@
procps-3.1.15 --> procps-3.2.0
build on IA-64 again #227933
pmap: output like Solaris 9, not Solaris 7
ps: also handle SELinux on the 2.4.xx kernels
top: during a ^Z, the terminal was messed up #228822
future-proof the tty handling (thanks to Zhou Wei)
slabtop (Chris Rivera and Robert Love) #226778 rh114012a
slabtop (Chris Rivera and Robert Love) #226778
pmap: detect the primary stack
pmap: -d format
free: report high and low memory
procps-3.1.14 --> procps-3.1.15

View File

@ -161,11 +161,11 @@ typedef struct PROCTAB {
proc_t*(*reader)(struct PROCTAB *restrict const, proc_t *restrict const);
int(*taskfinder)(struct PROCTAB *restrict const, const proc_t *restrict const, proc_t *restrict const, char *restrict const);
proc_t*(*taskreader)(struct PROCTAB *restrict const, const proc_t *restrict const, proc_t *restrict const, char *restrict const);
unsigned flags;
pid_t* pids; // pids of the procs
uid_t* uids; // uids of procs
int nuid; // cannot really sentinel-terminate unsigned short[]
int i; // generic
unsigned flags;
unsigned u; // generic
void * vp; // generic
char path[PROCPATHLEN]; // must hold /proc/2000222000/task/2000222000/cmdline

View File

@ -5,6 +5,7 @@
struct slab_info {
char name[SLAB_INFO_NAME_LEN]; /* name of this cache */
struct slab_info *next;
int nr_objs; /* number of objects in this cache */
int nr_active_objs; /* number of active objects */
int obj_size; /* size of each object */
@ -14,7 +15,6 @@ struct slab_info {
int nr_active_slabs; /* number of active slabs */
int use; /* percent full: total / active */
int cache_size; /* size of entire cache */
struct slab_info *next;
};
struct slab_stat {

View File

@ -512,7 +512,6 @@ static int want_this_proc_nop(proc_t *dummy){
/***** sorted or forest */
static void fancy_spew(void){
proc_t *retbuf = NULL;
proc_data_t *pd = NULL;
PROCTAB *restrict ptp;
int n = 0; /* number of processes & index into array */

51
top.c
View File

@ -119,17 +119,17 @@ static int No_ksyms = -1, // set to '0' if ksym avail, '1' otherwise
/* 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 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...
@ -461,6 +461,11 @@ static void suspend (int dont_care_sig)
/*###### Misc Color/Display support ####################################*/
/* macro to test if a basic (non-color) capability is valid
thanks: Floyd Davidson <floyd@ptialaska.net> */
#define tIF(s) s ? s : ""
#define CAPCOPY(dst,src) src && strcpy(dst,src)
/*
* Make the appropriate caps/color strings and set some
* lengths which are used to distinguish twix the displayed
@ -469,9 +474,6 @@ static void suspend (int dont_care_sig)
* compatibility with the user's xterm settings */
static void capsmk (WIN_t *q)
{
/* macro to test if a basic (non-color) capability is valid
thanks: Floyd Davidson <floyd@ptialaska.net> */
#define tIF(s) s ? s : ""
static int capsdone = 0;
// we must NOT disturb our 'empty' terminfo strings!
@ -479,16 +481,17 @@ static void capsmk (WIN_t *q)
// these are the unchangeable puppies, so we only do 'em once
if (!capsdone) {
strcpy(Cap_clr_eol, tIF(clr_eol));
strcpy(Cap_clr_eos, tIF(clr_eos));
strcpy(Cap_clr_scr, tIF(clear_screen));
strcpy(Cap_rmam, tIF(exit_am_mode));
strcpy(Cap_smam, tIF(enter_am_mode));
strcpy(Cap_curs_huge, tIF(cursor_visible));
strcpy(Cap_curs_norm, tIF(cursor_normal));
strcpy(Cap_home, tIF(cursor_home));
strcpy(Cap_norm, tIF(exit_attribute_mode));
strcpy(Cap_reverse, tIF(enter_reverse_mode));
CAPCOPY(Cap_clr_eol, clr_eol);
CAPCOPY(Cap_clr_eos, clr_eos);
CAPCOPY(Cap_clr_scr, clear_screen);
CAPCOPY(Cap_rmam, exit_am_mode);
CAPCOPY(Cap_smam, enter_am_mode);
CAPCOPY(Cap_curs_huge, cursor_visible);
CAPCOPY(Cap_curs_norm, cursor_normal);
CAPCOPY(Cap_home, cursor_home);
CAPCOPY(Cap_norm, exit_attribute_mode);
CAPCOPY(Cap_reverse, enter_reverse_mode);
snprintf(Caps_off, sizeof(Caps_off), "%s%s", Cap_norm, tIF(orig_pair));
if (tgoto(cursor_address, 1, 1)) Cap_can_goto = 1;
capsdone = 1;

17
top.h
View File

@ -56,9 +56,15 @@
/* Specific process id monitoring support (command line only) */
#define MONPIDMAX 20
// Power-of-two sizes lead to trouble; the largest power of
// two factor should be the cache line size. It'll mean the
// array indexing math gets slower, but cache aliasing is
// avoided.
#define CACHE_TWEAK_FACTOR 64
/* Miscellaneous buffer sizes with liberal values
-- mostly just to pinpoint source code usage/dependancies */
#define SCREENMAX 512
#define SCREENMAX ( 512 + CACHE_TWEAK_FACTOR)
/* the above might seem pretty stingy, until you consider that with every
one of top's fields displayed we're talking a 160 byte column header --
so that will provide for all fields plus a 350+ byte command line */
@ -69,10 +75,10 @@
#define CLRBUFSIZ 64
#define GETBUFSIZ 32
#define TNYBUFSIZ 32
#define SMLBUFSIZ 256
#define OURPATHSZ 1024
#define MEDBUFSIZ 1024
#define BIGBUFSIZ 2048
#define SMLBUFSIZ ( 256 + CACHE_TWEAK_FACTOR)
#define OURPATHSZ (1024 + CACHE_TWEAK_FACTOR)
#define MEDBUFSIZ (1024 + CACHE_TWEAK_FACTOR)
#define BIGBUFSIZ (2048 + CACHE_TWEAK_FACTOR)
#define USRNAMSIZ GETBUFSIZ
#define ROWBUFSIZ SCREENMAX + CLRBUFSIZ
@ -628,4 +634,3 @@ typedef struct WIN_t {
// int main (int dont_care_argc, char **argv);
#endif /* _Itop */