Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Harald Koenig <koenig@tat.physik.uni-tuebingen.de>
Subject: AXP patches for procps-1.01
Date: Sun, 16 Jun 1996 12:33:36 +0200 (MET DST)	[thread overview]
Message-ID: <199606161456.QAA21498@ceres.tat.physik.uni-tuebingen.de> (raw)
In-Reply-To: <199606151740.KAA28742@escher.SD.BBN.COM>

here are some more patches for procps-1.01 for AXP.

proc/ksym.c: sizeof() returns size_t which is long;  %*s needs int argument

proc/output.c: #include <string.h>  for strlen()

ps.c:  fixes for 8k page size (again)   and two more HZ dependencies

top.c:  "top -c" doesn't insert spaces between command line arguments

sessreg.c: changed argument for syserr() and sysnerr() from int to long
        so that pointer and lseek() return value high word doesn't get dropped
	for 64bit longs/pointer

-------------------------------------------------------------------------------
--- procps-1.01/proc/ksym.c.orig	Wed Jun 12 14:28:22 1996
+++ procps-1.01/proc/ksym.c	Sun Jun 16 11:28:47 1996
@@ -168,8 +168,8 @@
 	if (psdb != -1)
 	    fprintf(stderr,
 		    "psdatabase has magic no. %*s instead of %*s\n",
-		    sizeof db_hdr.magic, db_hdr.magic,
-		    sizeof db_hdr.magic, procps_version);
+		    (int)(sizeof db_hdr.magic), db_hdr.magic,
+		    (int)(sizeof db_hdr.magic), procps_version);
 	close(psdb);
     }
     return -1;
--- procps-1.01/proc/output.c.orig	Wed Jun 12 10:19:49 1996
+++ procps-1.01/proc/output.c	Sun Jun 16 11:35:19 1996
@@ -3,6 +3,7 @@
   Copyright (C) 1996, Charles Blake.  See COPYING for details.
 */
 #include <stdio.h>
+#include <string.h>
 #include <ctype.h>
 
 /* output a string, converting unprintables to octal as we go, and stopping after
--- procps-1.01/ps.c.orig	Wed Jun 12 14:39:36 1996
+++ procps-1.01/ps.c	Sun Jun 16 11:17:51 1996
@@ -105,7 +105,7 @@
     CL_sort     = 1,
     CL_forest,
     CL_Sum,
-    CL_pg_shift = 2;      /* default: show k instead of pages */
+    CL_pg_shift = (PAGE_SHIFT-10);      /* default: show k instead of pages */
 
 /* Globals */
 
@@ -391,7 +391,7 @@
 	sprintf(wchanb, "%-11.11s", wchan(p->wchan));
     sprintf(s, "%6x %5d %5d %5d %3d %3d %6d %5d %-11.11s %s%3s",
 	    p->flags, p->uid, p->pid, p->ppid, p->priority, p->nice,
-	    p->vsize >> 10, p->rss * 4, wchanb, status(p), p->ttyc);
+	    p->vsize >> 10, p->rss << (PAGE_SHIFT-10), wchanb, status(p), p->ttyc);
 }
 
 void show_jobs(char *s, proc_t *p) {
@@ -409,18 +409,18 @@
 	s += sprintf(s, "%5d    ", p->uid);
     else
 	s += sprintf(s, "%-8s ", p->user);
-    seconds = (((GL_current_time * 100) - p->start_time) / HZ);
+    seconds = (((GL_current_time * HZ) - p->start_time) / HZ);
     start = GL_time_now - seconds;
     total_time = (p->utime + p->stime +
 		  (CL_Sum ? p->cutime + p->cstime : 0));
     pcpu = seconds ?
-	(total_time * 10) / seconds :
+	(total_time * 10 * 100/HZ) / seconds :
 	0;
     if (pcpu > 999) pcpu = 999;
-    pmem = p->rss * 1000 / (GL_main_mem >> 12);
+    pmem = p->rss * 1000 / (GL_main_mem >> PAGE_SHIFT);
     sprintf(s, "%5d %2u.%u %2d.%d %5d %5d %2s %s%.6s ",
 	    p->pid,  pcpu / 10, pcpu % 10,  pmem / 10, pmem % 10,
-	    p->vsize >> 10, p->rss << 2, p->ttyc, status(p),
+	    p->vsize >> 10, p->rss << (PAGE_SHIFT-10), p->ttyc, status(p),
 	    ctime(&start) + (GL_time_now - start > 3600*24 ? 4 : 10));
 }
 
