Accepting request 48560 from Base:System
checked in (request 48560) OBS-URL: https://build.opensuse.org/request/show/48560 OBS-URL: https://build.opensuse.org/package/show/Base:System/procps?expand=0&rev=30
This commit is contained in:
parent
c4dc9444c4
commit
aea24f3524
@ -6,9 +6,9 @@
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: boot.sysctl
|
||||
# Required-Start: boot.proc $local_fs
|
||||
# Required-Start: $local_fs
|
||||
# Should-Start: setserial boot.isapnp
|
||||
# Required-Stop: boot.proc $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Should-Stop: $null
|
||||
# Default-Start: B
|
||||
# Default-Stop:
|
||||
|
@ -1,114 +0,0 @@
|
||||
--- procps-3.2.7/proc/sysinfo.c 2010-08-20 15:59:36.991845322 -0500
|
||||
+++ procps-3.2.7/proc/sysinfo.c 2010-08-25 09:01:49.867972887 -0500
|
||||
@@ -26,8 +26,6 @@
|
||||
#include <netinet/in.h> /* htons */
|
||||
#endif
|
||||
|
||||
-long smp_num_cpus; /* number of CPUs */
|
||||
-
|
||||
#define BAD_OPEN_MESSAGE \
|
||||
"Error: /proc must be mounted\n" \
|
||||
" To mount /proc at boot you need an /etc/fstab line like:\n" \
|
||||
@@ -169,7 +167,7 @@
|
||||
setlocale(LC_NUMERIC, savelocale);
|
||||
jiffies = user_j + nice_j + sys_j + other_j;
|
||||
seconds = (up_1 + up_2) / 2;
|
||||
- h = (unsigned)( (double)jiffies/seconds/smp_num_cpus );
|
||||
+ h = (unsigned)( (double)jiffies/seconds/smp_num_cpus() );
|
||||
/* actual values used by 2.4 kernels: 32 64 100 128 1000 1024 1200 */
|
||||
switch(h){
|
||||
case 9 ... 11 : Hertz = 10; break; /* S/390 (sometimes) */
|
||||
@@ -234,9 +232,13 @@
|
||||
return !!rc;
|
||||
}
|
||||
|
||||
-static void init_libproc(void) __attribute__((constructor));
|
||||
-static void init_libproc(void){
|
||||
- have_privs = check_for_privs();
|
||||
+long smp_num_cpus(void)
|
||||
+{
|
||||
+ static long _smp_num_cpus=-1; /* number of CPUs */
|
||||
+
|
||||
+ if (_smp_num_cpus != -1)
|
||||
+ return(_smp_num_cpus);
|
||||
+
|
||||
// ought to count CPUs in /proc/stat instead of relying
|
||||
// on glibc, which foolishly tries to parse /proc/cpuinfo
|
||||
//
|
||||
@@ -244,8 +247,15 @@
|
||||
// appears to have a non-SMP kernel on a 2-way SMP box.
|
||||
// _SC_NPROCESSORS_CONF returns 2, resulting in HZ=512
|
||||
// _SC_NPROCESSORS_ONLN returns 1, which should work OK
|
||||
- smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
- if(smp_num_cpus<1) smp_num_cpus=1; /* SPARC glibc is buggy */
|
||||
+ _smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
+ if(_smp_num_cpus<1) _smp_num_cpus=1; /* SPARC glibc is buggy */
|
||||
+
|
||||
+ return(_smp_num_cpus);
|
||||
+}
|
||||
+
|
||||
+static void init_libproc(void) __attribute__((constructor));
|
||||
+static void init_libproc(void){
|
||||
+ have_privs = check_for_privs();
|
||||
|
||||
if(linux_version_code > LINUX_VERSION(2, 4, 0)){
|
||||
Hertz = find_elf_note(AT_CLKTCK);
|
||||
--- procps-3.2.7/proc/sysinfo.h 2010-08-20 15:59:37.011847000 -0500
|
||||
+++ procps-3.2.7/proc/sysinfo.h 2010-08-25 08:58:17.557096693 -0500
|
||||
@@ -7,7 +7,7 @@
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
extern unsigned long long Hertz; /* clock tick frequency */
|
||||
-extern long smp_num_cpus; /* number of CPUs */
|
||||
+extern long smp_num_cpus(void); /* number of CPUs */
|
||||
extern int have_privs; /* boolean, true if setuid or similar */
|
||||
|
||||
#if 0
|
||||
--- procps-3.2.7/top.c 2010-08-20 15:59:37.507910544 -0500
|
||||
+++ procps-3.2.7/top.c 2010-08-20 16:24:36.623565229 -0500
|
||||
@@ -1656,7 +1656,7 @@
|
||||
if (Myname) ++Myname; else Myname = me;
|
||||
|
||||
/* establish cpu particulars -- even bigger! */
|
||||
- Cpu_tot = smp_num_cpus;
|
||||
+ Cpu_tot = smp_num_cpus();
|
||||
if (linux_version_code > LINUX_VERSION(2, 5, 41))
|
||||
States_fmts = STATES_line2x5;
|
||||
if (linux_version_code >= LINUX_VERSION(2, 6, 0)) // grrr... only some 2.6.0-testX :-(
|
||||
@@ -1676,15 +1676,15 @@
|
||||
|
||||
Fieldstab[P_CPN].head = " P";
|
||||
Fieldstab[P_CPN].fmts = " %1u";
|
||||
- if(smp_num_cpus>9){
|
||||
+ if(smp_num_cpus()>9){
|
||||
Fieldstab[P_CPN].head = " P";
|
||||
Fieldstab[P_CPN].fmts = " %2u";
|
||||
}
|
||||
- if(smp_num_cpus>99){
|
||||
+ if(smp_num_cpus()>99){
|
||||
Fieldstab[P_CPN].head = " P";
|
||||
Fieldstab[P_CPN].fmts = " %3u";
|
||||
}
|
||||
- if(smp_num_cpus>999){
|
||||
+ if(smp_num_cpus()>999){
|
||||
Fieldstab[P_CPN].head = " P";
|
||||
Fieldstab[P_CPN].fmts = " %4u";
|
||||
}
|
||||
@@ -1831,7 +1831,7 @@
|
||||
confighlp(Winstk[i].rc.fieldscur);
|
||||
}
|
||||
|
||||
- if(Rc.mode_irixps && smp_num_cpus>1){
|
||||
+ if(Rc.mode_irixps && smp_num_cpus()>1){
|
||||
// good for 100 CPUs per process
|
||||
pcpu_max_value = 9999.0;
|
||||
Fieldstab[P_CPU].fmts = " %4.0f";
|
||||
@@ -2677,7 +2677,7 @@
|
||||
Rc.mode_irixps = !Rc.mode_irixps;
|
||||
show_msg(fmtmk("Irix mode %s", Rc.mode_irixps ? "On" : "Off"));
|
||||
#endif
|
||||
- if(Rc.mode_irixps && smp_num_cpus>1){
|
||||
+ if(Rc.mode_irixps && smp_num_cpus()>1){
|
||||
// good for 100 CPUs per process
|
||||
pcpu_max_value = 9999.0;
|
||||
Fieldstab[P_CPU].fmts = " %4.0f";
|
@ -1,20 +0,0 @@
|
||||
Do not setup SIGHUP signal handler if we are in the batch mode
|
||||
|
||||
Top enables a signal handler for the SIGHUP signal (loss of terminal). While
|
||||
this makes sense for top's default interactive mode, it doesn't make any sense
|
||||
for batch mode. If you run top in nohup just to collect data over time and
|
||||
disconnect top finishes which is not what one would expect.
|
||||
Index: procps-3.2.8/top.c
|
||||
===================================================================
|
||||
--- procps-3.2.8/top.c
|
||||
+++ procps-3.2.8/top.c 2010-09-20 12:26:57.024458172 +0200
|
||||
@@ -3445,7 +3445,8 @@ int main (int dont_care_argc, char *argv
|
||||
windows_stage2(); // as bottom slice
|
||||
// +-------------+
|
||||
signal(SIGALRM, end_pgm);
|
||||
- signal(SIGHUP, end_pgm);
|
||||
+ if (!Batch)
|
||||
+ signal(SIGHUP, end_pgm);
|
||||
signal(SIGINT, end_pgm);
|
||||
signal(SIGPIPE, end_pgm);
|
||||
signal(SIGQUIT, end_pgm);
|
@ -18,19 +18,16 @@ Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
ps/output.c | 2 +-
|
||||
3 files changed, 28 insertions(+), 1 deletion(-)
|
||||
|
||||
--- procps-3.2.7/proc/sysinfo.c
|
||||
+++ procps-3.2.7/proc/sysinfo.c 2007-08-31 11:55:32.000000000 +0000
|
||||
@@ -90,6 +90,35 @@ int uptime(double *restrict uptime_secs,
|
||||
--- procps-3.2.7.orig/proc/sysinfo.c 2007-08-31 10:18:07.000000000 +0200
|
||||
+++ procps-3.2.7/proc/sysinfo.c 2007-08-31 13:55:32.000000000 +0200
|
||||
@@ -88,6 +88,32 @@ int uptime(double *restrict uptime_secs,
|
||||
return up; /* assume never be zero seconds in practice */
|
||||
}
|
||||
|
||||
+unsigned long getbtime(void) {
|
||||
+ static unsigned long btime = 0;
|
||||
+ unsigned long btime = 0;
|
||||
+ FILE *f;
|
||||
+
|
||||
+ if (btime)
|
||||
+ return btime;
|
||||
+
|
||||
+ /* /proc/stat can get very large on multi-CPU systems so we
|
||||
+ can't use FILE_TO_BUF */
|
||||
+ if (!(f = fopen(STAT_FILE, "r"))) {
|
||||
@ -56,9 +53,9 @@ Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
/***********************************************************************
|
||||
* Some values in /proc are expressed in units of 1/HZ seconds, where HZ
|
||||
* is the kernel clock tick rate. One of these units is called a jiffy.
|
||||
--- procps-3.2.7/proc/sysinfo.h
|
||||
+++ procps-3.2.7/proc/sysinfo.h 2007-08-31 08:18:58.000000000 +0000
|
||||
@@ -17,6 +17,7 @@ extern void eight_cpu_numbers(JT *uret,
|
||||
--- procps-3.2.7.orig/proc/sysinfo.h 2007-08-31 10:18:07.000000000 +0200
|
||||
+++ procps-3.2.7/proc/sysinfo.h 2007-08-31 10:18:58.000000000 +0200
|
||||
@@ -17,6 +17,7 @@ extern void eight_cpu_numbers(JT *uret,
|
||||
#endif
|
||||
|
||||
extern int uptime (double *uptime_secs, double *idle_secs);
|
||||
@ -66,57 +63,14 @@ Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
extern void loadavg(double *av1, double *av5, double *av15);
|
||||
|
||||
|
||||
--- procps-3.2.7/ps/output.c
|
||||
+++ procps-3.2.7/ps/output.c 2010-09-07 16:31:59.776958123 +0000
|
||||
@@ -77,7 +77,6 @@ static unsigned max_leftward = 0x1234567
|
||||
static int wide_signals; /* true if we have room */
|
||||
|
||||
static unsigned long seconds_since_1970;
|
||||
-static unsigned long time_of_boot;
|
||||
static unsigned long page_shift;
|
||||
|
||||
|
||||
@@ -793,7 +792,7 @@ static int pr_bsdtime(char *restrict con
|
||||
static int pr_bsdstart(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
time_t start;
|
||||
time_t seconds_ago;
|
||||
- start = time_of_boot + pp->start_time / Hertz;
|
||||
+ start = getbtime() + pp->start_time / Hertz;
|
||||
seconds_ago = seconds_since_1970 - start;
|
||||
if(seconds_ago < 0) seconds_ago=0;
|
||||
if(seconds_ago > 3600*24) strcpy(outbuf, ctime(&start)+4);
|
||||
@@ -907,7 +906,7 @@ static int pr_pmem(char *restrict const
|
||||
|
||||
static int pr_lstart(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
time_t t;
|
||||
- t = time_of_boot + pp->start_time / Hertz;
|
||||
+ t = getbtime() + pp->start_time / Hertz;
|
||||
return snprintf(outbuf, COLWID, "%24.24s", ctime(&t));
|
||||
}
|
||||
|
||||
@@ -930,7 +929,7 @@ static int pr_stime(char *restrict const
|
||||
our_time = localtime(&seconds_since_1970); /* not reentrant */
|
||||
tm_year = our_time->tm_year;
|
||||
tm_yday = our_time->tm_yday;
|
||||
- t = time_of_boot + pp->start_time / Hertz;
|
||||
+ t = getbtime() + pp->start_time / Hertz;
|
||||
proc_time = localtime(&t); /* not reentrant, this corrupts our_time */
|
||||
fmt = "%H:%M"; /* 03:02 23:59 */
|
||||
if(tm_yday != proc_time->tm_yday) fmt = "%b%d"; /* Jun06 Aug27 */
|
||||
@@ -941,7 +940,7 @@ static int pr_stime(char *restrict const
|
||||
static int pr_start(char *restrict const outbuf, const proc_t *restrict const pp){
|
||||
time_t t;
|
||||
char *str;
|
||||
- t = time_of_boot + pp->start_time / Hertz;
|
||||
+ t = getbtime() + pp->start_time / Hertz;
|
||||
str = ctime(&t);
|
||||
if(str[8]==' ') str[8]='0';
|
||||
if(str[11]==' ') str[11]='0';
|
||||
@@ -1961,7 +1960,6 @@ void init_output(void){
|
||||
--- procps-3.2.7.orig/ps/output.c 2007-08-31 10:18:22.000000000 +0200
|
||||
+++ procps-3.2.7/ps/output.c 2007-08-31 10:18:58.000000000 +0200
|
||||
@@ -1952,7 +1952,7 @@ void init_output(void){
|
||||
// available space: page_size*outbuf_pages-SPACE_AMOUNT
|
||||
|
||||
seconds_since_1970 = time(NULL);
|
||||
- time_of_boot = seconds_since_1970 - seconds_since_boot;
|
||||
+ time_of_boot = getbtime();
|
||||
|
||||
meminfo();
|
||||
|
||||
|
@ -1,14 +1,3 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 20 12:30:21 CEST 2010 - werner@suse.de
|
||||
|
||||
- Ignore SIGHUP within batch mode of top (bnc#634840)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 7 18:34:50 CEST 2010 - werner@suse.de
|
||||
|
||||
- Add change to avoid repeated read of /proc/stat (bnc#634071)
|
||||
- Add change to avoid repeated call of sysconf() (bnc#634071)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 28 06:38:35 UTC 2010 - jengelh@medozas.de
|
||||
|
||||
|
@ -68,8 +68,6 @@ Patch30: procps-3.2.8-sysctlerr.dif
|
||||
Patch31: procps-3.2.8-columns.dif
|
||||
Patch32: procps-3.2.7-oom.diff
|
||||
Patch33: procps-3.2.8-integer-overflow.patch
|
||||
Patch34: bug-634071_procstat2.diff
|
||||
Patch35: bug-634840.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%description
|
||||
@ -131,8 +129,6 @@ Authors:
|
||||
%patch31
|
||||
%patch32 -p1
|
||||
%patch33 -p1
|
||||
%patch34 -p1
|
||||
%patch35 -p1
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} CFLAGS="-Wall -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $RPM_OPT_FLAGS -pipe" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user