Extending the end-of-job patch disabling the screen content restoration
This commit is contained in:
parent
df645e2acd
commit
9d1d494517
232
0001-top-refine-some-miscellaneous-signals-interrupt-stuf.patch
Normal file
232
0001-top-refine-some-miscellaneous-signals-interrupt-stuf.patch
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
From e5d1a884f4e780aca7f9eaf68a51b967f9b43abf Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jim Warner <james.warner@comcast.net>
|
||||||
|
Date: Sun, 30 Jun 2013 00:00:00 -0500
|
||||||
|
Subject: [PATCH 1/2] top: refine some miscellaneous signals interrupt stuff
|
||||||
|
|
||||||
|
This commit mostly justs renames a few identifiers but
|
||||||
|
it also will now suppress any end-of-job report if top
|
||||||
|
wasn't ended via the 'q' key convention (i.e. signal).
|
||||||
|
|
||||||
|
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
||||||
|
---
|
||||||
|
top/top.c | 48 +++++++++++++++++++++++++-----------------------
|
||||||
|
top/top.h | 4 ++--
|
||||||
|
2 files changed, 27 insertions(+), 25 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/top/top.c b/top/top.c
|
||||||
|
index cdcf3c0..c1c61dd 100644
|
||||||
|
--- a/top/top.c
|
||||||
|
+++ b/top/top.c
|
||||||
|
@@ -174,7 +174,7 @@ static WIN_t *Curwin;
|
||||||
|
and/or that are simply more efficiently handled as globals
|
||||||
|
[ 'Frames_...' (plural) stuff persists beyond 1 frame ]
|
||||||
|
[ or are used in response to async signals received ! ] */
|
||||||
|
-static volatile int Frames_resize; // time to rebuild all column headers
|
||||||
|
+static volatile int Frames_signal; // time to rebuild all column headers
|
||||||
|
static int Frames_libflags; // PROC_FILLxxx flags
|
||||||
|
static int Frame_maxtask; // last known number of active tasks
|
||||||
|
// ie. current 'size' of proc table
|
||||||
|
@@ -377,7 +377,7 @@ static void bye_bye (const char *str) {
|
||||||
|
at_eoj(); // restore tty in preparation for exit
|
||||||
|
#ifdef ATEOJ_RPTSTD
|
||||||
|
{ proc_t *p;
|
||||||
|
- if (!str && Ttychanged) { fprintf(stderr,
|
||||||
|
+ if (!str && !Frames_signal && Ttychanged) { fprintf(stderr,
|
||||||
|
"\n%s's Summary report:"
|
||||||
|
"\n\tProgram"
|
||||||
|
"\n\t Linux version = %u.%u.%u, %s"
|
||||||
|
@@ -447,7 +447,7 @@ static void bye_bye (const char *str) {
|
||||||
|
|
||||||
|
#ifndef OFF_HST_HASH
|
||||||
|
#ifdef ATEOJ_RPTHSH
|
||||||
|
- if (!str && Ttychanged) {
|
||||||
|
+ if (!str && !Frames_signal && Ttychanged) {
|
||||||
|
int i, j, pop, total_occupied, maxdepth, maxdepth_sav, numdepth
|
||||||
|
, cross_foot, sz = HHASH_SIZ * (unsigned)sizeof(int);
|
||||||
|
int depths[HHASH_SIZ];
|
||||||
|
@@ -588,6 +588,7 @@ static void sig_endpgm (int dont_care_sig) {
|
||||||
|
// POSIX.1-2004 async-signal-safe: sigfillset, sigprocmask
|
||||||
|
sigfillset(&ss);
|
||||||
|
sigprocmask(SIG_BLOCK, &ss, NULL);
|
||||||
|
+ Frames_signal = BREAK_sig;
|
||||||
|
bye_bye(NULL);
|
||||||
|
(void)dont_care_sig;
|
||||||
|
} // end: sig_endpgm
|
||||||
|
@@ -619,7 +620,7 @@ static void sig_paused (int dont_care_sig) {
|
||||||
|
#endif
|
||||||
|
if (keypad_xmit) putp(keypad_xmit);
|
||||||
|
putp(Cursor_state);
|
||||||
|
- Frames_resize = RESIZ_sig;
|
||||||
|
+ Frames_signal = BREAK_sig;
|
||||||
|
(void)dont_care_sig;
|
||||||
|
} // end: sig_paused
|
||||||
|
|
||||||
|
@@ -630,7 +631,7 @@ static void sig_paused (int dont_care_sig) {
|
||||||
|
static void sig_resize (int dont_care_sig) {
|
||||||
|
// POSIX.1-2004 async-signal-safe: tcdrain
|
||||||
|
tcdrain(STDOUT_FILENO);
|
||||||
|
- Frames_resize = RESIZ_sig;
|
||||||
|
+ Frames_signal = BREAK_sig;
|
||||||
|
(void)dont_care_sig;
|
||||||
|
} // end: sig_resize
|
||||||
|
|
||||||
|
@@ -928,12 +929,13 @@ static inline int ioa (struct timespec *ts) {
|
||||||
|
FD_ZERO(&fs);
|
||||||
|
FD_SET(STDIN_FILENO, &fs);
|
||||||
|
|
||||||
|
-#ifndef SIGNALS_LESS // conditional comments are silly, but help in documenting
|
||||||
|
- // hold here until we've got keyboard input, any signal (including SIGWINCH)
|
||||||
|
-#else
|
||||||
|
+#ifdef SIGNALS_LESS // conditional comments are silly, but help in documenting
|
||||||
|
// hold here until we've got keyboard input, any signal except SIGWINCH
|
||||||
|
-#endif
|
||||||
|
// or (optionally) we timeout with nanosecond granularity
|
||||||
|
+#else
|
||||||
|
+ // hold here until we've got keyboard input, any signal (including SIGWINCH)
|
||||||
|
+ // or (optionally) we timeout with nanosecond granularity
|
||||||
|
+#endif
|
||||||
|
rc = pselect(STDIN_FILENO + 1, &fs, NULL, NULL, ts, &Sigwinch_set);
|
||||||
|
|
||||||
|
if (rc < 0) rc = 0;
|
||||||
|
@@ -1263,7 +1265,7 @@ static float get_float (const char *prompt) {
|
||||||
|
float f;
|
||||||
|
|
||||||
|
line = ioline(prompt);
|
||||||
|
- if (!line[0] || Frames_resize) return -1.0;
|
||||||
|
+ if (!line[0] || Frames_signal) return -1.0;
|
||||||
|
// note: we're not allowing negative floats
|
||||||
|
if (strcspn(line, "+,.0123456789")) {
|
||||||
|
show_msg(N_txt(BAD_numfloat_txt));
|
||||||
|
@@ -1284,7 +1286,7 @@ static int get_int (const char *prompt) {
|
||||||
|
int n;
|
||||||
|
|
||||||
|
line = ioline(prompt);
|
||||||
|
- if (Frames_resize) return GET_INT_BAD;
|
||||||
|
+ if (Frames_signal) return GET_INT_BAD;
|
||||||
|
if (!line[0]) return GET_INTNONE;
|
||||||
|
// note: we've got to allow negative ints (renice)
|
||||||
|
if (strcspn(line, "-+0123456789")) {
|
||||||
|
@@ -1822,7 +1824,7 @@ static void adj_geometry (void) {
|
||||||
|
PSU_CLREOS(0);
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
- Frames_resize = RESIZ_clr;
|
||||||
|
+ Frames_signal = BREAK_off;
|
||||||
|
} // end: adj_geometry
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2134,7 +2136,7 @@ signify_that:
|
||||||
|
display_fields(i, (p != NULL));
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
- if (Frames_resize) goto signify_that;
|
||||||
|
+ if (Frames_signal) goto signify_that;
|
||||||
|
key = iokey(1);
|
||||||
|
if (key < 1) goto signify_that;
|
||||||
|
|
||||||
|
@@ -3053,7 +3055,7 @@ signify_that:
|
||||||
|
lest repeated <Enter> keys produce immediate re-selection in caller */
|
||||||
|
tcflush(STDIN_FILENO, TCIFLUSH);
|
||||||
|
|
||||||
|
- if (Frames_resize) goto signify_that;
|
||||||
|
+ if (Frames_signal) goto signify_that;
|
||||||
|
key = iokey(1);
|
||||||
|
if (key < 1) goto signify_that;
|
||||||
|
|
||||||
|
@@ -3158,7 +3160,7 @@ signify_that:
|
||||||
|
, pid, p->cmd, p->euser, sels));
|
||||||
|
INSP_MKSL(0, " ");
|
||||||
|
|
||||||
|
- if (Frames_resize) goto signify_that;
|
||||||
|
+ if (Frames_signal) goto signify_that;
|
||||||
|
if (key == INT_MAX) key = iokey(1);
|
||||||
|
if (key < 1) goto signify_that;
|
||||||
|
|
||||||
|
@@ -3903,7 +3905,7 @@ signify_that:
|
||||||
|
putp(Cap_clr_eos);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
- if (Frames_resize) goto signify_that;
|
||||||
|
+ if (Frames_signal) goto signify_that;
|
||||||
|
key = iokey(1);
|
||||||
|
if (key < 1) goto signify_that;
|
||||||
|
|
||||||
|
@@ -4135,7 +4137,7 @@ signify_that:
|
||||||
|
putp(Cap_clr_eos);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
- if (Frames_resize) goto signify_that;
|
||||||
|
+ if (Frames_signal) goto signify_that;
|
||||||
|
key = iokey(1);
|
||||||
|
if (key < 1) goto signify_that;
|
||||||
|
|
||||||
|
@@ -4151,7 +4153,7 @@ signify_that:
|
||||||
|
, Winstk[2].rc.winname, Winstk[3].rc.winname));
|
||||||
|
putp(Cap_clr_eos);
|
||||||
|
fflush(stdout);
|
||||||
|
- if (Frames_resize || (key = iokey(1)) < 1) {
|
||||||
|
+ if (Frames_signal || (key = iokey(1)) < 1) {
|
||||||
|
adj_geometry();
|
||||||
|
putp(Cap_clr_scr);
|
||||||
|
} else w = win_select(key);
|
||||||
|
@@ -4341,7 +4343,7 @@ static void keys_global (int ch) {
|
||||||
|
if (0 > pid) pid = def;
|
||||||
|
str = ioline(fmtmk(N_fmt(GET_sigs_num_fmt), pid, SIGTERM));
|
||||||
|
if (*str) sig = signal_name_to_number(str);
|
||||||
|
- if (Frames_resize) break;
|
||||||
|
+ if (Frames_signal) break;
|
||||||
|
if (0 < sig && kill(pid, sig))
|
||||||
|
show_msg(fmtmk(N_fmt(FAIL_signals_fmt)
|
||||||
|
, pid, sig, strerror(errno)));
|
||||||
|
@@ -4909,12 +4911,12 @@ static void do_key (int ch) {
|
||||||
|
for (i = 0; i < MAXTBL(key_tab); ++i)
|
||||||
|
if (strchr(key_tab[i].keys, ch)) {
|
||||||
|
key_tab[i].func(ch);
|
||||||
|
- Frames_resize = RESIZ_kbd;
|
||||||
|
+ Frames_signal = BREAK_kbd;
|
||||||
|
putp((Cursor_state = Cap_curs_hide));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
- /* Frames_resize above will force a rebuild of all column headers and
|
||||||
|
+ /* Frames_signal above will force a rebuild of all column headers and
|
||||||
|
the PROC_FILLxxx flags. It's NOT simply lazy programming. Here are
|
||||||
|
some keys that COULD require new column headers and/or libproc flags:
|
||||||
|
'A' - likely
|
||||||
|
@@ -5458,7 +5460,7 @@ static void frame_make (void) {
|
||||||
|
int i, scrlins;
|
||||||
|
|
||||||
|
// deal with potential signal(s) since the last time around...
|
||||||
|
- if (Frames_resize)
|
||||||
|
+ if (Frames_signal)
|
||||||
|
zap_fieldstab();
|
||||||
|
|
||||||
|
// whoa either first time or thread/task mode change, (re)prime the pump...
|
||||||
|
@@ -5549,7 +5551,7 @@ int main (int dont_care_argc, char **argv) {
|
||||||
|
produce a screen refresh. in this main loop frame_make
|
||||||
|
assumes responsibility for such refreshes. other logic
|
||||||
|
in contact with users must deal more obliquely with an
|
||||||
|
- interrupt/refresh (hint: Frames_resize + return code)!
|
||||||
|
+ interrupt/refresh (hint: Frames_signal + return code)!
|
||||||
|
|
||||||
|
(everything is perfectly justified plus right margins)
|
||||||
|
(are completely filled, but of course it must be luck)
|
||||||
|
diff --git a/top/top.h b/top/top.h
|
||||||
|
index a8a7357..43d1ebc 100644
|
||||||
|
--- a/top/top.h
|
||||||
|
+++ b/top/top.h
|
||||||
|
@@ -208,9 +208,9 @@ enum scale_enum {
|
||||||
|
SK_Kb, SK_Mb, SK_Gb, SK_Tb, SK_Pb, SK_Eb, SK_SENTINEL
|
||||||
|
};
|
||||||
|
|
||||||
|
- /* Used to manipulate (and document) the Frames_resize states */
|
||||||
|
+ /* Used to manipulate (and document) the Frames_signal states */
|
||||||
|
enum resize_states {
|
||||||
|
- RESIZ_clr, RESIZ_kbd, RESIZ_sig
|
||||||
|
+ BREAK_off = 0, BREAK_kbd, BREAK_sig
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This typedef just ensures consistent 'process flags' handling */
|
||||||
|
--
|
||||||
|
1.8.1.2
|
||||||
|
|
@ -0,0 +1,60 @@
|
|||||||
|
From eee15b862dd5b051f16c719bf3c974591783a8f8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jim Warner <james.warner@comcast.net>
|
||||||
|
Date: Mon, 1 Jul 2013 00:00:00 -0500
|
||||||
|
Subject: [PATCH 2/2] top: cursor repositioning includes line oriented input
|
||||||
|
|
||||||
|
A recent patch introduced the ability to recognize the
|
||||||
|
need to reposition the cursor at suspension or program
|
||||||
|
end. There remained unmet 1 additional potential need.
|
||||||
|
|
||||||
|
This commit extends that ability to embrace line input
|
||||||
|
so that if a user issues ^Z or ^C while being prompted
|
||||||
|
the resulting shell output will no longer be embedded.
|
||||||
|
|
||||||
|
Reference(s):
|
||||||
|
http://www.freelists.org/post/procps/top-library-miscellaneous-tweaks,7
|
||||||
|
commit 5c974ff44da4fbbb9170dd15bdd81555c62c31a9
|
||||||
|
|
||||||
|
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
||||||
|
---
|
||||||
|
top/top.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/top/top.c b/top/top.c
|
||||||
|
index c1c61dd..138f3ee 100644
|
||||||
|
--- a/top/top.c
|
||||||
|
+++ b/top/top.c
|
||||||
|
@@ -1081,12 +1081,14 @@ static char *ioline (const char *prompt) {
|
||||||
|
static char buf[MEDBUFSIZ];
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
+ Cursor_repos = 1;
|
||||||
|
show_pmt(prompt);
|
||||||
|
memset(buf, '\0', sizeof(buf));
|
||||||
|
ioch(1, buf, sizeof(buf)-1);
|
||||||
|
|
||||||
|
if ((p = strpbrk(buf, ws))) *p = '\0';
|
||||||
|
// note: we DO produce a vaid 'string'
|
||||||
|
+ Cursor_repos = 0;
|
||||||
|
return buf;
|
||||||
|
} // end: ioline
|
||||||
|
|
||||||
|
@@ -1117,6 +1119,7 @@ static char *ioline (const char *prompt) {
|
||||||
|
};
|
||||||
|
static struct lin_s *anchor, *plin;
|
||||||
|
|
||||||
|
+ Cursor_repos = 1;
|
||||||
|
if (!anchor) {
|
||||||
|
anchor = alloc_c(sizeof(struct lin_s));
|
||||||
|
anchor->str = alloc_s(""); // top-of-stack == empty str
|
||||||
|
@@ -1182,6 +1185,7 @@ static char *ioline (const char *prompt) {
|
||||||
|
putp(tg2(beg+pos, Msg_row));
|
||||||
|
} while (key && key != kbd_ENTER && key != kbd_ESC);
|
||||||
|
|
||||||
|
+ Cursor_repos = 0;
|
||||||
|
// weed out duplicates, including empty strings (top-of-stack)...
|
||||||
|
for (i = 0, plin = anchor; ; i++) {
|
||||||
|
#ifdef RECALL_FIXED
|
||||||
|
--
|
||||||
|
1.8.1.2
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
Summary: System and process monitoring utilities
|
Summary: System and process monitoring utilities
|
||||||
Name: procps-ng
|
Name: procps-ng
|
||||||
Version: 3.3.8
|
Version: 3.3.8
|
||||||
Release: 7%{?dist}
|
Release: 8%{?dist}
|
||||||
License: GPLv2+ and LGPLv2+
|
License: GPLv2+ and LGPLv2+
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
URL: https://sourceforge.net/projects/procps-ng/
|
URL: https://sourceforge.net/projects/procps-ng/
|
||||||
@ -14,6 +14,8 @@ Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz
|
|||||||
Patch0: 0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch
|
Patch0: 0001-top-add-the-major-version-to-dlopen-of-libnuma-sonam.patch
|
||||||
Patch1: 0002-library-for-atexit-support-fix-fileutils-for-EPIPE.patch
|
Patch1: 0002-library-for-atexit-support-fix-fileutils-for-EPIPE.patch
|
||||||
Patch2: 0001-top-enable-screen-contents-preservation-at-end-of-jo.patch
|
Patch2: 0001-top-enable-screen-contents-preservation-at-end-of-jo.patch
|
||||||
|
Patch3: 0001-top-refine-some-miscellaneous-signals-interrupt-stuf.patch
|
||||||
|
Patch4: 0002-top-cursor-repositioning-includes-line-oriented-inpu.patch
|
||||||
|
|
||||||
Requires(post): /sbin/ldconfig
|
Requires(post): /sbin/ldconfig
|
||||||
Requires(postun): /sbin/ldconfig
|
Requires(postun): /sbin/ldconfig
|
||||||
@ -72,6 +74,8 @@ System and process monitoring utilities development headers
|
|||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
%patch4 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# The following stuff is needed for git archives only
|
# The following stuff is needed for git archives only
|
||||||
@ -137,6 +141,9 @@ mkdir -p %{buildroot}%{_sysconfdir}/sysctl.d
|
|||||||
%{_includedir}/proc
|
%{_includedir}/proc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jul 02 2013 Jaromir Capik <jcapik@redhat.com> - 3.3.8-8
|
||||||
|
- Extending the end-of-job patch disabling the screen content restoration
|
||||||
|
|
||||||
* Mon Jul 01 2013 Jaromir Capik <jcapik@redhat.com> - 3.3.8-7
|
* Mon Jul 01 2013 Jaromir Capik <jcapik@redhat.com> - 3.3.8-7
|
||||||
- Disabling screen content restoration when exiting 'top' (#977561)
|
- Disabling screen content restoration when exiting 'top' (#977561)
|
||||||
- Enabling SIGWINCH flood prevention
|
- Enabling SIGWINCH flood prevention
|
||||||
|
Loading…
Reference in New Issue
Block a user