@@ -440,12 +440,12 @@
 		 p->maj_flt + (CL_Sum ? p->cmaj_flt : 0),
 		 p->vsize ? (p->end_code - p->start_code) >> 10 : 0,
 		 p->vsize ? (p->vsize - p->end_code + p->start_code) >> 10 : 0,
-		 p->rss << 2);
+		 p->rss << (PAGE_SHIFT-10));
     if(p->rss_rlim == RLIM_INFINITY)
 	s += sprintf(s, "   xx ");
     else
 	s += sprintf(s, "%5d ", p->rss_rlim >> 10);
-    pmem = p->rss * 1000 / (GL_main_mem >> 12);
+    pmem = p->rss * 1000 / (GL_main_mem >> PAGE_SHIFT);
     sprintf(s, "%2d.%d ", pmem / 10, pmem % 10);
 }
 
--- procps-1.01/top.c.orig	Thu Jun 13 05:20:00 1996
+++ procps-1.01/top.c	Sun Jun 16 11:50:07 1996
@@ -840,6 +840,8 @@
 	    if (!show_cmd && task->cmdline && *(task->cmdline)) {
 	        j=0;
 	        while(((task->cmdline)[j] != NULL) && (strlen(tmp3)<1024)){
+		    if (j > 0) 
+		        strcat(tmp3," ");
 		    strcat(tmp3,(task->cmdline)[j]);
 		    j++; 
 	        }
--- procps-1.01/top.h.orig	Mon Jun 10 11:09:20 1996
+++ procps-1.01/top.h	Sun Jun 16 10:29:07 1996
@@ -95,7 +95,7 @@
 int Secure = 0;
 int Cumulative = 0;
 int Noidle = 0;
-int CL_pg_shift = 2;
+int CL_pg_shift = (PAGE_SHIFT-10);
 int CL_wchan_nout = 0;
 int show_stats = 1;    /* show status summary */
 int show_memory = 1;   /* show memory summary */
--- procps-1.01/sessreg.c.orig	Tue Jan 16 13:15:05 1996
+++ procps-1.01/sessreg.c	Sun Jun 16 10:42:10 1996
@@ -129,9 +129,7 @@
 	return *a;
 }
 
-int syserr (x, s)
-int	x;
-char	*s;
+int syserr (long x, char *s)
 {
 	if (x == -1) {
 		perror (s);
@@ -140,9 +138,7 @@
 	return x;
 }
 
-int sysnerr (x, s)
-int	x;
-char	*s;
+int sysnerr (long x, char *s)
 {
 	if (x == 0) {
 		perror (s);
@@ -225,7 +221,7 @@
 	}
 #endif
 	if (!lflag) {
-		sysnerr ((int) (line_tmp = ttyname (0)), "ttyname");
+		sysnerr ((long)(line_tmp = ttyname (0)), "ttyname");
 		line = strrchr(line_tmp, '/');
 		if (line)
 			line = line + 1;
@@ -250,7 +246,7 @@
 #else
 		utmp = open (utmp_file, O_RDWR);
 		if (utmp != -1) {
-			syserr ((int) lseek (utmp, (long) (slot_number - 1) * sizeof (struct utmp), 0), "lseek");
+			syserr (lseek (utmp, (long) (slot_number - 1) * sizeof (struct utmp), 0), "lseek");
 			sysnerr (write (utmp, (char *) &utmp_entry, sizeof (utmp_entry))
 				        == sizeof (utmp_entry), "write utmp entry");
 			close (utmp);
@@ -389,7 +385,7 @@
 	struct passwd *pwd = getpwnam(user_name);
 
         if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) >= 0) {
-		syserr ((int) lseek(fd, (off_t)pwd->pw_uid * sizeof(ll),  0), "lseek");
+		syserr (lseek(fd, (off_t)pwd->pw_uid * sizeof(ll),  0), "lseek");
                 memset((char *)&ll, 0, sizeof(ll));
                 (void)time(&ll.ll_time);
                 strncpy(ll.ll_line, line, sizeof(ll.ll_line));

-- 
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^

           reply	other threads:[~1996-06-16 10:33 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <199606151740.KAA28742@escher.SD.BBN.COM>]
read-only archive

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