public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.4.0-x features ?
@ 2001-01-15  5:19 Pierre Rousselet
  2001-01-15 19:59 ` Albert D. Cahalan
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Rousselet @ 2001-01-15  5:19 UTC (permalink / raw)
  To: linux-kernel

Pentium-III 256Mb BE6.
1) top (procps-2.0.7) gives me the messages :
'bad data in /proc/uptime'
'bad data in /proc/loadavg'
cat /proc/uptime 
1435.30 904.74
cat /proc/loadavg
0.01 0.21 0.29 1/17 19444
What is wrong ?
2) pppd (2.4.0b4) gives me the message :
'tdb_store failed : Success'
'tdb_store key failed : Success'
What does that mean ?
-- 
------------------------------------------------
 Pierre Rousselet <pierre.rousselet@wanadoo.fr>
------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.4.0-x features ?
  2001-01-15  5:19 2.4.0-x features ? Pierre Rousselet
@ 2001-01-15 19:59 ` Albert D. Cahalan
  2001-01-16 13:14   ` John Fremlin
  2001-01-16 22:18   ` Pierre Rousselet
  0 siblings, 2 replies; 5+ messages in thread
From: Albert D. Cahalan @ 2001-01-15 19:59 UTC (permalink / raw)
  To: Pierre Rousselet; +Cc: linux-kernel

Pierre Rousselet writes:

> 1) top (procps-2.0.7) gives me the messages :
> 'bad data in /proc/uptime'
> 'bad data in /proc/loadavg'
> cat /proc/uptime 
> 1435.30 904.74
> cat /proc/loadavg
> 0.01 0.21 0.29 1/17 19444
> What is wrong ?

Which 2.4.0-x kernel, and how was procps compiled?
(the broken gcc again perhaps?)

You might as well get procps-010114.tar.gz (new just yesterday!) and
compile it yourself. The top command seems to tolerate Red Hat's
fixed gcc, which you should get if you are using Red Hat 7.

http://www.cs.uml.edu/~acahalan/procps/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.4.0-x features ?
  2001-01-15 19:59 ` Albert D. Cahalan
@ 2001-01-16 13:14   ` John Fremlin
  2001-01-16 21:50     ` Pierre Rousselet
  2001-01-16 22:18   ` Pierre Rousselet
  1 sibling, 1 reply; 5+ messages in thread
From: John Fremlin @ 2001-01-16 13:14 UTC (permalink / raw)
  To: Albert D. Cahalan; +Cc: Pierre Rousselet, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 464 bytes --]

 "Albert D. Cahalan" <acahalan@cs.uml.edu> writes:

> > 1) top (procps-2.0.7) gives me the messages :
> > 'bad data in /proc/uptime'
> > 'bad data in /proc/loadavg'
> > cat /proc/uptime 
> > 1435.30 904.74
> > cat /proc/loadavg
> > 0.01 0.21 0.29 1/17 19444
> > What is wrong ?

You probably have locale settings where the decimal point is a comma
so scanf on /proc/loadavg etc. doesn't work. The following patch
(submitted to RedHat ages ago) fixes that for me.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: procps-2.0.7-intl.patch --]
[-- Type: text/x-patch, Size: 1962 bytes --]

diff -u --recursive procps-2.0.7-orig/proc/sysinfo.c procps-2.0.7-hacked/proc/sysinfo.c
--- procps-2.0.7-orig/proc/sysinfo.c	Mon Jul 10 20:36:13 2000
+++ procps-2.0.7-hacked/proc/sysinfo.c	Wed Nov 29 23:11:41 2000
@@ -13,6 +13,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <locale.h>
+#include <assert.h>
 
 #include <unistd.h>
 #include <fcntl.h>
