build, library & top: make OOMEM options unconditional
It was probably always wrong to have a variable length proc_t structure. This patch takes all remaining oomem former suse only options and makes them unconditional. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
f0c23e51ec
commit
64238730fa
@ -189,14 +189,6 @@ AC_ARG_ENABLE([examples],
|
||||
)
|
||||
AM_CONDITIONAL(EXAMPLE_FILES, test "x$enable_examples" = xyes)
|
||||
|
||||
AC_ARG_ENABLE([oomem],
|
||||
AS_HELP_STRING([--enable-oomem], [add out-of-memory fields to the library and top]),
|
||||
[], [enable_oomem=no]
|
||||
)
|
||||
if test "x$enable_oomem" = xyes; then
|
||||
AC_DEFINE(OOMEM_ENABLE, 1, [add out-of-memory fields to the library and top])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([sigwinch],
|
||||
AS_HELP_STRING([--enable-sigwinch], [reduce impact of x-windows resize operations on top]),
|
||||
[], [enable_sigwinch=no]
|
||||
|
@ -458,7 +458,6 @@ static void supgrps_from_supgids (proc_t *p) {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
#ifdef OOMEM_ENABLE
|
||||
static void oomscore2proc(const char* S, proc_t *restrict P)
|
||||
{
|
||||
sscanf(S, "%d", &P->oom_score);
|
||||
@ -468,7 +467,6 @@ static void oomadj2proc(const char* S, proc_t *restrict P)
|
||||
{
|
||||
sscanf(S, "%d", &P->oom_adj);
|
||||
}
|
||||
#endif
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
static const char *ns_names[] = {
|
||||
@ -985,14 +983,12 @@ static proc_t* simple_readproc(PROCTAB *restrict const PT, proc_t *restrict cons
|
||||
} else
|
||||
p->cgroup = NULL;
|
||||
|
||||
#ifdef OOMEM_ENABLE
|
||||
if (unlikely(flags & PROC_FILLOOM)) {
|
||||
if (likely(file2str(path, "oom_score", &ub) != -1))
|
||||
oomscore2proc(ub.buf, p);
|
||||
if (likely(file2str(path, "oom_adj", &ub) != -1))
|
||||
oomadj2proc(ub.buf, p);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (unlikely(flags & PROC_FILLNS)) // read /proc/#/ns/*
|
||||
ns2proc(path, p);
|
||||
@ -1144,14 +1140,12 @@ static proc_t* simple_readtask(PROCTAB *restrict const PT, const proc_t *restric
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef OOMEM_ENABLE
|
||||
if (unlikely(flags & PROC_FILLOOM)) {
|
||||
if (likely(file2str(path, "oom_score", &ub) != -1))
|
||||
oomscore2proc(ub.buf, t);
|
||||
if (likely(file2str(path, "oom_adj", &ub) != -1))
|
||||
oomadj2proc(ub.buf, t);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (unlikely(flags & PROC_FILLNS)) // read /proc/#/task/#/ns/*
|
||||
ns2proc(path, t);
|
||||
|
@ -160,11 +160,9 @@ typedef struct proc_t {
|
||||
tpgid, // stat terminal process group id
|
||||
exit_signal, // stat might not be SIGCHLD
|
||||
processor; // stat current (or most recent?) CPU
|
||||
#ifdef OOMEM_ENABLE
|
||||
int
|
||||
oom_score, // oom_score (badness for OOM killer)
|
||||
oom_adj; // oom_adj (adjustment to OOM score)
|
||||
#endif
|
||||
long
|
||||
ns[NUM_NS]; // (ns subdir) inode number of namespaces
|
||||
char
|
||||
|
12
top/top.c
12
top/top.c
@ -1583,12 +1583,8 @@ static struct {
|
||||
{ -1, -1, A_left, 0, 0, PROCPS_PIDS_SUPGIDS }, // str EU_SGD
|
||||
{ -1, -1, A_left, 0, 0, PROCPS_PIDS_SUPGROUPS }, // str EU_SGN
|
||||
{ 0, -1, A_right, 0, 0, PROCPS_PIDS_ID_TGID }, // s_int EU_TGD
|
||||
#ifdef OOMEM_ENABLE
|
||||
#define L_oom PROC_FILLOOM
|
||||
{ 3, -1, A_right, 0, 0, PROCPS_PIDS_OOM_ADJ }, // s_int EU_OOA
|
||||
{ 8, -1, A_right, 0, 0, PROCPS_PIDS_OOM_SCORE }, // s_int EU_OOM
|
||||
#undef L_oom
|
||||
#endif
|
||||
{ -1, -1, A_left, 0, 0, PROCPS_PIDS_ENVIRON }, // str EU_ENV
|
||||
{ 3, -1, A_right, 0, 0, PROCPS_PIDS_FLT_MAJ_DELTA }, // ul_int EU_FV1
|
||||
{ 3, -1, A_right, 0, 0, PROCPS_PIDS_FLT_MIN_DELTA }, // ul_int EU_FV2
|
||||
@ -3012,11 +3008,7 @@ static int config_cvt (WIN_t *q) {
|
||||
#undef old_Show_THREAD
|
||||
};
|
||||
static const char fields_src[] = CVT_FIELDS;
|
||||
#ifdef OOMEM_ENABLE
|
||||
char fields_dst[PFLAGSSIZ], *p1, *p2;
|
||||
#else
|
||||
char fields_dst[PFLAGSSIZ];
|
||||
#endif
|
||||
int i, j, x;
|
||||
|
||||
// first we'll touch up this window's winflags...
|
||||
@ -3035,14 +3027,12 @@ static int config_cvt (WIN_t *q) {
|
||||
if (j > CVT_FLDMAX)
|
||||
return 1;
|
||||
strcpy(fields_dst, fields_src);
|
||||
#ifdef OOMEM_ENABLE
|
||||
/* all other fields represent the 'on' state with a capitalized version
|
||||
of a particular qwerty key. for the 2 additional suse out-of-memory
|
||||
fields it makes perfect sense to do the exact opposite, doesn't it?
|
||||
in any case, we must turn them 'off' temporarily... */
|
||||
if ((p1 = strchr(q->rc.fieldscur, '['))) *p1 = '{';
|
||||
if ((p2 = strchr(q->rc.fieldscur, '\\'))) *p2 = '|';
|
||||
#endif
|
||||
for (i = 0; i < j; i++) {
|
||||
int c = q->rc.fieldscur[i];
|
||||
x = tolower(c) - 'a';
|
||||
@ -3052,11 +3042,9 @@ static int config_cvt (WIN_t *q) {
|
||||
if (isupper(c))
|
||||
FLDon(fields_dst[i]);
|
||||
}
|
||||
#ifdef OOMEM_ENABLE
|
||||
// if we turned any suse only fields off, turn 'em back on OUR way...
|
||||
if (p1) FLDon(fields_dst[p1 - q->rc.fieldscur]);
|
||||
if (p2) FLDon(fields_dst[p2 - q->rc.fieldscur]);
|
||||
#endif
|
||||
strcpy(q->rc.fieldscur, fields_dst);
|
||||
|
||||
// lastly, we must adjust the old sort field enum...
|
||||
|
14
top/top.h
14
top/top.h
@ -28,7 +28,6 @@
|
||||
//#define BOOST_PERCNT /* enable extra precision for two % fields */
|
||||
//#define NOBOOST_MEMS /* disable extra precision for mem fields */
|
||||
//#define NUMA_DISABLE /* disable summary area NUMA/Nodes display */
|
||||
//#define OOMEM_ENABLE /* enable the SuSE out-of-memory additions */
|
||||
//#define ORIG_TOPDEFS /* with no rcfile retain original defaults */
|
||||
//#define SIGNALS_LESS /* favor reduced signal load over response */
|
||||
|
||||
@ -181,9 +180,7 @@ enum pflag {
|
||||
EU_FL1, EU_FL2, EU_DRT,
|
||||
EU_STA, EU_CMD, EU_WCH, EU_FLG, EU_CGR,
|
||||
EU_SGD, EU_SGN, EU_TGD,
|
||||
#ifdef OOMEM_ENABLE
|
||||
EU_OOA, EU_OOM,
|
||||
#endif
|
||||
EU_ENV,
|
||||
EU_FV1, EU_FV2,
|
||||
EU_USE,
|
||||
@ -531,16 +528,11 @@ typedef struct WIN_t {
|
||||
#define JOB_FIELDS "¥¦¹·º(³´Ä»½@<§Å)*+,-./012568>?ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
|
||||
#define MEM_FIELDS "¥º»<½¾¿ÀÁMBNÃD34·Å&'()*+,-./0125689FGHIJKLOPQRSTUVWXYZ[" RCF_PLUS_H
|
||||
#define USR_FIELDS "¥¦§¨ª°¹·ºÄÅ)+,-./1234568;<=>?@ABCFGHIJKLMNOPQRSTUVWXYZ[" RCF_PLUS_H
|
||||
#ifdef OOMEM_ENABLE
|
||||
// the suse old top fields ( 'a'-'z' + '{|' ) in positions 0-27
|
||||
// ( the extra chars above represent the 'off' state )
|
||||
// old top fields ( 'a'-'z' ) in positions 0-25
|
||||
// other suse old top fields ( '{|' ) in positions 26-27
|
||||
#define CVT_FIELDS "%&*'(-0346789:;<=>?@ACDEFGML)+,./125BHIJKNOPQRSTUVWXYZ["
|
||||
#define CVT_FLDMAX 28
|
||||
#else
|
||||
// other old top fields ( 'a'-'z' ) in positions 0-25
|
||||
#define CVT_FIELDS "%&*'(-0346789:;<=>?@ACDEFG)+,./125BHIJKLMNOPQRSTUVWXYZ["
|
||||
#define CVT_FLDMAX 26
|
||||
#endif
|
||||
|
||||
|
||||
/* The default values for the local config file */
|
||||
#define DEF_RCFILE { \
|
||||
|
@ -237,14 +237,12 @@ static void build_two_nlstabs (void) {
|
||||
/* Translation Hint: maximum 'TGID' = 5 */
|
||||
Head_nlstab[EU_TGD] = _("TGID");
|
||||
Desc_nlstab[EU_TGD] = _("Thread Group Id");
|
||||
#ifdef OOMEM_ENABLE
|
||||
/* Translation Hint: maximum 'Adj' = 3 */
|
||||
Head_nlstab[EU_OOA] = _("Adj");
|
||||
Desc_nlstab[EU_OOA] = _("oom_adjustment (2^X)");
|
||||
/* Translation Hint: maximum 'Badness' = 7 */
|
||||
Head_nlstab[EU_OOM] = _("Badness");
|
||||
Desc_nlstab[EU_OOM] = _("oom_score (badness)");
|
||||
#endif
|
||||
/* Translation Hint: maximum 'ENVIRON' = 7 */
|
||||
Head_nlstab[EU_ENV] = _("ENVIRON");
|
||||
/* Translation Hint: the abbreviation 'vars' below is shorthand for
|
||||
|
Loading…
Reference in New Issue
Block a user