@@ -62,12 +64,19 @@
 /***********************************************************************/
 int uptime(double *uptime_secs, double *idle_secs) {
     double up=0, idle=0;
+    char*numeric=setlocale(LC_NUMERIC,0);
+    /* It is necessary to save and restore the numeric locale, because
+    if the locale we're in happens to use , instead of decimal point,
+    we can't sscanf the values in /proc/uptime */
+    setlocale(LC_NUMERIC,"C");
 
     FILE_TO_BUF(UPTIME_FILE,uptime_fd);
     if (sscanf(buf, "%lf %lf", &up, &idle) < 2) {
 	fprintf(stderr, "bad data in " UPTIME_FILE "\n");
 	return 0;
     }
+    setlocale(LC_NUMERIC,numeric);
+
     SET_IF_DESIRED(uptime_secs, up);
     SET_IF_DESIRED(idle_secs, idle);
     return up;	/* assume never be zero seconds in practice */
@@ -171,12 +180,20 @@
 /***********************************************************************/
 int loadavg(double *av1, double *av5, double *av15) {
     double avg_1=0, avg_5=0, avg_15=0;
+    /* It is necessary to save and restore the numeric locale, because
+    if the locale we're in happens to use , instead of decimal point,
+    we can't sscanf the values in /proc/loadavg */
+    char*numeric=setlocale(LC_NUMERIC,0);
+    setlocale(LC_NUMERIC,"C");
     
     FILE_TO_BUF(LOADAVG_FILE,loadavg_fd);
     if (sscanf(buf, "%lf %lf %lf", &avg_1, &avg_5, &avg_15) < 3) {
 	fprintf(stderr, "bad data in " LOADAVG_FILE "\n");
 	exit(1);
+
     }
+    setlocale(LC_NUMERIC,numeric);
+    
     SET_IF_DESIRED(av1,  avg_1);
     SET_IF_DESIRED(av5,  avg_5);
     SET_IF_DESIRED(av15, avg_15);

[-- Attachment #3: Type: text/plain, Size: 50 bytes --]


[...]


-- 

	http://www.penguinpowered.com/~vii

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.4.0-x features ?
  2001-01-16 13:14   ` John Fremlin
@ 2001-01-16 21:50     ` Pierre Rousselet
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Rousselet @ 2001-01-16 21:50 UTC (permalink / raw)
  To: John Fremlin; +Cc: Albert D. Cahalan, linux-kernel

John Fremlin wrote:
> 
>  "Albert D. Cahalan" <acahalan@cs.uml.edu> writes:
> 
> > > 1) top (procps-2.0.7) gives me the messages :
> > > 'bad data in /proc/uptime'
> > > 'bad data in /proc/loadavg'
> > > cat /proc/uptime
> > > 1435.30 904.74
> > > cat /proc/loadavg
> > > 0.01 0.21 0.29 1/17 19444
> > > What is wrong ?
> 
> You probably have locale settings where the decimal point is a comma
> so scanf on /proc/loadavg etc. doesn't work. The following patch
> (submitted to RedHat ages ago) fixes that for me.

That's it. i persist in setting LANG=fr.

Thank you for the tip.

------------------------------------------------
 Pierre Rousselet <pierre.rousselet@wanadoo.fr>
------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.4.0-x features ?
  2001-01-15 19:59 ` Albert D. Cahalan
  2001-01-16 13:14   ` John Fremlin
@ 2001-01-16 22:18   ` Pierre Rousselet
  1 sibling, 0 replies; 5+ messages in thread
From: Pierre Rousselet @ 2001-01-16 22:18 UTC (permalink / raw)
  To: Albert D. Cahalan; +Cc: linux-kernel

"Albert D. Cahalan" wrote:
> 
> Pierre Rousselet writes:
> 
> > 1) top (procps-2.0.7) gives me the messages :
> > 'bad data in /proc/uptime'
> > 'bad data in /proc/loadavg'
> > cat /proc/uptime
> > 1435.30 904.74
> > cat /proc/loadavg
> > 0.01 0.21 0.29 1/17 19444
> > What is wrong ?
> 
> Which 2.4.0-x kernel, and how was procps compiled?
> (the broken gcc again perhaps?)
> 
> You might as well get procps-010114.tar.gz (new just yesterday!) and
> compile it yourself. The top command seems to tolerate Red Hat's
> fixed gcc, which you should get if you are using Red Hat 7.

I did that. Compilation OK with gcc-2.95.2 top still doesn't work (
top > /dev/null tells you 'bad data in ...' just before the screen
blanks).
logout after commenting LC_ALL=fr and LANG=fr in /etc/profile 
login again : top works. 

It is a question of '.' and ','


------------------------------------------------
 Pierre Rousselet <pierre.rousselet@wanadoo.fr>
------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-01-16 22:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-15  5:19 2.4.0-x features ? Pierre Rousselet
2001-01-15 19:59 ` Albert D. Cahalan
2001-01-16 13:14   ` John Fremlin
2001-01-16 21:50     ` Pierre Rousselet
2001-01-16 22:18   ` Pierre Rousselet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox